dom/webidl/MozWifiManager.webidl

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:bbf3062231b7
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 enum WifiWPSMethod {
6 "pbc",
7 "pin",
8 "cancel"
9 };
10
11 enum ConnectionStatus {
12 "connecting",
13 "associated",
14 "connected",
15 "disconnected",
16 "wps-timeout",
17 "wps-failed",
18 "wps-overlapped",
19 "connectingfailed"
20 };
21
22 dictionary WifiWPSInfo {
23 WifiWPSMethod method;
24 DOMString? pin;
25 DOMString? bssid;
26 };
27
28 dictionary NetworkProperties {
29 DOMString ssid;
30 sequence<DOMString>? security;
31 sequence<DOMString>? capabilities;
32 boolean known;
33 boolean connected;
34 boolean hidden;
35 DOMString bssid;
36 DOMString signalStrength;
37 long relSignalStrength;
38 DOMString psk;
39 DOMString wep;
40 DOMString wep_key0;
41 DOMString wep_key1;
42 DOMString wep_key2;
43 DOMString wep_key3;
44 long wep_tx_keyidx;
45 long priority;
46 long scan_ssid;
47 DOMString keyManagement;
48 DOMString identity;
49 DOMString password;
50 DOMString auth_alg;
51 DOMString phase1;
52 DOMString phase2;
53 DOMString eap;
54 DOMString pin;
55 boolean dontConnect;
56 };
57
58 [Constructor(optional NetworkProperties properties),
59 JSImplementation="@mozilla.org/mozwifinetwork;1",
60 Func="Navigator::HasWifiManagerSupport"]
61 interface MozWifiNetwork {
62 readonly attribute DOMString ssid;
63 [Constant, Cached] readonly attribute sequence<DOMString>? security;
64 [Constant, Cached] readonly attribute sequence<DOMString>? capabilities;
65 readonly attribute boolean known;
66 readonly attribute boolean connected;
67 readonly attribute boolean hidden;
68
69 attribute DOMString? bssid;
70 attribute DOMString? signalStrength;
71 attribute long? relSignalStrength;
72 attribute DOMString? psk;
73 attribute DOMString? wep;
74 attribute DOMString? wep_key0;
75 attribute DOMString? wep_key1;
76 attribute DOMString? wep_key2;
77 attribute DOMString? wep_key3;
78 attribute long? wep_tx_keyidx;
79 attribute long? priority;
80 attribute long? scan_ssid;
81 attribute DOMString? keyManagement;
82 attribute DOMString? identity;
83 attribute DOMString? password;
84 attribute DOMString? auth_alg;
85 attribute DOMString? phase1;
86 attribute DOMString? phase2;
87 attribute DOMString? eap;
88 attribute DOMString? pin;
89 attribute boolean? dontConnect;
90 };
91
92 [JSImplementation="@mozilla.org/mozwificonnection;1",
93 ChromeOnly]
94 interface MozWifiConnection {
95 readonly attribute ConnectionStatus status;
96 readonly attribute MozWifiNetwork? network;
97 };
98
99 [JSImplementation="@mozilla.org/mozwificonnectioninfo;1",
100 ChromeOnly]
101 interface MozWifiConnectionInfo {
102 readonly attribute short signalStrength;
103 readonly attribute short relSignalStrength;
104 readonly attribute long linkSpeed;
105 readonly attribute DOMString? ipAddress;
106 };
107
108 dictionary IPConfiguration {
109 boolean enabled;
110 DOMString ipaddr;
111 DOMString proxy;
112 short maskLength;
113 DOMString gateway;
114 DOMString dns1;
115 DOMString dns2;
116 };
117
118 [JSImplementation="@mozilla.org/wifimanager;1",
119 NavigatorProperty="mozWifiManager",
120 Func="Navigator::HasWifiManagerSupport"]
121 interface MozWifiManager : EventTarget {
122 /**
123 * Returns the list of currently available networks.
124 * onsuccess: We have obtained the current list of networks. request.value
125 * is an object whose property names are SSIDs and values are
126 * network objects.
127 * onerror: We were unable to obtain a list of property names.
128 */
129 DOMRequest getNetworks();
130
131 /**
132 * Returns the list of networks known to the system that will be
133 * automatically connected to if they're in range.
134 * onsuccess: request.value is an object whose property names are
135 * SSIDs and values are network objects.
136 * onerror: We were unable to obtain a list of known networks.
137 */
138 DOMRequest getKnownNetworks();
139
140 /**
141 * Takes one of the networks returned from getNetworks and tries to
142 * connect to it.
143 * @param network A network object with information about the network,
144 * such as the SSID, key management desired, etc.
145 * onsuccess: We have started attempting to associate with the network.
146 * request.value is true.
147 * onerror: We were unable to select the network. This most likely means a
148 * configuration error.
149 */
150 DOMRequest associate(MozWifiNetwork network);
151
152 /**
153 * Given a network, removes it from the list of networks that we'll
154 * automatically connect to. In order to re-connect to the network, it is
155 * necessary to call associate on it.
156 * @param network A network object with the SSID of the network to remove.
157 * onsuccess: We have removed this network. If we were previously
158 * connected to it, we have started reconnecting to the next
159 * network in the list.
160 * onerror: We were unable to remove the network.
161 */
162 DOMRequest forget(MozWifiNetwork network);
163
164 /**
165 * Wi-Fi Protected Setup functionality.
166 * @param detail WPS detail which has 'method' and 'pin' field.
167 * The possible method field values are:
168 * - pbc: The Push Button Configuration.
169 * - pin: The PIN configuration.
170 * - cancel: Request to cancel WPS in progress.
171 * If method field is 'pin', 'pin' field can exist and has
172 * a PIN number.
173 * If method field is 'pin', 'bssid' field can exist and has
174 * a opposite BSSID.
175 * onsuccess: We have successfully started/canceled wps.
176 * onerror: We have failed to start/cancel wps.
177 */
178 DOMRequest wps(optional WifiWPSInfo detail);
179
180 /**
181 * Turn on/off wifi power saving mode.
182 * @param enabled true or false.
183 * onsuccess: We have successfully turn on/off wifi power saving mode.
184 * onerror: We have failed to turn on/off wifi power saving mode.
185 */
186 DOMRequest setPowerSavingMode(boolean enabled);
187
188 /**
189 * Given a network, configure using static IP instead of running DHCP
190 * @param network A network object with the SSID of the network to set static ip.
191 * @param info info should have following field:
192 * - enabled True to enable static IP, false to use DHCP
193 * - ipaddr configured static IP address
194 * - proxy configured proxy server address
195 * - maskLength configured mask length
196 * - gateway configured gateway address
197 * - dns1 configured first DNS server address
198 * - dns2 configured seconf DNS server address
199 * onsuccess: We have successfully configure the static ip mode.
200 * onerror: We have failed to configure the static ip mode.
201 */
202 DOMRequest setStaticIpMode(MozWifiNetwork network, optional IPConfiguration info);
203
204 /**
205 * Given a network, configure http proxy when using wifi.
206 * @param network A network object with the SSID of the network to set http proxy.
207 * @param info info should have following field:
208 * - httpProxyHost ip address of http proxy.
209 * - httpProxyPort port of http proxy, set 0 to use default port 8080.
210 * set info to null to clear http proxy.
211 * onsuccess: We have successfully configure http proxy.
212 * onerror: We have failed to configure http proxy.
213 */
214 DOMRequest setHttpProxy(MozWifiNetwork network, any info);
215
216 /**
217 * Returns whether or not wifi is currently enabled.
218 */
219 readonly attribute boolean enabled;
220
221 /**
222 * Returns the MAC address of the wifi adapter.
223 */
224 readonly attribute DOMString macAddress;
225
226 /**
227 * An non-null object containing the following information:
228 * - status ("disconnected", "connecting", "associated", "connected")
229 * - network
230 *
231 * Note that the object returned is read only. Any changes required must
232 * be done by calling other APIs.
233 */
234 readonly attribute MozWifiConnection connection;
235
236 /**
237 * A connectionInformation object with the same information found in an
238 * nsIDOMMozWifiConnectionInfoEvent (but without the network).
239 * If we are not currently connected to a network, this will be null.
240 */
241 readonly attribute MozWifiConnectionInfo? connectionInformation;
242
243 /**
244 * State notification listeners. These all take an
245 * nsIDOMMozWifiStatusChangeEvent with the new status and a network (which
246 * may be null).
247 *
248 * The possible statuses are:
249 * - connecting: Fires when we start the process of connecting to a
250 * network.
251 * - associated: Fires when we have connected to an access point but do
252 * not yet have an IP address.
253 * - connected: Fires once we are fully connected to an access point and
254 * can access the internet.
255 * - disconnected: Fires when we either fail to connect to an access
256 * point (transition: associated -> disconnected) or
257 * when we were connected to a network but have
258 * disconnected for any reason (transition: connected ->
259 * disconnected).
260 */
261 attribute EventHandler onstatuschange;
262
263 /**
264 * An event listener that is called with information about the signal
265 * strength and link speed every 5 seconds.
266 */
267 attribute EventHandler onconnectionInfoUpdate;
268
269 /**
270 * These two events fire when the wifi system is brought online or taken
271 * offline.
272 */
273 attribute EventHandler onenabled;
274 attribute EventHandler ondisabled;
275 };

mercurial