top

AppCommon API

To use Samsung Product API, 

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

Should be loaded in index.html

This module defines the application information retrieval functionalities provided by the Tizen Samsung TV Product API.

Since : 2.3

Product : TV, AV_BD

Table of Contents

  1. 1. Type Definitions
    1. 1.1. AppCommonKeyName
  2. 2. Interfaces
    1. 2.1. AppCommonManagerObject
    2. 2.2. AppCommonManager
    3. 2.3. AppCommonScreenSaverState
    4. 2.3. AppCommonRecommendedWordsType
    5. 2.3. AppCommonInputDeviceKey
    6. 2.3. AppcommonTarget
    7. 2.3. AppcommonAction
  3. 3. Full WebIDL

Summary of Interfaces and Methods

Interface Method
AppCommonManagerObject  
AppCommonManager DOMString getVersion ()
void setScreenSaver (unsigned short state, optional SuccessCallback ? onsuccess, optional ErrorCallback ? onerror)
AppCommonScreenSaverState  

1. Type Definitions

1.1. AppCommonKeyName

Specifies keys that can be registered and unregistered individually, such as TV-specific keys.

enum AppCommonKeyName {
  "SmartHub",
  "Power",
  "SMODE",
  "PMODE",
  "More",
  "BTVoice",
  "Color",
  "BTPairing",
  "Sleep",
  "Netflix",
  "NoiseReduction",
  "Help",
  "Content",
  "HotelMovies",
  "HotelLanguage",
  "HotelTVGuide",
  "NR",
  "HotelRoomControl",
  "Ambient",
  "PanelPower",
  "PanelSource",
  "PanelMenu"
};

Since : 2.4

The following values are supported

  • SmartHub keyCode: 10071
  • Power keyCode: 409
  • SMODE keyCode: 10197
  • PMODE keyCode: 10141
  • More keyCode: 10148
  • BTVoice keyCode: 10224
  • Color keyCode: 10385
  • BTPairing keyCode: 10161
  • Sleep keyCode: 10150
  • Netflix keyCode: 10234 (HotelTV only)
  • NoiseReduction keyCode: 10519 (HotelTV only)
  • Help keyCode: 10520 (HotelTV only)
  • Content keyCode: 10497 (HotelTV only)
  • HotelMovies keyCode: 10494 (HotelTV only)
  • HotelLanguage keyCode: 10495 (HotelTV only)
  • HotelTVGuide keyCode: 10496 (HotelTV only)
  • NR keyCode: 10521 (HotelTV only)
  • HotelRoomControl keyCode: 10522 (HotelTV only)
  • Ambient keyCode: 10530 (Since Tizen4.0)
  • PanelPower keyCode: 10531 (HotelTV only)
  • PanelSource keyCode: 10532 (HotelTV only)
  • PanelMenu keyCode: 10533 (HotelTV only)

2. Interfaces

2.1. AppCommonManagerObject

Defines a WebApi object instance of the Tizen Samsung TV Product API.
The webapis.appcommon object enables access to AppCommon API functionality.

[NoInterfaceObject]interface AppCommonManagerObject {
  readonly attribute AppCommonManager appcommon;
};
	

  WebApi implements AppCommonManagerObject;

Attributes

2.2. AppCommonManager

Provides methods for AppCommon functionalities.

[NoInterfaceObject]interface AppCommonManager {
  attribute AppCommonScreenSaverState AppCommonScreenSaverState;
  attribute AppcommonTarget AppcommonTarget;
  attribute AppcommonAction AppcommonAction;

  DOMString getVersion();
  void setScreenSaver(AppCommonScreenSaverState state, optional SuccessCallback ? onsuccess, optional ErrorCallback ? onerror);
};
	

Attributes

Methods

getVersion
Retrieves the plugin version number.

DOMString getVersion();

Since : 2.3

Product : TV, AV_BD

Return value:

DOMString Plugin version

Code example:


try {
  var value = webapis.appcommon.getVersion();
  console.log(" version value = " + value);
} catch (error) {
  console.log(" error code = " + error.code);
}
setScreenSaver
Sets the screensaver.

void setScreenSaver(AppCommonScreenSaverState state, optional SuccessCallback ? onsuccess, optional ErrorCallback ? onerror);

Since : 2.3

Product : TV, AV_BD

