Samsung Electronics logo

Samsung Web API: DisplayControl


Introduction

This API provides stereoscopy (also called 3D) effects on the TV associated device.

A webapis.displaycontrol object provides access to the functionality of the displaycontrol API.

For more information on the Display Control features, see Display Control Guide.


Table of Contents


Summary of Interfaces and Methods

Interface Method
WebAPIsDisplayControlManager
DisplayControlManager unsigned short get3DEffectMode()
unsigned short check3DModeEnable()
void get3DModeSupportList(Mode3DEffectListSupportCallback successCallback, ErrorCallback? errorCallback)
Mode3DEffectListSupportCallback void onsuccess(UnsignedShortArray mode3DEffectArray)

1. Interfaces

1.1. WebAPIsDisplayControlManager

The DisplayControl module handles the TV display functions. For example, it can check whether your device supports 3D.

    [NoInterfaceObject] interface WebAPIsDisplayControlManager{
        readonly attribute DisplayControlManager displaycontrol;
    };
    WebAPIs implements WebAPIsDisplayControlManager;

A webapis.displaycontrol object provides access to th functionality of the DisplayControl module.

1.2. DisplayControlManager

The DisplayControl interface that provides access to the TV API.

    [NoInterfaceObject] interface DisplayControlManager {
 
        const unsigned short MODE_3D_EFFECT_OFF = 0;

        const unsigned short MODE_3D_EFFECT_TOP_BOTTOM = 1;

        const unsigned short MODE_3D_EFFECT_SIDE_BY_SIDE = 2;

        const unsigned short MODE_3D_EFFECT_LINE_BY_LINE= 3;

        const unsigned short MODE_3D_EFFECT_VERTICAL_STRIPE  = 4;

        const unsigned short MODE_3D_EFFECT_FRAME_SEQUENCE = 5;

        const unsigned short MODE_3D_EFFECT_CHECKER_BD = 6;

        const unsigned short MODE_3D_EFFECT_FROM_2D_TO_3D = 7;

        const unsigned short MODE_3D_DEVICE_NOT_CONNECTED = -1;

        const unsigned short MODE_3D_NOT_SUPPORTED =  0;

        const unsigned short MODE_3D_ENABLE_OK =  1;

         unsigned short get3DEffectMode();

         unsigned short check3DModeEnable();
 
        void get3DModeSupportList(Mode3DEffectListSupportCallback successCallback, 
                                 ErrorCallback? errorCallback);
    };

This manager interface exposes the TV control API for controlling basic functions of a TV.

CONSTANTS

unsigned short MODE_3D_EFFECT_OFF

Identifier for 3DEffect mode off

unsigned short MODE_3D_EFFECT_TOP_BOTTOM

Identifier for 3DEffect mode top_bottom

unsigned short MODE_3D_EFFECT_SIDE_BY_SIDE

Identifier for 3DEffect mode side_by_side

unsigned short MODE_3D_EFFECT_LINE_BY_LINE

Identifier for 3DEffect mode line_by_line

unsigned short MODE_3D_EFFECT_VERTICAL_STRIPE

Identifier for 3DEffect mode vertical_stripe

unsigned short MODE_3D_EFFECT_FRAME_SEQUENCE

Identifier for 3DEffect mode frame_sequence

unsigned short MODE_3D_EFFECT_CHECKER_BD

Identifier for 3DEffect mode checker BD

unsigned short MODE_3D_EFFECT_FROM_2D_TO_3D

Identifier for 3DEffect mode convert 2D to 3D

unsigned short MODE_3D_DEVICE_NOT_CONNECTED

Supports 3D mode, but 3D display is not connected.

unsigned short MODE_3D_NOT_SUPPORTED

No support for 3D mode.

unsigned short MODE_3D_ENABLE_OK

Identifier for enabling 3D mode

METHODS

get3DEffectMode

Gets the current 3D effect mode.

Signature
unsigned short get3DEffectMode();
Return value
unsigned short current 3D effect mode
Exceptions
  • WebAPIException:

    with error type UnknownError in any other error case.

    with error type NotSupportedError if the feature is not supported.

    with error type SecurityError if this functionality is not allowed.

Code example
 try {
     var effect = webapis.displaycontrol.get3DEffectMode();
     switch (effect) {
         case webapis.displaycontrol.MODE_3D_EFFECT_OFF : 
             console.log("3D effect is off");
             break;
         case webapis.displaycontrol.MODE_3D_EFFECT_TOP_BOTTOM : 
             console.log("3D effect is top and bottom");
             break;
    }
 } catch (error) {
    console.log(error.name);
 }
 

check3DModeEnable

Checks whether the 3D mode is available or not.

