Namespace: system

ENABLE. system

Namespaces

tv_system

Members

static,constantENABLE.system.APP_PAUSEString

This is an indicator that the user no longer actively interacts with the activity, but it is still visible on screen.
This event is mostly used for saving any persistent state the activity is editing.

Since:
  • 1.0.0

static,constantENABLE.system.APP_RESTARTString

Involved after APP_STOP when the current activity is being re-displayed to the user (the user has navigated back to it).
It will be followed by APP_RESUME.

Since:
  • 1.3.0

static,constantENABLE.system.APP_RESUMEString

This is an indicator that the activity of browser application became active and ready to receive input.

Since:
  • 1.0.0

static,constantENABLE.system.APP_STOPString

This is an indicator that application is no longer visible to the user.
This is a good place to stop refreshing UI, running animations and other visual things.

Since:
  • 1.0.0

static,constantENABLE.system.INI_UPDATEString

This is an indicator that the INI configuration has been updated.
Application may read the configuration and apply it.

Since:
  • 1.0.0

static,constantENABLE.system.PWR_MODE_S0_STBYString

Parameter returned from ENABLE.system.getStandbyStatus.
Standby Mode S0, CPU keeps running, processes are running. Outputs are off, TV will show no signal.

Since:
  • 1.0.0

static,constantENABLE.system.PWR_MODE_S2_STBYString

Parameter returned from ENABLE.system.getStandbyStatus.
Standby Mode S2, CPU is stopped, processes are suspended. Network interface on but only able to handle magic packet to wake up STB.

Since:
  • 1.0.0

static,constantENABLE.system.REASON_COLD_BOOTString

Parameter returned from ENABLE.system.getLastBootReason.
Cold boot, generally indicates a full reset of all devices, including memory.

Since:
  • 1.0.0

static,constantENABLE.system.REASON_FACTORY_RESETString

Parameter returned from ENABLE.system.getLastBootReason.
Factory reset, reboot to reset the device to factory settings.

Since:
  • 1.0.0

static,constantENABLE.system.REASON_UPGRADEString

Parameter returned from ENABLE.system.getLastBootReason.
Upgrade, reboot to upgrade ota package for the device.

Since:
  • 1.0.0

static,constantENABLE.system.REASON_WARM_BOOTString

Parameter returned from ENABLE.system.getLastBootReason.
Warm boot, generally indicates the memory and the devices retain some state, and the ramoops backing store contains persistent content.

Since:
  • 1.0.0

Methods

staticENABLE.system.factoryReset(){Object}

system.js, line 269

Erase all data on internal storage, including application data and settings, and installed apps.
STB will then be rebooted.

Since:
  • 1.0.0
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS

staticENABLE.system.getAllINIs(){Object}

system.js, line 200

Retrieves all INI configuration values from the system.

  • The data type of INI value will be returned as String.
  • Accessing specific values can be done by using the key as an index into the returned object, e.g., ENABLE.system.getAllINIs()["tvapp.package_id"].

Example return structure:

{
  "adb.mode": "1",
  "tvapp.package_id": "com.aminocom.browser",
  "browser.js.compatibility.enable": "true",
  "status_code": ENABLE.status.SUCCESS
}
Since:
  • 1.0.0
Returns:
Name Type Description
object Object
Name Type Description
key String Key of the ini
value String Value of the ini
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR

staticENABLE.system.getConfigSource(){Object}

system.js, line 481

Returns the INI config source that STB boots through and related info.

