blob: 7b514a72f9c433b1f4261fc68bb38a1c2dcc195d [file] [log] [blame]
Roshan Piusadcfba42016-10-05 10:19:06 -07001/*
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@1.0;
18
19import IWifiIface;
Roshan Pius7b777472016-10-07 13:15:59 -070020import IWifiStaIfaceEventCallback;
Roshan Piusadcfba42016-10-05 10:19:06 -070021
22/**
23 * Interface used to represent a single STA iface.
24 */
25interface IWifiStaIface extends IWifiIface {
Roshan Pius7b777472016-10-07 13:15:59 -070026 /**
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,
Roshan Pius18680b72016-10-12 08:25:48 -070043 /**
44 * If set indicates that the link layer stats APIs are supported.
45 */
Roshan Pius5e254662016-10-26 10:10:48 -070046 LINK_LAYER_STATS = 1 << 2,
Roshan Piusfe9ad362016-10-19 16:45:12 -070047 /**
Roshan Piusd4767542016-12-06 10:04:05 -080048 * If set indicates that the RSSI monitor APIs are supported.
49 */
50 RSSI_MONITOR = 1 << 3,
51 /**
Roshan Piusfe9ad362016-10-19 16:45:12 -070052 * Tracks connection packets' fate.
53 */
Roshan Piusd4767542016-12-06 10:04:05 -080054 DEBUG_PACKET_FATE_SUPPORTED = 1 << 4
Roshan Pius18680b72016-10-12 08:25:48 -070055 };
56
57 /**
Roshan Pius7b777472016-10-07 13:15:59 -070058 * Requests notifications of significant events on this iface. Multiple calls
59 * to this must register multiple callbacks each of which must receive all
60 * events.
61 *
62 * @param callback An instance of the |IWifiStaIfaceEventCallback| HIDL interface
63 * object.
Roshan Piusa52dc732016-10-10 11:53:07 -070064 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -070065 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -070066 * |WifiStatusCode.SUCCESS|,
67 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|
Roshan Pius7b777472016-10-07 13:15:59 -070068 */
Roshan Pius1f9073c2016-10-10 10:32:22 -070069 registerEventCallback(IWifiStaIfaceEventCallback callback)
Roshan Piusa52dc732016-10-10 11:53:07 -070070 generates (WifiStatus status);
Roshan Pius7b777472016-10-07 13:15:59 -070071
72 /**
73 * Get the capabilities supported by this STA iface.
74 *
Roshan Piusa52dc732016-10-10 11:53:07 -070075 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -070076 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -070077 * |WifiStatusCode.SUCCESS|,
78 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
79 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
80 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius7b777472016-10-07 13:15:59 -070081 * @return capabilities Bitset of |StaIfaceCapabilityMask| values.
82 */
Roshan Pius5e254662016-10-26 10:10:48 -070083 getCapabilities() generates (WifiStatus status, uint32_t capabilities);
Roshan Pius7b777472016-10-07 13:15:59 -070084
85 /**
86 * Used to query additional information about the chip's APF capabilities.
Roshan Pius18680b72016-10-12 08:25:48 -070087 * Must fail if |StaIfaceCapabilityMask.APF| is not set.
Roshan Pius7b777472016-10-07 13:15:59 -070088 *
Roshan Piusa52dc732016-10-10 11:53:07 -070089 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -070090 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -070091 * |WifiStatusCode.SUCCESS|,
92 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
93 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
94 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
95 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius5e254662016-10-26 10:10:48 -070096 * @return capabilities Instance of |StaApfPacketFilterCapabilities|.
Roshan Pius7b777472016-10-07 13:15:59 -070097 */
98 getApfPacketFilterCapabilities()
Roshan Pius5e254662016-10-26 10:10:48 -070099 generates (WifiStatus status, StaApfPacketFilterCapabilities capabilities);
Roshan Pius7b777472016-10-07 13:15:59 -0700100
101 /**
102 * Installs an APF program on this iface, replacing an existing
103 * program if present.
Roshan Pius18680b72016-10-12 08:25:48 -0700104 * Must fail if |StaIfaceCapabilityMask.APF| is not set.
Roshan Pius7b777472016-10-07 13:15:59 -0700105 *
106 * @param cmdId command Id to use for this invocation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700107 * @param APF Program to be set.
Roshan Piusa52dc732016-10-10 11:53:07 -0700108 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700109 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -0700110 * |WifiStatusCode.SUCCESS|,
111 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
112 * |WifiStatusCode.ERROR_INVALID_ARGS|,
113 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
114 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
115 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius7b777472016-10-07 13:15:59 -0700116 */
Roshan Pius1f9073c2016-10-10 10:32:22 -0700117 installApfPacketFilter(CommandId cmdId, vec<uint8_t> program)
Roshan Piusa52dc732016-10-10 11:53:07 -0700118 generates (WifiStatus status);
Roshan Pius7b777472016-10-07 13:15:59 -0700119
120 /**
Roshan Pius18680b72016-10-12 08:25:48 -0700121 * Used to query additional information about the chip's Background Scan capabilities.
122 * Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
Roshan Pius7b777472016-10-07 13:15:59 -0700123 *
Roshan Piusa52dc732016-10-10 11:53:07 -0700124 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700125 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -0700126 * |WifiStatusCode.SUCCESS|,
127 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
128 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
129 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
130 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius5e254662016-10-26 10:10:48 -0700131 * @return capabilities Instance of |StaBackgroundScanCapabilities|.
Roshan Pius7b777472016-10-07 13:15:59 -0700132 */
133 getBackgroundScanCapabilities()
Roshan Pius5e254662016-10-26 10:10:48 -0700134 generates (WifiStatus status, StaBackgroundScanCapabilities capabilities);
Roshan Pius7b777472016-10-07 13:15:59 -0700135
136 /**
Roshan Pius18680b72016-10-12 08:25:48 -0700137 * Used to query the list of valid frequencies (depending on country code set)
138 * for the provided band. These channels may be specifed in the
139 * |BackgroundScanBucketParameters.frequenciesInMhz| for a background scan
140 * request.
141 * Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
142 *
Roshan Pius5e254662016-10-26 10:10:48 -0700143 * @param band Band for which the frequency list is being generated.
Roshan Pius18680b72016-10-12 08:25:48 -0700144 * @return status WifiStatus of the operation.
145 * Possible status codes:
146 * |WifiStatusCode.SUCCESS|,
147 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
148 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
149 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
150 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius120f94c2016-10-13 11:48:42 -0700151 * @return frequencies vector of valid frequencies for the provided band.
Roshan Pius18680b72016-10-12 08:25:48 -0700152 */
Roshan Pius5e254662016-10-26 10:10:48 -0700153 getValidFrequenciesForBackgroundScan(StaBackgroundScanBand band)
Roshan Pius120f94c2016-10-13 11:48:42 -0700154 generates (WifiStatus status, vec<WifiChannelInMhz> frequencies);
Roshan Pius18680b72016-10-12 08:25:48 -0700155
156 /**
Roshan Pius7b777472016-10-07 13:15:59 -0700157 * Start a background scan using the given cmdId as an identifier. Only one
158 * active background scan need be supported.
Roshan Pius18680b72016-10-12 08:25:48 -0700159 * Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
Roshan Pius7b777472016-10-07 13:15:59 -0700160 *
161 * When this is called all requested buckets must be scanned, starting the
162 * beginning of the cycle.
163 *
164 * For example:
165 * If there are two buckets specified
166 * - Bucket 1: period=10s
167 * - Bucket 2: period=20s
168 * - Bucket 3: period=30s
169 * Then the following scans must occur
170 * - t=0 buckets 1, 2, and 3 are scanned
171 * - t=10 bucket 1 is scanned
172 * - t=20 bucket 1 and 2 are scanned
173 * - t=30 bucket 1 and 3 are scanned
174 * - t=40 bucket 1 and 2 are scanned
175 * - t=50 bucket 1 is scanned
176 * - t=60 buckets 1, 2, and 3 are scanned
177 * - and the patter repeats
178 *
179 * If any scan does not occur or is incomplete (error, interrupted, etc) then
180 * a cached scan result must still be recorded with the
181 * WIFI_SCAN_FLAG_INTERRUPTED flag set.
182 *
183 * @param cmdId command Id to use for this invocation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700184 * @params Background scan parameters.
Roshan Piusa52dc732016-10-10 11:53:07 -0700185 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700186 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -0700187 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
188 * |WifiStatusCode.ERROR_INVALID_ARGS|,
189 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
190 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
191 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius7b777472016-10-07 13:15:59 -0700192 */
Roshan Pius5e254662016-10-26 10:10:48 -0700193 startBackgroundScan(CommandId cmdId, StaBackgroundScanParameters params)
Roshan Piusa52dc732016-10-10 11:53:07 -0700194 generates (WifiStatus status);
Roshan Pius7b777472016-10-07 13:15:59 -0700195
196 /**
197 * Stop the background scan started.
Roshan Pius18680b72016-10-12 08:25:48 -0700198 * Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
Roshan Pius7b777472016-10-07 13:15:59 -0700199 *
200 * @param cmdId command Id corresponding to the request.
Roshan Piusa52dc732016-10-10 11:53:07 -0700201 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700202 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -0700203 * |WifiStatusCode.SUCCESS|,
204 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
205 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
Roshan Piusfe9ad362016-10-19 16:45:12 -0700206 * |WifiStatusCode.ERROR_NOT_STARTED|,
Roshan Piusa52dc732016-10-10 11:53:07 -0700207 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
208 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius7b777472016-10-07 13:15:59 -0700209 */
Roshan Piusa52dc732016-10-10 11:53:07 -0700210 stopBackgroundScan(CommandId cmdId) generates (WifiStatus status);
Roshan Pius18680b72016-10-12 08:25:48 -0700211
212 /**
213 * Enable link layer stats collection.
214 * Must fail if |StaIfaceCapabilityMask.LINK_LAYER_STATS| is not set.
215 *
216 * Radio statistics (once started) must not stop until disabled.
217 * Iface statistics (once started) reset and start afresh after each
218 * connection until disabled.
219 *
220 * @param debug Set for field debug mode. Driver must collect all
221 * statistics regardless of performance impact.
222 * @return status WifiStatus of the operation.
223 * Possible status codes:
224 * |WifiStatusCode.SUCCESS|,
225 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
226 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
227 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
228 * |WifiStatusCode.ERROR_UNKNOWN|
229 */
230 enableLinkLayerStatsCollection(bool debug)
231 generates (WifiStatus status);
232
233 /**
234 * Disable link layer stats collection.
235 * Must fail if |StaIfaceCapabilityMask.LINK_LAYER_STATS| is not set.
236 *
237 * @return status WifiStatus of the operation.
238 * Possible status codes:
239 * |WifiStatusCode.SUCCESS|,
240 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
241 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
Roshan Piusfe9ad362016-10-19 16:45:12 -0700242 * |WifiStatusCode.ERROR_NOT_STARTED|,
Roshan Pius18680b72016-10-12 08:25:48 -0700243 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
244 * |WifiStatusCode.ERROR_UNKNOWN|
245 */
246 disableLinkLayerStatsCollection() generates (WifiStatus status);
247
248 /**
249 * Retrieve the latest link layer stats.
250 * Must fail if |StaIfaceCapabilityMask.LINK_LAYER_STATS| is not set or if
251 * link layer stats collection hasn't been explicitly enabled.
252 *
253 * @return status WifiStatus of the operation.
254 * Possible status codes:
255 * |WifiStatusCode.SUCCESS|,
256 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
257 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
Roshan Piusfe9ad362016-10-19 16:45:12 -0700258 * |WifiStatusCode.ERROR_NOT_STARTED|,
Roshan Pius18680b72016-10-12 08:25:48 -0700259 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
260 * |WifiStatusCode.ERROR_UNKNOWN|
261 * @return stats Instance of |LinkLayerStats|.
262 */
Roshan Pius5e254662016-10-26 10:10:48 -0700263 getLinkLayerStats() generates (WifiStatus status, StaLinkLayerStats stats);
Roshan Piusfe9ad362016-10-19 16:45:12 -0700264
265 /**
Roshan Piusd4767542016-12-06 10:04:05 -0800266 * Start RSSI monitoring on the currently connected access point.
267 * Once the monitoring is enabled,
268 * |IWifiStaIfaceEventCallback.onRssiThresholdBreached| callback must be
269 * invoked to indicate if the RSSI goes above |maxRssi| or below |minRssi|.
270 * Must fail if |StaIfaceCapabilityMask.RSSI_MONITOR| is not set.
271 *
272 * @param cmdId command Id to use for this invocation.
273 * @param maxRssi Maximum RSSI threshold.
274 * @param minRssi Minimum RSSI threshold.
275 * @return status WifiStatus of the operation.
276 * Possible status codes:
277 * |WifiStatusCode.SUCCESS|,
278 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
279 * |WifiStatusCode.ERROR_ARGS_INVALID|,
280 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
281 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
282 * |WifiStatusCode.ERROR_UNKNOWN|
283 */
284 startRssiMonitoring(CommandId cmdId, Rssi maxRssi, Rssi minRssi)
285 generates (WifiStatus status);
286
287 /**
288 * Stop RSSI monitoring.
289 * Must fail if |StaIfaceCapabilityMask.RSSI_MONITOR| is not set.
290 *
291 * @param cmdId command Id corresponding to the request.
292 * @return status WifiStatus of the operation.
293 * Possible status codes:
294 * |WifiStatusCode.SUCCESS|,
295 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
296 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
297 * |WifiStatusCode.ERROR_NOT_STARTED|,
298 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
299 * |WifiStatusCode.ERROR_UNKNOWN|
300 */
301 stopRssiMonitoring(CommandId cmdId) generates (WifiStatus status);
302
303 /**
Roshan Piusfe9ad362016-10-19 16:45:12 -0700304 * API to start packet fate monitoring.
305 * - Once stared, monitoring must remain active until HAL is unloaded.
306 * - When HAL is unloaded, all packet fate buffers must be cleared.
307 * - The packet fates are used to monitor the state of packets transmitted/
308 * received during association.
309 *
310 * @return status WifiStatus of the operation.
311 * Possible status codes:
312 * |WifiStatusCode.SUCCESS|,
313 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
314 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
315 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
316 * |WifiStatusCode.ERROR_UNKNOWN|
317 */
318 startDebugPacketFateMonitoring() generates (WifiStatus status);
319
320 /**
321 * API to stop packet fate monitoring.
322 *
323 * @return status WifiStatus of the operation.
324 * Possible status codes:
325 * |WifiStatusCode.SUCCESS|,
326 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
327 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
328 * |WifiStatusCode.ERROR_NOT_STARTED|,
329 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
330 * |WifiStatusCode.ERROR_UNKNOWN|
331 */
332 stopDebugPacketFateMonitoring() generates (WifiStatus status);
333
334 /**
335 * API to retrieve fates of outbound packets.
336 * - HAL implementation must return the fates of
337 * all the frames transmitted for the most recent association.
338 * The fate reports must follow the same order as their respective
339 * packets.
340 * - HAL implementation may choose (but is not required) to include
341 * reports for management frames.
342 * - Packets reported by firmware, but not recognized by driver,
343 * must be included. However, the ordering of the corresponding
344 * reports is at the discretion of HAL implementation.
345 * - Framework must be able to call this API multiple times for the same
346 * association.
347 *
348 * @return status WifiStatus of the operation.
349 * Possible status codes:
350 * |WifiStatusCode.SUCCESS|,
351 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
352 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
353 * |WifiStatusCode.ERROR_NOT_STARTED|,
354 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
355 * |WifiStatusCode.ERROR_UNKNOWN|
356 * @return fates Vector of |WifiDebugTxPacketFateReport| instances corresponding
357 * to the packet fates.
358 */
359 getDebugTxPacketFates()
360 generates (WifiStatus status, vec<WifiDebugTxPacketFateReport> fates);
361
362 /**
363 * API to retrieve fates of inbound packets.
364 * - HAL implementation must return the fates of
365 * all the frames received for the most recent association.
366 * The fate reports must follow the same order as their respective
367 * packets.
368 * - HAL implementation may choose (but is not required) to include
369 * reports for management frames.
370 * - Packets reported by firmware, but not recognized by driver,
371 * must be included. However, the ordering of the corresponding
372 * reports is at the discretion of HAL implementation.
373 * - Framework must be able to call this API multiple times for the same
374 * association.
375 *
376 * @return status WifiStatus of the operation.
377 * Possible status codes:
378 * |WifiStatusCode.SUCCESS|,
379 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
380 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
381 * |WifiStatusCode.ERROR_NOT_STARTED|,
382 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
383 * |WifiStatusCode.ERROR_UNKNOWN|
384 * @return fates Vector of |WifiDebugRxPacketFateReport| instances corresponding
385 * to the packet fates.
386 */
387 getDebugRxPacketFates()
388 generates (WifiStatus status, vec<WifiDebugRxPacketFateReport> fates);
Roshan Piusadcfba42016-10-05 10:19:06 -0700389};