Parameters:

  • state: Screensaver state
  • onsuccess [optional]: Callback method to invoke when the screensaver is set successfully
  • onerror [optional]: Callback method to invoke if an error occurs

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if an input parameter is not compatible with its expected type.

    • with error type InvalidValuesError, if any input parameter contains an invalid value. (Since plugin version 3.0)

Code example:


function onsuccess(data)  {
  console.log("setScreensavervalue = " + data);
}
function onerror(error)  {
  console.log("error code : " + error.code);
}
try {
  webapis.appcommon.setScreenSaver(webapis.appcommon.AppCommonScreenSaverState.SCREEN_SAVER_OFF, onsuccess, onerror);
} catch (error) {
  console.log(" error code = " + error.code);
}

2.3. AppCommonScreenSaverState

Defines constants for screensaver states.

[NoInterfaceObject]interface AppCommonScreenSaverState {
  const unsigned long SCREEN_SAVER_OFF = 0;
  const unsigned long SCREEN_SAVER_ON = 1;
};
	

The following values are supported

Constants

  • SCREEN_SAVER_OFF
    Screensaver off
  • SCREEN_SAVER_ON
    Screensaver on

2.4. AppCommonRecommendedWordsType

Defines constants for recommended words states.

[NoInterfaceObject]interface AppCommonRecommendedWordsType {
  const unsigned long RECOMMENDED_WORDS_DISABLE = 0;
  const unsigned long RECOMMENDED_WORDS_ENABLE = 1;
};
	

The following values are supported

Constants

  • RECOMMENDED_WORDS_DISABLE
    Recommended words disabled
  • RECOMMENDED_WORDS_ENABLE
    Recommended words enabled

2.5. AppCommonInputDeviceKey

Defines input device key information.

[NoInterfaceObject]interface AppCommonInputDeviceKey {
  readonly attribute DOMString name;
  readonly attribute unsigned long code;
};
	

Attributes

  • DOMString name
    The name of the key
  • unsigned long code
    Numeric key code

2.6. AppcommonTarget

Defines the Appcommon target.

[NoInterfaceObject]interface AppcommonTarget {
  const unsigned long CONFIG_LAST_SOURCE = 0;
};
	

The following values are supported

Constants

  • CONFIG_LAST_SOURCE
    Target is the last media source

2.7. AppcommonAction

Defines the Appcommon action

[NoInterfaceObject]interface AppcommonAction {
  const unsigned long CONFIG_LAUNCH = 0;
};
	

The following values are supported

Constants

  • CONFIG_LAUNCH
    Launch target

23. Full WebIDL


module AppCommon {
  enum AppCommonKeyName {
    "SmartHub",
    "Power",
    "SMODE",
    "PMODE",
    "More",
    "BTVoice",
    "Color",
    "BTPairing",
    "Sleep",
    "Netflix",
    "NoiseReduction",
    "Help",
    "Content",
    "HotelMovies",
    "HotelLanguage",
    "HotelTVGuide",
    "NR",
    "HotelRoomControl",
    "Ambient",
    "PanelPower",
    "PanelSource",
    "PanelMenu"
  };

  [NoInterfaceObject]interface AppCommonManagerObject {
    readonly attribute AppCommonManager appcommon;
  };

  WebApi implements AppCommonManagerObject;

  [NoInterfaceObject]interface AppCommonManager {
    attribute AppCommonScreenSaverState AppCommonScreenSaverState;
    attribute AppcommonTarget AppcommonTarget;
    attribute AppcommonAction AppcommonAction;

    DOMString getVersion();
    void setScreenSaver(AppCommonScreenSaverState state, optional SuccessCallback ? onsuccess, optional ErrorCallback ? onerror);
  };

  [NoInterfaceObject]interface AppCommonScreenSaverState {
    const unsigned long SCREEN_SAVER_OFF = 0;
    const unsigned long SCREEN_SAVER_ON = 1;
  };

  [NoInterfaceObject]interface AppCommonRecommendedWordsType {
    const unsigned long RECOMMENDED_WORDS_DISABLE = 0;
    const unsigned long RECOMMENDED_WORDS_ENABLE = 1;
  };

  [NoInterfaceObject]interface AppCommonInputDeviceKey {
    readonly attribute DOMString name;
    readonly attribute unsigned long code;
  };

  [NoInterfaceObject]interface AppcommonTarget {
    const unsigned long CONFIG_LAST_SOURCE = 0;
  };

  [NoInterfaceObject]interface AppcommonAction {
    const unsigned long CONFIG_LAUNCH = 0;
  };
};