top

TvInfo API

To use Samsung Product API, 

<script type="text/javascript" src="$WEBAPIS/webapis/webapis.js"></script>

Should be loaded in index.html

 

The module defines the functionalities of TV settings value that are provides as the Samsung Smart TV Product API.

Since : 1.0

Table of Contents

  1. 1. Interfaces
    1. 1.1. TvInfoManagerObject
    2. 1.2. TvInfoManager
    3. 1.3. TvInfoCaptionChangeCallback
    4. 1.4. TvInfoMenuKey
    5. 1.5. TvInfoMenuValue
  2. 2. Full WebIDL

Summary of Interfaces and Methods

Interface Method
TvInfoManagerObject  
TvInfoManager DOMString getVersion ()
unsigned short getMenuValue (unsigned short key)
unsigned long addCaptionChangeListener (TvInfoCaptionChangeCallback listener, unsigned short key)
void removeCaptionChangeListener (unsigned long listenerId)
boolean isTvsPicSizeResized();
TvInfoCaptionChangeCallback void onchange (unsigned short key)
TvInfoMenuValue  

1. Interfaces

1.1. TvInfoManagerObject

The interface defines what is instantiated by the WebApi object of Samsung TV for Tizen Platform Product API.
There will be a webapis.tvinfo object that allows access to the functionality of the TvInfo API

  [NoInterfaceObject]interface TvInfoManagerObject {
      readonly attribute TvInfoManager tvinfo;
  };

  WebApi implements TvInfoManagerObject;

Since : 1.0

Attributes

  • readonly TvInfoManager tvinfo
    Namespace for TvInfo API.

    Since : 1.0

1.2. TvInfoManager

This interface provides methods to use the TvInfo functionalities.

  [NoInterfaceObject]interface TvInfoManager {
      attribute TvInfoMenuKey TvInfoMenuKey;
      attribute TvInfoMenuValue TvInfoMenuValue;

      DOMString getVersion();
      unsigned short getMenuValue(unsigned short key);
      unsigned long addCaptionChangeListener(TvInfoCaptionChangeCallback listener, unsigned short key);
      void removeCaptionChangeListener(unsigned long listenerId);
      boolean isTvsPicSizeResized();
  };

Since : 1.0

Attributes

  • TvInfoMenuKey TvInfoMenuKey
    This attribute defines the key of each Caption Settings.

    Since : 1.0

  • TvInfoMenuValue TvInfoMenuValue
    This attribute defines that indicates the value of menu settings.

    Since : 1.0

Methods

getVersion
This method get the plugin's version number.

  DOMString getVersion();

Since : 1.0

Return value:

DOMString return value of plugin's version

Code example:


  try {    
      var value = webapis.tvinfo.getVersion();    
      console.log(" version value = " + value); 
  } catch (error) {    
      console.log(" error code = " + error.code);  
  }
getMenuValue
This method get the value of the TV caption menu which was selected by argument.

  unsigned short getMenuValue(unsigned short key);

Since : 1.0

Parameters:

  • key: Value of key about caption menu

Return value:

unsigned short const value of TvInfoMenuValue

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if invalid TvInfoMenuKey type passed for 'key' parameter

Code example:


  try {    
      var value = webapis.tvinfo.getMenuValue(webapis.tvinfo.TvInfoMenuKey.CAPTION_ONOFF_KEY);    
      console.log(" menu value = " + value); 
  } catch (error) {    
      console.log(" error code = " + error.code);  
  }
addCaptionChangeListener
This method add the listener callback for the caption menu change.

	  unsigned long addCaptionChangeListener(TvInfoCaptionChangeCallback listener,unsigned short key);             

Since : 1.0

Parameters:

  • listener: Listener of TvInfoCaptionChangeListener
  • key: Value of key about caption menu

Return value:

unsigned long return value of listener id

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if invalid TvInfoMenuKey type passed for 'key' parameter

    • with error type TypeMismatchError, if iInvalid ChangeCallback type passed for 'onchange' parameter

Code example:


  var listener = {   
      onchange: function(key) {     
          console.log(" TVInfoCaptionChange ");   
      }   
  }

  try {    
      var value = webapis.tvinfo.addCaptionChangeListener(listener, webapis.tvinfo.TvInfoMenuKey.CAPTION_ONOFF_KEY); 
      console.log("listener id = " + value); 
  } catch (error) {    
      console.log(" error code = " + error.code);  
  }
