Samsung Electronics logo

Samsung Web API: Info


Introduction

This API provides the system information for a device associated with a TV.

A webapis.tv.info object that provides access to the functionality of the TV info API.

For more information on the TV Info features, see TV Info Guide.


Table of Contents


Summary of Interfaces and Methods

Interface Method
WebAPIsTVInfoManager
TimeZone
TVInfoManager unsigned short getProduct()
DOMString getModel()
DOMString getFirmware()
DOMString getVersion()
DOMString getCountry()
DOMString getLanguage()
DOMString getDeviceID()
unsigned long getTick()
unsigned long getEpochTime()
Date convertEpochToTime(unsigned long epoch)
unsigned long convertTimeToEpoch(Date time)
TimeZone getTimeZone()

1. Interfaces

1.1. WebAPIsTVInfoManager

Defines what is instantiated in the webapis object.

    [NoInterfaceObject] interface WebAPIsTVInfoManager {
        readonly attribute TVInfoManager info;
    };
    TV implements WebAPIsTVInfoManager;

A webapis.tv.info object that provides access to the functionality of the info module.

1.2. TimeZone

Time zone object

    [NoInterfaceObject] interface TimeZone
    {
        readonly attribute unsigned short timezone;  

        readonly attribute long offset;

        readonly attribute unsigned short dst;
    };
Code example
 var timeZoneObj = webapis.tv.info.getTimeZone();
 switch (timeZoneObj.timezone) {
     case webapis.tv.info.TIMEZONE_USA_ATLANTIC : console.log("current time zone is atlantic, USA.");
         break;
     case webapis.tv.info.TIMEZONE_KOR_SEOUL : console.log("current time zone is seoul, Korea.");
         break;
 }
 console.log("time zone offset is " + timeZoneObj.offset);
 switch (timeZoneObj.dst) {
     case webapis.tv.info.TIMEZONE_DST_ON : console.log("current daylight saving time is on.");
         break;
     case webapis.tv.info.TIMEZONE_DST_OFF : console.log("current daylight saving time is off.");
         break;
     case webapis.tv.info.TIMEZONE_DST_AUTO : console.log("current daylight saving time is auto.");
         break;
 }
 

ATTRIBUTES

readonly unsigned short timezone

Time zone.

This attribute is read-only.

readonly long offset

Time zone offset value

This attribute is read-only.

readonly unsigned short dst

Daylight Saving Time mode

This attribute is read-only.

1.3. TVInfoManager

The TVInfoManager interface provides access to the specific information for a Smart TV.

    [NoInterfaceObject] interface TVInfoManager {

        const unsigned short TIMEZONE_USA_NEWFOUNDLAND = 0;

        const unsigned short TIMEZONE_USA_ATLANTIC = 1;

        const unsigned short TIMEZONE_USA_EASTERN = 2;

        const unsigned short TIMEZONE_USA_CENTRAL = 3;

        const unsigned short TIMEZONE_USA_MOUNTAIN = 4;

        const unsigned short TIMEZONE_USA_PACIFIC = 5;

        const unsigned short TIMEZONE_USA_ALASKA = 6;

        const unsigned short TIMEZONE_USA_HAWAII = 7;

        const unsigned short TIMEZONE_KOR_SEOUL = 8;

        const unsigned short TIMEZONE_DVB_REGION_0 = 9;

        const unsigned short TIMEZONE_DVB_REGION_1 = 10;
                  
        const unsigned short TIMEZONE_DVB_REGION_2 = 11;
                  
        const unsigned short TIMEZONE_DVB_REGION_3 = 12;           

        const unsigned short TIMEZONE_DVB_REGION_4 = 13;         
          
        const unsigned short TIMEZONE_DVB_REGION_5 = 14;          
         
        const unsigned short TIMEZONE_DVB_REGION_6 = 15;           

        const unsigned short TIMEZONE_DVB_REGION_7 = 16;
                   
        const unsigned short TIMEZONE_DVB_REGION_8 = 17;

        const unsigned short PRODUCT_TYPE_TV = 0;

        const unsigned short PRODUCT_TYPE_BD = 1;

        const unsigned short PRODUCT_TYPE_MONITOR = 2; 

        const unsigned short TIMEZONE_DST_ON = 1;

        const unsigned short TIMEZONE_DST_OFF = 2;

        const unsigned short TIMEZONE_DST_AUTO = 3;
                     
        unsigned short getProduct();        
 
        DOMString getModel();
 
        DOMString getFirmware();
 
        DOMString getVersion();
 
        DOMString getCountry();
 
        DOMString getLanguage();
 
        DOMString getDeviceID();      
        
       unsigned long getTick();
       
        unsigned long getEpochTime();
               
        Date convertEpochToTime(unsigned long epoch);
        
        unsigned long convertTimeToEpoch(Date time);
        
        TimeZone getTimeZone();
    };

