Method Summary
|
applySettings
(
|
Apply the provided settings. |
| getConnectedAccessPointInfo ( ) → apInfo |
Returns the currently connected access point. |
| getNetworkInfo ( ) → networkInfo | Returns the current network info. |
| getSettings ( ) → settings |
Returns the network settings. |
|
scanWifi
(
|
This asynchronous method is used to scan for available APs. |
Inherited Methods
|
addEventListener
(
|
This method registers an event listener for a specific event. Multiple listeners can be added for the same event. Events are broadcast to all registered listeners. |
|
removeEventListener
(
|
This method removes an event listener for a specific event. |
Type Definitions
|
The IP address acquisition method. |
|
|
Specifies the address scope where this network's IP address is valid. |
|
|
Specifies the availability of a particular feature for a device. |
|
|
Specifies whether the device can handle full- or half-duplex mode. |
|
|
Specifies the IP version. |
|
|
DNS name server IP address. |
|
|
|
|
|
Desired domain search path. |
|
|
|
|
|
Specifies the network state. |
|
|
WiFi authentication types. |
|
|
Wi-Fi radio band. |
|
|
WiFi encryption methods. |
|
|
WiFi events. |
|
|
WiFi modes. |
|
Methods
This method registers an event listener for a specific event. Multiple listeners can be added for the same event. Events are broadcast to all registered listeners.
Inherited From:
Parameters:
-
Name Type Description typenumber The event type of the event to subscribe to.
listenerToiEventListener The JavaScript function that will receive events.
Throws:
-
ToiInvalidArgumentException Raised if the event type is not supported by this object or if the listener is not a valid JavaScript function. This exception is also raised if the application calls addEventListener with the same combination of type and listener twice.
This function will apply the provided network settings. It is possible to omit optional properties in which case those settings will remain unchanged. This method may fail and throw an exception if the provided settings does not lie within the network's capabilities. Besides this the function will always succeed. Waiting for the asynchonous callback does not guarantee that any settings have been applied.
Note that a network's settings are applied in many other places besides calls to this function, for example when the box is booting or when link status changes. Because of this the network's state is the only safe way to detect failures to apply the settings since it may depend on external factors.
Parameters:
-
Name Type Description callbacksAsyncCallback Object with callback functions for the asynchronous operation. No result is produced by this method, so callbacks.onResult() will not be invoked..
settingsToiNetwork.ToiSettings A set of network settings to apply.
Throws:
-
ToiInvalidArgumentException Raised if an invalid operation identifier passed or if the provided settings does not lie within the network's capabilities.
Returns:
-
Type: ToiAsynchronousOperation
operation The asynchronous operation created by the function.
Returns the currently connected access point.
Throws:
-
ToiInvalidPreconditionException Raised if the WiFi interface is not enabled or if WiFi device is not up.
Returns:
-
Type: ToiNetwork.ToiWifiAccessPointInfo
Access point information.
This function will return the current status of the network.
Returns:
-
Type: ToiNetwork.ToiInformation
The current network info.
Returns the network settings.
Returns:
-
Type: ToiNetwork.ToiSettings
The current network settings for this network.
This method removes an event listener for a specific event.
Inherited From:
Parameters:
-
Name Type Description typenumber The event type of the event to remove the listener from.
listenerToiEventListener The JavaScript function that was previously added as an event listener.
Throws:
-
ToiInvalidArgumentException Raised if the event type is not supported by this object or if the listener is not a valid JavaScript function. This exception is also raised if the listener has not previously been added.
This asynchronous method is used to scan for available APs.
Parameters:
-
Name Type Description callbacksAsyncCallback Object with callback functions for the asynchronous operation. callbacks.onResult() will be invoked with a parameter of type Array.<ToiNetwork.ToiWifiAccessPointInfo> when the operation completes.
ssidstring The network name to scan for. In case of an empty string all APs will be passively scanned. Otherwise the STB will perform an active scan using the supplied SSID. This is useful when the AP isn't broadcasting the SSID.
Throws:
-
ToiInvalidArgumentException Raised if an invalid operation identifier passed.
ToiBusyException Raised if a scan already in progress.
ToiInvalidPreconditionException Raised if the WiFi interface is not enabled or if WiFi device is not up.
Returns:
-
Type: ToiAsynchronousOperation
operation The asynchronous operation created by the function.
Members
This is an Event identifier for ToiNetworkNetworkInfoChangedEvent.
Called when the network's info changes.
This is an Event identifier for ToiNetworkWifiChangedEvent.
Called when something happens to the wifi network.
Acquires both IPv4 and IPv6 addresses via DHCP.
Acquires only IPv4 address via DHCP.
Acquires only IPv6 address via DHCP.
Disables any automatic address acquisition and instead uses static settings.
The address is globally valid.
The address is only valid on this host.
The address is only valid for use on the local network.
(IPV6 only) The address is only valid for use on this site. (Deprecated in rfc4291, should be treated as global).
Indicates whether the auto negotiate enabled.
Indicates whether the flow control enabled.
Indicates whether the jumbo packet enabled.
Indicates whether the WOL feature is enabled.
Specifies full duplex mode.
Specifies half duplex mode.
Specifies that the duplex mode is unknown.
The interface is of ethernet type.
The interface is of WiFi type.
IP version 4, implies the InterNetwork address family.
IP version 6, implies the InterNetwork6 address family.
The network is not available. For Ethernet, it could be that the cable is disconnected or the link is down. For WiFi, it could be disconnected and there is no credential stored.
The network failed. This may happen when no access point is found or no DHCP server is found for dynamic configuration.
The network has been successfully configured and is ready to use.
The network is active and is waiting for dynamic configuration or is currently connecting to a WiFi access point.
Designates the open authentication method.
Designates the shared authentication method. Deprecated in 802.11-2012 and should only be used for backward compatibility.
Designates an unsupported authentication method.
Designates WPA2 authentication with a pre-shared key. Can be combined with ToiNetwork.WIFI_ENCRYPTION_TYPE_TKIP or ToiNetwork.WIFI_ENCRYPTION_TYPE_AES_CCMP.
Designates WPA authentication with a pre-shared key. Can be combined with ToiNetwork.WIFI_ENCRYPTION_TYPE_TKIP or ToiNetwork.WIFI_ENCRYPTION_TYPE_AES_CCMP.
Designates WPS authentication. Encryption type is ignored with this type of authentication.
Designates the 2.4 GHz band.
Designates the 5 GHz band.
Wi-Fi link to the AP is established.
Wi-Fi adapter is connecting to the AP.
Wi-Fi link is lost.
Designates AES CCMP style encryption.
Encryption not used.
Designates TKIP style encryption.
Designates an unsupported encryption method.
Designates WEP style encryption. Only available together with ToiNetwork.WIFI_AUTHENTICATION_TYPE_SHARED.
Wi-Fi connect failed, bad authentication.
Wi-Fi connect failed, AP unavailable.
Wi-Fi connect failed due to internal error.
Wi-Fi connect failed, time out.
Wi-Fi connect failed, several APs with WPS active at the same time.
802.11A
802.11AC
802.11B
802.11G
802.11N
Automatic choice of mode.
Wi-Fi adapter has finished handshake operation.
Wi-Fi adapter is in pairing mode.
Wi-Fi adapter has finished scan operation.
Specifies a network's capabilities.
Struct fields
| Name | Description |
|---|---|
| hasIpv6 | IPv6 support. Type: boolean |
| hasWifi | Indicates if the network has access to a Wi-Fi enabled device. Type: boolean |
| isConfigurable | A configurable network allows changes to its settings. Type: boolean |
| isIpRequired | Indicates that at least one IP address is required, static or dynamic. Address acquisition set to none and no static IP addresses are not allowed. Type: boolean |
| maxAddressEntries | Maximum number of IP address entries. Type: number |
| maxDnsEntries | Maximum number of DNS entries. Type: number |
| maxRouteEntries | Maximum number of route entries (i.e. default gateways). Type: number |
Specifies DHCP related information about a network.
Struct fields
| Name | Description |
|---|---|
| leaseRemainingTime | Remaining time in seconds of the IP address lease. Type: number |
| leaseTime | IP address lease time in seconds. Type: number |
| renewalAttemptCount | Number of renewal attempts. Type: number |
| renewalSuccessCount | Number of successful renewal attempts. Type: number |
| serverIpAddress
[optional] |
IP address of DHCP server. Type: string |
Specifies static DNS info for a network.
Struct fields
| Name | Description |
|---|---|
| nameServers | A list of DNS name server IP addresses (strings). This can be both IPv4 and IPv6 addresses. Type: Array.<ToiNetwork.ToiNameServer> |
| searchPaths | A list of DNS search paths (strings). Note that search paths settings are not persistent across reboots. Type: Array.<ToiNetwork.ToiSearchPath> |
Describes the current status of the network.
Struct fields
| Name | Description |
|---|---|
| capabilities | Specifies the network's capabilities. This determines if and how the network can be configured and used. Type: ToiNetwork.ToiCapabilities |
| dnsInfo | The current dns info. Type: ToiNetwork.ToiDnsInfo |
| interfaceInfo | The current interface info, such as IP address, statistics and more. Type: ToiNetwork.ToiInterfaceInfo |
| routes | The network's routes. Type: Array.<ToiNetwork.ToiRoute> |
| state | The current network state indicating if the network is ready to be used or not. Type: ToiNetwork.ToiState |
Struct fields
| Name | Description |
|---|---|
| duplexMode | Specifies the duplex mode used by the device. Type: ToiNetwork.ToiDuplexMode |
| features | A bit mask defined in ToiNetwork.ToiDeviceFeature specifying which features are available on the device. Type: number |
| hasLink | Indicates whether or not the interface has link. Type: boolean |
| ipAddresses | IP addresses associated with this interface. Type: Array.<ToiNetwork.ToiIpAddressInfo> |
| linkSpeed | The negotiated link speed in MBit/s. Type: number |
| mac | The hardware address (MAC). Type: string |
| name | The interface's name. Type: string |
| statistics | The interface statistics. Type: ToiNetwork.ToiInterfaceStatistics |
| type | The interface type, ethernet or WiFi. Type: ToiNetwork.ToiInterfaceType |
| wifiInfo
[optional] |
Wi-Fi specific interface information. Type: ToiNetwork.ToiInterfaceWifiInfo |
Network interface statistics.
Struct fields
| Name | Description |
|---|---|
| broadcastPacketsReceived | The total number of broadcast packets received on the device (IPv4 only). Type: number |
| broadcastPacketsSent | The total number of broadcast packets transmitted out of the device (IPv4 only). Type: number |
| bytesReceived | The total number of bytes received on the device. Type: number |
| bytesSent | The total number of bytes transmitted out of the device. Type: number |
| connectivityLossCount | The count of phy layer loss since last reboot. Type: number |
| discardPacketsReceived | The total number of unicast packets received on the device. Type: number |
| discardPacketsSent | The total number of discard packets transmitted out of the device. Type: number |
| errorsReceived | The total number of packets that could not be received on the device by the higher-layer protocol, because of errors. Type: number |
| errorsSent | The total number of packets that could not be transmitted out of the device, because of errors. Type: number |
| multicastPacketsReceived | The total number of multicast packets received on the device. Type: number |
| multicastPacketsSent | The total number of multicast packets transmitted out of the device. Type: number |
| packetsReceived | The total number of packets received on the device. Type: number |
| packetsSent | The total number of packets transmitted out of the device. Type: number |
| unicastPacketsReceived | The total number of unicast packets received on the device. Type: number |
| unicastPacketsSent | The total number of unicast packets transmitted out of the device. Type: number |
| unknownProtoPacketsReceived | The total number of packets received on the device which are discarded because of an unknown or unsupported protocol. Type: number |
Struct fields
| Name | Description |
|---|---|
| channelBandwidth | Max Channel bandwidth Type: number |
| regulatoryDomain | The regulatory domain used by the interface. Type: string |
| wifiStatistics | Wi-Fi related interface statistics. Type: ToiNetwork.ToiInterfaceWifiStatistics |
Struct fields
| Name | Description |
|---|---|
| measuredRate | Measured bit rate at the WiFi interface in Mb/s. Type: number |
| retransmissionCount | Number of retransmissions. Not necessarily the same as the number of dropped packets which is an IP metric. Type: number |
| signalNoiseRatio | Signal-to-noise ratio in tenths of a dB, i.e. the value 251 means 25.1 dB. When the receiver does not have channel lock this value is -1. Type: number |
Describes an IP network address used for a network's static IP settings.
Struct fields
| Name | Description |
|---|---|
| ipAddress | An IPv4 or IPv6 address (not including netmask/routing prefix). Type: string |
| label
[optional] |
An address label used to identify the address. This label will be appended to the real interface address label after the interface's name. Type: string |
| netmask | A netmask to use for subnetting. Can be specified using either the dot-decimal or CIDR notation (ie. 255.255.255.0 or /24). Type: string |
Specifies an IP address. This can be an IP assigned by a DHCP server in which case the DHCP client status can be retrieved from this structure.
Struct fields
| Name | Description |
|---|---|
| addressScope | The address scope of the address of this network. This controls where this address is valid. Type: ToiNetwork.ToiAddressScope |
| dhcpInfo
[optional] |
The current status of the DHCP client. If this IP was not acquired by DHCP this value will be undefined. Type: ToiNetwork.ToiDhcpInfo |
| ipAddress | The IP address. Type: string |
| ipVersion | The IP address version. Type: ToiNetwork.ToiIpVersion |
| netmask | The netmask. Type: string |
This data type contains permanent network settings used to configure the underlying network interface and network related tables and tools.
Struct fields
| Name | Description |
|---|---|
| addressAcquisitionMethod
[optional] |
The acquisition method specifies how network addresses are acquired. They are usually acquired from a DHCP server which includes IP address, DNS paths and default gateway. Type: ToiNetwork.ToiAddressAcquisitionMethod |
| staticSettings
[optional] |
The network may contain static configuration, not obtained from a DHCP server. This includes static IP addresses, DNS and routing information such as default gateway. Note that static settings can be used together with DHCP. Type: ToiNetwork.ToiStaticSettings |
| wifiSettings
[optional] |
The WiFi settings property includes WiFi related settings only applicable for networks using a WiFi network interface adapter. Type: ToiNetwork.ToiWifiSettings |
This data type specifies all the available static settings for a network. Note that WiFi settings are only applicable for networks using a WiFi network interface.
Link local addresses are assigned automatically to interfaces and should not be provided manually.
Struct fields
| Name | Description |
|---|---|
| dnsInfo
[optional] |
Static DNS info to use for this network. Note that this is used in combination with any dns information obtained from a DHCP server. Also note that this setting is not persistent across reboots in this technical preview, this behavior may change in the future. Type: ToiNetwork.ToiDnsInfo |
| ipAddresses
[optional] |
Specifies a set of IP addresses to associate with the network's network interface. Usually only one address is required if DHCP is not used. Type: Array.<ToiNetwork.ToiIpAddress> |
| routes
[optional] |
Static routes for this network. Used to specify default gateways. Note that routes are not persistent across reboots in this technical preview, this behaviour may change in the future. Type: Array.<ToiNetwork.ToiRoute> |
Wi-Fi access point information.
Struct fields
| Name | Description |
|---|---|
| authentication | Authentication used by the AP. Type: ToiNetwork.ToiWifiAuthenticationType |
| band | The radio band used by this access point. Type: ToiNetwork.ToiWifiBand |
| bssid | The BSSID of the access point. Type: string |
| channel | The channel used by the access point. Type: number |
| encryption | Encryption used by the AP. Type: ToiNetwork.ToiWifiEncryptionType |
| isRcpiEnabled | Denotes if received channel power indicator (RCPI) measurements can be provided. Type: boolean |
| isRssiEnabled | Denotes if received signal strength indicator (RSSI) measurements can be provided. Type: boolean |
| isWpsEnabled | Denotes whether the AP can handle WPS. Type: boolean |
| mode | WiFi mode currently used by the AP. Type: ToiNetwork.ToiWifiMode |
| rcpi | RCPI. The value will range between -110 dBm to 0 dBm in increments of 0.5dBm. Type: double |
| rssi | RSSI. Note very carefully that this value is vendor specific. Type: double |
| ssid | The SSID of the access point. Type: string |
Wi-Fi settings. The network will automatically reconnect to the access point if these settings are changed.
Struct fields
| Name | Description |
|---|---|
| authenticationType | Authentication type to use when connecting to the AP. Type: ToiNetwork.ToiWifiAuthenticationType |
| bssid
[optional] |
The BSSID of the AP to connect to. Type: string |
| encryptionType
[optional] |
Encryption to use when connecting to the AP. This value can be omitted when using WPS. Type: ToiNetwork.ToiWifiEncryptionType |
| presharedKey
[optional] |
Preshared key to use when connecting to the AP. This value can be omitted when using WPS. Type: string |
| ssid
[optional] |
The SSID of the AP to connect to if BSSID is omitted. Note that multiple APs can have the same SSID in which case the AP with the best signal is chosen. Type: string |