Signature
unsigned short check3DModeEnable();
Return value
unsigned short 3D effect mode index
Exceptions
  • WebAPIException:

    with error type UnknownError in any other error case.

    with error type NotSupportedError if the feature is not supported.

    with error type SecurityError if this functionality is not allowed.

Code example
 try {
     var mode = webapis.displaycontrol.check3DModeEnable();
     switch (mode) {
         case webapis.displaycontrol.MODE_3D_DEVICE_NOT_CONNECTED : 
             console.log("3D display is not connected");
            break;
         case webapis.displaycontrol.MODE_3D_NOT_SUPPORTED : 
            console.log("3D display is not supported");
            break;
         case webapis.displaycontrol.MODE_3D_ENABLE_OK : 
            console.log("3D display is enabled");
           break;
 } catch (error) {
     console.log(error.name);
 }
 

get3DModeSupportList

Gets the supported 3D Effects

Signature
void get3DModeSupportList(Mode3DEffectListSupportCallback successCallback, ErrorCallback? errorCallback);

The ErrorCallback is launched with these error types:

  • InvalidValuesError: If any of the input parameters contain an invalid value
  • UnknownError: In any other error case.

If the errorCallback does not contain a valid function (such as null) or in the case of any other error that should be returned in the errorCallback (see above), the implementation MUST silently fail and no further action is required (that is the developer is not notified of the error).

Parameters
  • successCallback
    • Optional: No.
    • Nullable: No.
    • Type: Mode3DEffectListSupportCallback.
    • Description: callback which invoked this operation is successfully done.
  • errorCallback
    • Optional: No.
    • Nullable: Yes.
    • Type: ErrorCallback.
    • Description: error callback which invoked this operation is failed
Exceptions
  • WebAPIException:

    with error type NotSupportedError if the feature is not supported.

    with error type SecurityError if this functionality is not allowed.

    with error type TypeMismatchError if any of the input attributes are of the wrong type

Code example
 function successCB(effects) {
     for (var i = 0; i  effects.length; i++) {
         switch (effects[i]) {
             case webapis.displaycontrol.MODE_3D_EFFECT_LINE_BY_LINE : 
                 console.log("Line by Line 3D effect is supported");
                 break;
             case webapis.displaycontrol.MODE_3D_EFFECT_VERTICAL_STRIPE : 
                 console.log("Vertical Stripe 3D effect is supported");
                 break;
         }
     }
 }

 function errorCB(error) {
     console.log(error.name);
 }
 
 try {
     webapis.displaycontrol.get3DModeSupportList(successCB, errorCB);
 } catch (error) {
     console.log(error.name);
 }
 

1.3. Mode3DEffectListSupportCallback

Success callback for retrieving a list of 3D modes.

    [Callback=FunctionOnly, NoInterfaceObject] interface Mode3DEffectListSupportCallback {
        void onsuccess(UnsignedShortArray mode3DEffectArray);
    };

METHODS

onsuccess

Method invoked when the list of 3D modes is retrieved successfully.

Signature
void onsuccess(UnsignedShortArray mode3DEffectArray);
Parameters
  • mode3DEffectArray
    • Optional: No.
    • Nullable: No.
    • Type: UnsignedShortArray.
    • Description: Array of supported 3D effect modes

2. Full WebIDL

module DisplayControl {

    [NoInterfaceObject] interface WebAPIsDisplayControlManager{
        readonly attribute DisplayControlManager displaycontrol;
    };
    WebAPIs implements WebAPIsDisplayControlManager;
    

    [NoInterfaceObject] interface DisplayControlManager {
 
        const unsigned short MODE_3D_EFFECT_OFF = 0;

        const unsigned short MODE_3D_EFFECT_TOP_BOTTOM = 1;

        const unsigned short MODE_3D_EFFECT_SIDE_BY_SIDE = 2;

        const unsigned short MODE_3D_EFFECT_LINE_BY_LINE= 3;

        const unsigned short MODE_3D_EFFECT_VERTICAL_STRIPE  = 4;

        const unsigned short MODE_3D_EFFECT_FRAME_SEQUENCE = 5;

        const unsigned short MODE_3D_EFFECT_CHECKER_BD = 6;

        const unsigned short MODE_3D_EFFECT_FROM_2D_TO_3D = 7;

        const unsigned short MODE_3D_DEVICE_NOT_CONNECTED = -1;

        const unsigned short MODE_3D_NOT_SUPPORTED =  0;

        const unsigned short MODE_3D_ENABLE_OK =  1;

         unsigned short get3DEffectMode();

         unsigned short check3DModeEnable();
 
        void get3DModeSupportList(Mode3DEffectListSupportCallback successCallback, 
                                 ErrorCallback? errorCallback);
    };
     
    [Callback=FunctionOnly, NoInterfaceObject] interface Mode3DEffectListSupportCallback {
        void onsuccess(UnsignedShortArray mode3DEffectArray);
    };
 
};