Returns an object with the following structure:

  • For DHCP source:

    {
      source: "dhcp",
      dhcp_source: "http://10.0.6.230/angus/H200_new.ini",
      status_code: ENABLE.status.SUCCESS
    }
    
  • For Orchestrate source:

    {
      source: "tr69",
      engage_last_connection: new Date('Wed Sep 28 2022 10:07:23 GMT+0000 (Greenwich Mean Time)'),
      engage_next_session: new Date('Wed Sep 29 2022 10:07:23 GMT+0000 (Greenwich Mean Time)'),
      status_code: ENABLE.status.SUCCESS
    }
    
  • For USB provision source:

    {
      source: "usb_provision",
      usb_last_modified: new Date('Wed Sep 28 2022 10:07:23 GMT+0000 (Greenwich Mean Time)'),
      status_code: ENABLE.status.SUCCESS
    }
    
  • If no source is detected:

    {
      source: "none",
      status_code: ENABLE.status.SUCCESS
    }
    

Note:

  • engage_last_connection, engage_next_session, and usb_last_modified are JavaScript Date objects, allowing methods like getFullYear(), getMonth(), etc., for further manipulation.
Since:
  • 1.0.0
Returns:
Name Type Description
object Object
Name Type Description
source Object STB boots through which ini config source
dhcp_source Object Optional. Dhcp source file if stb boots with dhcp source
engage_last_connection Date Optional. JS Date object to show engage last connection time if stb boots with tr69 source
engage_next_session Date Optional. JS Date object to show engage next session time if stb boots with tr69 source
usb_last_modified Date Optional. JS Date object to show usb ini last modified time if stb boots with usb provision ini source
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR

staticENABLE.system.getDeviceName(){Object}

system.js, line 621

Get the device name.

Since:
  • 1.4.0
Returns:
Name Type Description
object Object
Name Type Description
result String The configured device name.
status_code String ENABLE.status.SUCCESS

staticENABLE.system.getFullSerialNumber(){Object}

system.js, line 47

Gets full serial number of STB.

Since:
  • 1.0.0
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR
result String Full serial number in format [Product Number]-[Serial Number], e.g. 104-7260001

staticENABLE.system.getGlobalSettingValue(key){String}

system.js, line 560

Returns global setting value

ENABLE.system.getGlobalSettingValue("adb_enabled")
Returns {status_code: ENABLE.status.SUCCESS, result: "1"}
Name Type Description
key String

Global setting key, can be referred to
https://developer.android.com/reference/android/provider/Settings.Global#constants_1

Since:
  • 1.0.0
Returns:
Name Type Description
object.result String Global setting value
object.status_code String ENABLE.status.SUCCESS or
ENABLE.status.INVALID_ARGUMENT

staticENABLE.system.getHardwareInfo(){Object}

system.js, line 522

Returns system hardware information.

ENABLE.system.getHardwareInfo()
{
    board_version: "A2-200",
    model: "107",
    revision: "0",
    status_code: ENABLE.status.SUCCESS
}
Since:
  • 1.0.0
Returns:
Name Type Description
object Object
Name Type Description
board_version String Hardware board version
model String Hardware model
revision String Hardware boot revision
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR

staticENABLE.system.getINIValue(key){Object}

system.js, line 169

Gets the INI value indicated by the specified key.

Name Type Description
key String

INI key

Since:
  • 1.0.0
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR or
ENABLE.status.INVALID_ARGUMENT
result String value

staticENABLE.system.getLastBootReason(){Object}

system.js, line 540

Returns system last boot reason.

Since:
  • 1.0.0
Returns:
Name Type Description
object Object
Name Type Description
result String System last boot reason, can be one of the following:
ENABLE.system.REASON_WARM_BOOT or
ENABLE.system.REASON_COLD_BOOT or
ENABLE.system.REASON_UPGRADE or
ENABLE.system.REASON_FACTORY_RESET
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR

staticENABLE.system.getMute(){Object}

system.js, line 103

Retrieves the current mute status of STB.

Since:
  • 1.0.0
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR
result Boolean mute status, true if muted, false if unmuted

staticENABLE.system.getPrimaryMacAddress(){Object}

system.js, line 61

Retrieves Primary MAC address of STB in the format "00:03:E6:01:02:03".

Since:
  • 1.0.0
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.NOT_READY
result String MAC address