removeCaptionChangeListener
This method remove the listener which was added by addCaptionChangeListener.

	  void removeCaptionChangeListener(unsigned long listenerId);             

Since : 1.0

Parameters:

  • listenerId: Id of TvInfoCaptionChangeListener

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if invalid DOMString type passed for 'a' parameter

    • with error type NotFoundError, if can not find Listener by this listenerId

Code example:


  try {
      webapis.tvinfo.removeCaptionChangeListener(listenerId); // Defines listenerId before by addCaptionChangeListener
      console.log("listener id = " + value); 
  } catch (error) {    
      console.log(" error code = " + error.code);  
  }
isTvsPicSizeResized
This method check whether picture size resized.

  boolean isTvsPicSizeResized();      

Since : 1.0

Return value:

boolean return value of boolean
  • true is yes
  • false is no

Code example:


  try {    
      var flag = webapis.tvinfo.isTvsPicSizeResized(); 
      console.log("flag = " + flag); 
  } catch (error) {    
      console.log(" error code = " + error.code);  
  }

1.3. TvInfoCaptionChangeCallback

This callback interface defines listener for notification of changes in the Caption Settings.

  [Callback = FunctionOnly, NoInterfaceObject]interface TvInfoCaptionChangeListener {
      void onchange(unsigned short key);
  };

Since : 1.0

Methods

onchange
This method check callback which was changed to listen the change of TvInfoMenuKey.

  void onchange(unsigned short key);             

Since : 1.0

Parameters:

  • key: unsigned short

1.4. TvInfoMenuKey

This interface definesthe key of each Caption Settings.

  [NoInterfaceObject] interface TvInfoMenuKey {
      const unsigned short CAPTION_ONOFF_KEY = 0;
      const unsigned short CAPTION_MODE_KEY = 1;
      const unsigned short CAPTION_FONT_SIZE_KEY = 2;
      const unsigned short CAPTION_FONT_STYLE_KEY = 3;
      const unsigned short CAPTION_FG_COLOR_KEY = 4;
      const unsigned short CAPTION_FG_OPACITY_KEY = 5;
      const unsigned short CAPTION_BG_COLOR_KEY = 6;
      const unsigned short CAPTION_BG_OPACITY_KEY = 7;
      const unsigned short CAPTION_EDGE_TYPE_KEY = 8;
      const unsigned short CAPTION_EDGE_COLOR_KEY = 9;
      const unsigned short CAPTION_WINDOW_COLOR_KEY = 10;
      const unsigned short CAPTION_WINDOW_OPACITY_KEY = 11;
  };

Since : 1.0

Constants

  • CAPTION_ONOFF_KEY
    Caption On/Off

    Since : 1.0


     
  • CAPTION_MODE_KEY
    Caption mode defult ~ service 6

    Since : 1.0


     
  • CAPTION_FONT_SIZE_KEY
    Caption font size

    Since : 1.0


     
  • CAPTION_FONT_STYLE_KEY
    Caption font style defult ~ style 6

    Since : 1.0


     
  • CAPTION_FG_COLOR_KEY
    FG color of caption text

    Since : 1.0


     
  • CAPTION_FG_OPACITY_KEY
    FG opcacity of caption text

    Since : 1.0


     
  • CAPTION_BG_COLOR_KEY
    Background color of caption text

    Since : 1.0


     
  • CAPTION_BG_OPACITY_KEY
    Backgrount opacity of caption text

    Since : 1.0


     
  • CAPTION_EDGE_TYPE_KEY
    Edge type of caption text

    Since : 1.0


     
  • CAPTION_EDGE_COLOR_KEY
    Edge color of caption text
    CC1(US Localset)

    Since : 1.0


     
  • CAPTION_WINDOW_COLOR_KEY
    Window color of caption text
    CC2(US Localset)

    Since : 1.0


     
  • CAPTION_WINDOW_OPACITY_KEY
    Window opacity of caption text

    Since : 1.0


     

1.5. TvInfoMenuValue

