Namespace: network

ENABLE. network

Namespaces

eap_status
nic_type
wifi_security_type

Members

static,constantENABLE.network.ETHERNET_AUTHENTICATION_FAILEDString

IEEE 802.1X Ethernet authentication failed. This event is only sent when the device has been configured to use IEEE 802.1X authentication.

Since:
  • 1.3.0

static,constantENABLE.network.ETHERNET_AUTHENTICATION_SUCCESSString

IEEE 802.1X Ethernet authentication success. This event is only sent when the device has been configured to use IEEE 802.1X authentication.

Since:
  • 1.3.0

static,constantENABLE.network.ETHERNET_CONNECT_SUCCESSString

IEEE 802.1X connection was successful

Since:
  • 1.3.0

static,constantENABLE.network.NETWORK_INTERFACE_CHANGEDString

Network interface changed

Since:
  • 1.0.0

static,constantENABLE.network.NETWORK_IP_CHANGEDString

STB IP changed

Since:
  • 1.0.0

Network Link Status Down

Since:
  • 1.0.0

Network Link Status Up

Since:
  • 1.0.0

static,constantENABLE.network.NETWORK_READYString

Network Ready

Since:
  • 1.0.0

static,constantENABLE.network.SCAN_FAILEDString

WiFi Scanning failed

Since:
  • 1.0.1

static,constantENABLE.network.SCAN_RESULTS_AVAILABLEString

WiFi Scanning result is available

Since:
  • 1.0.1

static,constantENABLE.network.TYPE_DHCPString

Network IP type: DHCP

Since:
  • 1.0.0

static,constantENABLE.network.TYPE_STATICString

Network IP type: static

Since:
  • 1.0.0

static,constantENABLE.network.WIFI_CONNECT_FAILUREString

WiFi connection failed

Since:
  • 1.1.0

static,constantENABLE.network.WIFI_CONNECT_SUCCESSString

WiFi connection was successful

Since:
  • 1.1.0

Methods

staticENABLE.network.connectWifi(config){Object}

network.js, line 574

Connect to a WiFi network. Note that only one network interface is active at a time, and Ethernet has priority over WiFi.
If Ethernet is currently active, the switch to WiFi will only occur once Ethernet is disconnected.
If Ethernet is connected when this method is called, the WiFi connection will be stored but will not become active until the Ethernet connection is lost.
Return ENABLE.status.ERROR if no wireless interface was found

Name Type Description
config Object
Name Type Description
ssid String

SSID of the WiFi network

password String

Password of the WiFi network

security String

Security protocol of the WiFi network, support for
ENABLE.network.wifi_security_type.NONE
ENABLE.network.wifi_security_type.WEP
ENABLE.network.wifi_security_type.WPA
ENABLE.network.wifi_security_type.WPA2
ENABLE.network.wifi_security_type.SAE
ENABLE.network.wifi_security_type.WPA_WPA2

Since:
  • 1.1.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.network.disconnect8021xNetwork(){Object}

network.js, line 696

Disconnect from the current connected/connecting 802.1X network

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

staticENABLE.network.forgetWifi(network_id){Object}

network.js, line 599

Forget a WiFi network that connected previously.
network_id is returned from ENABLE.network.getConfiguredWifiNetworks

Name Type Description
network_id Number

Network Id of the WiFi network

Since:
  • 1.1.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.network.getConfiguredWifiNetworks(){Object}

network.js, line 620

Retrieves an array of the networks which this device previously connected to.

Since:
  • 1.1.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
network_id int Network Id of the WiFi network
ssid String SSID of the WiFi network
password String Password of the WiFi network
security String The security protocol supported by the WiFi network. ENABLE.network.wifi_security_type

staticENABLE.network.getConnectionInfo(custom_interface){Object}

network.js, line 392

Retrieves the details of the active network's configuration.
ENABLE.status.NOT_READY will be returned if there is no active network
Members other than status_code will be returned when ENABLE.status.SUCCESS