This manager interface exposes the TV System information for basic TV functions.

CONSTANTS

unsigned short TIMEZONE_USA_NEWFOUNDLAND

Time zone identifier for USA New found land

unsigned short TIMEZONE_USA_ATLANTIC

Time zone identifier for USA Atlantic

unsigned short TIMEZONE_USA_EASTERN

Time zone identifier for USA Eastern

unsigned short TIMEZONE_USA_CENTRAL

Time zone identifier for USA Central

unsigned short TIMEZONE_USA_MOUNTAIN

Time zone identifier for USA Mountain

unsigned short TIMEZONE_USA_PACIFIC

Time zone identifier for USA Pacific

unsigned short TIMEZONE_USA_ALASKA

Time zone identifier for USA Alaska

unsigned short TIMEZONE_USA_HAWAII

Time zone identifier for USA Hawaii

unsigned short TIMEZONE_KOR_SEOUL

Time zone identifier for USA Seoul

unsigned short TIMEZONE_DVB_REGION_0

The identifier for time zone offset DVB (Region 0) - Australia : Use in a country that does not have multiple time zones.

unsigned short TIMEZONE_DVB_REGION_1

The identifier for time zone offset DVB (Region 1) - Australia: reserved, Spain

unsigned short TIMEZONE_DVB_REGION_2

The identifier for time zone offset DVB (Region 2) - Australia: New South Wales / ACT, Spain

unsigned short TIMEZONE_DVB_REGION_3

The identifier for time zone offset DVB (Region 3) - Australia: Victoria

unsigned short TIMEZONE_DVB_REGION_4

The identifier for time zone offset DVB (Region 4) - Australia: Queensland

unsigned short TIMEZONE_DVB_REGION_5

The identifier for time zone offset DVB (Region 5) - Australia: South Australia

unsigned short TIMEZONE_DVB_REGION_6

The identifier for time zone offset DVB (Region 6) - Australia: Western Australia

unsigned short TIMEZONE_DVB_REGION_7

The identifier for time zone offset DVB (Region 7) - Australia: Tasmania

unsigned short TIMEZONE_DVB_REGION_8

The identifier for time zone offset DVB (Region 8) - Australia: Northern Territory

unsigned short PRODUCT_TYPE_TV

The identifier for TV product.

unsigned short PRODUCT_TYPE_BD

The identifier for Blu-ray player product.

unsigned short PRODUCT_TYPE_MONITOR

The identifier for monitor product

unsigned short TIMEZONE_DST_ON

The identifier for Daylight Saving Time is on.

unsigned short TIMEZONE_DST_OFF

The identifier for Daylight Saving Time is off.

unsigned short TIMEZONE_DST_AUTO

The identifier for Daylight Saving Time setting is auto.

METHODS

getProduct

Gets the product type.

Signature
unsigned short getProduct();
Return value
unsigned short product type number.
Exceptions
  • WebAPIException:

    with error type UnknownError In the case of any other error

    with error type NotSupportedError if the feature is not supported.

    with error type SecurityError if this functionality is not allowed.

Code example
 var product = webapis.tv.info.getProduct();
 switch (product) {
     case webapis.tv.info.PRODUCT_TYPE_TV : console.log("product is a TV");
         break;
     case webapis.tv.info.PRODUCT_TYPE_BD : console.log("product is a blue-ray player");
         break;
     case webapis.tv.info.PRODUCT_TYPE_MONITOR : console.log("product is a monitor");
         break;
 }
 

