Namespace: networking

airlock.networking

Provides functions and events for working with the network capabilities of a device.
Source:

Members

(static, readonly) NetworkConnectionType :number

Enum for network connection type values.
Type:
  • number
Properties:
Name Type Description
NONE number No network connection.
LAN number Connected to a local area network.
MOBILE_BROADBAND number Connected to a mobile broadband network.
Source:

Methods

(static) getNetworkInfo() → {airlock.networking.NetworkInfo}

Gets the information for the current network connection, if any.
Source:
See:
Returns:
The network connection information.
Type
airlock.networking.NetworkInfo
Example
var info = airlock.networking.getNetworkInfo();
// Display the SSID
alert(info.ssid);

(static) getWirelessNetworks() → {Promise.<Array.<airlock.networking.WirelessNetwork>>}

Gets a promise that returns a list of WirelessNetwork objects.
Source:
Returns:
A promise that containing a list of wireless networks when fulfilled. The promise may take several seconds to resolve.
Type
Promise.<Array.<airlock.networking.WirelessNetwork>>
Example
airlock.networking.getWirelessNetworks()
.then(function (result) {
		var text = '';
		// Get the SSID's for each network.
		for (var i = 0; i < result.length; i++) {
			var network = result[i];
			text += network.ssid + "\n";
		}
		alert(text);
}).catch(function (error) {
		alert("Error: " + error);
});

(static) isWifiEnabled() → {boolean}

Gets whether the device is able to connect to wireless networks.
Source:
Returns:
True if able to connect; false otherwise.
Type
boolean

(static) setWifiEnabled(enabled)

Enables or disables wireless networking.
Parameters:
Name Type Description
enabled boolean If true, WIFI is enabled; false, it is disabled.
Source:

Type Definitions

NetworkInfo

Type:
  • object
Properties:
Name Type Description
approachingDataLimit boolean Gets a value indicating whether the mobile broadband account is approaching a data limit. In which case, usage should be minimized.
connected boolean Gets a value indicating if the application has a network connection for transmitting data.
limitData boolean Gets a value indicating whether application data usage should be minimized.
networkConnectionType airlock.networking.NetworkConnectionType The type of network connection. It can be 0 (none), 1 (lan), or 2 (mobile broadband).
roaming boolean Gets a value indicating whether the mobile broadband account is relying on a third-party telecom; which may mean increased data usage costs for the user. If true, usage should be minimized.
ssid string The Service Set Identifier. SSID is a case sensitive, 32 alphanumeric character unique identifier attached to the header of packets sent over a wireless local-area network (WLAN).
wifiEnabled boolean Gets or sets whether the device is able to connect to wireless networks.
Source:

WirelessNetwork

Type:
  • object
Properties:
Name Type Description
bssid string The address of the access point.
ssid string The Service Set Identifier. SSID is a case sensitive, 32 alphanumeric character unique identifier attached to the header of packets sent over a wireless local-area network(WLAN).
capabilities string Describes the authentication, key management and encryption schemes supported by the access point.
isPasspointNetwork string Gets a value indicating if this network is a passpoint network, which is an improved method for connecting to Wi-Fi hotspots from the Wi-Fi Alliance.
level number The detected signal level in dBm, also known as the RSSI.
operatorFriendlyName string The user readable name of the network. The name can be up to 64 alphanumeric characters, and can include special characters and spaces. If the name includes quotation marks ("), include a backslash character (\) before each quotation mark. (e.g. \"example\")
Source:

Events

onConnectionChanged

onConnectionChanged Event. This event is raised when the device connects or disconnects to/from a network. To subscribe to the event use: airlock.networking.onConnectionChanged.addListener(function (networkInfo) {}) To unsubscribe to the event use: airlock.networking.onConnectionChanged.removeListener(afunctionReference)
Type:
Source:
Example
// Subscribe to event
airlock.networking.onConnectionChanged.addListener(handleConnectionChanged);

function handleConnectionChanged(args) {
		// Display whether the device is connected to a network.
		alert(args.connected);
}

// Unsubscribe
airlock.networking.onConnectionChanged.removeListener(handleConnectionChanged);