Name Type Description
custom_interface String optional

Optional, specify which network interface to query when multiple network interfaces are connected, i.e. WiFi and ethernet

Since:
  • 1.1.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
nic_name String Name of NIC
ip_type String ENABLE.network.TYPE_STATIC or ENABLE.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
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.
network_id int Available when connected to wireless interface. Network Id of the WiFi network.
ssid String Available when connected to wireless interface. SSID of the WiFi network.
signal_level int Available when connected to wireless interface. The detected signal level in -dBm, also known as the RSSI.
security String Available when connected to wireless interface. The security protocol supported by the WiFi network. See ENABLE.network.wifi_security_type.

staticENABLE.network.getEapStatus(){Object}

network.js, line 682

Retrieves the current EAP (Extensible Authentication Protocol) status for each network interface.

EAP is used within 802.1X frameworks for network access control, providing a secure method for
authenticating network devices. This function checks the authentication status of each network
interface that could be involved in such authentication processes.

Since:
  • 1.3.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
iface String Interface name (e.g., 'wlan0', 'eth0').
status String The EAP authentication status. ENABLE.network.eap_status

staticENABLE.network.getInterfaceInfo(){Object}

network.js, line 346

Retrieves details for all network interfaces on the device.
This function returns an array containing the configuration details of each network interface (NIC) present on the device.

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, ENABLE.network.nic_type.ETHERNET or ENABLE.network.nic_type.WIFI
mac_address String Mac address of the NIC
link_up Boolean true if NIC is up
linking Boolean deprecated, use link_up instead

staticENABLE.network.getLastScanResult(){Object}

network.js, line 502

Retrieves the latest Wi-Fi network scanning results.

  • This function does not trigger a new Wi-Fi scan.
  • If no scan has been performed previously, it will return an empty array with status_code ENABLE.status.SUCCESS.
Since:
  • 1.1.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
ssid String SSID of the WiFi network
signal_level int The detected signal level in -dBm, also known as the RSSI.
frequency String The center frequency (Mhz) of the channel over which the client is communicating with the WiFi network.
bssid String Mac address of the WiFi network
security String The security protocol supported by the WiFi network. ENABLE.network.wifi_security_type

staticENABLE.network.getOfflineMode(){Object}

network.js, line 715

Retrieves the current status of offline mode. Offline mode dictates:

  • Whether the UI waits for a network connection during system boot.
  • If network settings should be launched automatically when the connection is lost.

This function returns the value set in the INI configuration file under net.offline_mode.

Since:
  • 1.4.0
Deprecated
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR
result boolean true if the offline mode is enabled, false otherwise.

staticENABLE.network.isOfflineModeEnabled(){Object}

network.js, line 733

Retrieves the current status of offline mode. Offline mode dictates:

  • Whether the UI waits for a network connection during system boot.
  • If network settings should be launched automatically when the connection is lost.

This function returns the value set in the INI configuration file under net.offline_mode.

Since:
  • 1.7.0
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR
result boolean true if the offline mode is enabled, false otherwise.

staticENABLE.network.isWifiEnabled(){Object}

network.js, line 546

Retrieves the current state of Wi-Fi functionality on the device.

This function checks whether Wi-Fi is enabled, disabled, in the process of being enabled, or in the process of being disabled.

  • Enabling: Wi-Fi is in the process of turning on. This might occur
    when the system has received a command to enable Wi-Fi but the hardware
    has not yet fully activated.
  • Disabling: Wi-Fi is in the process of turning off. This state indicates
    that the system is in the midst of deactivating Wi-Fi functionality.
Since:
  • 1.1.0
Returns:
Name Type Description
object Object
Name Type Description
status_code String ENABLE.status.SUCCESS or
ENABLE.status.ERROR
result boolean true if it is enabled or enabling, false if it is disabled or disabling

staticENABLE.network.remove8021xSecurityConfig(){Object}

network.js, line 662

Deletes the stored IEEE 802.1X Ethernet connection configuration from the device.