This interface defines constants that indicates the value of menu settings.

  [NoInterfaceObject]interface TvInfoMenuValue {

      const unsigned short CAPTION_OFF = 0;
      const unsigned short CAPTION_ON = 1;

      const unsigned short CAPTION_MODE_DEFAULT = 0;
      const unsigned short CAPTION_MODE_SERVICE1 = 1;
      const unsigned short CAPTION_MODE_SERVICE2 = 2;
      const unsigned short CAPTION_MODE_SERVICE3 = 3;
      const unsigned short CAPTION_MODE_SERVICE4 = 4;
      const unsigned short CAPTION_MODE_SERVICE5 = 5;
      const unsigned short CAPTION_MODE_SERVICE6 = 6;
      const unsigned short CAPTION_MODE_CC1 = 7;
      const unsigned short CAPTION_MODE_CC2 = 8;
      const unsigned short CAPTION_MODE_CC3 = 9;
      const unsigned short CAPTION_MODE_CC4 = 10;
      const unsigned short CAPTION_MODE_TEXT1 = 11;
      const unsigned short CAPTION_MODE_TEXT2 = 12;
      const unsigned short CAPTION_MODE_TEXT3 = 13;
      const unsigned short CAPTION_MODE_TEXT4 = 14;

      const unsigned short CAPTION_SIZE_DEFAULT = 0;
      const unsigned short CAPTION_SIZE_SMALL = 1;
      const unsigned short CAPTION_SIZE_STANDARD = 2;
      const unsigned short CAPTION_SIZE_LARGE = 3;
      const unsigned short CAPTION_SIZE_EXTRA_LARGE = 4;

      const unsigned short CAPTION_FONT_DEFAULT = 0;
      const unsigned short CAPTION_FONT_STYLE0 = 1;
      const unsigned short CAPTION_FONT_STYLE1 = 2;
      const unsigned short CAPTION_FONT_STYLE2 = 3;
      const unsigned short CAPTION_FONT_STYLE3 = 4;
      const unsigned short CAPTION_FONT_STYLE4 = 5;
      const unsigned short CAPTION_FONT_STYLE5 = 6;
      const unsigned short CAPTION_FONT_STYLE6 = 7;
      const unsigned short CAPTION_FONT_STYLE7 = 8;

      const unsigned short CAPTION_COLOR_DEFAULT = 0;
      const unsigned short CAPTION_COLOR_WHITE = 1;
      const unsigned short CAPTION_COLOR_BLACK = 2;
      const unsigned short CAPTION_COLOR_RED = 3;
      const unsigned short CAPTION_COLOR_GREEN = 4;
      const unsigned short CAPTION_COLOR_BLUE = 5;
      const unsigned short CAPTION_COLOR_YELLOW = 6;
      const unsigned short CAPTION_COLOR_MAGENTA = 7;
      const unsigned short CAPTION_COLOR_CYAN = 8;

      const unsigned short CAPTION_OPACITY_SOLID = 0;
      const unsigned short CAPTION_OPACITY_FLASHING = 1;
      const unsigned short CAPTION_OPACITY_TRANSLUCENT = 2;
      const unsigned short CAPTION_OPACITY_TRANSPARENT = 3;
      const unsigned short CAPTION_OPACITY_DEFAULT = 4;

      const unsigned short CAPTION_EDGE_NONE = 0;
      const unsigned short CAPTION_EDGE_RAISED = 1;
      const unsigned short CAPTION_EDGE_DEPRESSED = 2;
      const unsigned short CAPTION_EDGE_UNIFORM = 3;
      const unsigned short CAPTION_EDGE_DROP_SHADOWED = 4;
  };

