WifiManager

  • Revision slug: Web/API/WifiManager
  • Revision title: WifiManager
  • Revision id: 466893
  • Created:
  • Creator: Jeremie
  • Is current revision? No
  • Comment

Revision Content

{{ non-standard_header() }}

{{ B2GOnlyHeader2('certified') }}

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

{{domxref("WifiManager.enabled")}} {{readonlyinline}}
A boolean Indicating whether the wifi is on (true) or off (false)
{{domxref("WifiManager.macAddress")}} {{readonlyinline}}
A string representing the wifi adapter's MAC address
{{domxref("WifiManager.connection")}} {{readonlyinline}}
An object providing information about the current connection (status and network in use)
{{domxref("WifiManager.connectionInformation")}} {{readonlyinline}}
An object provinding extra information about the current connection or null if the device is not connected to the Wifi.

Event handlers

{{domxref("WifiManager.onenabled")}}
A handler for the {{event("enabled")}} event; It is triggered when the wifi has been turned on.
{{domxref("WifiManager.ondisabled")}}
A handler for the {{event("disabled")}} event; It is triggered when the wifi has been turned off.
{{domxref("WifiManager.onstatuschange")}}
A handler for the {{event("statuschange")}} event; The event object is a {{domxref("MozWifiStatusChangeEvent")}} instance.
{{domxref("WifiManager.connectionInfoUpdate")}}
A handler for the {{event("connectionInfoUpdate")}} event; Triggered any time the connection information changes. The event object is a {{domxref("MozWifiConnectionInfoEvent")}} instance.

Methods

{{domxref("WifiManager.associate()")}}
Allows to associate (and connect) a device with a given network. Returns a {{domxref("DOMRequest")}}
{{domxref("WifiManager.forget()")}}
Allows to make a device no longer associate with a given network. Returns a {{domxref("DOMRequest")}}
{{domxref("WifiManager.getKnownNetworks()")}}
Allows to retrieve the list of all the networks the device was associate with. Returns a {{domxref("DOMRequest")}}
{{domxref("WifiManager.getNetworks()")}}
Allows to retrieve the liste of all the networks available in the area surrounding the device. Returns a {{domxref("DOMRequest")}}
{{domxref("WifiManager.setPowerSavingMode()")}}
Allows the WiFi adapter to enter/exit power saving mode. Returns a {{domxref("DOMRequest")}}
{{domxref("WifiManager.setStaticIpMode()")}}
Allows to configure a static IP address for the device on a given network. Returns a {{domxref("DOMRequest")}}
{{domxref("WifiManager.wps()")}}
Allows to connect the device to a network using the network's WPS capability (if any). Returns a {{domxref("DOMRequest")}}

Specification

Not part of any specification

See also

  • {{domxref("window.navigator.mozWifiManager","navigator.mozWifiManager")}}
  • {{domxref("MozWifiConnectionInfoEvent")}}
  • {{domxref("MozWifiStatusChangeEvent")}}
  • The WiFi Information API aticle
  • Pages with the tag {{Tag("WiFi")}}

Revision Source

<p>{{ non-standard_header() }}</p>
<p>{{ B2GOnlyHeader2('certified') }}</p>
<h2 id="Summary">Summary</h2>
<p>The WifiManager API provides access to the wifi device capability.</p>
<h2 id="Interface">Interface</h2>
<pre>
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)
};
</pre>
<h2 id="Properties">Properties</h2>
<dl>
  <dt>
    {{domxref("WifiManager.enabled")}} {{readonlyinline}}</dt>
  <dd>
    A boolean Indicating whether the wifi is on (<code>true</code>) or off (<code>false</code>)</dd>
  <dt>
    {{domxref("WifiManager.macAddress")}} {{readonlyinline}}</dt>
  <dd>
    A string representing the wifi adapter's <a href="http://en.wikipedia.org/wiki/MAC_address" title="http://en.wikipedia.org/wiki/MAC_address">MAC address</a></dd>
  <dt>
    {{domxref("WifiManager.connection")}} {{readonlyinline}}</dt>
  <dd>
    An object providing information about the current connection (status and network in use)</dd>
  <dt>
    {{domxref("WifiManager.connectionInformation")}} {{readonlyinline}}</dt>
  <dd>
    An object provinding extra information about the current connection or <code>null</code> if the device is not connected to the Wifi.</dd>
