Skip to content

Latest commit

 

History

History
188 lines (109 loc) · 3.3 KB

en_platform.md

File metadata and controls

188 lines (109 loc) · 3.3 KB

Platform

Device native methods are called through the base SB object. You can extend it and add your own new platform. After SB.ready a current platform has been already defined and is kept in SB.

Properties and methods

SB.platformName

String: platform name (samsung, lg, philips, etc...)

SB.keys

Plain object: hash containing keys codes and them names.

Default key names

    BLUE
    CH_DOWN
    CH_UP
    DOWN
    ENTER
    EXIT
    FF
    GREEN
    INFO
    LEFT
    N0
    N1
    N2
    N3
    N4
    N5
    N6
    N7
    N8
    N9
    NEXT
    PAUSE
    PLAY
    PRECH
    PREV
    REC
    RED
    RETURN
    RIGHT
    RW
    SMART
    STOP
    SUBT
    TOOLS
    UP
    YELLOW

SB.platformUserAgent

String unique string for platform. It's compare with environment userAgent in SB.detect method

Example

SB.platformUserAgent === 'netcast'; // for philips
SB.platformUserAgent === 'maple';   // for samsung

SB.getDUID

Function return platform DUID in case of SB.config.DUID

Returns

String DUID

SB.getNativeDUID

Function return native DUID if exist

Returns

String DUID or empty string

SB.getSDI

Function return platform SDI if exist

Returns

String SDI or empty string

SB.getRandomDUID

Function return random DUID

Returns

String generated DUID, for example: "1446dcfb2ca1091"

SB.getMac

Function return platform MAC if exist

Returns

String MAC or empty string

SB.setPlugins

Function initialize & start plugins specific for platform function calls automatically with smartbox initialization

SB.setData(name, value)

Function save data in platform storage

Arguments

  1. name String data name
  2. value (*) data value

SB.getData(name)

Function return value from platform storage

Arguments

  1. name String data name

Returns

(*) data value

SB.removeData(name)

Function remove data from platform storage

Arguments

  1. name String data name

New platform adding

You can add a new plaform using function SB.createPlatform(platformName, cb)

var platformName = 'myPlatform';
SB.createPlatform(platformName, {
    //platform methods
});