blob: 3ca9b7d084e67ed86b50c7df4072790e6d2f1b72 [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 Pius18680b72016-10-12 08:25:48 -070047 };
48
49 /**
Roshan Pius7b777472016-10-07 13:15:59 -070050 * Requests notifications of significant events on this iface. Multiple calls
51 * to this must register multiple callbacks each of which must receive all
52 * events.
53 *
54 * @param callback An instance of the |IWifiStaIfaceEventCallback| HIDL interface
55 * object.
Roshan Piusa52dc732016-10-10 11:53:07 -070056 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -070057 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -070058 * |WifiStatusCode.SUCCESS|,
59 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|
Roshan Pius7b777472016-10-07 13:15:59 -070060 */
Roshan Pius1f9073c2016-10-10 10:32:22 -070061 registerEventCallback(IWifiStaIfaceEventCallback callback)
Roshan Piusa52dc732016-10-10 11:53:07 -070062 generates (WifiStatus status);
Roshan Pius7b777472016-10-07 13:15:59 -070063
64 /**
65 * Get the capabilities supported by this STA iface.
66 *
Roshan Piusa52dc732016-10-10 11:53:07 -070067 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -070068 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -070069 * |WifiStatusCode.SUCCESS|,
70 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
71 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
72 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius7b777472016-10-07 13:15:59 -070073 * @return capabilities Bitset of |StaIfaceCapabilityMask| values.
74 */
Roshan Pius5e254662016-10-26 10:10:48 -070075 getCapabilities() generates (WifiStatus status, uint32_t capabilities);
Roshan Pius7b777472016-10-07 13:15:59 -070076
77 /**
78 * Used to query additional information about the chip's APF capabilities.
Roshan Pius18680b72016-10-12 08:25:48 -070079 * Must fail if |StaIfaceCapabilityMask.APF| is not set.
Roshan Pius7b777472016-10-07 13:15:59 -070080 *
Roshan Piusa52dc732016-10-10 11:53:07 -070081 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -070082 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -070083 * |WifiStatusCode.SUCCESS|,
84 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
85 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
86 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
87 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius5e254662016-10-26 10:10:48 -070088 * @return capabilities Instance of |StaApfPacketFilterCapabilities|.
Roshan Pius7b777472016-10-07 13:15:59 -070089 */
90 getApfPacketFilterCapabilities()
Roshan Pius5e254662016-10-26 10:10:48 -070091 generates (WifiStatus status, StaApfPacketFilterCapabilities capabilities);
Roshan Pius7b777472016-10-07 13:15:59 -070092
93 /**
94 * Installs an APF program on this iface, replacing an existing
95 * program if present.
Roshan Pius18680b72016-10-12 08:25:48 -070096 * Must fail if |StaIfaceCapabilityMask.APF| is not set.
Roshan Pius7b777472016-10-07 13:15:59 -070097 *
98 * @param cmdId command Id to use for this invocation.
Roshan Pius1f9073c2016-10-10 10:32:22 -070099 * @param APF Program to be set.
Roshan Piusa52dc732016-10-10 11:53:07 -0700100 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700101 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -0700102 * |WifiStatusCode.SUCCESS|,
103 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
104 * |WifiStatusCode.ERROR_INVALID_ARGS|,
105 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
106 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
107 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius7b777472016-10-07 13:15:59 -0700108 */
Roshan Pius1f9073c2016-10-10 10:32:22 -0700109 installApfPacketFilter(CommandId cmdId, vec<uint8_t> program)
Roshan Piusa52dc732016-10-10 11:53:07 -0700110 generates (WifiStatus status);
Roshan Pius7b777472016-10-07 13:15:59 -0700111
112 /**
Roshan Pius18680b72016-10-12 08:25:48 -0700113 * Used to query additional information about the chip's Background Scan capabilities.
114 * Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
Roshan Pius7b777472016-10-07 13:15:59 -0700115 *
Roshan Piusa52dc732016-10-10 11:53:07 -0700116 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700117 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -0700118 * |WifiStatusCode.SUCCESS|,
119 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
120 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
121 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
122 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius5e254662016-10-26 10:10:48 -0700123 * @return capabilities Instance of |StaBackgroundScanCapabilities|.
Roshan Pius7b777472016-10-07 13:15:59 -0700124 */
125 getBackgroundScanCapabilities()
Roshan Pius5e254662016-10-26 10:10:48 -0700126 generates (WifiStatus status, StaBackgroundScanCapabilities capabilities);
Roshan Pius7b777472016-10-07 13:15:59 -0700127
128 /**
Roshan Pius18680b72016-10-12 08:25:48 -0700129 * Used to query the list of valid frequencies (depending on country code set)
130 * for the provided band. These channels may be specifed in the
131 * |BackgroundScanBucketParameters.frequenciesInMhz| for a background scan
132 * request.
133 * Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
134 *
Roshan Pius5e254662016-10-26 10:10:48 -0700135 * @param band Band for which the frequency list is being generated.
Roshan Pius18680b72016-10-12 08:25:48 -0700136 * @return status WifiStatus of the operation.
137 * Possible status codes:
138 * |WifiStatusCode.SUCCESS|,
139 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
140 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
141 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
142 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius120f94c2016-10-13 11:48:42 -0700143 * @return frequencies vector of valid frequencies for the provided band.
Roshan Pius18680b72016-10-12 08:25:48 -0700144 */
Roshan Pius5e254662016-10-26 10:10:48 -0700145 getValidFrequenciesForBackgroundScan(StaBackgroundScanBand band)
Roshan Pius120f94c2016-10-13 11:48:42 -0700146 generates (WifiStatus status, vec<WifiChannelInMhz> frequencies);
Roshan Pius18680b72016-10-12 08:25:48 -0700147
148 /**
Roshan Pius7b777472016-10-07 13:15:59 -0700149 * Start a background scan using the given cmdId as an identifier. Only one
150 * active background scan need be supported.
Roshan Pius18680b72016-10-12 08:25:48 -0700151 * Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
Roshan Pius7b777472016-10-07 13:15:59 -0700152 *
153 * When this is called all requested buckets must be scanned, starting the
154 * beginning of the cycle.
155 *
156 * For example:
157 * If there are two buckets specified
158 * - Bucket 1: period=10s
159 * - Bucket 2: period=20s
160 * - Bucket 3: period=30s
161 * Then the following scans must occur
162 * - t=0 buckets 1, 2, and 3 are scanned
163 * - t=10 bucket 1 is scanned
164 * - t=20 bucket 1 and 2 are scanned
165 * - t=30 bucket 1 and 3 are scanned
166 * - t=40 bucket 1 and 2 are scanned
167 * - t=50 bucket 1 is scanned
168 * - t=60 buckets 1, 2, and 3 are scanned
169 * - and the patter repeats
170 *
171 * If any scan does not occur or is incomplete (error, interrupted, etc) then
172 * a cached scan result must still be recorded with the
173 * WIFI_SCAN_FLAG_INTERRUPTED flag set.
174 *
175 * @param cmdId command Id to use for this invocation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700176 * @params Background scan parameters.
Roshan Piusa52dc732016-10-10 11:53:07 -0700177 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700178 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -0700179 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
180 * |WifiStatusCode.ERROR_INVALID_ARGS|,
181 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
182 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
183 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius7b777472016-10-07 13:15:59 -0700184 */
Roshan Pius5e254662016-10-26 10:10:48 -0700185 startBackgroundScan(CommandId cmdId, StaBackgroundScanParameters params)
Roshan Piusa52dc732016-10-10 11:53:07 -0700186 generates (WifiStatus status);
Roshan Pius7b777472016-10-07 13:15:59 -0700187
188 /**
189 * Stop the background scan started.
Roshan Pius18680b72016-10-12 08:25:48 -0700190 * Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set.
Roshan Pius7b777472016-10-07 13:15:59 -0700191 *
192 * @param cmdId command Id corresponding to the request.
Roshan Piusa52dc732016-10-10 11:53:07 -0700193 * @return status WifiStatus of the operation.
Roshan Pius1f9073c2016-10-10 10:32:22 -0700194 * Possible status codes:
Roshan Piusa52dc732016-10-10 11:53:07 -0700195 * |WifiStatusCode.SUCCESS|,
196 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
197 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
198 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
199 * |WifiStatusCode.ERROR_UNKNOWN|
Roshan Pius7b777472016-10-07 13:15:59 -0700200 */
Roshan Piusa52dc732016-10-10 11:53:07 -0700201 stopBackgroundScan(CommandId cmdId) generates (WifiStatus status);
Roshan Pius18680b72016-10-12 08:25:48 -0700202
203 /**
204 * Enable link layer stats collection.
205 * Must fail if |StaIfaceCapabilityMask.LINK_LAYER_STATS| is not set.
206 *
207 * Radio statistics (once started) must not stop until disabled.
208 * Iface statistics (once started) reset and start afresh after each
209 * connection until disabled.
210 *
211 * @param debug Set for field debug mode. Driver must collect all
212 * statistics regardless of performance impact.
213 * @return status WifiStatus of the operation.
214 * Possible status codes:
215 * |WifiStatusCode.SUCCESS|,
216 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
217 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
218 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
219 * |WifiStatusCode.ERROR_UNKNOWN|
220 */
221 enableLinkLayerStatsCollection(bool debug)
222 generates (WifiStatus status);
223
224 /**
225 * Disable link layer stats collection.
226 * Must fail if |StaIfaceCapabilityMask.LINK_LAYER_STATS| is not set.
227 *
228 * @return status WifiStatus of the operation.
229 * Possible status codes:
230 * |WifiStatusCode.SUCCESS|,
231 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
232 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
233 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
234 * |WifiStatusCode.ERROR_UNKNOWN|
235 */
236 disableLinkLayerStatsCollection() generates (WifiStatus status);
237
238 /**
239 * Retrieve the latest link layer stats.
240 * Must fail if |StaIfaceCapabilityMask.LINK_LAYER_STATS| is not set or if
241 * link layer stats collection hasn't been explicitly enabled.
242 *
243 * @return status WifiStatus of the operation.
244 * Possible status codes:
245 * |WifiStatusCode.SUCCESS|,
246 * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
247 * |WifiStatusCode.ERROR_NOT_SUPPORTED|,
248 * |WifiStatusCode.ERROR_NOT_AVAILABLE|,
249 * |WifiStatusCode.ERROR_UNKNOWN|
250 * @return stats Instance of |LinkLayerStats|.
251 */
Roshan Pius5e254662016-10-26 10:10:48 -0700252 getLinkLayerStats() generates (WifiStatus status, StaLinkLayerStats stats);
Roshan Piusadcfba42016-10-05 10:19:06 -0700253};