getModel

Gets the model name.

Signature
DOMString getModel();
Exceptions
  • WebAPIException:

    with error type UnknownError In the case of any other error

    with error type NotSupportedError if the feature is not supported.

    with error type SecurityError if this functionality is not allowed.

Code example
 
 console.log("model name is " + webapis.tv.info.getModel());
 

getFirmware

Gets the firmware version.

Signature
DOMString getFirmware();
Return value
DOMString returns the firmware version
Exceptions
  • WebAPIException:

    with error type UnknownError In the case of any other error

    with error type NotSupportedError if the feature is not supported.

    with error type SecurityError if this functionality is not allowed.

Code example
 
 console.log("firmware version is " + webapis.tv.info.getFirmware());
 

getVersion

Gets Smart Hub Version.

Signature
DOMString getVersion();
Return value
DOMString the SmartHub Version.
Exceptions
  • WebAPIException:

    with error type UnknownError In the case of any other error

    with error type NotSupportedError if the feature is not supported.

    with error type SecurityError if this functionality is not allowed.

Code example
 
 console.log("Smart Hub version is " + webapis.tv.info.getVersion());
 

getCountry

Gets the country code in which device is located.

Signature
DOMString getCountry();
Return value
DOMString the country code (ISO 3166) in which the device is located.
Exceptions
  • WebAPIException:

    with error type UnknownError In the case of any other error

    with error type NotSupportedError if the feature is not supported.

    with error type SecurityError if this functionality is not allowed.

Code example
 
 console.log("country code is " + webapis.tv.info.getCountry());
 

getLanguage

Gets the language code.

Signature
DOMString getLanguage();
Return value
DOMString the language code in which the user interface will be displayed.
Exceptions
  • WebAPIException:

    with error type UnknownError In the case of any other error

    with error type NotSupportedError if the feature is not supported.

    with error type SecurityError if this functionality is not allowed.

Code example
 
 console.log("current language is " + webapis.tv.info.getLanguage());
 

getDeviceID

Gets the device id. The device ID should be unique across all devices for a given product. It is useful for unique device identification.

Signature
DOMString getDeviceID();
Return value
DOMString unique device identification.
Exceptions
  • WebAPIException:

    with error type UnknownError In the case of any other error

    with error type NotSupportedError if the feature is not supported.

    with error type SecurityError if this functionality is not allowed.

Code example
 
 console.log("Device ID is " + webapis.tv.info.getDeviceID());
 

getTick

Gets tick count.

Signature
unsigned long getTick();
Return value
unsigned long the current tick count
Exceptions
  • WebAPIException:

    with error type UnknownError In the case of any other error

    with error type NotSupportedError if the feature is not supported.

    with error type SecurityError if this functionality is not allowed.

Code example
 
 console.log("current tick time is " + webapis.tv.info.getTick());
 

getEpochTime

Gets current epoch time.

Signature
unsigned long getEpochTime();
Return value
unsigned long current epoch time
Exceptions
  • WebAPIException:

    with error type UnknownError In the case of any other error

    with error type NotSupportedError if the feature is not supported.

    with error type SecurityError if this functionality is not allowed.

Code example
 
 console.log("current epoch time is " + webapis.tv.info.getEpochTime());
 

convertEpochToTime

Converts epoch time to time. The epoch time is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds (ISO 8601: 1970-01-01T00:00:00Z)

Signature
Date convertEpochToTime(unsigned long epoch);
Parameters
  • epoch
    • Optional: No.
    • Nullable: No.
    • Type: unsigned long.
    • Description: epoch time. Epoch time shoud be a postive number which is greater than zero.
Return value
Date object which is converted from epoch time
Exceptions
  • WebAPIException:

    with error type UnknownError In the case of any other error

    with error type NotSupportedError if the feature is not supported.

    with error type SecurityError if this functionality is not allowed.

    with error type InvalidValuesError if the input attributes do not contain a valid value

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

