Smart Signage
API References
Web API References
Samsung Product API References
Network API
To use Samsung Product API,
<script type="text/javascript" src="$WEBAPIS/webapis/webapis.js"></script>
Should be loaded in index.html
This module defines the network information retrieval functionalities provided by the Tizen Samsung Product API.
Since : 2.3
Product : TV, AV, B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Summary of Interfaces and Methods
1. Interfaces
1.1 NetworkManagerObject
Defines a WebApi object instance of the Tizen Samsung Product API.
The webapis.network object enables access to Network API functionality.
[NoInterfaceObject] interface NetworkManagerObject {
readonly attribute NetworkManager network;
};
WebApi implements NetworkManagerObject;
Attributes
1.2 NetworkManager
Provides methods for network functionalities.
[NoInterfaceObject] interface NetworkManager {
attribute NetworkActiveConnectionType NetworkActiveConnectionType;
attribute NetworkIpMode NetworkIpMode;
attribute NetworkState NetworkState;
attribute NetworkWiFiSecurityMode NetworkWiFiSecurityMode;
attribute NetworkWiFiEncryptionType NetworkWiFiEncryptionType;
DOMString getVersion();
boolean isConnectedToGateway();
NetworkIpMode getIpMode();
void setIpMode(NetworkIpMode ipmode);
DOMString getSubnetMask();
void setSubnetMask(DOMString subnet);
DOMString getGateway();
void setGateway(DOMString gateway);
DOMString getMac();
DOMString getDns();
void setDns(DOMString dns);
DOMString getIp();
void setIp(DOMString ip);
DOMString getProxyserverInfo();
void setProxyserverInfo(DOMString id, DOMString pwd, DOMString url, DOMString port);
DOMString getTVName();
NetworkActiveConnectionType getActiveConnectionType();
unsigned long addNetworkStateChangeListener(NetworkStateChangedCallback listener);
void removeNetworkStateChangeListener(unsigned long listenerId);
DOMString getWiFiSsid();
long getWiFiSignalStrengthLevel();
NetworkWiFiSecurityMode getWiFiSecurityMode();
NetworkWiFiEncryptionType getWiFiEncryptionType();
DOMString getSecondaryDns();
void setDhcpOption60Field(DOMString vendorName);
void removeDhcpOption60Field();
DOMString getCurrentDhcpOption60Field();
DOMString checkCurrentIpWith60Field();
void enableSoftAP();
void disableSoftAP();
boolean isSoftAPEnabled();
DOMString getSoftAPSSID();
void setSoftAPChannel(long channel);
DOMString getSoftAPSecurityKey();
void setSoftAPSignalStrength(unsigned long power);
void setEAPCAfilePath(DOMString path);
void setEAPPassphrase(DOMString name, DOMString password);
long getWiFiFrequency();
};
Attributes
Methods
getVersion
Retrieves the device network module version.
DOMString getVersion();
Product : TV, AV, B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Return Value :
DOMString : DOMString Network plugin module version
Exceptions :
WebAPIException
with error type SecurityError, if the application does not have the privilege to call this method.
Since : 2.3
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);
}
isConnectedToGateway
Checks whether the device is connected to a network gateway.
boolean isConnectedToGateway();
Product : TV, AV, B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Return Value :
boolean : Boolean value:
true: Gateway connected
false: Gateway is not connected
Exceptions :
WebAPIException
with error type SecurityError, if the application does not have the privilege to call this method.
Since : 2.3
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);
}
getIpMode
Retrieves the device's IP configuration mode.
NetworkIpMode getIpMode();
Product : TV, AV, B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Return Value :
NetworkIpMode : unsigned long Network IP mode
"NONE":0
"STATIC": 1
"DYNAMIC": 2
"AUTO": 3
"FIXED": 4
"UNKNOWN": 5
Exceptions :
WebAPIException
with error type SecurityError, if the application does not have the privilege to call this method.
Since : 2.3
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);
}
setIpMode
Configures device's IP mode.
void setIpMode(NetworkIpMode ipmode);
Product : B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Parameters :
ipmode : ip mode to be set
"NONE":0
"STATIC": 1
"DYNAMIC": 2
"AUTO": 3
"FIXED": 4
"UNKNOWN": 5
Exceptions :
WebAPIException
with error type SecurityError, if the application does not have the privilege to call this method.
with the error type TypeMismatchError if different type argument values are passed for an input parameter
with error type InvalidStateError, if a network connection is not available. (Since plugin version 3.0)
Since : 6.5
Code Example :
var err = false;
try {
webapis.network.setIpMode(webapis.network.NetworkIpMode.STATIC);
} catch (e) {
console.error("setIpMode exception [" + e.code + "] name: " + e.name + " message: " + e.message);
err = true;
}
if (err != true) {
console.log("[setIpMode] SUCCESS");
}
getSubnetMask
Retrieves the device's configured subnet mask address.
DOMString getSubnetMask();
Product : TV, AV, B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Return Value :
DOMString : DOMString Subnet mask address for the currently-configured network
Example: 255.255.255.0
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)
Since : 2.3
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);
}
setSubnetMask
Configures device's Subnet mask.
void setSubnetMask(DOMString subnet);
Product : B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Parameters :
subnet : subnet mask to be set
Exceptions :
WebAPIException
with error type SecurityError, if the application does not have the privilege to call this method.
with the error type TypeMismatchError if different type argument values are passed for an input parameter
with error type InvalidStateError, if a network connection is not available. (Since plugin version 3.0)
Since : 6.5
Code Example :
var err = false;
try {
webapis.network.setSubnetMask("255.255.255.0");
} catch (e) {
console.error("setSubnetMask exception [" + e.code + "] name: " + e.name + " message: " + e.message);
err = true;
}
if (err != true) {
console.log("[setSubnetMask] SUCCESS");
}
getGateway
Retrieves the device's configured gateway address.
DOMString getGateway();
Product : TV, AV, B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Return Value :
DOMString : DOMString Gateway address for the currently-configured network
Example: 192.168.0.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)
Since : 2.3
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);
}
setGateway
Configures device's Gateway address.
void setGateway(DOMString gateway);
Product : B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Parameters :
gateway : gateway to be set
Exceptions :
WebAPIException
with error type SecurityError, if the application does not have the privilege to call this method.
with the error type TypeMismatchError if different type argument values are passed for an input parameter
with error type InvalidStateError, if a network connection is not available. (Since plugin version 3.0)
Since : 6.5
Code Example :
var err = false;
try {
webapis.network.setGateway("107.109.92.1");
} catch (e) {
console.error("setGateway exception [" + e.code + "] name: " + e.name + " message: " + e.message);
err = true;
}
if (err != true) {
console.log("[setGateway] SUCCESS");
}
getMac
Retrieves the network device's MAC address.
DOMString getMac();
Product : TV, AV, B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Return Value :
DOMString : DOMString MAC address for the currently-configured network
Example: 50:B7:A3:C2:96:11
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)
Since : 2.3
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);
}
getDns
Retrieves the device's configured DNS address.
DOMString getDns();
Product : TV, AV, B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Return Value :
DOMString : DOMString DNS address for the currently-configured network
Example: 192.168.0.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)
Since : 2.3
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);
}
setDns
Configures device's Dns address.
void setDns(DOMString dns);
Product : B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Parameters :
Exceptions :
WebAPIException
with error type SecurityError, if the application does not have the privilege to call this method.
with the error type TypeMismatchError if different type argument values are passed for an input parameter
with error type InvalidStateError, if a network connection is not available. (Since plugin version 3.0)
Since : 6.5
Code Example :
var err = false;
try {
webapis.network.setDns("8.8.8.8");
} catch (e) {
console.error("setDns exception [" + e.code + "] name: " + e.name + " message: " + e.message);
err = true;
}
if (err != true) {
console.log("[setDns] SUCCESS");
}
getIp
Retrieves the device's configured IP address.
DOMString getIp();
Product : TV, AV, B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Return Value :
DOMString : DOMString IP address for the currently-configured network
Example: 192.168.0.11
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)
Since : 2.3
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);
}
setIp
Configures device's IP address.
void setIp(DOMString ip);
Product : B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Parameters :
Exceptions :
WebAPIException
with error type SecurityError, if the application does not have the privilege to call this method.
with the error type TypeMismatchError if different type argument values are passed for an input parameter
with error type InvalidStateError, if a network connection is not available. (Since plugin version 3.0)
Since : 6.5
Code Example :
var err = false;
try {
webapis.network.setIp("107.109.92.9");
} catch (e) {
console.error("setIp exception [" + e.code + "] name: " + e.name + " message: " + e.message);
err = true;
}
if (err != true) {
console.log("[setIp] SUCCESS");
}
getProxyserverInfo
Retrieves the device's configured proxy server info.
DOMString getProxyserverInfo();
Product : B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Return Value :
DOMString : DOMString proxy server info
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)
Since : 6.5
Code Example :
var proxy = null;
try {
proxy = network.getProxyserverInfo();
} catch (e) {
console.log("getProxyserverInfo exception [" + e.code + "] name: " + e.name + " message: " + e.message);
}
if (null != proxy) {
console.log("[getProxyserverInfo] proxy: " + proxy);
}
setProxyserverInfo
Configures device's proxy server info.
void setProxyserverInfo(DOMString id, DOMString pwd, DOMString url, DOMString port);
Product : B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Parameters :
id : id to be set
pwd : password to be set
url : url to be set
port : port to be set
Exceptions :
WebAPIException
with error type SecurityError, if the application does not have the privilege to call this method.
with error type TypeMismatchError if different type argument values are passed for an input parameter
with error type InvalidStateError, if a network connection is not available. (Since plugin version 3.0)
Since : 6.5
Code Example :
var err = false;
try {
webapis.network.setProxyserverInfo("id", "pwd", "10.20.30.40", "9998");
} catch (e) {
console.error("setProxyserverInfo exception [" + e.code + "] name: " + e.name + " message: " + e.message);
err = true;
}
if (err != true) {
console.log("[setProxyserverInfo] SUCCESS");
}
getTVName
Retrieves the device's configured name when device is connected to a network.
DOMString getTVName();
Product : TV, AV, B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Return Value :
DOMString : DOMString Device Name for any connected network
Example: Tizen_Device
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)
Since : 4.0
Code Example :
var tvname = null;
try {
tvname = webapis.network.getTVName();
} catch (e) {
console.log("getTVName exception [" + e.code + "] mname: " + e.name + " message: " + e.message);
}
if (null != tvname) {
console.log("[getTVName] tvname : " + tvname);
}
getActiveConnectionType
Retrieves the device's currently-active connection type.
NetworkActiveConnectionType getActiveConnectionType();
Product : TV, AV, B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Return Value :
NetworkActiveConnectionType : unsigned long Currently-active network connection type:
"DISCONNECTED": 0
"WIFI": 1
"CELLULAR": 2
"ETHERNET": 3
Exceptions :
WebAPIException
with error type SecurityError, if the application does not have the privilege to call this method.
Since : 2.3
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);
}
addNetworkStateChangeListener
Registers an asynchronous event listener.
unsigned long addNetworkStateChangeListener(NetworkStateChangedCallback listener);
Product : TV, AV, B2B
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 : unsigned long Application async 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.
Since : 2.3
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);
Product : TV, AV, B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Parameters :
listenerId : ListenerID to be removed
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)
Since : 2.3
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();
Product : TV, AV, B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Return Value :
DOMString : DOMString Wi-Fi network SSID
Example: Strawbarry
Exceptions :
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)
Since : 2.3
Code Example :
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);
}
getWiFiSignalStrengthLevel
Retrieves the Wi-Fi signal strength. Works only when the active connection type is Wi-Fi.
long getWiFiSignalStrengthLevel();
Product : TV, AV, B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Return Value :
long : long Signal strength level. Valid values are 1 to 5. Signal strength is strongest when the value is 5.
8dBm
8 ~ -77dBm
7 ~ -66dBm
6 ~ -55dBm
5dBm
Exceptions :
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)
Since : 2.3
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);
}
getWiFiSecurityMode
Retrieves the Wi-Fi security mode. Works only when the active connection type is Wi-Fi.
NetworkWiFiSecurityMode getWiFiSecurityMode();
Product : TV, AV, B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Return Value :
NetworkWiFiSecurityMode : unsigned long Wi-Fi security mode
"WEP": 1
"WPA_PSK": 2
"WPA2_PSK": 3
"EAP": 4
"NONE": 5
"UNKNOWN": 6
Exceptions :
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)
Since : 2.3
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);
}
getWiFiEncryptionType
Retrieves the Wi-Fi encryption type. Works only when the active connection type is Wi-Fi.
NetworkWiFiEncryptionType getWiFiEncryptionType();
Product : TV, AV, B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Return Value :
NetworkWiFiEncryptionType : unsigned long Wi-Fi encryption type
"WEP": 1
"TKIP": 2
"AES": 3
"TKIP_AES_MIXED": 4
"NONE": 5
"UNKNOWN": 6
Exceptions :
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)
Since : 2.3
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);
}
getSecondaryDns
Retrieves the device's configured secondary DNS address.
DOMString getSecondaryDns();
Product : TV, AV, B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Return Value :
DOMString : DOMString Secondary DNS address
Example: 192.168.0.100
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)
Since : 2.3
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);
}
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);
Product : TV, AV, B2B
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)
Since : 2.3
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();
Product : TV, AV, B2B
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)
Since : 2.3
Code Example :
try {
webapis.network.removeDhcpOption60Field();
} catch (e) {
console.error("removeDHCPOption60Field exception [" + e.code + "] message: " + e.message );
}
console.log("[removeDHCPOption60Field] DHCPOption60Field:Success ");
getCurrentDhcpOption60Field
Retrieves the DHCP option 60 vendor string. Works only when the active connection type is wired.
DOMString getCurrentDhcpOption60Field();
Product : TV, AV, B2B
Privilege Level : Partner
Privilege : http://developer.samsung.com/privilege/network.dhcpoption60
Return Value :
DOMString : 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)
Since : 2.3
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);
}
checkCurrentIpWith60Field
Retrieves the DHCP option 60 vendor string currently used by Udhcp. Works only when the active connection type is wired.
DOMString checkCurrentIpWith60Field();
Product : TV, AV, B2B
Privilege Level : Partner
Privilege : http://developer.samsung.com/privilege/network.dhcpoption60
Return Value :
DOMString : 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)
Since : 2.3
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);
}
enableSoftAP
This method enables SoftAP in Hotel TV.
void enableSoftAP();
Product : B2B(HTV)
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.softAP
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 connected on Wireless connection as SoftAP feature is valid for only wired connection (Since plugin version 3.0)
Since : 3.0
Code Example :
var err = false;
try {
webapis.network.enableSoftAP();
} catch (e) {
console.error("enable softAP exception [" + e.code + "] name: " + e.name + " message: " + e.message);
err = true;
}
if (err != true) {
console.log("[enableSoftAP] SUCCESS");
}
disableSoftAP
This method disables SoftAP in Hotel TV.
void disableSoftAP();
Product : B2B(HTV)
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.softAP
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 connected on Wireless connection as SoftAP feature is valid for only wired connection (Since plugin version 3.0)
Since : 3.0
Code Example :
var err = false;
try {
webapis.network.disableSoftAP();
} catch (e) {
console.error("disable softAP exception [" + e.code + "] name: " + e.name + " message: " + e.message);
err = true;
}
if (err != true) {
console.log("[disableSoftAP] SUCCESS");
}
isSoftAPEnabled
This method gets the softAP status in Hotel TV whether it is enabled or not.
boolean isSoftAPEnabled();
Product : B2B(HTV)
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.softAP
Return Value :
boolean : Boolean It returns true if SoftAP is enabled, false if softAP is disabled.
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 connected on Wireless connection as SoftAP feature is valid for only wired connection (Since plugin version 3.0)
Since : 3.0
Code Example :
var status = null;
try {
status = webapis.network.isSoftAPEnabled();
} catch (e) {
console.error("issoftAPEnabled exception [" + e.code + "] name: " + e.name + " message: " + e.message);
err = true;
}
if (null != status) {
console.log("[issoftAPEnabled] status: " + status);
}
getSoftAPSSID
This method returns the softAP SSID.
DOMString getSoftAPSSID();
Product : B2B(HTV)
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.softAP
Return Value :
DOMString : DOMString It returns the softAP SSID from tethering module.
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 connected on Wireless connection as SoftAP feature is valid for only wired connection (Since plugin version 3.0)
Since : 3.0
Code Example :
var ssid = null;
try {
ssid = webapis.network.getSoftAPSSID();
} catch (e) {
console.error("getSoftAPSSID exception [" + e.code + "] name: " + e.name + " message: " + e.message);
}
if (null != ssid) {
console.log("[getSoftAPSSID] SSID: " + ssid);
}
setSoftAPChannel
This method sets the SoftAP channel to specified channel.
void setSoftAPChannel(long channel);
Product : B2B(HTV)
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.softAP
Parameters :
channel : softAP channel to be set
Exceptions :
WebAPIException
with error type TypeMismatchError, if invalid long type passed for 'channel' parameter
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 connected on Wireless connection as SoftAP feature is valid for only wired connection (Since plugin version 3.0)
Since : 3.0
Code Example :
var err = false;
try {
//take input from user and forward it to below API
webapis.network.setSoftAPChannel(5);
} catch (e) {
console.error("setSoftAPChannel exception [" + e.code + "] name: " + e.name + " message: " + e.message);
err = true;
}
if (err != true) {
console.log("[setSoftAPChannel] SUCCESS");
}
getSoftAPSecurityKey
This method returns the softAP Security Key.
DOMString getSoftAPSecurityKey();
Product : B2B(HTV)
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.softAP
Return Value :
DOMString : DOMString It returns the softAP security key from tethering module.
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 connected on Wireless connection as SoftAP feature is valid for only wired connection (Since plugin version 3.0)
Since : 3.0
Code Example :
var key = null;
try {
key = webapis.network.getSoftAPSecurityKey();
} catch (e) {
console.error("getSoftAPSecurityKey exception [" + e.code + "] name: " + e.name + " message: " + e.message);
}
if (null != key) {
console.log("[getSoftAPSecurityKey] key: " + key);
}
setSoftAPSignalStrength
This method sets SoftAP Signal strength to a specific value.
void setSoftAPSignalStrength(unsigned long power);
Product : B2B(HTV)
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.softAP
Parameters :
power : signal strength(0-100)
Exceptions :
WebAPIException
with error type TypeMismatchError, if invalid unsigned long type passed for 'power' parameter
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 connected on Wireless connection as SoftAP feature is valid for only wired connection (Since plugin version 3.0)
with error type InvalidValuesError, if power is out of range.
Since : 3.0
Code Example :
var err = false;
try {
//take input from user and forward it to below API
webapis.network.setSoftAPSignalStrength(100);
} catch (e) {
console.error("setSoftAPSignalStrength exception [" + e.code + "] name: " + e.name + " message: " + e.message);
err = true;
}
if (err != true) {
console.log("[setSoftAPSignalStrength] SUCCESS");
}
setEAPCAfilePath
Set the PEAP certification file path for PEAP base AP connection.
void setEAPCAfilePath(DOMString path);
Product : TV, AV, B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Parameters :
path : PEAP certification file path
Exceptions :
WebAPIException
with error type TypeMismatchError, if invalid DOMString type passed for 'path' parameter
with error type SecurityError, if the application does not have the privilege to call this method.
Since : 6.5
Code Example :
var err = false;
try {
webapis.network.setEAPCAfilePath("/opt/usr/home/owner/share/Root_test/ca.der");
} catch (e) {
console.error("setEAPCAfilePath exception [" + e.code + "] name: " + e.name + " message: " + e.message);
err = true;
}
if (err != true) {
console.log("[setEAPCAfilePath] SUCCESS");
}
setEAPPassphrase
sets the username and password.
void setEAPPassphrase(DOMString name, DOMString password);
Product : TV, AV, B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Parameters :
name : to be set
password : to be set
Exceptions :
WebAPIException
with error type TypeMismatchError, if invalid DOMString type passed for 'name' and 'password' parameter
with error type SecurityError, if the application does not have the privilege to call this method.
Since : 6.5
Code Example :
var err = false;
try {
webapis.network.setEAPPassphrase("testing11", "password11");
} catch (e) {
console.error("setEAPPassphrase exception [" + e.code + "] name: " + e.name + " message: " + e.message);
err = true;
}
if (err != true) {
console.log("[setEAPPassphrase] SUCCESS");
}
getWiFiFrequency
Retrieves the Wi-Fi network Frequency. Works only when the active connection type is Wi-Fi.
long getWiFiFrequency();
Product : TV, AV, B2B
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Return Value :
long : Wi-Fi network Frequency (MHz)
Exceptions :
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 : 6.0
Code Example :
var WiFiFrequency = null;
try {
WiFiFrequency = webapis.network.getWiFiFrequency();
} catch (e) {
console.log("getWiFiFrequency exception [" + e.code + "] name: " + e.name
+ " message: " + e.message);
}
if (null != WiFiFrequency) {
console.log("[getWiFiFrequency] WiFiFrequency: " + WiFiFrequency);
}
1.3 NetworkStateChangedCallback
Defines a listener for gateway connection state change notifications.
[Callback = FunctionOnly, NoInterfaceObject] interface NetworkStateChangedCallback {
void onchange(NetworkState state);
};
Methods
onchange
Callback method for gateway connection state change notifications.
void onchange(NetworkState state);
Privilege Level : Public
Privilege : http://developer.samsung.com/privilege/network.public
Parameters :
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)
Since : 3.0
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
Defines constants for network IP modes.
[NoInterfaceObject] interface NetworkIpMode {
const unsigned long NONE = 0;
const unsigned long STATIC = 1;
const unsigned long DYNAMIC = 2;
const unsigned long AUTO = 3;
const unsigned long FIXED = 4;
const unsigned long 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: Connected to wired or wireless IPv4 network through automatic IP configuration
FIXED
Connected to cellular network through fixed IP configuration
UNKNOWN
No wired or wireless connection
1.5 NetworkActiveConnectionType
Defines constants for network connection types.
[NoInterfaceObject] interface NetworkActiveConnectionType {
const unsigned long DISCONNECTED = 0;
const unsigned long WIFI = 1;
const unsigned long CELLULAR = 2;
const unsigned long 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
Defines constants for network states.
[NoInterfaceObject] interface NetworkState {
const unsigned long INTERNET_CONNECTED = 0;
const unsigned long LAN_CABLE_ATTACHED = 1;
const unsigned long LAN_CABLE_DETACHED = 2;
const unsigned long LAN_CABLE_STATE_UNKNOWN = 3;
const unsigned long GATEWAY_CONNECTED = 4;
const unsigned long GATEWAY_DISCONNECTED = 5;
const unsigned long WIFI_MODULE_STATE_ATTACHED = 6;
const unsigned long WIFI_MODULE_STATE_DETACHED = 7;
const unsigned long WIFI_MODULE_STATE_UNKNOWN = 8;
const unsigned long INTERNET_DISCONNECTED = 9;
};
Constants
INTERNET_CONNECTED
Internet connected
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
INTERNET_DISCONNECTED
Internet disconnected
1.7 NetworkWiFiSecurityMode
Defines constants for Wi-Fi network security modes.
[NoInterfaceObject] interface NetworkWiFiSecurityMode {
const unsigned long WEP = 1;
const unsigned long WPA_PSK = 2;
const unsigned long WPA2_PSK = 3;
const unsigned long EAP = 4;
const unsigned long NONE = 5;
const unsigned long 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
UNKNOWN
Security mode unknown
1.8 NetworkWiFiEncryptionType
Defines constants for Wi-fi network encryption types.
[NoInterfaceObject] interface NetworkWiFiEncryptionType {
const unsigned long WEP = 1;
const unsigned long TKIP = 2;
const unsigned long AES = 3;
const unsigned long TKIP_AES_MIXED = 4;
const unsigned long NONE = 5;
const unsigned long UNKNOWN = 6;
};
Constants
WEP
WEP encryption
TKIP
TKIP encryption
AES
AES encryption
TKIP_AES_MIXED
TKIP_AES_MIXED encryption
NONE
No encryption
UNKNOWN
Encryption type unknown
2. Full WebIDL
module Network {
[NoInterfaceObject] interface NetworkManagerObject {
readonly attribute NetworkManager network;
};
WebApi implements NetworkManagerObject;
[NoInterfaceObject] interface NetworkManager {
attribute NetworkActiveConnectionType NetworkActiveConnectionType;
attribute NetworkIpMode NetworkIpMode;
attribute NetworkState NetworkState;
attribute NetworkWiFiSecurityMode NetworkWiFiSecurityMode;
attribute NetworkWiFiEncryptionType NetworkWiFiEncryptionType;
DOMString getVersion();
boolean isConnectedToGateway();
NetworkIpMode getIpMode();
void setIpMode(NetworkIpMode ipmode);
DOMString getSubnetMask();
void setSubnetMask(DOMString subnet);
DOMString getGateway();
void setGateway(DOMString gateway);
DOMString getMac();
DOMString getDns();
void setDns(DOMString dns);
DOMString getIp();
void setIp(DOMString ip);
DOMString getProxyserverInfo();
void setProxyserverInfo(DOMString id, DOMString pwd, DOMString url, DOMString port);
DOMString getTVName();
NetworkActiveConnectionType getActiveConnectionType();
unsigned long addNetworkStateChangeListener(NetworkStateChangedCallback listener);
void removeNetworkStateChangeListener(unsigned long listenerId);
DOMString getWiFiSsid();
long getWiFiSignalStrengthLevel();
NetworkWiFiSecurityMode getWiFiSecurityMode();
NetworkWiFiEncryptionType getWiFiEncryptionType();
DOMString getSecondaryDns();
void setDhcpOption60Field(DOMString vendorName);
void removeDhcpOption60Field();
DOMString getCurrentDhcpOption60Field();
DOMString checkCurrentIpWith60Field();
void enableSoftAP();
void disableSoftAP();
boolean isSoftAPEnabled();
DOMString getSoftAPSSID();
void setSoftAPChannel(long channel);
DOMString getSoftAPSecurityKey();
void setSoftAPSignalStrength(unsigned long power);
void setEAPCAfilePath(DOMString path);
void setEAPPassphrase(DOMString name, DOMString password);
long getWiFiFrequency();
};
[Callback = FunctionOnly, NoInterfaceObject] interface NetworkStateChangedCallback {
void onchange(NetworkState state);
};
[NoInterfaceObject] interface NetworkIpMode {
const unsigned long NONE = 0;
const unsigned long STATIC = 1;
const unsigned long DYNAMIC = 2;
const unsigned long AUTO = 3;
const unsigned long FIXED = 4;
const unsigned long UNKNOWN = 5;
};
[NoInterfaceObject] interface NetworkActiveConnectionType {
const unsigned long DISCONNECTED = 0;
const unsigned long WIFI = 1;
const unsigned long CELLULAR = 2;
const unsigned long ETHERNET = 3;
};
[NoInterfaceObject] interface NetworkState {
const unsigned long INTERNET_CONNECTED = 0;
const unsigned long LAN_CABLE_ATTACHED = 1;
const unsigned long LAN_CABLE_DETACHED = 2;
const unsigned long LAN_CABLE_STATE_UNKNOWN = 3;
const unsigned long GATEWAY_CONNECTED = 4;
const unsigned long GATEWAY_DISCONNECTED = 5;
const unsigned long WIFI_MODULE_STATE_ATTACHED = 6;
const unsigned long WIFI_MODULE_STATE_DETACHED = 7;
const unsigned long WIFI_MODULE_STATE_UNKNOWN = 8;
const unsigned long INTERNET_DISCONNECTED = 9;
};
[NoInterfaceObject] interface NetworkWiFiSecurityMode {
const unsigned long WEP = 1;
const unsigned long WPA_PSK = 2;
const unsigned long WPA2_PSK = 3;
const unsigned long EAP = 4;
const unsigned long NONE = 5;
const unsigned long UNKNOWN = 6;
};
[NoInterfaceObject] interface NetworkWiFiEncryptionType {
const unsigned long WEP = 1;
const unsigned long TKIP = 2;
const unsigned long AES = 3;
const unsigned long TKIP_AES_MIXED = 4;
const unsigned long NONE = 5;
const unsigned long UNKNOWN = 6;
};
};