This repository has been archived by the owner on Apr 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 305
/
nsIWifi.idl
188 lines (164 loc) · 6.69 KB
/
nsIWifi.idl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/* 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/. */
#include "nsISupports.idl"
#include "nsIDOMDOMRequest.idl"
#include "nsIDOMEvent.idl"
interface nsIVariant;
[scriptable, uuid(cf1ac02b-1f39-446e-815b-651ac78d2233)]
interface nsIWifiScanResult : nsISupports {
readonly attribute DOMString ssid;
readonly attribute DOMString bssid;
const int32_t WPA_PSK = 0x01;
const int32_t WPA_EAP = 0x02;
const int32_t WEP = 0x04;
readonly attribute uint32_t capabilities;
/**
* Strength of the signal to network.
*/
readonly attribute uint32_t signalStrength;
readonly attribute uint32_t relSignalStrength;
readonly attribute boolean connected;
};
[scriptable, uuid(a6931ebf-8493-4014-90e2-99f406999982)]
interface nsIWifiScanResultsReady : nsISupports {
/**
* Callback with list of networks.
*/
void onready(in uint32_t count, [array, size_is(count)] in nsIWifiScanResult results);
/**
* Callback if scanning for networks failed after 3 retry attempts.
*/
void onfailure();
};
[scriptable, uuid(08dfefed-5c5d-4468-8c5d-2c65c24692d9)]
interface nsIWifi : nsISupports
{
/**
* Shutdown the wifi system.
*/
void shutdown();
/**
* Returns the list of currently available networks as well as the list of
* currently configured networks.
*
* On success a callback is notified with the list of networks.
* On failure after 3 scan retry attempts a callback is notified of failure.
*/
void getWifiScanResults(in nsIWifiScanResultsReady callback);
};
[scriptable, uuid(caa76ee3-8ffe-4ea5-bc59-3b53a9df0d07)]
interface nsIDOMWifiManager : nsISupports
{
/**
* Returns the list of currently available 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();
/**
* 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();
/**
* 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);
/**
* 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);
/**
* 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);
/**
* 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);
/**
* Returns whether or not wifi is currently enabled.
*/
readonly attribute boolean enabled;
/**
* Returns the MAC address of the wifi adapter.
*/
readonly attribute DOMString macAddress;
/**
* 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.
*/
readonly attribute jsval connection;
/**
* A connectionInformation object with the same information found in an
* nsIDOMMozWifiConnectionInfoEvent (but without the network).
* If we are not currently connected to a network, this will be null.
*/
readonly attribute jsval connectionInformation;
/**
* State notification listeners. These all take an
* nsIDOMMozWifiStatusChangeEvent with the new status and a network (which
* 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).
*/
attribute nsIDOMEventListener onstatuschange;
/**
* An event listener that is called with information about the signal
* strength and link speed every 5 seconds.
*/
attribute nsIDOMEventListener connectionInfoUpdate;
/**
* These two events fire when the wifi system is brought online or taken
* offline.
*/
attribute nsIDOMEventListener onenabled;
attribute nsIDOMEventListener ondisabled;
};