Code example
 
 console.log("current epoch time is " + webapis.tv.info.getEpochTime());
 

convertTimeToEpoch

Converts time to epoch time.

Signature
unsigned long convertTimeToEpoch(Date time);
Parameters
  • time
    • Optional: No.
    • Nullable: No.
    • Type: Date.
    • Description: Date object which will be converted
Return value
unsigned long epoch time
Exceptions
  • WebAPIException:

    with error type UnknownError In the case of any other error

    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
 
 var date = new Date();
 console.log("current epoch time is " + webapis.tv.info.convertTimeToEpoch(date));
 

getTimeZone

Gets a timezone information

Signature
TimeZone getTimeZone();
Return value
TimeZone timezone information
Exceptions
  • WebAPIException:

    with error type UnknownError In the case of any other error

    with error type NotSupportedError if the feature is not supported.

    with error type SecurityError if this functionality is not allowed.

Code example
 var timeZoneObj = webapis.tv.info.getTimeZone();
 switch (timeZoneObj.timezone) {
     case webapis.tv.info.TIMEZONE_USA_ATLANTIC : console.log("current time zone is atlantic, USA.");
         break;
     case webapis.tv.info.TIMEZONE_KOR_SEOUL : console.log("current time zone is seoul, Korea.");
         break;
 }
 

2. Full WebIDL

module Info {
    [NoInterfaceObject] interface WebAPIsTVInfoManager {
        readonly attribute TVInfoManager info;
    };
    TV implements WebAPIsTVInfoManager;

    [NoInterfaceObject] interface TimeZone
    {
        readonly attribute unsigned short timezone;  

        readonly attribute long offset;

        readonly attribute unsigned short dst;
    };   

   
    [NoInterfaceObject] interface TVInfoManager {

        const unsigned short TIMEZONE_USA_NEWFOUNDLAND = 0;

        const unsigned short TIMEZONE_USA_ATLANTIC = 1;

        const unsigned short TIMEZONE_USA_EASTERN = 2;

        const unsigned short TIMEZONE_USA_CENTRAL = 3;

        const unsigned short TIMEZONE_USA_MOUNTAIN = 4;

        const unsigned short TIMEZONE_USA_PACIFIC = 5;

        const unsigned short TIMEZONE_USA_ALASKA = 6;

        const unsigned short TIMEZONE_USA_HAWAII = 7;

        const unsigned short TIMEZONE_KOR_SEOUL = 8;

        const unsigned short TIMEZONE_DVB_REGION_0 = 9;

        const unsigned short TIMEZONE_DVB_REGION_1 = 10;
                  
        const unsigned short TIMEZONE_DVB_REGION_2 = 11;
                  
        const unsigned short TIMEZONE_DVB_REGION_3 = 12;           

        const unsigned short TIMEZONE_DVB_REGION_4 = 13;         
          
        const unsigned short TIMEZONE_DVB_REGION_5 = 14;          
         
        const unsigned short TIMEZONE_DVB_REGION_6 = 15;           

        const unsigned short TIMEZONE_DVB_REGION_7 = 16;
                   
        const unsigned short TIMEZONE_DVB_REGION_8 = 17;

        const unsigned short PRODUCT_TYPE_TV = 0;

        const unsigned short PRODUCT_TYPE_BD = 1;

        const unsigned short PRODUCT_TYPE_MONITOR = 2; 

        const unsigned short TIMEZONE_DST_ON = 1;

        const unsigned short TIMEZONE_DST_OFF = 2;

        const unsigned short TIMEZONE_DST_AUTO = 3;
                     
        unsigned short getProduct();        
 
        DOMString getModel();
 
        DOMString getFirmware();
 
        DOMString getVersion();
 
        DOMString getCountry();
 
        DOMString getLanguage();
 
        DOMString getDeviceID();      
        
       unsigned long getTick();
       
        unsigned long getEpochTime();
               
        Date convertEpochToTime(unsigned long epoch);
        
        unsigned long convertTimeToEpoch(Date time);
        
        TimeZone getTimeZone();
    };
};