Constants

  • CAPTION_OFF
    Caption Off

    Since : 1.0


     
  • CAPTION_ON
    Caption On

    Since : 1.0


     
  • CAPTION_MODE_DEFAULT
    Default Mode

    Since : 1.0


     
  • CAPTION_MODE_SERVICE1
    Service 1

    Since : 1.0


     
  • CAPTION_MODE_SERVICE2
    Service 2

    Since : 1.0


     
  • CAPTION_MODE_SERVICE3
    Service 3

    Since : 1.0


     
  • CAPTION_MODE_SERVICE4
    Service 4

    Since : 1.0


     
  • CAPTION_MODE_SERVICE5
    Service 5

    Since : 1.0


     
  • CAPTION_MODE_SERVICE6
    Service 6

    Since : 1.0


     
  • CAPTION_MODE_CC1
    English(KOR Localset)
    CC1(US Localset)

    Since : 1.0


     
  • CAPTION_MODE_CC2
    Korean(KOR Localsel)
    CC2(US Localset)

    Since : 1.0


     
  • CAPTION_MODE_CC3
    Only US Localset

    Since : 1.0


     
  • CAPTION_MODE_CC4
    Only US Localset

    Since : 1.0


     
  • CAPTION_MODE_TEXT1
    Text 1

    Since : 1.0


     
  • CAPTION_MODE_TEXT2
    Text 2

    Since : 1.0


     
  • CAPTION_MODE_TEXT3
    Text 3

    Since : 1.0


     
  • CAPTION_MODE_TEXT4
    Text 4

    Since : 1.0


     
  • CAPTION_SIZE_DEFAULT
    Standard

    Since : 1.0


     
  • CAPTION_SIZE_SMALL
    Small

    Since : 1.0


     
  • CAPTION_SIZE_STANDARD
    Standard

    Since : 1.0


     
  • CAPTION_SIZE_LARGE
    Large

    Since : 1.0


     
  • CAPTION_SIZE_EXTRA_LARGE
    ExtraLarge

    Since : 1.0


     
  • CAPTION_FONT_DEFAULT
    Default

    Since : 1.0


     
  • CAPTION_FONT_STYLE0
    Default

    Since : 1.0


     
  • CAPTION_FONT_STYLE1
    Style 0

    Since : 1.0


     
  • CAPTION_FONT_STYLE2
    Style 1

    Since : 1.0


     
  • CAPTION_FONT_STYLE3
    Style 2

    Since : 1.0


     
  • CAPTION_FONT_STYLE4
    Style 3

    Since : 1.0


     
  • CAPTION_FONT_STYLE5
    Style 4

    Since : 1.0


     
  • CAPTION_FONT_STYLE6
    Style 5

    Since : 1.0


     
  • CAPTION_FONT_STYLE7
    Style 6

    Since : 1.0


     
  • CAPTION_COLOR_DEFAULT
    Default

    Since : 1.0


     
  • CAPTION_COLOR_WHITE
    White

    Since : 1.0


     
  • CAPTION_COLOR_BLACK
    Black

    Since : 1.0


     
  • CAPTION_COLOR_RED
    Red

    Since : 1.0


     
  • CAPTION_COLOR_GREEN
    Green

    Since : 1.0


     
  • CAPTION_COLOR_BLUE
    Blue

    Since : 1.0


     
  • CAPTION_COLOR_YELLOW
    Yellow

    Since : 1.0


     
  • CAPTION_COLOR_MAGENTA
    Magenta

    Since : 1.0


     
  • CAPTION_COLOR_CYAN
    Cyan

    Since : 1.0


     
  • CAPTION_COLOR_MAGENTA
    Magenta

    Since : 1.0


     
  • CAPTION_OPACITY_FLASHING
    Flashing

    Since : 1.0


     
  • CAPTION_OPACITY_TRANSLUCENT
    Translucent

    Since : 1.0


     
  • CAPTION_OPACITY_TRANSPARENT
    Transparent

    Since : 1.0


     
  • CAPTION_OPACITY_DEFAULT
    Default

    Since : 1.0


     
  • CAPTION_EDGE_NONE
    No Edge

    Since : 1.0


     
  • CAPTION_EDGE_RAISED
    Raised

    Since : 1.0


     
  • CAPTION_EDGE_DEPRESSED
    Depressed

    Since : 1.0


     
  • CAPTION_EDGE_UNIFORM
    Uniform

    Since : 1.0


     
  • CAPTION_EDGE_DROP_SHADOWED
    Drop Shadow

    Since : 1.0


     

