This article is in need of a technical review.
Non-standard
This feature is not on a current W3C standards track, but it is supported on the Firefox OS platform. Although implementations may change in the future and it is not supported widely across browsers, it is suitable for use in code dedicated to Firefox OS apps.
This API is available on Firefox OS for certified applications only.
Summary
The WifiManager API provides access to the wifi device capability.
Interface
interface WifiManager {
readonly attribute boolean enabled;
readonly attribute string macAddress;
readonly attribute object connection;
readonly attribute object connectionInformation;
attribute nsIDOMEventListener onenabled;
attribute nsIDOMEventListener ondisabled;
attribute nsIDOMEventListener onstatuschange;
attribute nsIDOMEventListener connectionInfoUpdate;
DOMRequest getNetworks();
DOMRequest getKnownNetworks();
DOMRequest associate(object network);
DOMRequest forget(object network);
DOMRequest wps(object detail);
DOMRequest setPowerSavingMode(boolean enabled);
DOMRequest setStaticIpMode(object network, object info)
};
Properties
-
WifiManager.enabledRead only -
A boolean indicating whether the wifi is on (
true) or off (false). -
WifiManager.macAddressRead only - A string representing the wifi adapter's MAC address.
-
WifiManager.connectionRead only - An object providing information about the current connection (status and network in use).
-
WifiManager.connectionInformationRead only -
An object providing extra information about the current connection or
nullif the device is not connected to the wifi.
Event handlers
-
WifiManager.onenabled -
A handler for the
enabledevent; it is triggered when the wifi has been turned on. -
WifiManager.ondisabled -
A handler for the
disabledevent; it is triggered when the wifi has been turned off. -
WifiManager.onstatuschange -
A handler for the
statuschangeevent; the event object is aMozWifiStatusChangeEventinstance. -
WifiManager.connectionInfoUpdate -
A handler for the
connectionInfoUpdateevent; triggered any time the connection information changes. The event object is aMozWifiConnectionInfoEventinstance.
Methods
-
WifiManager.associate() -
Allows to associate (and connect) a device with a given network. Returns a
DOMRequest. -
WifiManager.forget() -
Allows to make a device no longer associate with a given network. Returns a
DOMRequest. -
WifiManager.getKnownNetworks() -
Allows to retrieve the list of all the networks the device was associated with. Returns a
DOMRequest. -
WifiManager.getNetworks() -
Allows to retrieve the list of all the networks available in the area surrounding the device. Returns a
DOMRequest. -
WifiManager.setPowerSavingMode() -
Allows the wifi adapter to enter/exit power saving mode. Returns a
DOMRequest. -
WifiManager.setStaticIpMode() -
Allows to configure a static IP address for the device on a given network. Returns a
DOMRequest. -
WifiManager.wps() -
Allows to connect the device to a network using the network's WPS capability (if any). Returns a
DOMRequest.
Specification
Not part of any specification
See also
navigator.mozWifiManagerMozWifiConnectionInfoEventMozWifiStatusChangeEvent- The WiFi Information API aticle
- Pages with the tag WiFi