Network API
To use Samsung Product API,
<script type="text/javascript" src="$WEBAPIS/webapis/webapis.js"></script>
Should be loaded in index.html
Since : 2.3
Product : TV, AV_BD
Privilege level: public
Privilege: http://developer.samsung.com/privilege/network.public
Summary of Interfaces and Methods
Interface | Method |
---|---|
NetworkManagerObject | |
NetworkManager |
DOMString getVersion () |
NetworkStateChangedCallback | void onchange (unsigned short state) |
NetworkIpMode | |
NetworkActiveConnectionType | |
NetworkState | |
NetworkWiFiSecurityMode | |
NetworkWiFiEncryptionType |
1. Interfaces
1.1. NetworkManagerObject
The webapis.network object enables access to Network API functionality.
[NoInterfaceObject]interface NetworkManagerObject {
readonly attribute NetworkManager network;
};
WebApi implements NetworkManagerObject;
Attributes
- readonly NetworkManager network
Network API namespace.
Since : 2.3
1.2. NetworkManager
[NoInterfaceObject]interface NetworkManager {
readonly attribute NetworkActiveConnectionType NetworkActiveConnectionType;
readonly attribute NetworkIpMode NetworkIpMode;
readonly attribute NetworkState NetworkState;
readonly attribute NetworkWiFiSecurityMode NetworkWiFiSecurityMode;
readonly attribute NetworkWiFiEncryptionType NetworkWiFiEncryptionType;
DOMString getVersion();
boolean isConnectedToGateway();
NetworkIpMode getIpMode();
DOMString getSubnetMask();
DOMString getGateway();
DOMString getMac();
DOMString getDns();
DOMString getIp();
NetworkActiveConnectionType getActiveConnectionType();
unsigned long addNetworkStateChangeListener(NetworkStateChangedCallback listener);
void removeNetworkStateChangeListener(unsigned long listenerId);
DOMString getWiFiSsid();
short getWiFiSignalStrengthLevel();
NetworkWiFiSecurityMode getWiFiSecurityMode();
NetworkWiFiEncryptionType getWiFiEncryptionType();
DOMString getSecondaryDns();
void setDhcpOption60Field(DOMString vendorName);
void removeDhcpOption60Field();
DOMString getCurrentDhcpOption60Field();
DOMString checkCurrentIpWith60Field();
};
Attributes
- readonly NetworkActiveConnectionType NetworkActiveConnectionType
NetworkActiveConnectionType interface-related constant
- readonly NetworkIpMode NetworkIpMode
NetworkIpMode interface-related constant
- readonly NetworkState NetworkState
NetworkState interface-related constant
- readonly NetworkWiFiSecurityMode NetworkWiFiSecurityMode
NetworkWiFiSecurityMode interface-related constant
- readonly NetworkWiFiEncryptionType NetworkWiFiEncryptionType
NetworkWiFiEncryptionType interface-related constant
Methods
getVersion
-
Retrieves the TV network module version.
DOMString getVersion>();
Since : 2.3
Product : TV, AV_BD
Privilege level: public
Privilege: http://developer.samsung.com/privilege/network.public
Return value:
DOMString Network plugin module versionExceptions:
- WebAPIException
-
with error type SecurityError, if the application does not have the privilege to call this method.
-
Code example:
var version = null; try { version = webapis.network.getVersion(); } catch (e) { console.log("getVersion exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null != version) { console.log("[getVersion] version: " + version); }
- WebAPIException
isConnectedToGateway
-
Checks whether the TV is connected to a network gateway.
boolean isConnectedToGateway();
Since : 2.3
Product : TV, AV_BD
Privilege level: public
Privilege: http://developer.samsung.com/privilege/network.public
Return value:
Boolean value:
true: Gateway connected
false: Gateway is not connectedExceptions:
- WebAPIException
-
with error type SecurityError, if the application does not have the privilege to call this method.
-
with error type InvalidStateError, if a network connection is not available. (Since plugin version 3.0)
-
Code example:
var gatewayStatus = null; try { gatewayStatus = webapis.network.isConnectedToGateway(); } catch (e) { console.error("isConnectedToGateway exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null != gatewayStatus { console.log("[isConnectedToGateway] gatewayStatus: " + gatewayStatus); }
- WebAPIException
getIpMode
-
Retrieves the TV's IP configuration mode.
unsigned short getIpMode();
Since : 2.3
Product : TV, AV_BD
Privilege level: public
Privilege: http://developer.samsung.com/privilege/network.public
Return value:
unsigned short Network IP mode
"NONE" : 0
"STATIC" : 1
"DYNAMIC" : 2
"AUTO" : 3
"FIXED" : 4
"UNKNOWN" : 5Exceptions:
- WebAPIException
-
with error type SecurityError, if the application does not have the privilege to call this method.
-
Code example:
var ipMode = null; var retVal = null; try { retVal = webapis.network.getIpMode(); } catch (e) { console.log("getIPMode exception [" + e.code + "] message: " + e.message); } if (null != retVal) { switch(retVal) { case webapis.network.NetworkIpMode.STATIC : ipMode = "STATIC"; break; case webapis.network.NetworkIpMode.DYNAMIC; ipMode = "DYNAMIC"; break; case webapis.network.NetworkIpMode.AUTO : ipMode = "AUTO"; break; case webapis.network.NetworkIpMode.FIXED : ipMode = "FIXED"; break; case webapis.network.NetworkIpMode.NONE : ipMode = "NONE"; break; case webapis.network.NetworkIpMode.UNKNOWN : ipMode = "UNKNOWN"; break; default: ipMode = "Error"; } console.log("[getIPMode] ipMode: " + ipMode); }
- WebAPIException
getSubnetMask
-
Retrieves the TV's configured subnet mask address.
DOMString getSubnetMask();
Since : 2.3
Product : TV, AV_BD
Privilege level: public
Privilege: http://developer.samsung.com/privilege/network.public
Return value:
DOMString Subnet mask address for the currently-configured network
Example: 255.255.255.0Exceptions:
- WebAPIException
-
with error type SecurityError, if the application does not have the privilege to call this method.
-
with error type InvalidStateError, if a network connection is not available. (Since plugin version 3.0)
-
Code example:
var netMask = null; try { netMask = webapis.network.getSubnetMask(); } catch (e) { console.log("getSubnetMask exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null != netMask) { console.log("[getSubnetMask] netMask: " + netMask); }
- WebAPIException
getGateway
-
Retrieves the TV's configured gateway address.
DOMString getGateway();
Since : 2.3
Product : TV, AV_BD
Privilege level: public
Privilege: http://developer.samsung.com/privilege/network.public
Return value:
DOMString Gateway address for the currently-configured network
Example: 192.168.0.1Exceptions:
- WebAPIException
-
with error type SecurityError, if the application does not have the privilege to call this method.
-
with error type InvalidStateError, if a network connection is not available. (Since plugin version 3.0)
-
Code example:
var gateway = null; try { gateway = webapis.network.getGateway(); } catch (e) { console.log("getGateway exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null != gateway) { console.log("[getGateway] gateway: " + gateway); }
- WebAPIException
getMac
-
Retrieves the network device's MAC address.
DOMString getMac();
Since : 2.3
Product : TV, AV_BD
Privilege level: public
Privilege: http://developer.samsung.com/privilege/network.public
Return value:
DOMString MAC address for the currently-configured network
Example: 50:B7:A3:C2:96:11Exceptions:
- WebAPIException
-
with error type SecurityError, if the application does not have the privilege to call this method.
-
with error type InvalidStateError, if a network connection is not available. (Since plugin version 3.0)
-
Code example:
var mac = null; try { mac = webapis.network.getMac(); } catch (e) { console.log("getMAC exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null != mac) { console.log("[getMAC] mac: " + mac); }
- WebAPIException
getDns
-
Retrieves the TV's configured DNS address.
DOMString getDns();
Since : 2.3
Product : TV, AV_BD
Privilege level: public
Privilege: http://developer.samsung.com/privilege/network.public
Return value:
DOMString DNS address for the currently-configured network
Example: 192.168.0.1Exceptions:
- WebAPIException
-
with error type SecurityError, if the application does not have the privilege to call this method.
-
with error type InvalidStateError, if a network connection is not available. (Since plugin version 3.0)
-
Code example:
var dns = null; try { dns = webapis.network.getDns(); } catch (e) { console.log("getDNS exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null != dns) { console.log("[getDNS] dns: " + dns); }
- WebAPIException
getIp
-
Retrieves the TV's configured IP address.
DOMString getIp();
Since : 2.3
Product : TV, AV_BD
Privilege level: public
Privilege: http://developer.samsung.com/privilege/network.public
Return value:
DOMString IP address for the currently-configured network
Example: 192.168.0.11Exceptions:
- WebAPIException
-
with error type SecurityError, if the application does not have the privilege to call this method.
-
with error type InvalidStateError, if a network connection is not available. (Since plugin version 3.0)
-
Code example:
var ip = null; try { ip = webapis.network.getIp(); } catch (e) { console.log("getIp exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null != ip) { console.log("[getIp] ip: " + ip); } }
- WebAPIException
getActiveConnectionType
-
Retrieves the TV's currently-active connection type.
unsigned short getActiveConnectionType();
Since : 2.3
Product : TV, AV_BD
Privilege level: public
Privilege: http://developer.samsung.com/privilege/network.public
Return value:
unsigned short Currently-active network connection type:
"DISCONNECTED" : 0
"WIFI" : 1
"CELLULAR" : 2
"ETHERNET" : 3Exceptions:
- WebAPIException
-
with error type SecurityError, if the application does not have the privilege to call this method.
-
Code example:
var connType = null; var retVal = null; try { retVal = webapis.network.getActiveConnectionType(); } catch (e) { console.error("getActiveConnectionType exception [" + e.code + "] message: " + e.message ); } if (null != retVal) { switch(retVal) { case webapis.network.NetworkActiveConnectionType.DISCONNECTED : connType = "DISCONNECTED"; break; case webapis.network.NetworkActiveConnectionType.WIFI : connType = "WIFI"; break; case webapis.network.NetworkActiveConnectionType.CELLULAR : connType = "CELLULAR"; break; case webapis.network.NetworkActiveConnectionType.ETHERNET : connType = "ETHERNET"; break; default: connType = "Error"; } console.log("[getActiveConnectionType] Active Connection Type: " + connType); }
- WebAPIException
addNetworkStateChangeListener
-
Registers an asynchronous event listener.
unsigned long addNetworkStateChangeListener(NetworkStateChangedCallback listener);
Since : 2.3
Product : TV, AV_BD
Privilege level: public
Privilege: http://developer.samsung.com/privilege/network.public
Parameters:
- listener: Callback method. For example: listenerID = network.addNetworkStateChangeListener(onChange);
Return value:
unsigned long Application async listener IDExceptions:
- WebAPIException
-
with error type SecurityError, if the application does not have the privilege to call this method.
-
with error type TypeMismatchError, if an input parameter is not compatible with its expected type.
-
Code example:
var onChange = function(data) { console.log("[NetworkStateChangedCallback] data :" + data + " changed"); } try { listenerID = webapis.network.addNetworkStateChangeListener(onChange); } catch (e) { console.log("addNetworkStateChangeListener exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (listenerID > -1) { console.log("addNetworkStateChangeListener success listener ID [" + listenerID + "] "); }
removeNetworkStateChangeListener
-
Unregisters an asynchronous event listener.
void removeNetworkStateChangeListener(unsigned long listenerId);
Since : 2.3
Product : TV, AV_BD
Privilege level: public
Privilege: http://developer.samsung.com/privilege/network.public
Parameters:
- listenerId: Listener ID
Exceptions:
- WebAPIException
-
with error type SecurityError, if the application does not have the privilege to call this method.
-
with error type TypeMismatchError, if an input parameter is not compatible with its expected type.
-
with error type InvalidValuesError, if the listenerId value is not the same as the value generated by addNetworkStateChangeListener. (Since plugin version 3.0)
-
Code example:
try { console.log("begin removeNetworkStateChangeListener listenerID: " + listenerID); webapis.network.removeNetworkStateChangeListener(listenerID); } catch (e) { console.log("removeNetworkStateChangeListener exception [" + e.code + "] name: " + e.name + " message: " + e.message); return; } console.log("removeNetworkStateChangeListener success");
getWiFiSsid
-
Retrieves the Wi-Fi network SSID. Works only when the active connection type is Wi-Fi.
DOMString getWiFiSsid();
Since : 2.3
Product : TV, AV_BD
Privilege level: public
Privilege: http://developer.samsung.com/privilege/network.public
Return value:
DOMString Wi-Fi network SSID
Example: StrawbarryExceptions:
- WebAPIException
-
with error type SecurityError, if the application does not have the privilege to call this method.
-
WebAPIException with error type InvalidStateError, if a Wi-Fi connection is not available. (Since plugin version 3.0)
-
Code example:
code var WiFiSSID = null; try { WiFiSSID = webapis.network.getWiFiSsid(); } catch (e) { console.log("getWiFiSSID exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null != WiFiSSID) { console.log("[getWiFiSSID] WiFiSSID: " + WiFiSSID); }
- WebAPIException
getWiFiSignalStrengthLevel
-
Retrieves the Wi-Fi signal strength. Works only when the active connection type is Wi-Fi.
short getWiFiSignalStrengthLevel();
Since : 2.3
Product : TV, AV_BD
Privilege level: public
Privilege: http://developer.samsung.com/privilege/network.public
Return value:
short Signal strength level. Valid values are 1 to 5. Signal strength is strongest when the value is 5.
"1" : below -88dBm
"2" : -88 ~ -77dBm
"3" : -77 ~ -66dBm
"4" : -66 ~ -55dBm
"5" : above -55dBmExceptions:
- WebAPIException
-
with error type SecurityError, if the application does not have the privilege to call this method.
-
with error type InvalidStateError, if a Wi-Fi connection is not available. (Since plugin version 3.0)
-
Code example:
var WiFiSignalStrengthLevel = null; try { WiFiSignalStrengthLevel = webapis.network.getWiFiSignalStrengthLevel(); } catch (e) { console.log("getWiFiSignalStrengthLevel exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null != WiFiSignalStrengthLevel) { console.log("[getWiFiSignalStrengthLevel] WiFiSignalStrengthLevel: " + WiFiSignalStrengthLevel); }
- WebAPIException
getWiFiSecurityMode
-
Retrieves the Wi-Fi security mode. Works only when the active connection type is Wi-Fi.
NetworkWiFiSecurityMode getWiFiSecurityMode();
Since : 2.3
Product : TV, AV_BD
Privilege level: public
Privilege: http://developer.samsung.com/privilege/network.public
Return value:
unsigned short Wi-Fi security mode
"WEP" : 1
"WPA_PSK" : 2
"WPA2_PSK" : 3
"EAP" : 4
"NONE" : 5
"UNKNOWN" : 6Exceptions:
- WebAPIException
-
with error type SecurityError, if the application does not have the privilege to call this method.
-
with error type InvalidStateError, if a Wi-Fi connection is not available. (Since plugin version 3.0)
-
Code example:
var WiFiSecurityMode = null; try { WiFiSecurityMode = webapis.network.getWiFiSecurityMode(); } catch (e) { console.log("getWiFiSecurityMode exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null != WiFiSecurityMode) { console.log("[getWiFiSecurityMode] WiFiSecurityMode: " + WiFiSecurityMode); }
- WebAPIException
getWiFiEncryptionType
-
Retrieves the Wi-Fi encryption type. Works only when the active connection type is Wi-Fi.
NetworkWiFiEncryptionType getWiFiEncryptionType();
Since : 2.3
Product : TV, AV_BD
Privilege level: public
Privilege: http://developer.samsung.com/privilege/network.public
Return value:
unsigned short Wi-Fi encryption type
"WEP" : 1
"TKIP" : 2
"AES" : 3
"TKIP_AES_MIXED" : 4
"NONE " : 5
"UNKNOWN" : 6Exceptions:
- WebAPIException
-
with error type SecurityError, if the application does not have the privilege to call this method.
-
with error type InvalidStateError, if a Wi-Fi connection is not available. (Since plugin version 3.0)
-
Code example:
var WiFiEncryptionType = null; try { WiFiEncryptionType = webapis.network.getWiFiEncryptionType(); } catch (e) { console.log("getWiFiEncryptionType exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null != WiFiEncryptionType) { console.log("[getWiFiEncryptionType] WiFiEncryptionType: " + WiFiEncryptionType); }
- WebAPIException
getSecondaryDns
-
Retrieves the TV's configured secondary DNS address.
DOMString getSecondaryDns();
Since : 2.3
Product : TV, AV_BD
Privilege level: public
Privilege: http://developer.samsung.com/privilege/network.public
Return value:
DOMString Secondary DNS address
Example: 192.168.0.100Exceptions:
- WebAPIException
-
with error type SecurityError, if the application does not have the privilege to call this method.
-
with with error type InvalidStateError, if a network connection is not available. (Since plugin version 3.0)
-
Code example:
var secondaryDNS = null; try { secondaryDNS = webapis.network.getSecondaryDns(); } catch (e) { console.error("getSecondaryDNS exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null != secondaryDNS) { console.log("[getSecondaryDNS] secondaryDNS: " + secondaryDNS); }
- WebAPIException
setDhcpOption60Field
-
Sets the DHCP option 60 vendor string. Works only when the active connection type is wired. The vendor string is updated when Udhcpc is restarted or relaunched.
void setDhcpOption60Field(DOMString vendorName);
Since : 2.3
Product : TV, AV_BD
Privilege level: partner
Privilege: http://developer.samsung.com/privilege/network.dhcpoption60
Parameters:
- vendorName: DHCP option 60 vendor name string
Exceptions:
- WebAPIException
-
with error type SecurityError, if the application does not have the privilege to call this method.
-
with error type InvalidStateError, if a network connection is not available. (Since plugin version 3.0)
-
with error type InvalidStateError, if the active connection type is Wi-Fi. (Since plugin version 3.0)
-
with error type TypeMismatchError, if an input parameter is not compatible with its expected type. (Since plugin version 3.0)
-
Code example:
try { webapis.network.setDhcpOption60Field("Cisco"); } catch (e) { console.error("setDHCPOption60Field exception [" + e.code + "] message: " + e.message); } console.log("[setDHCPOption60Field] DHCPOption60Field:Success ");
removeDhcpOption60Field
-
Sets the DHCP option 60 vendor string to the default value, "udhcpc1.21.1". Works only when the active connection type is wired. The vendor string is updated when Udhcpc is restarted or relaunched.
void removeDhcpOption60Field();
Since : 2.3
Product : TV, AV_BD
Privilege level: partner
Privilege: http://developer.samsung.com/privilege/network.dhcpoption60
Exceptions:
- WebAPIException
-
with error type SecurityError, if the application does not have the privilege to call this method.
-
with error type InvalidStateError, if a network connection is not available. (Since plugin version 3.0)
-
with error type InvalidStateError, if the active connection type is Wi-Fi. (Since plugin version 3.0)
-
Code example:
try { webapis.network.removeDhcpOption60Field(); } catch (e) { console.error("removeDHCPOption60Field exception [" + e.code + "] message: " + e.message ); } console.log("[removeDHCPOption60Field] DHCPOption60Field:Success ");
- WebAPIException
getCurrentDhcpOption60Field
-
Retrieves the DHCP option 60 vendor string. Works only when the active connection type is wired.
DOMString getCurrentDhcpOption60Field();
Since : 2.3
Product : TV, AV_BD
Privilege level: partner
Privilege: http://developer.samsung.com/privilege/network.dhcpoption60
Return value:
DOMString Vendor-specific string. Default value is "default".
Example: If setDhcpOption60Field = "cisco" then getCurrentDhcpOption60Field = "cisco".Exceptions:
- WebAPIException
-
with error type SecurityError, if the application does not have the privilege to call this method.
-
with error type InvalidStateError, if a network connection is not available. (Since plugin version 3.0)
-
with error type InvalidStateError, if the active connection type is Wi-Fi. (Since plugin version 3.0)
-
Code example:
var DHCPOption60Field = null; try { DHCPOption60Field = webapis.network.getCurrentDhcpOption60Field(); } catch (e) { console.error("getCurrentDHCPOption60Field exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null != DHCPOption60Field) { console.log("[getCurrentDHCPOption60Field] DHCPOption60Field: " + DHCPOption60Field); }
- WebAPIException
checkCurrentIpWith60Field
-
Retrieves the DHCP option 60 vendor string currently used by Udhcp. Works only when the active connection type is wired.
DOMString checkCurrentIpWith60Field();
Since : 2.3
Product : TV, AV_BD
Privilege level: partner
Privilege: http://developer.samsung.com/privilege/network.dhcpoption60
Return value:
DOMString Vendor string
Example: If Udhcpc is running with the default string "udhcpc1.21.1", after calling setDhcpOption60Field = "cisco", checkCurrentIpWith60Field= "udhcpc1.21.1"Exceptions:
- WebAPIException
-
with error type SecurityError, if the application does not have the privilege to call this method.
-
with error type InvalidStateError, if a network connection is not available. (Since plugin version 3.0)
-
with error type InvalidStateError, if the active connection type is Wi-Fi. (Since plugin version 3.0)
-
Code example:
var DHCPOption60Field = null; try { DHCPOption60Field = webapis.network.checkCurrentIpWith60Field(); } catch (e) { console.error("checkCurrentIPwith60Field exception [" + e.code + "] name: " + e.name + " message: " + e.message); } if (null != DHCPOption60Field) { console.log("[checkCurrentIPwith60Field] DHCPOption60Field: " + DHCPOption60Field); }
- WebAPIException
1.3. NetworkStateChangedCallback
[Callback = FunctionOnly, NoInterfaceObject]interface NetworkStateChangedCallback {
void onchange(NetworkState state);
};
Methods
onchange
-
Callback method for gateway connection state change notifications.
void onchange(NetworkState state);
Parameters:
- state: Connection state
Code example:
var Gatewaystatus =null; var onChange = function(data) { if(data == webapis.network.NetworkState.GATEWAY_CONNECTED){ Gatewaystatus ="GATEWAY_CONNECTED"; } else if(data == webapis.network.NetworkState.GATEWAY_DISCONNECTED){ Gatewaystatus ="GATEWAY_DISCONNECTED"; } else{ Gatewaystatus ="Status UNKNOWN"; } console.log("[NetworkStateChangedCallback] data :" + data +" "+ Gatewaystatus); }
1.4. NetworkIpMode
[NoInterfaceObject] interface NetworkIpMode {
const unsigned short NONE = 0;
const unsigned short STATIC = 1;
const unsigned short DYNAMIC = 2;
const unsigned short AUTO = 3;
const unsigned short FIXED = 4;
const unsigned short UNKNOWN = 5;
};
Constants
- NONE
No network IP mode configured
- STATIC
Connected to wired or wireless IPv4 network through static IP configuration
- DYNAMIC
Connected to wired or wireless IPv6 network through dynamic IP configuration
- AUTO
DHCP: Wired / Wireless connected to IPv4 network via auto ip configuration.
- FIXED
Connected to cellular network through fixed IP configuration
- UNKNOWN
No wired or wireless connection
1.5. NetworkActiveConnectionType
[NoInterfaceObject] interface NetworkActiveConnectionType {
const unsigned short DISCONNECTED = 0;
const unsigned short WIFI = 1;
const unsigned short CELLULAR = 2;
const unsigned short ETHERNET = 3;
};
Constants
- DISCONNECTED
No network configured
- WIFI
Connected to a Wi-Fi network.
- CELLULAR
Connected to a cellular network.
- ETHERNET
Connected to an Ethernet network.
1.6. NetworkState
[NoInterfaceObject] interface NetworkState {
const unsigned short LAN_CABLE_ATTACHED = 1;
const unsigned short LAN_CABLE_DETACHED = 2;
const unsigned short LAN_CABLE_STATE_UNKNOWN = 3;
const unsigned short GATEWAY_CONNECTED = 4;
const unsigned short GATEWAY_DISCONNECTED = 5;
const unsigned short WIFI_MODULE_STATE_ATTACHED = 6;
const unsigned short WIFI_MODULE_STATE_DETACHED = 7;
const unsigned short WIFI_MODULE_STATE_UNKNOWN = 8;
};
Since : 2.3
Constants
- LAN_CABLE_ATTACHED
LAN cable connected
- LAN_CABLE_DETACHED
LAN cable disconnected
- LAN_CABLE_STATE_UNKNOWN
LAN cable connection state unknown
- GATEWAY_CONNECTED
Gateway connected
- GATEWAY_DISCONNECTED
Gateway disconnected
- WIFI_MODULE_STATE_ATTACHED
Wi-Fi module connected
- WIFI_MODULE_STATE_DETACHED
Wi-Fi module disconnected
- WIFI_MODULE_STATE_UNKNOWN
Wi-Fi module connection state unknown
1.7. NetworkWiFiSecurityMode
[NoInterfaceObject] interface NetworkWiFiSecurityMode{
const unsigned short WEP= 1;
const unsigned short WPA_PSK= 2;
const unsigned short WPA2_PSK = 3;
const unsigned short EAP = 4;
const unsigned short NONE = 5;
const unsigned short UNKNOWN = 6;
};
Constants
- WEP
WEP security mode
- WPA_PSK
PSK security mode
- WPA2_PSK
WPA2_PSK security mode
- EAP
EAP security mode
- NONE
Open security mode
- UNKKNOWN
Security mode unknown
1.8. NetworkWiFiEncryptionType
[NoInterfaceObject] interface NetworkWiFiEncryptionType{
const unsigned short WEP= 1;
const unsigned short TKIP= 2;
const unsigned short AES = 3;
const unsigned short TKIP_AES_MIXED = 4;
const unsigned short NONE = 5;
const unsigned short UNKNOWN = 6;
};
Since : 2.3
Constants
- WEP
WEP encryption
- TKIP
TKIP encryption
- AES
AES encryption
- TKIP_AES_MIXED
TKIP_AES_MIXED encryption
- NONE
No encryption
- UNKKNOWN
Encryption type unknown
2. Full WebIDL
module Network {
[NoInterfaceObject]interface NetworkManagerObject {
readonly attribute NetworkManager network;
};
WebApi implements NetworkManagerObject;
[NoInterfaceObject]interface NetworkManager {
readonly attribute NetworkActiveConnectionType NetworkActiveConnectionType;
readonly attribute NetworkIpMode NetworkIpMode;
readonly attribute NetworkState NetworkState;
readonly attribute NetworkWiFiSecurityMode NetworkWiFiSecurityMode;
readonly attribute NetworkWiFiEncryptionType NetworkWiFiEncryptionType;
DOMString getVersion();
boolean isConnectedToGateway();
NetworkIpMode getIpMode();
DOMString getSubnetMask();
DOMString getGateway();
DOMString getMac();
DOMString getDns();
DOMString getIp();
NetworkActiveConnectionType getActiveConnectionType();
unsigned long addNetworkStateChangeListener(NetworkStateChangedCallback listener);
void removeNetworkStateChangeListener(unsigned long listenerId);
DOMString getWiFiSsid();
short getWiFiSignalStrengthLevel();
NetworkWiFiSecurityMode getWiFiSecurityMode();
NetworkWiFiEncryptionType getWiFiEncryptionType();
DOMString getSecondaryDns();
void setDhcpOption60Field(DOMString vendorName);
void removeDhcpOption60Field();
DOMString getCurrentDhcpOption60Field();
DOMString checkCurrentIpWith60Field();
};
[Callback = FunctionOnly, NoInterfaceObject]interface NetworkStateChangedCallback {
void onchange(NetworkState state);
};
[NoInterfaceObject] interface NetworkIpMode {
const unsigned short NONE = 0;
const unsigned short STATIC = 1;
const unsigned short DYNAMIC = 2;
const unsigned short AUTO = 3;
const unsigned short FIXED = 4;
const unsigned short UNKNOWN = 5;
};
[NoInterfaceObject] interface NetworkActiveConnectionType {
const unsigned short DISCONNECTED = 0;
const unsigned short WIFI = 1;
const unsigned short CELLULAR = 2;
const unsigned short ETHERNET = 3;
};
[NoInterfaceObject] interface NetworkState {
const unsigned short LAN_CABLE_ATTACHED = 1;
const unsigned short LAN_CABLE_DETACHED = 2;
const unsigned short LAN_CABLE_STATE_UNKNOWN = 3;
const unsigned short GATEWAY_CONNECTED = 4;
const unsigned short GATEWAY_DISCONNECTED = 5;
const unsigned short WIFI_MODULE_STATE_ATTACHED = 6;
const unsigned short WIFI_MODULE_STATE_DETACHED = 7;
const unsigned short WIFI_MODULE_STATE_UNKNOWN = 8;
};
[NoInterfaceObject] interface NetworkWiFiSecurityMode{
const unsigned short WEP= 1;
const unsigned short WPA_PSK= 2;
const unsigned short WPA2_PSK = 3;
const unsigned short EAP = 4;
const unsigned short NONE = 5;
const unsigned short UNKNOWN = 6;
};
[NoInterfaceObject] interface NetworkWiFiEncryptionType{
const unsigned short WEP= 1;
const unsigned short TKIP= 2;
const unsigned short AES = 3;
const unsigned short TKIP_AES_MIXED = 4;
const unsigned short NONE = 5;
const unsigned short UNKNOWN = 6;
};
};