</dl>
<h3 id="Event_handlers">Event handlers</h3>
<dl>
  <dt>
    {{domxref("WifiManager.onenabled")}}</dt>
  <dd>
    A handler for the {{event("enabled")}} event; It is triggered when the wifi has been turned on.</dd>
  <dt>
    {{domxref("WifiManager.ondisabled")}}</dt>
  <dd>
    A handler for the {{event("disabled")}} event; It is triggered when the wifi has been turned off.</dd>
  <dt>
    {{domxref("WifiManager.onstatuschange")}}</dt>
  <dd>
    A handler for the {{event("statuschange")}} event; The event object is a {{domxref("MozWifiStatusChangeEvent")}} instance.</dd>
  <dt>
    {{domxref("WifiManager.connectionInfoUpdate")}}</dt>
  <dd>
    A handler for the {{event("connectionInfoUpdate")}} event; Triggered any time the connection information changes. The event object is a {{domxref("MozWifiConnectionInfoEvent")}} instance.</dd>
</dl>
<h2 id="Methods">Methods</h2>
<dl>
  <dt>
    {{domxref("WifiManager.associate()")}}</dt>
  <dd>
    Allows to associate (and connect) a device with a given network. Returns a {{domxref("DOMRequest")}}</dd>
  <dt>
    {{domxref("WifiManager.forget()")}}</dt>
  <dd>
    Allows to make a device no longer associate with a given network. Returns a {{domxref("DOMRequest")}}</dd>
  <dt>
    {{domxref("WifiManager.getKnownNetworks()")}}</dt>
  <dd>
    Allows to retrieve the list of all the networks the device was associate with. Returns a {{domxref("DOMRequest")}}</dd>
  <dt>
    {{domxref("WifiManager.getNetworks()")}}</dt>
  <dd>
    Allows to retrieve the liste of all the networks available in the area surrounding the device. Returns a {{domxref("DOMRequest")}}</dd>
  <dt>
    {{domxref("WifiManager.setPowerSavingMode()")}}</dt>
  <dd>
    Allows the WiFi adapter to enter/exit power saving mode. Returns a {{domxref("DOMRequest")}}</dd>
  <dt>
    {{domxref("WifiManager.setStaticIpMode()")}}</dt>
  <dd>
    Allows to configure a static IP address for the device on a given network. Returns a {{domxref("DOMRequest")}}</dd>
  <dt>
    {{domxref("WifiManager.wps()")}}</dt>
  <dd>
    Allows to connect the device to a network using the network's <a href="http://en.wikipedia.org/wiki/Wi-Fi_Protected_Setup" title="http://en.wikipedia.org/wiki/Wi-Fi_Protected_Setup">WPS</a> capability (if any). Returns a {{domxref("DOMRequest")}}</dd>
</dl>
<h2 id="Specification">Specification</h2>
<p>Not part of any specification</p>
<h2 id="See_also">See also</h2>
<ul>
  <li>{{domxref("window.navigator.mozWifiManager","navigator.mozWifiManager")}}</li>
  <li>{{domxref("MozWifiConnectionInfoEvent")}}</li>
  <li>{{domxref("MozWifiStatusChangeEvent")}}</li>
  <li>The <a href="/en-US/docs/WebAPI/WiFi_Information" title="/en-US/docs/WebAPI/WiFi_Information">WiFi Information API</a> aticle</li>
  <li>Pages with the tag {{Tag("WiFi")}}</li>
</ul>
Revert to this revision