Class DeviceInfo#getNetworkInfo

DeviceInfo

Class Summary
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}
PropertyTypeDescription
isInternetConnectionAvailableBooleanInternet connection true: connected, false: not connected
wiredObjectWired network information object.
wired.stateStringWired network connection "connected": connected "disconnected": not connected
wired.interfaceNameStringWired network interface name.
wired.ipAddressStringIP address assigned to the wired network interface.
wired.netmaskStringNetmask assigned to the wired network interface.
wired.gatewayStringGateway address assigned to the wired network interface
wired.onInternetStringInternet connection to the wired network "yes": connected "no": not connected.
wired.methodStringIP allocation "manual": fixed allocation "dhcp": dynamic allocation
wired.dns1StringDNS address assigned to the wired network interface.
wired.dns2StringSecondary DNS address assigned to the wired network interface.
wifiObjectWireless network information object.
wifi.stateStringWireless network connection "connected": connected "disconnected": not connected
wifi.interfaceNameStringWireless network interface name.
wifi.ipAddressStringIP address assigned to the wireless network interface.
wifi.netmaskStringNetmask assigned to the wireless network interface.
wifi.gatewayStringGateway address assigned to the wireless network interface
wifi.onInternetStringInternet connection to the wireless network "yes": connected "no": not connected.
wifi.methodStringIP allocation "manual": fixed allocation "dhcp": dynamic allocation
wifi.dns1StringDNS address assigned to the wireless network interface.
wifi.dns2StringSecondary DNS address assigned to the wireless network interface.
See:
DeviceInfo.getNetworkMacInfo()
, DeviceInfo.setNetworkInfo()