2. Full WebIDL


  module TvInfo {
      [NoInterfaceObject]interface TvInfoManagerObject {
          readonly attribute TvInfoManager tvinfo;
      };
      WebApi implements TvInfoManagerObject;
      [NoInterfaceObject]interface TvInfoManager {
          attribute TvInfoMenuKey TvInfoMenuKey;
          attribute TvInfoMenuValue TvInfoMenuValue;

          DOMString getVersion();
          unsigned short getMenuValue(unsigned short key);
          unsigned long addCaptionChangeListener(TvInfoCaptionChangeCallback listener, unsigned short key);
          void removeCaptionChangeListener(unsigned long listenerId);
          boolean isTvsPicSizeResized();
      };

      [Callback = FunctionOnly, NoInterfaceObject]interface TvInfoCaptionChangeCallback {
          void onchange(unsigned short key);
      };

      [NoInterfaceObject] interface TvInfoMenuKey {
          const unsigned short CAPTION_ONOFF_KEY = 0;
          const unsigned short CAPTION_MODE_KEY = 1;
          const unsigned short CAPTION_FONT_SIZE_KEY = 2;
          const unsigned short CAPTION_FONT_STYLE_KEY = 3;
          const unsigned short CAPTION_FG_COLOR_KEY = 4;
          const unsigned short CAPTION_FG_OPACITY_KEY = 5;
          const unsigned short CAPTION_BG_COLOR_KEY = 6;
          const unsigned short CAPTION_BG_OPACITY_KEY = 7;
          const unsigned short CAPTION_EDGE_TYPE_KEY = 8;
          const unsigned short CAPTION_EDGE_COLOR_KEY = 9;
          const unsigned short CAPTION_WINDOW_COLOR_KEY = 10;
          const unsigned short CAPTION_WINDOW_OPACITY_KEY = 11;
     };

      [NoInterfaceObject]interface TvInfoMenuValue {

          const unsigned short CAPTION_OFF = 0;
          const unsigned short CAPTION_ON = 1;

          const unsigned short CAPTION_MODE_DEFAULT = 0;
          const unsigned short CAPTION_MODE_SERVICE1 = 1;
          const unsigned short CAPTION_MODE_SERVICE2 = 2;
          const unsigned short CAPTION_MODE_SERVICE3 = 3;
          const unsigned short CAPTION_MODE_SERVICE4 = 4;
          const unsigned short CAPTION_MODE_SERVICE5 = 5;
          const unsigned short CAPTION_MODE_SERVICE6 = 6;
          const unsigned short CAPTION_MODE_CC1 = 7;
          const unsigned short CAPTION_MODE_CC2 = 8;
          const unsigned short CAPTION_MODE_CC3 = 9;
          const unsigned short CAPTION_MODE_CC4 = 10;
          const unsigned short CAPTION_MODE_TEXT1 = 11;
          const unsigned short CAPTION_MODE_TEXT2 = 12;
          const unsigned short CAPTION_MODE_TEXT3 = 13;
          const unsigned short CAPTION_MODE_TEXT4 = 14;

          const unsigned short CAPTION_SIZE_DEFAULT = 0;
          const unsigned short CAPTION_SIZE_SMALL = 1;
          const unsigned short CAPTION_SIZE_STANDARD = 2;
          const unsigned short CAPTION_SIZE_LARGE = 3;
          const unsigned short CAPTION_SIZE_EXTRA_LARGE = 4;

          const unsigned short CAPTION_FONT_DEFAULT = 0;
          const unsigned short CAPTION_FONT_STYLE0 = 1;
          const unsigned short CAPTION_FONT_STYLE1 = 2;
          const unsigned short CAPTION_FONT_STYLE2 = 3;
          const unsigned short CAPTION_FONT_STYLE3 = 4;
          const unsigned short CAPTION_FONT_STYLE4 = 5;
          const unsigned short CAPTION_FONT_STYLE5 = 6;
          const unsigned short CAPTION_FONT_STYLE6 = 7;
          const unsigned short CAPTION_FONT_STYLE7 = 8;

          const unsigned short CAPTION_COLOR_DEFAULT = 0;
          const unsigned short CAPTION_COLOR_WHITE = 1;
          const unsigned short CAPTION_COLOR_BLACK = 2;
          const unsigned short CAPTION_COLOR_RED = 3;
          const unsigned short CAPTION_COLOR_GREEN = 4;
          const unsigned short CAPTION_COLOR_BLUE = 5;
          const unsigned short CAPTION_COLOR_YELLOW = 6;
          const unsigned short CAPTION_COLOR_MAGENTA = 7;
          const unsigned short CAPTION_COLOR_CYAN = 8;

          const unsigned short CAPTION_OPACITY_SOLID = 0;
          const unsigned short CAPTION_OPACITY_FLASHING = 1;
          const unsigned short CAPTION_OPACITY_TRANSLUCENT = 2;
          const unsigned short CAPTION_OPACITY_TRANSPARENT = 3;
          const unsigned short CAPTION_OPACITY_DEFAULT = 4;

          const unsigned short CAPTION_EDGE_NONE = 0;
          const unsigned short CAPTION_EDGE_RAISED = 1;
          const unsigned short CAPTION_EDGE_DEPRESSED = 2;
          const unsigned short CAPTION_EDGE_UNIFORM = 3;
          const unsigned short CAPTION_EDGE_DROP_SHADOWED = 4;
      };

  };