blob: ea535f2151275e2428cdef838db0d926873ae797 [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,
43 };
44
45 /**
46 * Parameters to specify the APF capability of this iface.
47 */
48 struct ApfPacketFilterCapabilities {
49 /**
50 * Version of the packet filter interpreter supported
51 */
52 uint32_t version;
53 /**
54 * Maximum size of the filter bytecodes in bytes for an iface.
55 */
56 uint32_t maxLength;
57 };
58
59 /**
60 * Parameters to specify the Background Scan capability of this iface.
61 */
62 struct BackgroundScanCapabilities {
63 /**
64 * Maximum number of bytes available for cached scan results
65 */
66 uint32_t maxCacheSize;
67 /**
68 * Maximum number of buckets that can be supplied for a scan
69 */
70 uint32_t maxBuckets;
71 /**
72 * Maximum number of APs that must be stored for each scan.
73 */
74 uint32_t maxApCachePerScan;
75 /**
76 * Max reporting number of scans threshold that can be specified in the scan
77 * parameters.
78 */
79 int32_t maxReportingThreshold;
80 };
81
82 /**
83 * Bands that can be specified in Background scan requests.
84 */
85 enum BackgroundScanBand : uint32_t {
86 BAND_UNSPECIFIED,
87 /**
88 * 2.4 GHz.
89 */
90 BAND_24GHZ = 1,
91 /**
92 * 5 GHz without DFS.
93 */
94 BAND_5GHZ = 2,
95 /**
96 * 5 GHz DFS only.
97 */
98 BAND_5GHZ_DFS = 4,
99 /**
100 * 5 GHz with DFS.
101 */
102 BAND_5GHZ_WITH_DFS = 6,
103 /**
104 * 2.4 GHz + 5 GHz; no DFS.
105 */
106 BAND_24GHZ_5GHZ = 3,
107 /**
108 * 2.4 GHz + 5 GHz with DFS
109 */
110 BAND_24GHZ_5GHZ_WITH_DFS = 7
111 };
112
113 /**
114 * Mask of event reporting schemes that can be specified in background scan
115 * requests.
116 */
117 enum BackgroundScanBucketEventReportSchemeMask : uint32_t {
118 /**
119 * Report a scan completion event after scan. If this is not set then scan
120 * completion events must be reported if report_threshold_percent or
121 * report_threshold_num_scans is reached.
122 */
123 EACH_SCAN = 1 << 0,
124 /**
125 * Forward scan results (beacons/probe responses + IEs) in real time to HAL,
126 * in addition to completion events.
127 * Note: To keep backward compatibility, fire completion events regardless
128 * of REPORT_EVENTS_EACH_SCAN.
129 */
130 FULL_RESULTS = 1 << 1,
131 /**
132 * Controls if scans for this bucket must be placed in the results buffer.
133 */
134 NO_BATCH = 1 << 2,
135 };
136
137 /**
138 * Background Scan parameters per bucket that can be specified in background
139 * scan requests.
140 */
141 struct BackgroundScanBucketParameters {
142 /**
143 * Bands to scan or 0 if frequencies list must be used instead.
144 */
145 BackgroundScanBand band;
146 /**
147 * Channel frequencies (in Mhz) to scan if |band| is set to
148 * |UNSPECIFIED|.
149 */
150 vec<uint32_t> frequenciesInMhz;
151 /**
152 * Period at which this bucket must be scanned (in milliseconds). Must be an integer
153 * multiple of the |basePeriodInMs| specified in the BackgroundScanParameters.
154 */
155 uint32_t periodInMs;
156 /**
157 * Bitset of |BackgroundScanBucketEventReportSchemeMask| values controlling
158 * when events for this bucket must be reported.
159 */
160 uint32_t eventReportScheme;
161 /**
162 * For exponential back off. If |exponentialMaxPeriodInMs| is non zero or
163 * different than period, then this bucket is an exponential backoff bucket
164 * and the scan period must grow exponentially as per formula:
165 * actual_period(N) = period * (base ^ (N/step_count))
166 * to this maximum period (in milliseconds).
167 */
168 uint32_t exponentialMaxPeriodInMs;
169 /**
170 * For exponential back off. multiplier: new_period=old_period * base
171 */
172 uint32_t exponentialBase;
173 /**
174 * For exponential back off. Number of scans to perform for a given
175 * period.
176 */
177 uint32_t exponentialStepCount;
178 };
179
180 /**
181 * Background Scan parameters that can be specified in background scan
182 * requests.
183 */
184 struct BackgroundScanParameters {
185 /**
186 * GCD of all bucket periods (in milliseconds).
187 */
188 uint32_t basePeriodInMs;
189 /**
190 * Maximum number of APs that must be stored for each scan. If the maximum
191 * is reached the highest RSSI results must be returned.
192 */
193 uint32_t maxApPerScan;
194 /**
195 * % cache buffer filled threshold at which the host must be notified of
196 * batched scan results.
197 */
198 uint32_t reportThresholdPercent;
199 /**
200 * Threshold at which the AP must be woken up, in number of scans.
201 */
202 uint32_t reportThresholdNumScans;
203 /**
204 * List of buckets to be scheduled.
205 */
206 vec<BackgroundScanBucketParameters> buckets;
207 };
208
209 /**
210 * Requests notifications of significant events on this iface. Multiple calls
211 * to this must register multiple callbacks each of which must receive all
212 * events.
213 *
214 * @param callback An instance of the |IWifiStaIfaceEventCallback| HIDL interface
215 * object.
Roshan Piusa52dc732016-10-10 11:53:07 -0700216 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700217 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -0700218 * |WifiStatusCode.SUCCESS|,
219 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|
Roshan Pius7b777472016-10-07 13:15:59 -0700220 */
Roshan Pius1f9073c2016-10-10 10:32:22 -0700221 registerEventCallback(IWifiStaIfaceEventCallback callback)
Roshan Piusa52dc732016-10-10 11:53:07 -0700222 generates (WifiStatus status);
Roshan Pius7b777472016-10-07 13:15:59 -0700223
224 /**
225 * Get the capabilities supported by this STA iface.
226 *
Roshan Piusa52dc732016-10-10 11:53:07 -0700227 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700228 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -0700229 * |WifiStatusCode.SUCCESS|,
230 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
231 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
232 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius7b777472016-10-07 13:15:59 -0700233 * @return capabilities Bitset of |StaIfaceCapabilityMask| values.
234 */
Roshan Piusa52dc732016-10-10 11:53:07 -0700235 getCapabilities() generates (WifiStatus status, uint64_t capabilities);
Roshan Pius7b777472016-10-07 13:15:59 -0700236
237 /**
238 * Used to query additional information about the chip's APF capabilities.
239 * Will fail if |StaIfaceCapabilityMask.APF| is not set.
240 *
Roshan Piusa52dc732016-10-10 11:53:07 -0700241 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700242 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -0700243 * |WifiStatusCode.SUCCESS|,
244 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
245 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
246 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
247 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius7b777472016-10-07 13:15:59 -0700248 * @return capabilities Instance of |ApfPacketFilterCapabilities|.
249 */
250 getApfPacketFilterCapabilities()
Roshan Piusa52dc732016-10-10 11:53:07 -0700251 generates (WifiStatus status, ApfPacketFilterCapabilities capabilities);
Roshan Pius7b777472016-10-07 13:15:59 -0700252
253 /**
254 * Installs an APF program on this iface, replacing an existing
255 * program if present.
256 * Will fail if |StaIfaceCapabilityMask.APF| is not set.
257 *
258 * @param cmdId command Id to use for this invocation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700259 * @param APF Program to be set.
Roshan Piusa52dc732016-10-10 11:53:07 -0700260 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700261 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -0700262 * |WifiStatusCode.SUCCESS|,
263 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
264 * |WifiStatusCode.ERROR_INVALID_ARGS|,
265 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
266 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
267 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius7b777472016-10-07 13:15:59 -0700268 */
Roshan Pius1f9073c2016-10-10 10:32:22 -0700269 installApfPacketFilter(CommandId cmdId, vec<uint8_t> program)
Roshan Piusa52dc732016-10-10 11:53:07 -0700270 generates (WifiStatus status);
Roshan Pius7b777472016-10-07 13:15:59 -0700271
272 /**
273 * Used to query additional information about the chip's APF capabilities.
274 * Will fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
275 *
Roshan Piusa52dc732016-10-10 11:53:07 -0700276 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700277 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -0700278 * |WifiStatusCode.SUCCESS|,
279 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
280 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
281 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
282 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius7b777472016-10-07 13:15:59 -0700283 * @return capabilities Instance of |BackgroundScanCapabilities|.
284 */
285 getBackgroundScanCapabilities()
Roshan Piusa52dc732016-10-10 11:53:07 -0700286 generates (WifiStatus status, BackgroundScanCapabilities capabilities);
Roshan Pius7b777472016-10-07 13:15:59 -0700287
288 /**
289 * Start a background scan using the given cmdId as an identifier. Only one
290 * active background scan need be supported.
291 *
292 * When this is called all requested buckets must be scanned, starting the
293 * beginning of the cycle.
294 *
295 * For example:
296 * If there are two buckets specified
297 * - Bucket 1: period=10s
298 * - Bucket 2: period=20s
299 * - Bucket 3: period=30s
300 * Then the following scans must occur
301 * - t=0 buckets 1, 2, and 3 are scanned
302 * - t=10 bucket 1 is scanned
303 * - t=20 bucket 1 and 2 are scanned
304 * - t=30 bucket 1 and 3 are scanned
305 * - t=40 bucket 1 and 2 are scanned
306 * - t=50 bucket 1 is scanned
307 * - t=60 buckets 1, 2, and 3 are scanned
308 * - and the patter repeats
309 *
310 * If any scan does not occur or is incomplete (error, interrupted, etc) then
311 * a cached scan result must still be recorded with the
312 * WIFI_SCAN_FLAG_INTERRUPTED flag set.
313 *
314 * @param cmdId command Id to use for this invocation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700315 * @params Background scan parameters.
Roshan Piusa52dc732016-10-10 11:53:07 -0700316 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700317 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -0700318 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
319 * |WifiStatusCode.ERROR_INVALID_ARGS|,
320 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
321 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
322 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius7b777472016-10-07 13:15:59 -0700323 */
Roshan Pius1f9073c2016-10-10 10:32:22 -0700324 startBackgroundScan(CommandId cmdId, BackgroundScanParameters params)
Roshan Piusa52dc732016-10-10 11:53:07 -0700325 generates (WifiStatus status);
Roshan Pius7b777472016-10-07 13:15:59 -0700326
327 /**
328 * Stop the background scan started.
329 *
330 * @param cmdId command Id corresponding to the request.
Roshan Piusa52dc732016-10-10 11:53:07 -0700331 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700332 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -0700333 * |WifiStatusCode.SUCCESS|,
334 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
335 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
336 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
337 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius7b777472016-10-07 13:15:59 -0700338 */
Roshan Piusa52dc732016-10-10 11:53:07 -0700339 stopBackgroundScan(CommandId cmdId) generates (WifiStatus status);
Roshan Piusadcfba42016-10-05 10:19:06 -0700340};