blob: a738ebe4dad160f8dc1c4d4b3b46d75808c3585a [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.
216 */
217 oneway registerEventCallback(IWifiStaIfaceEventCallback callback);
218
219 /**
220 * Get the capabilities supported by this STA iface.
221 *
222 * @return capabilities Bitset of |StaIfaceCapabilityMask| values.
223 */
224 getCapabilities() generates (uint64_t capabilities);
225
226 /**
227 * Used to query additional information about the chip's APF capabilities.
228 * Will fail if |StaIfaceCapabilityMask.APF| is not set.
229 *
230 * @return capabilities Instance of |ApfPacketFilterCapabilities|.
231 */
232 getApfPacketFilterCapabilities()
233 generates (ApfPacketFilterCapabilities capabilities);
234
235 /**
236 * Installs an APF program on this iface, replacing an existing
237 * program if present.
238 * Will fail if |StaIfaceCapabilityMask.APF| is not set.
239 *
240 * @param cmdId command Id to use for this invocation.
241 * @param program APF Program to be set.
242 */
243 oneway installApfPacketFilter(CommandId cmdId, vec<uint8_t> program);
244
245 /**
246 * Used to query additional information about the chip's APF capabilities.
247 * Will fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
248 *
249 * @return capabilities Instance of |BackgroundScanCapabilities|.
250 */
251 getBackgroundScanCapabilities()
252 generates (BackgroundScanCapabilities capabilities);
253
254 /**
255 * Start a background scan using the given cmdId as an identifier. Only one
256 * active background scan need be supported.
257 *
258 * When this is called all requested buckets must be scanned, starting the
259 * beginning of the cycle.
260 *
261 * For example:
262 * If there are two buckets specified
263 * - Bucket 1: period=10s
264 * - Bucket 2: period=20s
265 * - Bucket 3: period=30s
266 * Then the following scans must occur
267 * - t=0 buckets 1, 2, and 3 are scanned
268 * - t=10 bucket 1 is scanned
269 * - t=20 bucket 1 and 2 are scanned
270 * - t=30 bucket 1 and 3 are scanned
271 * - t=40 bucket 1 and 2 are scanned
272 * - t=50 bucket 1 is scanned
273 * - t=60 buckets 1, 2, and 3 are scanned
274 * - and the patter repeats
275 *
276 * If any scan does not occur or is incomplete (error, interrupted, etc) then
277 * a cached scan result must still be recorded with the
278 * WIFI_SCAN_FLAG_INTERRUPTED flag set.
279 *
280 * @param cmdId command Id to use for this invocation.
281 * @param params Background scan parameters.
282 */
283 oneway startBackgroundScan(CommandId cmdId, BackgroundScanParameters params);
284
285 /**
286 * Stop the background scan started.
287 *
288 * @param cmdId command Id corresponding to the request.
289 */
290 oneway stopBackgroundScan(CommandId cmdId);
Roshan Piusadcfba42016-10-05 10:19:06 -0700291};