1/*
2 * Copyright 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.wifi.supplicant@1.0;
18
19import ISupplicantIface;
20import ISupplicantStaIfaceCallback;
21
22/**
23 * Interface exposed by the supplicant for each station mode network
24 * interface (e.g wlan0) it controls.
25 */
26interface ISupplicantStaIface extends ISupplicantIface {
27  /**
28   * Access Network Query Protocol info ID elements
29   * for IEEE Std 802.11u-2011.
30   */
31  enum AnqpInfoId : uint16_t {
32    VENUE_NAME = 258,
33    ROAMING_CONSORTIUM = 261,
34    IP_ADDR_TYPE_AVAILABILITY = 262,
35    NAI_REALM = 263,
36    ANQP_3GPP_CELLULAR_NETWORK = 264,
37    DOMAIN_NAME = 268
38  };
39
40  /**
41   * Access Network Query Protocol subtype elements
42   * for Hotspot 2.0.
43   */
44  enum Hs20AnqpSubtypes : uint32_t {
45    OPERATOR_FRIENDLY_NAME = 3,
46    WAN_METRICS = 4,
47    CONNECTION_CAPABILITY = 5,
48    OSU_PROVIDERS_LIST = 8,
49  };
50
51  /**
52   * Enum describing the types of RX filter supported
53   * via driver commands.
54   */
55  enum RxFilterType : uint8_t {
56    V4_MULTICAST = 0,
57    V6_MULTICAST = 1
58  };
59
60  /**
61   * Enum describing the modes of BT coexistence supported
62   * via driver commands.
63   */
64  enum BtCoexistenceMode : uint8_t {
65    ENABLED = 0,
66    DISABLED = 1,
67    SENSE = 2
68  };
69
70  enum ExtRadioWorkDefaults : uint32_t {
71    TIMEOUT_IN_SECS = 10
72  };
73
74  /**
75   * Register for callbacks from this interface.
76   *
77   * These callbacks are invoked for events that are specific to this interface.
78   * Registration of multiple callback objects is supported. These objects must
79   * be automatically deleted when the corresponding client process is dead or
80   * if this interface is removed.
81   *
82   * @param callback An instance of the |ISupplicantStaIfaceCallback| HIDL
83   *        interface object.
84   * @return status Status of the operation.
85   *         Possible status codes:
86   *         |SupplicantStatusCode.SUCCESS|,
87   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
88   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
89   */
90  registerCallback(ISupplicantStaIfaceCallback callback)
91      generates (SupplicantStatus status);
92
93  /**
94   * Reconnect to the currently active network, even if we are already
95   * connected.
96   *
97   * @return status Status of the operation.
98   *         Possible status codes:
99   *         |SupplicantStatusCode.SUCCESS|,
100   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
101   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|,
102   *         |SupplicantStatusCode.FAILURE_IFACE_DISABLED|
103   */
104  reassociate() generates (SupplicantStatus status);
105
106  /**
107   * Reconnect to the currently active network, if we are currently
108   * disconnected.
109   *
110   * @return status Status of the operation.
111   *         Possible status codes:
112   *         |SupplicantStatusCode.SUCCESS|,
113   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
114   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|,
115   *         |SupplicantStatusCode.FAILURE_IFACE_DISABLED|,
116   *         |SupplicantStatusCode.FAILURE_IFACE_NOT_DISCONNECTED|
117   */
118  reconnect() generates (SupplicantStatus status);
119
120  /**
121   * Disconnect from the current active network.
122   *
123   * @return status Status of the operation.
124   *         Possible status codes:
125   *         |SupplicantStatusCode.SUCCESS|,
126   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
127   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|,
128   *         |SupplicantStatusCode.FAILURE_IFACE_DISABLED|
129   */
130  disconnect() generates (SupplicantStatus status);
131
132  /**
133   * Turn on/off power save mode for the interface.
134   *
135   * @param enable Indicate if power save is to be turned on/off.
136   * @return status Status of the operation.
137   *         Possible status codes:
138   *         |SupplicantStatusCode.SUCCESS|,
139   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
140   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|,
141   *         |SupplicantStatusCode.FAILURE_IFACE_DISABLED|
142   */
143  setPowerSave(bool enable) generates (SupplicantStatus status);
144
145  /**
146   * Initiate TDLS discover with the provided peer MAC address.
147   *
148   * @param macAddress MAC address of the peer.
149   * @return status Status of the operation.
150   *         Possible status codes:
151   *         |SupplicantStatusCode.SUCCESS|,
152   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
153   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
154   */
155  initiateTdlsDiscover(MacAddress macAddress)
156      generates (SupplicantStatus status);
157
158  /**
159   * Initiate TDLS setup with the provided peer MAC address.
160   *
161   * @param macAddress MAC address of the peer.
162   * @return status Status of the operation.
163   *         Possible status codes:
164   *         |SupplicantStatusCode.SUCCESS|,
165   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
166   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
167   */
168  initiateTdlsSetup(MacAddress macAddress)
169      generates (SupplicantStatus status);
170
171  /**
172   * Initiate TDLS teardown with the provided peer MAC address.
173   *
174   * @param macAddress MAC address of the peer.
175   * @return status Status of the operation.
176   *         Possible status codes:
177   *         |SupplicantStatusCode.SUCCESS|,
178   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
179   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
180   */
181  initiateTdlsTeardown(MacAddress macAddress)
182      generates (SupplicantStatus status);
183
184  /**
185   * Initiate ANQP (for IEEE 802.11u Interworking/Hotspot 2.0) queries with the
186   * specified access point.
187   * The ANQP data fetched must be returned in the
188   * |ISupplicantStaIfaceCallback.onAnqpQueryDone| callback.
189   *
190   * @param macAddress MAC address of the access point.
191   * @param infoElements List of information elements to query for.
192   * @param subtypes List of HS20 subtypes to query for.
193   * @return status Status of the operation.
194   *         Possible status codes:
195   *         |SupplicantStatusCode.SUCCESS|,
196   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
197   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
198   */
199  initiateAnqpQuery(MacAddress macAddress,
200                    vec<AnqpInfoId> infoElements,
201                    vec<Hs20AnqpSubtypes> subTypes)
202      generates (SupplicantStatus status);
203
204  /**
205   * Initiate the Hotspot 2.0 icon query with the specified accesss point.
206   * The icon data fetched must be returned in the
207   * |ISupplicantStaIfaceCallback.onHs20IconQueryDone| callback.
208   *
209   * @param macAddress MAC address of the access point.
210   * @param fileName Name of the file to request from the access point.
211   * @return status Status of the operation.
212   *         Possible status codes:
213   *         |SupplicantStatusCode.SUCCESS|,
214   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
215   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
216   */
217  initiateHs20IconQuery(MacAddress macAddress, string fileName)
218      generates (SupplicantStatus status);
219
220  /**
221   * Send driver command to get MAC address of the device.
222   *
223   * @return status Status of the operation.
224   *         Possible status codes:
225   *         |SupplicantStatusCode.SUCCESS|,
226   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
227   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
228   * @return macAddr MAC address of the device.
229   */
230  getMacAddress()
231      generates (SupplicantStatus status, MacAddress macAddr);
232
233  /**
234   * Send driver command to start RX filter.
235   *
236   * @return status Status of the operation.
237   *         Possible status codes:
238   *         |SupplicantStatusCode.SUCCESS|,
239   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
240   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
241   */
242  startRxFilter() generates (SupplicantStatus status);
243
244  /**
245   * Send driver command to stop RX filter.
246   *
247   * @return status Status of the operation.
248   *         Possible status codes:
249   *         |SupplicantStatusCode.SUCCESS|,
250   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
251   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
252   */
253  stopRxFilter() generates (SupplicantStatus status);
254
255  /**
256   * Send driver command to add the specified RX filter.
257   *
258   * @param type Type of filter.
259   * @return status Status of the operation.
260   *         Possible status codes:
261   *         |SupplicantStatusCode.SUCCESS|,
262   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
263   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
264   */
265  addRxFilter(RxFilterType type)
266      generates (SupplicantStatus status);
267
268  /**
269   * Send driver command to remove the specified RX filter.
270   *
271   * @param type Type of filter.
272   * @return status Status of the operation.
273   *         Possible status codes:
274   *         |SupplicantStatusCode.SUCCESS|,
275   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
276   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
277   */
278  removeRxFilter(RxFilterType type)
279      generates (SupplicantStatus status);
280
281  /**
282   * Send driver command to set Bluetooth coexistence mode.
283   *
284   * @param mode Mode of Bluetooth coexistence.
285   * @return status Status of the operation.
286   *         Possible status codes:
287   *         |SupplicantStatusCode.SUCCESS|,
288   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
289   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
290   */
291  setBtCoexistenceMode(BtCoexistenceMode mode)
292      generates (SupplicantStatus status);
293
294  /**
295   * Send driver command to set Bluetooth coexistence scan mode.
296   * When this mode is on, some of the low-level scan parameters
297   * used by the driver are changed to reduce interference
298   * with A2DP streaming.
299   *
300   * @param enable true to enable, false to disable.
301   * @return status Status of the operation.
302   *         Possible status codes:
303   *         |SupplicantStatusCode.SUCCESS|,
304   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
305   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
306   */
307  setBtCoexistenceScanModeEnabled(bool enable)
308      generates (SupplicantStatus status);
309
310  /**
311   * Send driver command to set suspend optimizations for power save.
312   *
313   * @param enable true to enable, false to disable.
314   * @return status Status of the operation.
315   *         Possible status codes:
316   *         |SupplicantStatusCode.SUCCESS|,
317   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
318   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
319   */
320  setSuspendModeEnabled(bool enable)
321      generates (SupplicantStatus status);
322
323  /**
324   * Send driver command to set country code.
325   *
326   * @param code 2 byte country code (as defined in ISO 3166) to set.
327   * @return status Status of the operation.
328   *         Possible status codes:
329   *         |SupplicantStatusCode.SUCCESS|,
330   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
331   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
332   */
333  setCountryCode(int8_t[2] code)
334      generates (SupplicantStatus status);
335
336  /**
337   * Initiate WPS setup in registrar role to learn the current AP configuration.
338   *
339   * @param bssid BSSID of the AP.
340   * @param pin Pin of the AP.
341   * @return status Status of the operation.
342   *         Possible status codes:
343   *         |SupplicantStatusCode.SUCCESS|,
344   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
345   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
346   */
347  startWpsRegistrar(Bssid bssid, string pin)
348      generates (SupplicantStatus status);
349
350  /**
351   * Initiate WPS Push Button setup.
352   * The PBC operation requires that a button is also pressed at the
353   * AP/Registrar at about the same time (2 minute window).
354   *
355   * @param bssid BSSID of the AP. Use zero'ed bssid to indicate wildcard.
356   * @return status Status of the operation.
357   *         Possible status codes:
358   *         |SupplicantStatusCode.SUCCESS|,
359   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
360   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
361   */
362  startWpsPbc(Bssid bssid) generates (SupplicantStatus status);
363
364  /**
365   * Initiate WPS Pin Keypad setup.
366   *
367   * @param pin 8 digit pin to be used.
368   * @return status Status of the operation.
369   *         Possible status codes:
370   *         |SupplicantStatusCode.SUCCESS|,
371   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
372   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
373   */
374  startWpsPinKeypad(string pin) generates (SupplicantStatus status);
375
376  /**
377   * Initiate WPS Pin Display setup.
378   *
379   * @param bssid BSSID of the AP. Use zero'ed bssid to indicate wildcard.
380   * @return status Status of the operation.
381   *         Possible status codes:
382   *         |SupplicantStatusCode.SUCCESS|,
383   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
384   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
385   * @return generatedPin 8 digit pin generated.
386   */
387  startWpsPinDisplay(Bssid bssid)
388      generates (SupplicantStatus status, string generatedPin);
389
390  /**
391   * Cancel any ongoing WPS operations.
392   *
393   * @return status Status of the operation.
394   *         Possible status codes:
395   *         |SupplicantStatusCode.SUCCESS|,
396   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
397   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
398   */
399  cancelWps() generates (SupplicantStatus status);
400
401  /**
402   * Use external processing for SIM/USIM operations
403   *
404   * @param useExternalSim true to use external, false otherwise.
405   * @return status Status of the operation.
406   *         Possible status codes:
407   *         |SupplicantStatusCode.SUCCESS|,
408   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
409   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|
410   */
411  setExternalSim(bool useExternalSim) generates (SupplicantStatus status);
412
413  /**
414   * External programs can request supplicant to not start offchannel
415   * operations during other tasks that may need exclusive control of the
416   * radio.
417   *
418   * This method can be used to reserve a slot for radio access. If freq is
419   * specified, other radio work items on the same channel can be completed in
420   * parallel. Otherwise, all other radio work items are blocked during
421   * execution. Timeout must be set to |ExtRadioWorkDefaults.TIMEOUT_IN_SECS|
422   * seconds by default to avoid blocking supplicant operations on the iface
423   * for excessive time. If a longer (or shorter) safety timeout is needed,
424   * that may be specified with the optional timeout parameter. This command
425   * returns an identifier for the radio work item.
426   *
427   * Once the radio work item has been started,
428   * |ISupplicant.onExtRadioWorkStart| callback is indicated that the external
429   * processing can start.
430   *
431   * @param name Name for the radio work being added.
432   * @param freqInMhz Frequency to specify. Set to 0 for all channels.
433   * @param timeoutInSec Timeout tospecify. Set to 0 for default timeout.
434   * @return status Status of the operation.
435   *         Possible status codes:
436   *         |SupplicantStatusCode.SUCCESS|,
437   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
438   * @return id Identifier for this radio work.
439   */
440  addExtRadioWork(string name, uint32_t freqInMhz, uint32_t timeoutInSec)
441      generates (SupplicantStatus status, uint32_t id);
442
443  /**
444   * Indicates to supplicant that the external radio work has completed.
445   * This allows other radio works to be performed. If this method is not
446   * invoked (e.g., due to the external program terminating), supplicant
447   * must time out the radio work item on the iface and send
448   * |ISupplicantCallback.onExtRadioWorkTimeout| event to indicate
449   * that this has happened.
450   *
451   * This method may also be used to cancel items that have been scheduled
452   * via |addExtRadioWork|, but have not yet been started (notified via
453   * |ISupplicantCallback.onExtRadioWorkStart|).
454   *
455   * @return id Identifier generated for the radio work addition
456   *         (using |addExtRadioWork|).
457   * @return status Status of the operation.
458   *         Possible status codes:
459   *         |SupplicantStatusCode.SUCCESS|,
460   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
461   */
462  removeExtRadioWork(uint32_t id) generates (SupplicantStatus status);
463
464  /**
465   * Enable/Disable auto reconnect to networks.
466   * Use this to prevent wpa_supplicant from trying to connect to networks
467   * on its own.
468   *
469   * @param enable true to enable, false to disable.
470   * @return status Status of the operation.
471   *         Possible status codes:
472   *         |SupplicantStatusCode.SUCCESS|,
473   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
474   *         |SupplicantStatusCode.FAILURE_IFACE_INVALID|,
475   *         |SupplicantStatusCode.FAILURE_IFACE_DISABLED|
476   */
477  enableAutoReconnect(bool enable) generates (SupplicantStatus status);
478};
479