1.0.1 ENABLE.network
Namespace: network
Namespaces
- nic_type
Members
-
static,constant ENABLE.network.NETWORK_INTERFACE_CHANGED String
-
Network interface changed
- Since:
-
- 1.0.0
-
static,constant ENABLE.network.NETWORK_IP_CHANGED String
-
STB IP changed
- Since:
-
- 1.0.0
-
static,constant ENABLE.network.NETWORK_LINK_STATUS_DOWN String
-
Network Link Status Down
- Since:
-
- 1.0.0
-
static,constant ENABLE.network.NETWORK_LINK_STATUS_UP String
-
Network Link Status Up
- Since:
-
- 1.0.0
-
static,constant ENABLE.network.NETWORK_READY String
-
Network Ready
- Since:
-
- 1.0.0
-
static,constant ENABLE.network.TYPE_DHCP String
-
Network IP type: DHCP
- Since:
-
- 1.0.0
-
static,constant ENABLE.network.TYPE_STATIC String
-
Network IP type: static
- Since:
-
- 1.0.0
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- 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.NOT_READY
object
Object object
will also have following members Ifobject.status_code
isENABLE.status.SUCCESS
Name Type Description nic_name
String Name of NIC ip_type
String ENABLE.network.TYPE_STATIC
orENABLE.network.TYPE_DHCP
ip_address
String IPv4 / IPv6 address, e.g. "10.0.35.106" or "2403:4a00:4001:15:45b7:8109:cf41:44b6" prefix_length
Number Prefix length of IPv4 / IPv6 address ip_address_v6_list
Array.<Object> List of IPv6 Addresses Name Type Description ip_address
String IPv6 address prefix_length
Number Prefix length of IPv6 address flag_permanent
boolean Permanent address, true
for indicating the address is permanent.false
for indicating dynamic address (stateless address)flag_temporary
boolean Temporary address, true
for indicating the address is temporary. Temporary address is a randomly generated 64-bit number as the interface ID instead of an interface's MAC address. You can use temporary addresses for any interface on an IPv6 node that you want to keep anonymous.scope
String The scope of the area where this address is valid.
global
- the address is globally valid.
site
- the address is site local.
link
- the address is link local.
host
- the address is valid only inside this host.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 IPv4 Network mask of STB, e.g. "255.255.255.0", return empty string for IPv6 address -
static ENABLE.network.getInterfaceInfo () {Object}
-
Retrieves the defails of network interface.
- Since:
-
- 1.0.0
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 ofENABLE.network.getConnectionInfo
-
ip_type will become
ENABLE.network.TYPE_DHCP
- 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
-
ip_type will become
-
static ENABLE.network.setEventCallback (callback) {Object}
-
Register network callback function for JavaScript application.
Only one callback function can be registered. Passnull
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.
- Since:
-
- 1.0.0
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 ofENABLE.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
- 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
-
ip_type will become
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
- Since:
-
- 1.0.0