25.3.2231.6R ENABLE.network

Namespaces

nic_type

Members

static,constant ENABLE.network.NETWORK_INTERFACE_CHANGED String

Network interface changed

static,constant ENABLE.network.NETWORK_IP_CHANGED String

STB IP changed

Network Link Status Down

Network Link Status Up

static,constant ENABLE.network.NETWORK_READY String

Network Ready

static,constant ENABLE.network.TYPE_DHCP String

Network IP type: DHCP

static,constant ENABLE.network.TYPE_STATIC String

Network IP type: static

Methods

static ENABLE.network.getConnectionInfo () {Object}

Retrieves the defails of network configuration of the active network
ENABLE.status.NOT_READY will be return if there is no active network

Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR or
ENABLE.status.NOT_READY
object Object object will also have following members If object.status_code is ENABLE.status.SUCCESS
Name Type Description
nic_name String Name of NIC
ip_type String ENABLE.network.TYPE_STATIC or ENABLE.network.TYPE_DHCP
ip_address String IP address, e.g. "10.0.35.106"
prefix_length Number Prefix length of IP address
gateway String IP address of default gateway's
dns_servers Array.<String> List of DNS's IP address
bandwidth Number Downstream bandwidth in Kbps
netmask String Network mask of STB, e.g. "255.255.255.0"

static ENABLE.network.getInterfaceInfo () {Object}

Retrieves the defails of network interface.

Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR
result Array.<Object> Array of object with following members:
Name Type Description
nic_name String Name of NIC
nic_type String Type of NIC, ETHERNET or WIFI
mac_address String Mac address of the NIC
linking Boolean true if NIC is up

static ENABLE.network.setDhcpConfig () {Object}

Use connection config from DHCP server on current network interface

Calling ENABLE.network.setStaticConfig will update result of ENABLE.network.getConnectionInfo

  • ip_type will become ENABLE.network.TYPE_DHCP
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR or
ENABLE.status.INVALID_ARGUMENT

static ENABLE.network.setEventCallback (callback) {Object}

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

let callback = function(obj) {
    if (obj.event === ENABLE.network.NETWORK_READY) {
        console.log("A network interface is ready to use");
    }
};
ENABLE.network.setEventCallback(callback);
Name Type Description
callback ENABLE.network#Callback

Callback function will be involved when events arrived.

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

static ENABLE.network.setStaticConfig (config) {Object}

Use specified connection config on current network interface

Calling ENABLE.network.setStaticConfig will update result of ENABLE.network.getConnectionInfo

  • ip_type will become ENABLE.network.TYPE_STATIC

Remarks:
IPv4 address will be expected in format "192.168.1.2"

Sample code calling ENABLE.network.setStaticConfig :

var config = {
    "ip_address": "10.0.35.219",
    "prefix_length": 22,
    "gateway": "10.0.32.6",
    "dns_servers": [ "192.169.1.22" ]
};
ENABLE.network.setStaticConfig(config);
Name Type Description
config Object
Name Type Description
ip_address String

IPv4 address of the STB

prefix_length Number

Prefix length of ip_address

gateway String

IPv4 address of the gateway

dns_servers Array.<String>

List of IPv4 address of DNS, expected 1 to 2 address

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

Type Definitions

Callback (object)

Callback function for ENABLE.network.setEventCallback

Name Type Description
object Object
Name Type Description
event Object

Possible values of event:
ENABLE.network.NETWORK_IP_CHANGED
ENABLE.network.NETWORK_INTERFACE_CHANGED
ENABLE.network.NETWORK_LINK_STATUS_UP
ENABLE.network.NETWORK_LINK_STATUS_DOWN
ENABLE.network.NETWORK_READY