blob: 41b2bad7f699b3ee43183e8ed38cee8df29b7fae [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 /**
48 * Tracks connection packets' fate.
49 */
50 DEBUG_PACKET_FATE_SUPPORTED = 1 << 3
Roshan Pius18680b72016-10-12 08:25:48 -070051 };
52
53 /**
Roshan Pius7b777472016-10-07 13:15:59 -070054 * Requests notifications of significant events on this iface. Multiple calls
55 * to this must register multiple callbacks each of which must receive all
56 * events.
57 *
58 * @param callback An instance of the |IWifiStaIfaceEventCallback| HIDL interface
59 * object.
Roshan Piusa52dc732016-10-10 11:53:07 -070060 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -070061 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -070062 * |WifiStatusCode.SUCCESS|,
63 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|
Roshan Pius7b777472016-10-07 13:15:59 -070064 */
Roshan Pius1f9073c2016-10-10 10:32:22 -070065 registerEventCallback(IWifiStaIfaceEventCallback callback)
Roshan Piusa52dc732016-10-10 11:53:07 -070066 generates (WifiStatus status);
Roshan Pius7b777472016-10-07 13:15:59 -070067
68 /**
69 * Get the capabilities supported by this STA iface.
70 *
Roshan Piusa52dc732016-10-10 11:53:07 -070071 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -070072 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -070073 * |WifiStatusCode.SUCCESS|,
74 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
75 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
76 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius7b777472016-10-07 13:15:59 -070077 * @return capabilities Bitset of |StaIfaceCapabilityMask| values.
78 */
Roshan Pius5e254662016-10-26 10:10:48 -070079 getCapabilities() generates (WifiStatus status, uint32_t capabilities);
Roshan Pius7b777472016-10-07 13:15:59 -070080
81 /**
82 * Used to query additional information about the chip's APF capabilities.
Roshan Pius18680b72016-10-12 08:25:48 -070083 * Must fail if |StaIfaceCapabilityMask.APF| is not set.
Roshan Pius7b777472016-10-07 13:15:59 -070084 *
Roshan Piusa52dc732016-10-10 11:53:07 -070085 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -070086 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -070087 * |WifiStatusCode.SUCCESS|,
88 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
89 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
90 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
91 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius5e254662016-10-26 10:10:48 -070092 * @return capabilities Instance of |StaApfPacketFilterCapabilities|.
Roshan Pius7b777472016-10-07 13:15:59 -070093 */
94 getApfPacketFilterCapabilities()
Roshan Pius5e254662016-10-26 10:10:48 -070095 generates (WifiStatus status, StaApfPacketFilterCapabilities capabilities);
Roshan Pius7b777472016-10-07 13:15:59 -070096
97 /**
98 * Installs an APF program on this iface, replacing an existing
99 * program if present.
Roshan Pius18680b72016-10-12 08:25:48 -0700100 * Must fail if |StaIfaceCapabilityMask.APF| is not set.
Roshan Pius7b777472016-10-07 13:15:59 -0700101 *
102 * @param cmdId command Id to use for this invocation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700103 * @param APF Program to be set.
Roshan Piusa52dc732016-10-10 11:53:07 -0700104 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700105 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -0700106 * |WifiStatusCode.SUCCESS|,
107 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
108 * |WifiStatusCode.ERROR_INVALID_ARGS|,
109 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
110 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
111 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius7b777472016-10-07 13:15:59 -0700112 */
Roshan Pius1f9073c2016-10-10 10:32:22 -0700113 installApfPacketFilter(CommandId cmdId, vec<uint8_t> program)
Roshan Piusa52dc732016-10-10 11:53:07 -0700114 generates (WifiStatus status);
Roshan Pius7b777472016-10-07 13:15:59 -0700115
116 /**
Roshan Pius18680b72016-10-12 08:25:48 -0700117 * Used to query additional information about the chip's Background Scan capabilities.
118 * Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
Roshan Pius7b777472016-10-07 13:15:59 -0700119 *
Roshan Piusa52dc732016-10-10 11:53:07 -0700120 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700121 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -0700122 * |WifiStatusCode.SUCCESS|,
123 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
124 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
125 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
126 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius5e254662016-10-26 10:10:48 -0700127 * @return capabilities Instance of |StaBackgroundScanCapabilities|.
Roshan Pius7b777472016-10-07 13:15:59 -0700128 */
129 getBackgroundScanCapabilities()
Roshan Pius5e254662016-10-26 10:10:48 -0700130 generates (WifiStatus status, StaBackgroundScanCapabilities capabilities);
Roshan Pius7b777472016-10-07 13:15:59 -0700131
132 /**
Roshan Pius18680b72016-10-12 08:25:48 -0700133 * Used to query the list of valid frequencies (depending on country code set)
134 * for the provided band. These channels may be specifed in the
135 * |BackgroundScanBucketParameters.frequenciesInMhz| for a background scan
136 * request.
137 * Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
138 *
Roshan Pius5e254662016-10-26 10:10:48 -0700139 * @param band Band for which the frequency list is being generated.
Roshan Pius18680b72016-10-12 08:25:48 -0700140 * @return status WifiStatus of the operation.
141 * Possible status codes:
142 * |WifiStatusCode.SUCCESS|,
143 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
144 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
145 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
146 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius120f94c2016-10-13 11:48:42 -0700147 * @return frequencies vector of valid frequencies for the provided band.
Roshan Pius18680b72016-10-12 08:25:48 -0700148 */
Roshan Pius5e254662016-10-26 10:10:48 -0700149 getValidFrequenciesForBackgroundScan(StaBackgroundScanBand band)
Roshan Pius120f94c2016-10-13 11:48:42 -0700150 generates (WifiStatus status, vec<WifiChannelInMhz> frequencies);
Roshan Pius18680b72016-10-12 08:25:48 -0700151
152 /**
Roshan Pius7b777472016-10-07 13:15:59 -0700153 * Start a background scan using the given cmdId as an identifier. Only one
154 * active background scan need be supported.
Roshan Pius18680b72016-10-12 08:25:48 -0700155 * Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
Roshan Pius7b777472016-10-07 13:15:59 -0700156 *
157 * When this is called all requested buckets must be scanned, starting the
158 * beginning of the cycle.
159 *
160 * For example:
161 * If there are two buckets specified
162 * - Bucket 1: period=10s
163 * - Bucket 2: period=20s
164 * - Bucket 3: period=30s
165 * Then the following scans must occur
166 * - t=0 buckets 1, 2, and 3 are scanned
167 * - t=10 bucket 1 is scanned
168 * - t=20 bucket 1 and 2 are scanned
169 * - t=30 bucket 1 and 3 are scanned
170 * - t=40 bucket 1 and 2 are scanned
171 * - t=50 bucket 1 is scanned
172 * - t=60 buckets 1, 2, and 3 are scanned
173 * - and the patter repeats
174 *
175 * If any scan does not occur or is incomplete (error, interrupted, etc) then
176 * a cached scan result must still be recorded with the
177 * WIFI_SCAN_FLAG_INTERRUPTED flag set.
178 *
179 * @param cmdId command Id to use for this invocation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700180 * @params Background scan parameters.
Roshan Piusa52dc732016-10-10 11:53:07 -0700181 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700182 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -0700183 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
184 * |WifiStatusCode.ERROR_INVALID_ARGS|,
185 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
186 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
187 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius7b777472016-10-07 13:15:59 -0700188 */
Roshan Pius5e254662016-10-26 10:10:48 -0700189 startBackgroundScan(CommandId cmdId, StaBackgroundScanParameters params)
Roshan Piusa52dc732016-10-10 11:53:07 -0700190 generates (WifiStatus status);
Roshan Pius7b777472016-10-07 13:15:59 -0700191
192 /**
193 * Stop the background scan started.
Roshan Pius18680b72016-10-12 08:25:48 -0700194 * Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
Roshan Pius7b777472016-10-07 13:15:59 -0700195 *
196 * @param cmdId command Id corresponding to the request.
Roshan Piusa52dc732016-10-10 11:53:07 -0700197 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700198 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -0700199 * |WifiStatusCode.SUCCESS|,
200 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
201 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
Roshan Piusfe9ad362016-10-19 16:45:12 -0700202 * |WifiStatusCode.ERROR_NOT_STARTED|,
Roshan Piusa52dc732016-10-10 11:53:07 -0700203 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
204 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius7b777472016-10-07 13:15:59 -0700205 */
Roshan Piusa52dc732016-10-10 11:53:07 -0700206 stopBackgroundScan(CommandId cmdId) generates (WifiStatus status);
Roshan Pius18680b72016-10-12 08:25:48 -0700207
208 /**
209 * Enable link layer stats collection.
210 * Must fail if |StaIfaceCapabilityMask.LINK_LAYER_STATS| is not set.
211 *
212 * Radio statistics (once started) must not stop until disabled.
213 * Iface statistics (once started) reset and start afresh after each
214 * connection until disabled.
215 *
216 * @param debug Set for field debug mode. Driver must collect all
217 * statistics regardless of performance impact.
218 * @return status WifiStatus of the operation.
219 * Possible status codes:
220 * |WifiStatusCode.SUCCESS|,
221 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
222 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
223 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
224 * |WifiStatusCode.ERROR_UNKNOWN|
225 */
226 enableLinkLayerStatsCollection(bool debug)
227 generates (WifiStatus status);
228
229 /**
230 * Disable link layer stats collection.
231 * Must fail if |StaIfaceCapabilityMask.LINK_LAYER_STATS| is not set.
232 *
233 * @return status WifiStatus of the operation.
234 * Possible status codes:
235 * |WifiStatusCode.SUCCESS|,
236 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
237 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
Roshan Piusfe9ad362016-10-19 16:45:12 -0700238 * |WifiStatusCode.ERROR_NOT_STARTED|,
Roshan Pius18680b72016-10-12 08:25:48 -0700239 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
240 * |WifiStatusCode.ERROR_UNKNOWN|
241 */
242 disableLinkLayerStatsCollection() generates (WifiStatus status);
243
244 /**
245 * Retrieve the latest link layer stats.
246 * Must fail if |StaIfaceCapabilityMask.LINK_LAYER_STATS| is not set or if
247 * link layer stats collection hasn't been explicitly enabled.
248 *
249 * @return status WifiStatus of the operation.
250 * Possible status codes:
251 * |WifiStatusCode.SUCCESS|,
252 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
253 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
Roshan Piusfe9ad362016-10-19 16:45:12 -0700254 * |WifiStatusCode.ERROR_NOT_STARTED|,
Roshan Pius18680b72016-10-12 08:25:48 -0700255 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
256 * |WifiStatusCode.ERROR_UNKNOWN|
257 * @return stats Instance of |LinkLayerStats|.
258 */
Roshan Pius5e254662016-10-26 10:10:48 -0700259 getLinkLayerStats() generates (WifiStatus status, StaLinkLayerStats stats);
Roshan Piusfe9ad362016-10-19 16:45:12 -0700260
261 /**
262 * API to start packet fate monitoring.
263 * - Once stared, monitoring must remain active until HAL is unloaded.
264 * - When HAL is unloaded, all packet fate buffers must be cleared.
265 * - The packet fates are used to monitor the state of packets transmitted/
266 * received during association.
267 *
268 * @return status WifiStatus of the operation.
269 * Possible status codes:
270 * |WifiStatusCode.SUCCESS|,
271 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
272 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
273 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
274 * |WifiStatusCode.ERROR_UNKNOWN|
275 */
276 startDebugPacketFateMonitoring() generates (WifiStatus status);
277
278 /**
279 * API to stop packet fate monitoring.
280 *
281 * @return status WifiStatus of the operation.
282 * Possible status codes:
283 * |WifiStatusCode.SUCCESS|,
284 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
285 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
286 * |WifiStatusCode.ERROR_NOT_STARTED|,
287 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
288 * |WifiStatusCode.ERROR_UNKNOWN|
289 */
290 stopDebugPacketFateMonitoring() generates (WifiStatus status);
291
292 /**
293 * API to retrieve fates of outbound packets.
294 * - HAL implementation must return the fates of
295 * all the frames transmitted for the most recent association.
296 * The fate reports must follow the same order as their respective
297 * packets.
298 * - HAL implementation may choose (but is not required) to include
299 * reports for management frames.
300 * - Packets reported by firmware, but not recognized by driver,
301 * must be included. However, the ordering of the corresponding
302 * reports is at the discretion of HAL implementation.
303 * - Framework must be able to call this API multiple times for the same
304 * association.
305 *
306 * @return status WifiStatus of the operation.
307 * Possible status codes:
308 * |WifiStatusCode.SUCCESS|,
309 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
310 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
311 * |WifiStatusCode.ERROR_NOT_STARTED|,
312 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
313 * |WifiStatusCode.ERROR_UNKNOWN|
314 * @return fates Vector of |WifiDebugTxPacketFateReport| instances corresponding
315 * to the packet fates.
316 */
317 getDebugTxPacketFates()
318 generates (WifiStatus status, vec<WifiDebugTxPacketFateReport> fates);
319
320 /**
321 * API to retrieve fates of inbound packets.
322 * - HAL implementation must return the fates of
323 * all the frames received for the most recent association.
324 * The fate reports must follow the same order as their respective
325 * packets.
326 * - HAL implementation may choose (but is not required) to include
327 * reports for management frames.
328 * - Packets reported by firmware, but not recognized by driver,
329 * must be included. However, the ordering of the corresponding
330 * reports is at the discretion of HAL implementation.
331 * - Framework must be able to call this API multiple times for the same
332 * association.
333 *
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 * @return fates Vector of |WifiDebugRxPacketFateReport| instances corresponding
343 * to the packet fates.
344 */
345 getDebugRxPacketFates()
346 generates (WifiStatus status, vec<WifiDebugRxPacketFateReport> fates);
Roshan Piusadcfba42016-10-05 10:19:06 -0700347};