top

AppCommon 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 getting information that are related application that are provides as the Samsung TV for Tizen Platform Product API.

Since : 1.0

Table of Contents

  1. 1. Interfaces
    1. 1.1. AppCommonManagerObject
    2. 1.2. AppCommonManager
    3. 1.3. AppCommonScreenSaverState
  2. 2. 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. Interfaces

1.1. AppCommonManagerObject

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

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

  WebApi implements AppCommonManagerObject;

Since : 1.0

Attributes

1.2. AppCommonManager

This interface provides methods to use the AppCommon functionalities.

  [NoInterfaceObject]interface AppCommonManager {
      attribute AppCommonScreenSaverState AppCommonScreenSaverState;
      DOMString getVersion();
      void setScreenSaver(unsigned short state, optional SuccessCallback ? onsuccess, optional ErrorCallback ? onerror);
  };

Since : 1.0

Attributes

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.appcommon.getVersion();    
      console.log(" version value = " + value); 
  } catch (error) {    
      console.log(" error code = " + error.code);  
  }
setScreenSaver
This method set screen saver according to ScreenSaver api.

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

Since : 1.0

Parameters:

  • state: State of screensaver
  • onsuccess [optional]: SuccessCallback
  • onerror [optional]: ErrorCallback

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if invalid AppCommonScreenSaverState type passed for 'state' parameter

    • with error type TypeMismatchError, if invalid SuccessCallback type passed for 'onsuccess' parameter

    • with error type TypeMismatchError, if invalid ErrorCallback type passed for 'onerror' parameter

Code example:


  function onsuccess(data)  {   
      console.log("setScreensavervalue = " + data); 
  }

  function onerror(error)  {   
      console.log("error code : " + error.code); 
  }

  try {    
      var value = webapis.appcommon.setScreenSaver("SCREEN_SAVER_OFF", onsuccess, onerror); 
  } catch (error) {    
      console.log(" error code = " + error.code);  
  }

1.3. AppCommonScreenSaverState

This interface defines the state of screen saver.

  [NoInterfaceObject]enum AppCommonScreenSaverState {
      const unsigned short SCREEN_SAVER_OFF = 0;
      const unsigned short SCREEN_SAVER_ON = 1;
  };

Since : 1.0

The following values are supported

Constants

  • SCREEN_SAVER_OFF
    screen saver off

    Since : 2.0


     
  • SCREEN_SAVER_ON
    screen saver on

    Since : 1.0


     

2. Full WebIDL


  module AppCommon {
      [NoInterfaceObject]interface AppCommonManagerObject {
          readonly attribute AppCommonManager appcommon;
      };
      WebApi implements AppCommonManagerObject;
      [NoInterfaceObject]interface AppCommonManager {
          attribute AppCommonScreenSaverState AppCommonScreenSaverState;
          DOMString getVersion();
          void setScreenSaver(unsigned short state, optional SuccessCallback ? onsuccess, optional ErrorCallback ? onerror);
      };

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