staticENABLE.system.getProcessStatus(){Object}

system.js, line 423

Returns list of process with name pss (memory usage).
PSS: Proportion Set Size, the actual physical memory used, shared libraries, etc. are allocated proportionally.
PSS is similar to RSS, except the memory usage of shared libraries in PSS are calculated proportionally.
Sample output:

ENABLE.system.getProcessStatus();
{
    process_list: [
        {name: "com.aminocom.browser", total_pss: 80045056},
        {name: "system", total_pss: 95162368},
        {name: "com.aminocom.otaupdater", total_pss: 8085504}
        {name: "com.aminocom.terminal", total_pss: 44306432},
        {name: "com.android.systemui", total_pss: 27515904}
    ],
    status_code: ENABLE.status.SUCCESS
}
Since:
  • 1.0.0
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR
process_list Array.<Object> List of currently running processes
Name Type Description
name String Name of the process
total_pps Number Total PSS in bytes of the process

staticENABLE.system.getProductName(){Object}

system.js, line 89

Gets product name of STB.

Since:
  • 1.0.0
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR
result String Product name, e.g. H200

staticENABLE.system.getProductNumber(){Object}

system.js, line 75

Gets product number of STB.

Since:
  • 1.0.0
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR
result String Product number, e.g. 107 for H200

staticENABLE.system.getResourceStatus(){Object}

system.js, line 392

Returns device resource(CPU/storage) status.
Sample output:

ENABLE.system.getResourceStatus();
{
   "cpu_load_avg": 0.35940287275159805,
   "mem_total": 2085502976,
   "mem_available": 835780608,
   "space_total": 4363599872,
   "space_available": 4170665984,
   "storage": [
       {
           "description": "Internal shared storage",
           "is_emulated": true,
           "is_removable": false,
           "space_total": 4363599872,
           "space_available": 3952485991
       },
       {
           "description": "USB drive",
           "is_emulated": false,
           "is_removable": true,
           "space_total": 15836889088,
           "space_available": 5322588160
       }
   ],
   "status_code": ENABLE.status.SUCCESS
}
Since:
  • 1.4.0
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR
cpu_load_avg Number CPU Load Average ranging from 0 to 1, where 0 means totally idle and 1 means CPU is busy all the time
mem_total Number Total RAM in bytes
mem_available Number Available RAM in bytes
space_total Number Total space for user data (under /data directory) in bytes
space_available Number Available space for user data (under /data directory) in bytes
storage Array.<Object> A list of mounted storage devices
Name Type Description
description String The description of storage device
uuid String | undefined The UUID of storage device
is_emulated boolean true if it is an Android Emulated Storage (e.g. Internal shared storage)
is_removable boolean true if it is a removable device (e.g. USB)
description boolean The description of storage device
space_total Number The total storage size in bytes
space_available Number The available storage size in bytes

staticENABLE.system.getScreenSaverTimeout(){String}

system.js, line 594

Retrieves the screen saver timeout.

Since:
  • 1.4.0
Returns:
Name Type Description
object.result String The timeout value in seconds.
object.status_code String ENABLE.status.SUCCESS

staticENABLE.system.getSerialNumber(){Object}

system.js, line 32

Gets serial number of STB.

Since:
  • 1.0.0
See:
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR
result String Serial number, e.g. 7260001

staticENABLE.system.getSoftwareVersion(){Object}

system.js, line 337

Returns software version of STB as a string.

Since:
  • 1.0.0
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR
result String Software version

staticENABLE.system.getStandbyStatus(){Object}

system.js, line 324

Returns true if the device is in an interactive state.

Since:
  • 1.0.0
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR
current_status String active - the device is awake and ready to interact with the user or,
standby - the device is dozing or asleep and must be awoken before it will become ready to interact with the user again.
selected_mode String ENABLE.system.PWR_MODE_S0_STBY or
ENABLE.system.PWR_MODE_S2_STBY

