Class DeviceInfo#getNetworkInfo
DeviceInfo
- Defined in: deviceInfo.js
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
DeviceInfo#getNetworkInfo(successCallback, errorCallback)
Gets network information.
|
Class Detail
DeviceInfo#getNetworkInfo(successCallback, errorCallback)
Gets network information. Network information includes IP address assigned to wireless / wired LAN, gateway address, netmask and DNS address.
// Javascript code
function getNetworkInformation () {
function successCb(cbObject) {
console.log("cbObject : " + JSON.stringify(cbObject));
console.log("isInternetConnectionAvailable : " + cbObject.isInternetConnectionAvailable);
console.log("wired.state : " + cbObject.wired.state);
console.log("wired.method : " + cbObject.wired.method);
console.log("wired.ipAddress : " + cbObject.wired.ipAddress);
console.log("wired.netmask : " + cbObject.wired.netmask);
console.log("wired.dns1 : " + cbObject.wired.dns1);
console.log("wired.dns2 : " + cbObject.wired.dns2);
console.log("wifi.state : " + cbObject.wifi.state);
console.log("wifi.method : " + cbObject.wifi.method);
console.log("wifi.ipAddress : " + cbObject.wifi.ipAddress);
console.log("wifi.netmask : " + cbObject.wifi.netmask);
console.log("wifi.dns1 : " + cbObject.wifi.dns1);
console.log("wifi.dns2 : " + cbObject.wifi.dns2);
}
function failureCb(cbObject) {
var errorCode = cbObject.errorCode;
var errorText = cbObject.errorText;
console.log ("Error Code [" + errorCode + "]: " + errorText);
}
var deviceInfo = new DeviceInfo();
deviceInfo.getNetworkInfo(successCb, failureCb);
}
- Parameters:
- {Function} successCallback
- success callback function.
- {Function} errorCallback
- failure callback function.
- Since:
- 1.0
- Returns:
- {Object}
Property Type Description isInternetConnectionAvailable Boolean Internet connection true: connected, false: not connected wired Object Wired network information object. wired.state String Wired network connection "connected": connected "disconnected": not connected wired.interfaceName String Wired network interface name. wired.ipAddress String IP address assigned to the wired network interface. wired.netmask String Netmask assigned to the wired network interface. wired.gateway String Gateway address assigned to the wired network interface wired.onInternet String Internet connection to the wired network "yes": connected "no": not connected. wired.method String IP allocation "manual": fixed allocation "dhcp": dynamic allocation wired.dns1 String DNS address assigned to the wired network interface. wired.dns2 String Secondary DNS address assigned to the wired network interface. wifi Object Wireless network information object. wifi.state String Wireless network connection "connected": connected "disconnected": not connected wifi.interfaceName String Wireless network interface name. wifi.ipAddress String IP address assigned to the wireless network interface. wifi.netmask String Netmask assigned to the wireless network interface. wifi.gateway String Gateway address assigned to the wireless network interface wifi.onInternet String Internet connection to the wireless network "yes": connected "no": not connected. wifi.method String IP allocation "manual": fixed allocation "dhcp": dynamic allocation wifi.dns1 String DNS address assigned to the wireless network interface. wifi.dns2 String Secondary DNS address assigned to the wireless network interface. - See:
- DeviceInfo.getNetworkMacInfo()
, DeviceInfo.setNetworkInfo()