This operation will not immediately disconnect the device from the currently connected network.

  • The current session will remain active until the device is rebooted or there's an Ethernet hot plug event.
    To terminate the current network connection, use ENABLE.network.disconnect8021xNetwork.

This function is particularly useful for scenarios requiring temporary connections to EAP networks.

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

staticENABLE.network.set8021xSecurityConfig(config){Object}

network.js, line 642

Establishes a network connection using IEEE 802.1X Ethernet with the provided config.

  • Upon successful authentication, the configuration is automatically saved to the device.
  • Each subsequent call to this function will overwrite any previously stored configuration with the new config.
  • Persistent Connection: The device will automatically connect to the network upon booting up, following a reboot, or upon an Ethernet hot plug event, ensuring seamless connectivity without manual reconfiguration.
  • For temporary connections to EAP networks that should not persist after a reboot or hot plug, call ENABLE.network.remove8021xSecurityConfig after connecting.
Name Type Description
config Object
Name Type Description
identity String

The identity used for IEEE 802.1X connection

password String

The password used for IEEE 802.1X connection

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

staticENABLE.network.setDhcpConfig(custom_interface){Object}

network.js, line 417

Configures the specified network interface to use DHCP for obtaining an IP address.
If no interface name is provided, it attempts to set DHCP on current active interface.
ip_type in result of ENABLE.network.getConnectionInfo will become ENABLE.network.TYPE_DHCP

Name Type Description
custom_interface String optional

Optional The name of the network interface (e.g., "eth0", "wlan0"). If omitted, DHCP will be set on the current active interface.

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

staticENABLE.network.setEventCallback(callback){Object}

network.js, line 323

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

Reference to the callback function which will be called when a network event is received.

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.network.setOfflineMode(enable){Object}

network.js, line 754
  • Sets the offline mode status. This setting influences:
  • Whether the UI waits for a network connection during system boot.
  • If network settings should be launched automatically when the connection is lost.

Important Note: Calling this API takes effect only when net.offline_mode is not set in the INI configuration.
Otherwise, the preference is stored and will be applied once net.offline_mode is removed.

Name Type Description
enable Boolean

set to true in order to enable offline mode, or false to disable.

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

staticENABLE.network.setStaticConfig(config, custom_interface){Object}

network.js, line 453

Use specified connection config on current network interface

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

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

Network address prefix length

gateway String

IPv4 address of the gateway

dns_servers Array.<String>

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

custom_interface String optional

Optional, the name of the network interface (e.g., "eth0", "wlan0"). If omitted, config will be applied to current active interface.

Since:
  • 1.1.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.network.setWifiEnabled(enabled){Object}

network.js, line 519

Switch on/off Wifi
Return ENABLE.status.ERROR if no wireless interface was found

Name Type Description
enabled boolean

true to enable Wifi, false to disable

Since:
  • 1.1.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.network.wifiScan(){Object}

network.js, line 478

Scan Wifi once.
When the scan completes the registered callback function is called with the event ENABLE.network.SCAN_RESULTS_AVAILABLE. Detail of the results following the scan can be retrieved by calling ENABLE.network.getLastScanResult.
If no wireless NIC is found, ENABLE.status.ERROR will be returned.

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

Type Definitions

Callback(object)

network.js, line 284

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
ENABLE.network.SCAN_RESULTS_AVAILABLE
ENABLE.network.SCAN_FAILED
ENABLE.network.WIFI_CONNECT_SUCCESS
ENABLE.network.ETHERNET_CONNECT_SUCCESS
ENABLE.network.WIFI_CONNECT_FAILURE
ENABLE.network.ETHERNET_AUTHENTICATION_REQUEST @since 1.3.0
ENABLE.network.ETHERNET_AUTHENTICATION_SUCCESS @since 1.3.0
ENABLE.network.ETHERNET_AUTHENTICATION_FAILED @since 1.3.0

Since:
  • 1.1.0