staticENABLE.system.getTvSystem(){Object}

system.js, line 657

Get TV system of this device.

Since:
  • 1.4.0
Returns:
Name Type Description
object Object
Name Type Description
result String Broadcast television systems of this device, can be one of the following:
ENABLE.system.tv_system.PAL or ENABLE.system.tv_system.NTSC
status_code String ENABLE.status.SUCCESS

staticENABLE.system.getVolume(){Object}

system.js, line 136

Gets current system volume of STB

Since:
  • 1.0.0
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR
result Number volume index (0 to 15)

staticENABLE.system.isScreenSaverActivate(){boolean}

system.js, line 607

Checks if the screen saver is activated.

Since:
  • 1.4.0
Returns:
Name Type Description
object.result boolean true if the screen is activated, otherwise false
object.status_code String ENABLE.status.SUCCESS

staticENABLE.system.reboot(){Object}

system.js, line 257

Reboot the STB. Will not return if the reboot is successful.

Since:
  • 1.0.0
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.ERROR

staticENABLE.system.setDeviceName(device_name){Object}

system.js, line 638

Configure the device with a custom name.

Name Type Description
device_name String

The custom name to set for the device. Must not be empty or contain only spaces.

Since:
  • 1.4.0
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.INVALID_ARGUMENT

staticENABLE.system.setEventCallback(callback){Object}

system.js, line 233

Register system callback function for JavaScript application.
Only one callback function can be registered. Pass null to unregister.
Example:

var callback = function(obj) {
    if (obj.event === ENABLE.system.APP_RESUME){
        console.log("User came back from android system");
    }
};
ENABLE.system.setEventCallback(callback);
Name Type Description
callback ENABLE.system#Callback

Callback function will be involved when events arrived.

Since:
  • 1.0.0
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.INVALID_ARGUMENT

staticENABLE.system.setMute(is_mute){Object}

system.js, line 118

Sets mute status of STB.

Name Type Default Description
is_mute Boolean true optional

mute status

Since:
  • 1.0.0
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR or
ENABLE.status.INVALID_ARGUMENT

staticENABLE.system.setScreenSaverTimeout(timeout){String}

system.js, line 577

Sets the screen saver timeout.

Name Type Description
timeout number

The timeout value in seconds.
timeout with value 0 to turn off the screen saver. To turn on the screen saver, it accepts value between the range 10 to 2147483.

Since:
  • 1.4.0
Returns:
Type Description
String object.status_code ENABLE.status.SUCCESS or
ENABLE.status.INVALID_ARGUMENT

staticENABLE.system.setVolume(volume){Object}

system.js, line 151

Sets current system volume of STB

Name Type Description
volume Number

volume index (0 to 15)

Since:
  • 1.0.0
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR or
ENABLE.status.INVALID_ARGUMENT

staticENABLE.system.standby(config){Object}

system.js, line 288

Forces the device to go to sleep.
This is what happens when the power key is pressed to turn off the screen.
Sample code calling ENABLE.system.standby:

var config = { "keep_playback_status": true };
ENABLE.system.standby(config);
Name Type Description
config Object

Configuration.

Name Type Description
keep_playback_status boolean

Default true. Will re-open the last stream and seek to last position for non live stream. false to do nothing.

Since:
  • 1.0.0
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS

staticENABLE.system.wakeUp(){Object}

system.js, line 308

Forces the device to wake up from sleep.
If the device is currently asleep, wakes it up, otherwise does nothing.
This is what happens when the power key is pressed to turn on the screen.

Since:
  • 1.0.0
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS

Type Definitions

Callback(object)

system.js, line 205

Callback function for ENABLE.system.setEventCallback

Name Type Description
object Object
Name Type Description
event Object

Possible values of event:
ENABLE.system.APP_RESUME
ENABLE.system.APP_PAUSE
ENABLE.system.APP_STOP