OSDN Git Service

[AWARE] Add support for Subscribe Service ID List Attribute
[android-x86/hardware-interfaces.git] / wifi / 1.0 / IWifiStaIface.hal
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
17 package android.hardware.wifi@1.0;
18
19 import IWifiIface;
20 import IWifiStaIfaceEventCallback;
21
22 /**
23  * Interface used to represent a single STA iface.
24  */
25 interface IWifiStaIface extends IWifiIface {
26   /**
27    * Mask of capabilities suported by this Iface.
28    */
29   enum StaIfaceCapabilityMask : uint32_t {
30     /**
31      * If set indicates that the APF APIs are supported.
32      * APF (Android Packet Filter) is a BPF like packet filtering
33      * bytecode executed by the firmware.
34      */
35     APF = 1 << 0,
36     /**
37      * If set indicates that the Background Scan APIs are supported.
38      * Background scan allow the host to send a number of buckets down to the
39      * firmware. Each bucket contains a set of channels, a period, and some
40      * parameters about how and when to report results.
41      */
42     BACKGROUND_SCAN = 1 << 1,
43     /**
44      * If set indicates that the link layer stats APIs are supported.
45      */
46     LINK_LAYER_STATS = 1 << 2,
47     /**
48      * If set indicates that the RSSI monitor APIs are supported.
49      */
50     RSSI_MONITOR = 1 << 3,
51     /**
52      * If set indicates that the roaming API's are supported.
53      */
54     CONTROL_ROAMING = 1 << 4,
55     /**
56      * If set indicates support for Probe IE white listing.
57      */
58     PROBE_IE_WHITELIST =  1 << 5,
59     /**
60      * If set indicates support for MAC & Probe Sequence Number randomization.
61      */
62     SCAN_RAND = 1 << 6,
63     /**
64      * Support for 5 GHz Band.
65      */
66     STA_5G = 1 << 7,
67     /**
68      * Support for GAS/ANQP queries.
69      */
70     HOTSPOT = 1 << 8,
71     /**
72      * Support for Preferred Network Offload.
73      */
74     PNO = 1 << 9,
75     /**
76      * Support for Tunneled Direct Link Setup.
77      */
78     TDLS = 1 << 10,
79     /**
80      * Support for Tunneled Direct Link Setup off channel.
81      */
82     TDLS_OFFCHANNEL = 1 << 11,
83     /**
84      * Support for neighbour discovery offload.
85      */
86     ND_OFFLOAD = 1 << 12,
87     /**
88      * Support for keep alive packet offload.
89      */
90     KEEP_ALIVE = 1 << 13,
91     /**
92      * Support for tracking connection packets' fate.
93      */
94     DEBUG_PACKET_FATE = 1 << 14
95   };
96
97   /**
98    * Requests notifications of significant events on this iface. Multiple calls
99    * to this must register multiple callbacks each of which must receive all
100    * events.
101    *
102    * @param callback An instance of the |IWifiStaIfaceEventCallback| HIDL interface
103    *        object.
104    * @return status WifiStatus of the operation.
105    *         Possible status codes:
106    *         |WifiStatusCode.SUCCESS|,
107    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|
108    */
109   registerEventCallback(IWifiStaIfaceEventCallback callback)
110       generates (WifiStatus status);
111
112   /**
113    * Get the capabilities supported by this STA iface.
114    *
115    * @return status WifiStatus of the operation.
116    *         Possible status codes:
117    *         |WifiStatusCode.SUCCESS|,
118    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
119    *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
120    *         |WifiStatusCode.ERROR_UNKNOWN|
121    * @return capabilities Bitset of |StaIfaceCapabilityMask| values.
122    */
123   getCapabilities()
124       generates (WifiStatus status,
125                  bitfield<StaIfaceCapabilityMask> capabilities);
126
127   /**
128    * Used to query additional information about the chip's APF capabilities.
129    * Must fail if |StaIfaceCapabilityMask.APF| is not set.
130    *
131    * @return status WifiStatus of the operation.
132    *         Possible status codes:
133    *         |WifiStatusCode.SUCCESS|,
134    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
135    *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
136    *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
137    *         |WifiStatusCode.ERROR_UNKNOWN|
138    * @return capabilities Instance of |StaApfPacketFilterCapabilities|.
139    */
140   getApfPacketFilterCapabilities()
141       generates (WifiStatus status, StaApfPacketFilterCapabilities capabilities);
142
143   /**
144    * Installs an APF program on this iface, replacing an existing
145    * program if present.
146    * Must fail if |StaIfaceCapabilityMask.APF| is not set.
147    *
148    * @param cmdId command Id to use for this invocation.
149    * @param APF Program to be set.
150    * @return status WifiStatus of the operation.
151    *         Possible status codes:
152    *         |WifiStatusCode.SUCCESS|,
153    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
154    *         |WifiStatusCode.ERROR_INVALID_ARGS|,
155    *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
156    *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
157    *         |WifiStatusCode.ERROR_UNKNOWN|
158    */
159   installApfPacketFilter(CommandId cmdId, vec<uint8_t> program)
160       generates (WifiStatus status);
161
162   /**
163    * Used to query additional information about the chip's Background Scan capabilities.
164    * Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
165    *
166    * @return status WifiStatus of the operation.
167    *         Possible status codes:
168    *         |WifiStatusCode.SUCCESS|,
169    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
170    *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
171    *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
172    *         |WifiStatusCode.ERROR_UNKNOWN|
173    * @return capabilities Instance of |StaBackgroundScanCapabilities|.
174    */
175   getBackgroundScanCapabilities()
176       generates (WifiStatus status, StaBackgroundScanCapabilities capabilities);
177
178   /**
179    * Used to query the list of valid frequencies (depending on country code set)
180    * for the provided band. These channels may be specifed in the
181    * |BackgroundScanBucketParameters.frequenciesInMhz| for a background scan
182    * request.
183    * Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
184    *
185    * @param band Band for which the frequency list is being generated.
186    * @return status WifiStatus of the operation.
187    *         Possible status codes:
188    *         |WifiStatusCode.SUCCESS|,
189    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
190    *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
191    *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
192    *         |WifiStatusCode.ERROR_UNKNOWN|
193    * @return frequencies vector of valid frequencies for the provided band.
194    */
195   getValidFrequenciesForBackgroundScan(StaBackgroundScanBand band)
196       generates (WifiStatus status, vec<WifiChannelInMhz> frequencies);
197
198   /**
199    * Start a background scan using the given cmdId as an identifier. Only one
200    * active background scan need be supported.
201    * Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
202    *
203    * When this is called all requested buckets must be scanned, starting the
204    * beginning of the cycle.
205    *
206    * For example:
207    * If there are two buckets specified
208    *  - Bucket 1: period=10s
209    *  - Bucket 2: period=20s
210    *  - Bucket 3: period=30s
211    * Then the following scans must occur
212    *  - t=0  buckets 1, 2, and 3 are scanned
213    *  - t=10 bucket 1 is scanned
214    *  - t=20 bucket 1 and 2 are scanned
215    *  - t=30 bucket 1 and 3 are scanned
216    *  - t=40 bucket 1 and 2 are scanned
217    *  - t=50 bucket 1 is scanned
218    *  - t=60 buckets 1, 2, and 3 are scanned
219    *  - and the patter repeats
220    *
221    * If any scan does not occur or is incomplete (error, interrupted, etc) then
222    * a cached scan result must still be recorded with the
223    * WIFI_SCAN_FLAG_INTERRUPTED flag set.
224    *
225    * @param cmdId command Id to use for this invocation.
226    * @params Background scan parameters.
227    * @return status WifiStatus of the operation.
228    *         Possible status codes:
229    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
230    *         |WifiStatusCode.ERROR_INVALID_ARGS|,
231    *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
232    *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
233    *         |WifiStatusCode.ERROR_UNKNOWN|
234    */
235   startBackgroundScan(CommandId cmdId, StaBackgroundScanParameters params)
236       generates (WifiStatus status);
237
238   /**
239    * Stop the background scan started.
240    * Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
241    *
242    * @param cmdId command Id corresponding to the request.
243    * @return status WifiStatus of the operation.
244    *         Possible status codes:
245    *         |WifiStatusCode.SUCCESS|,
246    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
247    *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
248    *         |WifiStatusCode.ERROR_NOT_STARTED|,
249    *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
250    *         |WifiStatusCode.ERROR_UNKNOWN|
251    */
252   stopBackgroundScan(CommandId cmdId) generates (WifiStatus status);
253
254   /**
255    * Enable link layer stats collection.
256    * Must fail if |StaIfaceCapabilityMask.LINK_LAYER_STATS| is not set.
257    *
258    * Radio statistics (once started) must not stop until disabled.
259    * Iface statistics (once started) reset and start afresh after each
260    * connection until disabled.
261    *
262    * @param debug Set for field debug mode. Driver must collect all
263    *        statistics regardless of performance impact.
264    * @return status WifiStatus of the operation.
265    *         Possible status codes:
266    *         |WifiStatusCode.SUCCESS|,
267    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
268    *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
269    *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
270    *         |WifiStatusCode.ERROR_UNKNOWN|
271    */
272   enableLinkLayerStatsCollection(bool debug)
273       generates (WifiStatus status);
274
275   /**
276    * Disable link layer stats collection.
277    * Must fail if |StaIfaceCapabilityMask.LINK_LAYER_STATS| is not set.
278    *
279    * @return status WifiStatus of the operation.
280    *         Possible status codes:
281    *         |WifiStatusCode.SUCCESS|,
282    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
283    *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
284    *         |WifiStatusCode.ERROR_NOT_STARTED|,
285    *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
286    *         |WifiStatusCode.ERROR_UNKNOWN|
287    */
288   disableLinkLayerStatsCollection() generates (WifiStatus status);
289
290   /**
291    * Retrieve the latest link layer stats.
292    * Must fail if |StaIfaceCapabilityMask.LINK_LAYER_STATS| is not set or if
293    * link layer stats collection hasn't been explicitly enabled.
294    *
295    * @return status WifiStatus of the operation.
296    *         Possible status codes:
297    *         |WifiStatusCode.SUCCESS|,
298    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
299    *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
300    *         |WifiStatusCode.ERROR_NOT_STARTED|,
301    *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
302    *         |WifiStatusCode.ERROR_UNKNOWN|
303    * @return stats Instance of |LinkLayerStats|.
304    */
305   getLinkLayerStats() generates (WifiStatus status, StaLinkLayerStats stats);
306
307   /**
308    * Start RSSI monitoring on the currently connected access point.
309    * Once the monitoring is enabled,
310    * |IWifiStaIfaceEventCallback.onRssiThresholdBreached| callback must be
311    * invoked to indicate if the RSSI goes above |maxRssi| or below |minRssi|.
312    * Must fail if |StaIfaceCapabilityMask.RSSI_MONITOR| is not set.
313    *
314    * @param cmdId command Id to use for this invocation.
315    * @param maxRssi Maximum RSSI threshold.
316    * @param minRssi Minimum RSSI threshold.
317    * @return status WifiStatus of the operation.
318    *         Possible status codes:
319    *         |WifiStatusCode.SUCCESS|,
320    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
321    *         |WifiStatusCode.ERROR_ARGS_INVALID|,
322    *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
323    *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
324    *         |WifiStatusCode.ERROR_UNKNOWN|
325    */
326   startRssiMonitoring(CommandId cmdId, Rssi maxRssi, Rssi minRssi)
327       generates (WifiStatus status);
328
329   /**
330    * Stop RSSI monitoring.
331    * Must fail if |StaIfaceCapabilityMask.RSSI_MONITOR| is not set.
332    *
333    * @param cmdId command Id corresponding to the request.
334    * @return status WifiStatus of the operation.
335    *         Possible status codes:
336    *         |WifiStatusCode.SUCCESS|,
337    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
338    *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
339    *         |WifiStatusCode.ERROR_NOT_STARTED|,
340    *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
341    *         |WifiStatusCode.ERROR_UNKNOWN|
342    */
343   stopRssiMonitoring(CommandId cmdId) generates (WifiStatus status);
344
345   /**
346    * Get roaming control capabilities.
347    * Must fail if |StaIfaceCapabilityMask.CONTROL_ROAMING| is not set.
348    *
349    * @return status WifiStatus of the operation.
350    *         Possible status codes:
351    *         |WifiStatusCode.SUCCESS|,
352    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
353    *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
354    *         |WifiStatusCode.ERROR_UNKNOWN|
355    * @return caps Instance of |StaRoamingCapabilities|.
356    */
357   getRoamingCapabilities()
358       generates (WifiStatus status, StaRoamingCapabilities caps);
359
360   /**
361    * Configure roaming control parameters.
362    * Must fail if |StaIfaceCapabilityMask.CONTROL_ROAMING| is not set.
363    *
364    * @param config Instance of |StaRoamingConfig|.
365    * @return status WifiStatus of the operation.
366    *         Possible status codes:
367    *         |WifiStatusCode.SUCCESS|,
368    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
369    *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
370    *         |WifiStatusCode.ERROR_UNKNOWN|
371    */
372   configureRoaming(StaRoamingConfig config) generates (WifiStatus status);
373
374   /**
375    * Set the roaming control state with the parameters configured
376    * using |configureRoaming|. Depending on the roaming state set, the
377    * driver/firmware would enable/disable control over roaming decisions.
378    * Must fail if |StaIfaceCapabilityMask.CONTROL_ROAMING| is not set.
379    *
380    * @param state State of the roaming control.
381    * @return status WifiStatus of the operation.
382    *         Possible status codes:
383    *         |WifiStatusCode.SUCCESS|,
384    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
385    *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
386    *         |WifiStatusCode.ERROR_BUSY|,
387    *         |WifiStatusCode.ERROR_UNKNOWN|
388    */
389   setRoamingState(StaRoamingState state) generates (WifiStatus status);
390
391   /**
392    * Enable/Disable Neighbour discovery offload functionality in the firmware.
393    *
394    * @param enable true to enable, false to disable.
395    * @return status WifiStatus of the operation.
396    *         Possible status codes:
397    *         |WifiStatusCode.SUCCESS|,
398    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
399    *         |WifiStatusCode.ERROR_UNKNOWN|
400    */
401   enableNdOffload(bool enable) generates (WifiStatus status);
402
403   /**
404    * Start sending the specified keep alive packets periodically.
405    *
406    * @param cmdId command Id to use for this invocation.
407    * @param ipPacketData IP packet contents to be transmitted.
408    * @param etherType 16 bit ether type to be set in the ethernet frame
409    *        transmitted.
410    * @param srcAddress Source MAC address of the packet.
411    * @param dstAddress Destination MAC address of the packet.
412    * @param periodInMs Interval at which this packet must be transmitted.
413    * @return status WifiStatus of the operation.
414    *         Possible status codes:
415    *         |WifiStatusCode.SUCCESS|,
416    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
417    *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
418    *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
419    *         |WifiStatusCode.ERROR_UNKNOWN|
420    */
421   startSendingKeepAlivePackets(
422       CommandId cmdId, vec<uint8_t> ipPacketData, uint16_t etherType,
423       MacAddress srcAddress, MacAddress dstAddress, uint32_t periodInMs)
424       generates (WifiStatus status);
425
426   /**
427    * Stop sending the specified keep alive packets.
428    *
429    * @param cmdId command Id corresponding to the request.
430    * @return status WifiStatus of the operation.
431    *         Possible status codes:
432    *         |WifiStatusCode.SUCCESS|,
433    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
434    *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
435    *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
436    *         |WifiStatusCode.ERROR_UNKNOWN|
437    */
438   stopSendingKeepAlivePackets(CommandId cmdId) generates (WifiStatus status);
439
440   /**
441    * Set the MAC OUI during scanning.
442    * An OUI {Organizationally Unique Identifier} is a 24-bit number that
443    * uniquely identifies a vendor or manufacturer.
444    *
445    * @return status WifiStatus of the operation.
446    *         Possible status codes:
447    *         |WifiStatusCode.SUCCESS|,
448    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
449    *         |WifiStatusCode.ERROR_UNKNOWN|
450    */
451   setScanningMacOui(uint8_t[3] oui) generates (WifiStatus status);
452
453   /**
454    * API to start packet fate monitoring.
455    * - Once started, monitoring must remain active until HAL is stopped or the
456    *   chip is reconfigured.
457    * - When HAL is unloaded, all packet fate buffers must be cleared.
458    * - The packet fates are used to monitor the state of packets transmitted/
459    *   received during association.
460    *
461    * @return status WifiStatus of the operation.
462    *         Possible status codes:
463    *         |WifiStatusCode.SUCCESS|,
464    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
465    *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
466    *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
467    *         |WifiStatusCode.ERROR_UNKNOWN|
468    */
469   startDebugPacketFateMonitoring() generates (WifiStatus status);
470
471   /**
472    * API to retrieve fates of outbound packets.
473    * - HAL implementation must return the fates of
474    *   all the frames transmitted for the most recent association.
475    *   The fate reports must follow the same order as their respective
476    *   packets.
477    * - HAL implementation may choose (but is not required) to include
478    *   reports for management frames.
479    * - Packets reported by firmware, but not recognized by driver,
480    *   must be included. However, the ordering of the corresponding
481    *   reports is at the discretion of HAL implementation.
482    * - Framework must be able to call this API multiple times for the same
483    *   association.
484    *
485    * @return status WifiStatus of the operation.
486    *         Possible status codes:
487    *         |WifiStatusCode.SUCCESS|,
488    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
489    *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
490    *         |WifiStatusCode.ERROR_NOT_STARTED|,
491    *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
492    *         |WifiStatusCode.ERROR_UNKNOWN|
493    * @return fates Vector of |WifiDebugTxPacketFateReport| instances corresponding
494    *         to the packet fates.
495    */
496   getDebugTxPacketFates()
497       generates (WifiStatus status, vec<WifiDebugTxPacketFateReport> fates);
498
499   /**
500    * API to retrieve fates of inbound packets.
501    * - HAL implementation must return the fates of
502    *   all the frames received for the most recent association.
503    *   The fate reports must follow the same order as their respective
504    *   packets.
505    * - HAL implementation may choose (but is not required) to include
506    *   reports for management frames.
507    * - Packets reported by firmware, but not recognized by driver,
508    *   must be included. However, the ordering of the corresponding
509    *   reports is at the discretion of HAL implementation.
510    * - Framework must be able to call this API multiple times for the same
511    *   association.
512    *
513    * @return status WifiStatus of the operation.
514    *         Possible status codes:
515    *         |WifiStatusCode.SUCCESS|,
516    *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
517    *         |WifiStatusCode.ERROR_NOT_SUPPORTED|,
518    *         |WifiStatusCode.ERROR_NOT_STARTED|,
519    *         |WifiStatusCode.ERROR_NOT_AVAILABLE|,
520    *         |WifiStatusCode.ERROR_UNKNOWN|
521    * @return fates Vector of |WifiDebugRxPacketFateReport| instances corresponding
522    *         to the packet fates.
523    */
524   getDebugRxPacketFates()
525       generates (WifiStatus status, vec<WifiDebugRxPacketFateReport> fates);
526 };