2011-12-06 18:14:55 +04:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is Telephony.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* the Mozilla Foundation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2011
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
2012-02-16 18:00:53 +04:00
|
|
|
* Blake Kaplan <mrbkap@gmail.com>
|
2011-12-06 18:14:55 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
2012-03-15 00:39:15 +04:00
|
|
|
#include "nsIDOMDOMRequest.idl"
|
|
|
|
#include "nsIDOMEvent.idl"
|
2012-02-16 18:00:53 +04:00
|
|
|
|
2012-03-20 17:57:07 +04:00
|
|
|
[scriptable, uuid(abb936bc-ba81-4c23-8dfa-3e5d96557044)]
|
2011-12-06 18:14:55 +04:00
|
|
|
interface nsIWifi : nsISupports {
|
2012-03-20 17:57:07 +04:00
|
|
|
/**
|
|
|
|
* Shutdown the wifi system.
|
|
|
|
*/
|
|
|
|
void shutdown();
|
2011-12-06 18:14:55 +04:00
|
|
|
};
|
2012-03-15 00:39:15 +04:00
|
|
|
|
2012-03-26 20:26:32 +04:00
|
|
|
[scriptable, uuid(7df14510-f58b-4c9a-9e35-a39a94255941)]
|
2012-03-15 00:39:15 +04:00
|
|
|
interface nsIDOMWifiManager : nsISupports {
|
|
|
|
/**
|
|
|
|
* TODO Remove in favor of a settings API.
|
|
|
|
* Activates or disactivates wifi.
|
|
|
|
* onsuccess: Wifi has been successfully activated and can start
|
|
|
|
* attempting to connect to networks. request.value will be true.
|
|
|
|
* onerror: Wifi was not successfully activated. (TODO provide details!)
|
|
|
|
*/
|
|
|
|
nsIDOMDOMRequest setEnabled(in boolean enabled);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the list of currently available networks as well as the list of
|
|
|
|
* currently configured networks.
|
|
|
|
* 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();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TODO Remove in favor of a settings API.
|
|
|
|
* Returns whether or not wifi is currently enabled.
|
|
|
|
*/
|
|
|
|
readonly attribute boolean enabled;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A network object describing the currently connected network.
|
|
|
|
*/
|
|
|
|
readonly attribute jsval connectedNetwork;
|
|
|
|
|
2012-03-26 20:26:32 +04:00
|
|
|
/**
|
|
|
|
* A connectionInformation object with the same information found in an
|
|
|
|
* nsIDOMWifiConnectionInfoEvent (but without the network).
|
|
|
|
* If we are not currently connected to a network, this will be null.
|
|
|
|
*/
|
|
|
|
readonly attribute jsval connectionInformation;
|
|
|
|
|
2012-03-15 00:39:15 +04:00
|
|
|
/**
|
2012-03-20 19:31:10 +04:00
|
|
|
* These four functions serve as state notification listeners.
|
|
|
|
* onconnecting: Fires when we start the process of connecting to a
|
|
|
|
* network.
|
2012-03-15 00:39:15 +04:00
|
|
|
* onassociate: Fires when we have connected to an access point but do not
|
|
|
|
* yet have an IP address.
|
|
|
|
* onconnect: Fires once we are fully connected to an access point and can
|
|
|
|
* access the internet.
|
|
|
|
* ondisconnect: Fires when we either fail to connect to an access point
|
|
|
|
* (transition: onassociate -> ondisconnect) or when we were
|
|
|
|
* connected to a network but have disconnected for any
|
|
|
|
* reason (transition: onconnect -> ondisconnect).
|
|
|
|
*/
|
2012-03-20 19:31:10 +04:00
|
|
|
attribute nsIDOMEventListener onconnecting;
|
2012-03-15 00:39:15 +04:00
|
|
|
attribute nsIDOMEventListener onassociate;
|
|
|
|
attribute nsIDOMEventListener onconnect;
|
|
|
|
attribute nsIDOMEventListener ondisconnect;
|
2012-03-26 20:26:32 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* An event listener that is called with information about the signal
|
|
|
|
* strength and link speed every 5 seconds.
|
|
|
|
*/
|
|
|
|
attribute nsIDOMEventListener connectionInfoUpdate;
|
2012-03-15 00:39:15 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
[scriptable, uuid(4674c6f1-ea64-44db-ac2f-e7bd6514dfd6)]
|
|
|
|
interface nsIDOMWifiStateChangeEvent : nsIDOMEvent {
|
|
|
|
/**
|
|
|
|
* Network object with a SSID field describing the network affected by
|
|
|
|
* this change.
|
|
|
|
*/
|
|
|
|
readonly attribute jsval network;
|
|
|
|
};
|
2012-03-26 20:26:32 +04:00
|
|
|
|
|
|
|
[scriptable, uuid(5c9ee332-dd98-4227-b7fc-768418fd50e3)]
|
|
|
|
interface nsIDOMWifiConnectionInfoEvent : nsIDOMEvent {
|
|
|
|
/**
|
|
|
|
* Network object with an SSID field.
|
|
|
|
*/
|
|
|
|
readonly attribute jsval network;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Link spead in Mb/s.
|
|
|
|
*/
|
|
|
|
readonly attribute long linkSpeed;
|
|
|
|
};
|