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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
|
/*
* Copyright 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.hardware.wifi@1.0;
import IWifiIface;
import IWifiStaIfaceEventCallback;
/**
* Interface used to represent a single STA iface.
*/
interface IWifiStaIface extends IWifiIface {
/**
* Mask of capabilities suported by this Iface.
*/
enum StaIfaceCapabilityMask : uint32_t {
/**
* If set indicates that the APF APIs are supported.
* APF (Android Packet Filter) is a BPF like packet filtering
* bytecode executed by the firmware.
*/
APF = 1 << 0,
/**
* If set indicates that the Background Scan APIs are supported.
* Background scan allow the host to send a number of buckets down to the
* firmware. Each bucket contains a set of channels, a period, and some
* parameters about how and when to report results.
*/
BACKGROUND_SCAN = 1 << 1,
/**
* If set indicates that the link layer stats APIs are supported.
*/
LINK_LAYER_STATS = 1 << 2,
/**
* If set indicates that the RSSI monitor APIs are supported.
*/
RSSI_MONITOR = 1 << 3,
/**
* If set indicates that the roaming API's are supported.
*/
CONTROL_ROAMING = 1 << 4,
/**
* If set indicates support for Probe IE white listing.
*/
PROBE_IE_WHITELIST = 1 << 5,
/**
* If set indicates support for MAC & Probe Sequence Number randomization.
*/
SCAN_RAND = 1 << 6,
/**
* Support for 5 GHz Band.
*/
STA_5G = 1 << 7,
/**
* Support for GAS/ANQP queries.
*/
HOTSPOT = 1 << 8,
/**
* Support for Preferred Network Offload.
*/
PNO = 1 << 9,
/**
* Support for Tunneled Direct Link Setup.
*/
TDLS = 1 << 10,
/**
* Support for Tunneled Direct Link Setup off channel.
*/
TDLS_OFFCHANNEL = 1 << 11,
/**
* Support for neighbour discovery offload.
*/
ND_OFFLOAD = 1 << 12,
/**
* Support for keep alive packet offload.
*/
KEEP_ALIVE = 1 << 13,
/**
* Support for tracking connection packets' fate.
*/
DEBUG_PACKET_FATE = 1 << 14
};
/**
* Requests notifications of significant events on this iface. Multiple calls
* to this must register multiple callbacks each of which must receive all
* events.
*
* @param callback An instance of the |IWifiStaIfaceEventCallback| HIDL interface
* object.
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|
*/
registerEventCallback(IWifiStaIfaceEventCallback callback)
generates (WifiStatus status);
/**
* Get the capabilities supported by this STA iface.
*
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_UNKNOWN|
* @return capabilities Bitset of |StaIfaceCapabilityMask| values.
*/
getCapabilities()
generates (WifiStatus status,
bitfield<StaIfaceCapabilityMask> capabilities);
/**
* Used to query additional information about the chip's APF capabilities.
* Must fail if |StaIfaceCapabilityMask.APF| is not set.
*
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_UNKNOWN|
* @return capabilities Instance of |StaApfPacketFilterCapabilities|.
*/
getApfPacketFilterCapabilities()
generates (WifiStatus status, StaApfPacketFilterCapabilities capabilities);
/**
* Installs an APF program on this iface, replacing an existing
* program if present.
* Must fail if |StaIfaceCapabilityMask.APF| is not set.
*
* APF docs
* ==========================================================================
* APF functionality, instructions and bytecode/binary format is described in:
* http://android.googlesource.com/platform/hardware/google/apf/
* +/b75c9f3714cfae3dad3d976958e063150781437e/apf.h
*
* The interpreter API is described here:
* http://android.googlesource.com/platform/hardware/google/apf/+/
* b75c9f3714cfae3dad3d976958e063150781437e/apf_interpreter.h#32
*
* The assembler/generator API is described in javadocs here:
* http://android.googlesource.com/platform/frameworks/base/+/
* 4456f33a958a7f09e608399da83c4d12b2e7d191/services/net/java/android/net/
* apf/ApfGenerator.java
*
* Disassembler usage is described here:
* http://android.googlesource.com/platform/hardware/google/apf/+/
* b75c9f3714cfae3dad3d976958e063150781437e/apf_disassembler.c#65
*
* The BPF to APF translator usage is described here:
* http://android.googlesource.com/platform/frameworks/base/+/
* 4456f33a958a7f09e608399da83c4d12b2e7d191/tests/net/java/android/net/
* apf/Bpf2Apf.java
* ==========================================================================
*
* @param cmdId command Id to use for this invocation.
* @param APF Program to be set.
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_INVALID_ARGS|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
installApfPacketFilter(CommandId cmdId, vec<uint8_t> program)
generates (WifiStatus status);
/**
* Used to query additional information about the chip's Background Scan capabilities.
* Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
*
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_UNKNOWN|
* @return capabilities Instance of |StaBackgroundScanCapabilities|.
*/
getBackgroundScanCapabilities()
generates (WifiStatus status, StaBackgroundScanCapabilities capabilities);
/**
* Used to query the list of valid frequencies (depending on country code set)
* for the provided band. These channels may be specifed in the
* |BackgroundScanBucketParameters.frequenciesInMhz| for a background scan
* request.
*
* @param band Band for which the frequency list is being generated.
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_UNKNOWN|
* @return frequencies vector of valid frequencies for the provided band.
*/
getValidFrequenciesForBand(WifiBand band)
generates (WifiStatus status, vec<WifiChannelInMhz> frequencies);
/**
* Start a background scan using the given cmdId as an identifier. Only one
* active background scan need be supported.
* Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
*
* When this is called all requested buckets must be scanned, starting the
* beginning of the cycle.
*
* For example:
* If there are two buckets specified
* - Bucket 1: period=10s
* - Bucket 2: period=20s
* - Bucket 3: period=30s
* Then the following scans must occur
* - t=0 buckets 1, 2, and 3 are scanned
* - t=10 bucket 1 is scanned
* - t=20 bucket 1 and 2 are scanned
* - t=30 bucket 1 and 3 are scanned
* - t=40 bucket 1 and 2 are scanned
* - t=50 bucket 1 is scanned
* - t=60 buckets 1, 2, and 3 are scanned
* - and the patter repeats
*
* If any scan does not occur or is incomplete (error, interrupted, etc) then
* a cached scan result must still be recorded with the
* WIFI_SCAN_FLAG_INTERRUPTED flag set.
*
* @param cmdId command Id to use for this invocation.
* @params Background scan parameters.
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_INVALID_ARGS|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
startBackgroundScan(CommandId cmdId, StaBackgroundScanParameters params)
generates (WifiStatus status);
/**
* Stop the background scan started.
* Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
*
* @param cmdId command Id corresponding to the request.
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_NOT_STARTED|,
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
stopBackgroundScan(CommandId cmdId) generates (WifiStatus status);
/**
* Enable link layer stats collection.
* Must fail if |StaIfaceCapabilityMask.LINK_LAYER_STATS| is not set.
*
* Radio statistics (once started) must not stop until disabled.
* Iface statistics (once started) reset and start afresh after each
* connection until disabled.
*
* @param debug Set for field debug mode. Driver must collect all
* statistics regardless of performance impact.
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
enableLinkLayerStatsCollection(bool debug)
generates (WifiStatus status);
/**
* Disable link layer stats collection.
* Must fail if |StaIfaceCapabilityMask.LINK_LAYER_STATS| is not set.
*
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_NOT_STARTED|,
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
disableLinkLayerStatsCollection() generates (WifiStatus status);
/**
* Retrieve the latest link layer stats.
* Must fail if |StaIfaceCapabilityMask.LINK_LAYER_STATS| is not set or if
* link layer stats collection hasn't been explicitly enabled.
*
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_NOT_STARTED|,
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_UNKNOWN|
* @return stats Instance of |LinkLayerStats|.
*/
getLinkLayerStats() generates (WifiStatus status, StaLinkLayerStats stats);
/**
* Start RSSI monitoring on the currently connected access point.
* Once the monitoring is enabled,
* |IWifiStaIfaceEventCallback.onRssiThresholdBreached| callback must be
* invoked to indicate if the RSSI goes above |maxRssi| or below |minRssi|.
* Must fail if |StaIfaceCapabilityMask.RSSI_MONITOR| is not set.
*
* @param cmdId command Id to use for this invocation.
* @param maxRssi Maximum RSSI threshold.
* @param minRssi Minimum RSSI threshold.
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_ARGS_INVALID|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
startRssiMonitoring(CommandId cmdId, Rssi maxRssi, Rssi minRssi)
generates (WifiStatus status);
/**
* Stop RSSI monitoring.
* Must fail if |StaIfaceCapabilityMask.RSSI_MONITOR| is not set.
*
* @param cmdId command Id corresponding to the request.
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_NOT_STARTED|,
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
stopRssiMonitoring(CommandId cmdId) generates (WifiStatus status);
/**
* Get roaming control capabilities.
* Must fail if |StaIfaceCapabilityMask.CONTROL_ROAMING| is not set.
*
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_UNKNOWN|
* @return caps Instance of |StaRoamingCapabilities|.
*/
getRoamingCapabilities()
generates (WifiStatus status, StaRoamingCapabilities caps);
/**
* Configure roaming control parameters.
* Must fail if |StaIfaceCapabilityMask.CONTROL_ROAMING| is not set.
*
* @param config Instance of |StaRoamingConfig|.
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
configureRoaming(StaRoamingConfig config) generates (WifiStatus status);
/**
* Set the roaming control state with the parameters configured
* using |configureRoaming|. Depending on the roaming state set, the
* driver/firmware would enable/disable control over roaming decisions.
* Must fail if |StaIfaceCapabilityMask.CONTROL_ROAMING| is not set.
*
* @param state State of the roaming control.
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_BUSY|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
setRoamingState(StaRoamingState state) generates (WifiStatus status);
/**
* Enable/Disable Neighbour discovery offload functionality in the firmware.
*
* @param enable true to enable, false to disable.
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
enableNdOffload(bool enable) generates (WifiStatus status);
/**
* Start sending the specified keep alive packets periodically.
*
* @param cmdId command Id to use for this invocation.
* @param ipPacketData IP packet contents to be transmitted.
* @param etherType 16 bit ether type to be set in the ethernet frame
* transmitted.
* @param srcAddress Source MAC address of the packet.
* @param dstAddress Destination MAC address of the packet.
* @param periodInMs Interval at which this packet must be transmitted.
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
startSendingKeepAlivePackets(
CommandId cmdId, vec<uint8_t> ipPacketData, uint16_t etherType,
MacAddress srcAddress, MacAddress dstAddress, uint32_t periodInMs)
generates (WifiStatus status);
/**
* Stop sending the specified keep alive packets.
*
* @param cmdId command Id corresponding to the request.
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
stopSendingKeepAlivePackets(CommandId cmdId) generates (WifiStatus status);
/**
* Set the MAC OUI during scanning.
* An OUI {Organizationally Unique Identifier} is a 24-bit number that
* uniquely identifies a vendor or manufacturer.
*
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
setScanningMacOui(uint8_t[3] oui) generates (WifiStatus status);
/**
* API to start packet fate monitoring.
* - Once started, monitoring must remain active until HAL is stopped or the
* chip is reconfigured.
* - When HAL is unloaded, all packet fate buffers must be cleared.
* - The packet fates are used to monitor the state of packets transmitted/
* received during association.
*
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_UNKNOWN|
*/
startDebugPacketFateMonitoring() generates (WifiStatus status);
/**
* API to retrieve fates of outbound packets.
* - HAL implementation must return the fates of
* all the frames transmitted for the most recent association.
* The fate reports must follow the same order as their respective
* packets.
* - HAL implementation may choose (but is not required) to include
* reports for management frames.
* - Packets reported by firmware, but not recognized by driver,
* must be included. However, the ordering of the corresponding
* reports is at the discretion of HAL implementation.
* - Framework must be able to call this API multiple times for the same
* association.
*
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_NOT_STARTED|,
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_UNKNOWN|
* @return fates Vector of |WifiDebugTxPacketFateReport| instances corresponding
* to the packet fates.
*/
getDebugTxPacketFates()
generates (WifiStatus status, vec<WifiDebugTxPacketFateReport> fates);
/**
* API to retrieve fates of inbound packets.
* - HAL implementation must return the fates of
* all the frames received for the most recent association.
* The fate reports must follow the same order as their respective
* packets.
* - HAL implementation may choose (but is not required) to include
* reports for management frames.
* - Packets reported by firmware, but not recognized by driver,
* must be included. However, the ordering of the corresponding
* reports is at the discretion of HAL implementation.
* - Framework must be able to call this API multiple times for the same
* association.
*
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_NOT_SUPPORTED|,
* |WifiStatusCode.ERROR_NOT_STARTED|,
* |WifiStatusCode.ERROR_NOT_AVAILABLE|,
* |WifiStatusCode.ERROR_UNKNOWN|
* @return fates Vector of |WifiDebugRxPacketFateReport| instances corresponding
* to the packet fates.
*/
getDebugRxPacketFates()
generates (WifiStatus status, vec<WifiDebugRxPacketFateReport> fates);
};
|