2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-12-06 06:14:55 -08:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
2012-03-14 13:39:15 -07:00
|
|
|
#include "nsIDOMDOMRequest.idl"
|
|
|
|
#include "nsIDOMEvent.idl"
|
2012-02-16 06:00:53 -08:00
|
|
|
|
2012-06-16 11:14:12 -07:00
|
|
|
interface nsIVariant;
|
|
|
|
|
2012-09-13 00:19:26 -07:00
|
|
|
[scriptable, uuid(335ff8a0-fb18-11e1-a21f-0800200c9a66)]
|
2012-06-16 11:14:12 -07:00
|
|
|
interface nsIWifi : nsISupports
|
|
|
|
{
|
2012-03-20 06:57:07 -07:00
|
|
|
/**
|
|
|
|
* Shutdown the wifi system.
|
|
|
|
*/
|
|
|
|
void shutdown();
|
2011-12-06 06:14:55 -08:00
|
|
|
};
|
2012-03-14 13:39:15 -07:00
|
|
|
|
2012-09-27 11:18:34 -07:00
|
|
|
[scriptable, uuid(caa76ee3-8ffe-4ea5-bc59-3b53a9df0d07)]
|
2012-06-16 11:14:12 -07:00
|
|
|
interface nsIDOMWifiManager : nsISupports
|
|
|
|
{
|
2012-03-14 13:39:15 -07:00
|
|
|
/**
|
2012-09-27 11:18:34 -07:00
|
|
|
* Returns the list of currently available networks.
|
2012-03-14 13:39:15 -07:00
|
|
|
* onsuccess: We have obtained the current list of networks. request.value
|
|
|
|
* is an object whose property names are SSIDs and values are
|
|
|
|
* network objects.
|
|
|
|
* onerror: We were unable to obtain a list of property names.
|
|
|
|
*/
|
|
|
|
nsIDOMDOMRequest getNetworks();
|
|
|
|
|
2012-09-27 11:18:34 -07:00
|
|
|
/**
|
|
|
|
* Returns the list of networks known to the system that will be
|
|
|
|
* automatically connected to if they're in range.
|
|
|
|
* onsuccess: request.value is an object whose property names are
|
|
|
|
* SSIDs and values are network objects.
|
|
|
|
* onerror: We were unable to obtain a list of known networks.
|
|
|
|
*/
|
|
|
|
nsIDOMDOMRequest getKnownNetworks();
|
|
|
|
|
2012-03-14 13:39:15 -07:00
|
|
|
/**
|
|
|
|
* Takes one of the networks returned from getNetworks and tries to
|
|
|
|
* connect to it.
|
|
|
|
* @param network A network object with information about the network,
|
|
|
|
* such as the SSID, key management desired, etc.
|
|
|
|
* onsuccess: We have started attempting to associate with the network.
|
|
|
|
* request.value is true.
|
|
|
|
* onerror: We were unable to select the network. This most likely means a
|
|
|
|
* configuration error.
|
|
|
|
*/
|
|
|
|
nsIDOMDOMRequest associate(in jsval network);
|
|
|
|
|
2012-03-26 09:27:10 -07:00
|
|
|
/**
|
|
|
|
* Given a network, removes it from the list of networks that we'll
|
|
|
|
* automatically connect to. In order to re-connect to the network, it is
|
|
|
|
* necessary to call associate on it.
|
|
|
|
* @param network A network object with the SSID of the network to remove.
|
|
|
|
* onsuccess: We have removed this network. If we were previously
|
|
|
|
* connected to it, we have started reconnecting to the next
|
|
|
|
* network in the list.
|
|
|
|
* onerror: We were unable to remove the network.
|
|
|
|
*/
|
|
|
|
nsIDOMDOMRequest forget(in jsval network);
|
|
|
|
|
2012-08-16 15:19:51 -07:00
|
|
|
/**
|
|
|
|
* Wi-Fi Protected Setup functionality.
|
|
|
|
* @param detail WPS detail which has 'method' and 'pin' field.
|
|
|
|
* The possible method field values are:
|
|
|
|
* - pbc: The Push Button Configuration.
|
|
|
|
* - pin: The PIN configuration.
|
|
|
|
* - cancel: Request to cancel WPS in progress.
|
|
|
|
* If method field is 'pin', 'pin' field can exist and has
|
|
|
|
* a PIN number.
|
|
|
|
* onsuccess: We have successfully started/canceled wps.
|
|
|
|
* onerror: We have failed to start/cancel wps.
|
|
|
|
*/
|
|
|
|
nsIDOMDOMRequest wps(in jsval detail);
|
|
|
|
|
2012-09-18 00:03:46 -07:00
|
|
|
/**
|
|
|
|
* Turn on/off wifi power saving mode.
|
|
|
|
* @param enabled true or false.
|
|
|
|
* onsuccess: We have successfully turn on/off wifi power saving mode.
|
|
|
|
* onerror: We have failed to turn on/off wifi power saving mode.
|
|
|
|
*/
|
|
|
|
nsIDOMDOMRequest setPowerSavingMode(in boolean enabled);
|
|
|
|
|
2012-03-14 13:39:15 -07:00
|
|
|
/**
|
|
|
|
* Returns whether or not wifi is currently enabled.
|
|
|
|
*/
|
|
|
|
readonly attribute boolean enabled;
|
|
|
|
|
2012-09-27 11:14:06 -07:00
|
|
|
/**
|
|
|
|
* Returns the MAC address of the wifi adapter.
|
|
|
|
*/
|
|
|
|
readonly attribute DOMString macAddress;
|
|
|
|
|
2012-03-14 13:39:15 -07:00
|
|
|
/**
|
2012-04-08 20:32:17 -07:00
|
|
|
* An non-null object containing the following information:
|
|
|
|
* - status ("disconnected", "connecting", "associated", "connected")
|
|
|
|
* - network
|
|
|
|
*
|
|
|
|
* Note that the object returned is read only. Any changes required must
|
|
|
|
* be done by calling other APIs.
|
2012-03-14 13:39:15 -07:00
|
|
|
*/
|
2012-04-08 20:32:17 -07:00
|
|
|
readonly attribute jsval connection;
|
2012-03-14 13:39:15 -07:00
|
|
|
|
2012-03-26 09:26:32 -07:00
|
|
|
/**
|
|
|
|
* A connectionInformation object with the same information found in an
|
2012-06-16 11:14:12 -07:00
|
|
|
* nsIDOMMozWifiConnectionInfoEvent (but without the network).
|
2012-03-26 09:26:32 -07:00
|
|
|
* If we are not currently connected to a network, this will be null.
|
|
|
|
*/
|
|
|
|
readonly attribute jsval connectionInformation;
|
|
|
|
|
2012-03-14 13:39:15 -07:00
|
|
|
/**
|
2012-04-13 02:07:54 -07:00
|
|
|
* State notification listeners. These all take an
|
2012-06-16 11:14:12 -07:00
|
|
|
* nsIDOMMozWifiStatusChangeEvent with the new status and a network (which
|
2012-04-13 02:07:54 -07:00
|
|
|
* may be null).
|
|
|
|
*
|
|
|
|
* The possible statuses are:
|
|
|
|
* - connecting: Fires when we start the process of connecting to a
|
|
|
|
* network.
|
|
|
|
* - associated: Fires when we have connected to an access point but do
|
|
|
|
* not yet have an IP address.
|
|
|
|
* - connected: Fires once we are fully connected to an access point and
|
|
|
|
* can access the internet.
|
|
|
|
* - disconnected: Fires when we either fail to connect to an access
|
|
|
|
* point (transition: associated -> disconnected) or
|
|
|
|
* when we were connected to a network but have
|
|
|
|
* disconnected for any reason (transition: connected ->
|
|
|
|
* disconnected).
|
2012-03-14 13:39:15 -07:00
|
|
|
*/
|
2012-06-16 11:14:12 -07:00
|
|
|
attribute nsIDOMEventListener onstatuschange;
|
2012-03-26 09:26:32 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* An event listener that is called with information about the signal
|
|
|
|
* strength and link speed every 5 seconds.
|
|
|
|
*/
|
2012-06-16 11:14:12 -07:00
|
|
|
attribute nsIDOMEventListener connectionInfoUpdate;
|
2012-06-28 03:01:51 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* These two events fire when the wifi system is brought online or taken
|
|
|
|
* offline.
|
|
|
|
*/
|
|
|
|
attribute nsIDOMEventListener onenabled;
|
|
|
|
attribute nsIDOMEventListener ondisabled;
|
2012-03-14 13:39:15 -07:00
|
|
|
};
|
|
|
|
|
2012-08-04 00:44:00 -07:00
|
|
|
[scriptable, builtinclass, uuid(f3ef70b0-b2d3-4eb5-8ea4-008f8d330cd6)]
|
2012-06-16 11:14:12 -07:00
|
|
|
interface nsIDOMMozWifiStatusChangeEvent : nsIDOMEvent
|
|
|
|
{
|
2012-03-14 13:39:15 -07:00
|
|
|
/**
|
|
|
|
* Network object with a SSID field describing the network affected by
|
2012-04-13 02:07:54 -07:00
|
|
|
* this change. This might be null.
|
2012-03-14 13:39:15 -07:00
|
|
|
*/
|
2012-06-16 11:14:12 -07:00
|
|
|
readonly attribute nsIVariant network;
|
2012-04-13 02:07:54 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* String describing the current status of the wifi manager. See above for
|
|
|
|
* the possible values.
|
|
|
|
*/
|
2012-06-16 11:14:12 -07:00
|
|
|
readonly attribute DOMString status;
|
|
|
|
|
|
|
|
[noscript] void initMozWifiStatusChangeEvent(in DOMString aType,
|
|
|
|
in boolean aCanBubble,
|
|
|
|
in boolean aCancelable,
|
|
|
|
in nsIVariant aNetwork,
|
|
|
|
in DOMString status);
|
2012-03-14 13:39:15 -07:00
|
|
|
};
|
2012-03-26 09:26:32 -07:00
|
|
|
|
2012-09-27 11:14:06 -07:00
|
|
|
[scriptable, builtinclass, uuid(1717f9d9-5fd8-43d8-a098-55924c6d37de)]
|
2012-06-16 11:14:12 -07:00
|
|
|
interface nsIDOMMozWifiConnectionInfoEvent : nsIDOMEvent
|
|
|
|
{
|
2012-03-26 09:26:32 -07:00
|
|
|
/**
|
|
|
|
* Network object with an SSID field.
|
|
|
|
*/
|
2012-06-16 11:14:12 -07:00
|
|
|
readonly attribute nsIVariant network;
|
2012-03-26 09:26:32 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Strength of the signal to network, in dBm between -55 and -100 dBm.
|
|
|
|
*/
|
|
|
|
readonly attribute short signalStrength;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Relative signal strength between 0 and 100.
|
|
|
|
*/
|
|
|
|
readonly attribute short relSignalStrength;
|
|
|
|
|
|
|
|
/**
|
2012-06-16 11:14:12 -07:00
|
|
|
* Link speed in Mb/s.
|
2012-03-26 09:26:32 -07:00
|
|
|
*/
|
|
|
|
readonly attribute long linkSpeed;
|
2012-06-16 11:14:12 -07:00
|
|
|
|
2012-09-27 11:14:06 -07:00
|
|
|
/**
|
|
|
|
* IP address in the dotted quad format.
|
|
|
|
*/
|
|
|
|
readonly attribute DOMString ipAddress;
|
|
|
|
|
2012-06-16 11:14:12 -07:00
|
|
|
[noscript] void initMozWifiConnectionInfoEvent(in DOMString aType,
|
|
|
|
in boolean aCanBubble,
|
|
|
|
in boolean aCancelable,
|
|
|
|
in nsIVariant aNetwork,
|
|
|
|
in short signalStrength,
|
|
|
|
in short relSignalStrength,
|
2012-09-27 11:14:06 -07:00
|
|
|
in long linkSpeed,
|
|
|
|
in DOMString ipAddress);
|
2012-03-26 09:26:32 -07:00
|
|
|
};
|