Roshan Pius | adcfba4 | 2016-10-05 10:19:06 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package android.hardware.wifi@1.0; |
| 18 | |
| 19 | import IWifiIface; |
Roshan Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 20 | import IWifiStaIfaceEventCallback; |
Roshan Pius | adcfba4 | 2016-10-05 10:19:06 -0700 | [diff] [blame] | 21 | |
| 22 | /** |
| 23 | * Interface used to represent a single STA iface. |
| 24 | */ |
| 25 | interface IWifiStaIface extends IWifiIface { |
Roshan Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 26 | /** |
| 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 Pius | 18680b7 | 2016-10-12 08:25:48 -0700 | [diff] [blame] | 43 | /** |
| 44 | * If set indicates that the link layer stats APIs are supported. |
| 45 | */ |
Roshan Pius | 5e25466 | 2016-10-26 10:10:48 -0700 | [diff] [blame] | 46 | LINK_LAYER_STATS = 1 << 2, |
Roshan Pius | 18680b7 | 2016-10-12 08:25:48 -0700 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | /** |
Roshan Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 50 | * 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 Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 56 | * @return status WifiStatus of the operation. |
Roshan Pius | 1f9073c | 2016-10-10 10:32:22 -0700 | [diff] [blame] | 57 | * Possible status codes: |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 58 | * |WifiStatusCode.SUCCESS|, |
| 59 | * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID| |
Roshan Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 60 | */ |
Roshan Pius | 1f9073c | 2016-10-10 10:32:22 -0700 | [diff] [blame] | 61 | registerEventCallback(IWifiStaIfaceEventCallback callback) |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 62 | generates (WifiStatus status); |
Roshan Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 63 | |
| 64 | /** |
| 65 | * Get the capabilities supported by this STA iface. |
| 66 | * |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 67 | * @return status WifiStatus of the operation. |
Roshan Pius | 1f9073c | 2016-10-10 10:32:22 -0700 | [diff] [blame] | 68 | * Possible status codes: |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 69 | * |WifiStatusCode.SUCCESS|, |
| 70 | * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, |
| 71 | * |WifiStatusCode.ERROR_NOT_AVAILABLE|, |
| 72 | * |WifiStatusCode.ERROR_UNKNOWN| |
Roshan Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 73 | * @return capabilities Bitset of |StaIfaceCapabilityMask| values. |
| 74 | */ |
Roshan Pius | 5e25466 | 2016-10-26 10:10:48 -0700 | [diff] [blame] | 75 | getCapabilities() generates (WifiStatus status, uint32_t capabilities); |
Roshan Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 76 | |
| 77 | /** |
| 78 | * Used to query additional information about the chip's APF capabilities. |
Roshan Pius | 18680b7 | 2016-10-12 08:25:48 -0700 | [diff] [blame] | 79 | * Must fail if |StaIfaceCapabilityMask.APF| is not set. |
Roshan Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 80 | * |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 81 | * @return status WifiStatus of the operation. |
Roshan Pius | 1f9073c | 2016-10-10 10:32:22 -0700 | [diff] [blame] | 82 | * Possible status codes: |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 83 | * |WifiStatusCode.SUCCESS|, |
| 84 | * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, |
| 85 | * |WifiStatusCode.ERROR_NOT_SUPPORTED|, |
| 86 | * |WifiStatusCode.ERROR_NOT_AVAILABLE|, |
| 87 | * |WifiStatusCode.ERROR_UNKNOWN| |
Roshan Pius | 5e25466 | 2016-10-26 10:10:48 -0700 | [diff] [blame] | 88 | * @return capabilities Instance of |StaApfPacketFilterCapabilities|. |
Roshan Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 89 | */ |
| 90 | getApfPacketFilterCapabilities() |
Roshan Pius | 5e25466 | 2016-10-26 10:10:48 -0700 | [diff] [blame] | 91 | generates (WifiStatus status, StaApfPacketFilterCapabilities capabilities); |
Roshan Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 92 | |
| 93 | /** |
| 94 | * Installs an APF program on this iface, replacing an existing |
| 95 | * program if present. |
Roshan Pius | 18680b7 | 2016-10-12 08:25:48 -0700 | [diff] [blame] | 96 | * Must fail if |StaIfaceCapabilityMask.APF| is not set. |
Roshan Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 97 | * |
| 98 | * @param cmdId command Id to use for this invocation. |
Roshan Pius | 1f9073c | 2016-10-10 10:32:22 -0700 | [diff] [blame] | 99 | * @param APF Program to be set. |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 100 | * @return status WifiStatus of the operation. |
Roshan Pius | 1f9073c | 2016-10-10 10:32:22 -0700 | [diff] [blame] | 101 | * Possible status codes: |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 102 | * |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 Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 108 | */ |
Roshan Pius | 1f9073c | 2016-10-10 10:32:22 -0700 | [diff] [blame] | 109 | installApfPacketFilter(CommandId cmdId, vec<uint8_t> program) |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 110 | generates (WifiStatus status); |
Roshan Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 111 | |
| 112 | /** |
Roshan Pius | 18680b7 | 2016-10-12 08:25:48 -0700 | [diff] [blame] | 113 | * Used to query additional information about the chip's Background Scan capabilities. |
| 114 | * Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set. |
Roshan Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 115 | * |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 116 | * @return status WifiStatus of the operation. |
Roshan Pius | 1f9073c | 2016-10-10 10:32:22 -0700 | [diff] [blame] | 117 | * Possible status codes: |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 118 | * |WifiStatusCode.SUCCESS|, |
| 119 | * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, |
| 120 | * |WifiStatusCode.ERROR_NOT_SUPPORTED|, |
| 121 | * |WifiStatusCode.ERROR_NOT_AVAILABLE|, |
| 122 | * |WifiStatusCode.ERROR_UNKNOWN| |
Roshan Pius | 5e25466 | 2016-10-26 10:10:48 -0700 | [diff] [blame] | 123 | * @return capabilities Instance of |StaBackgroundScanCapabilities|. |
Roshan Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 124 | */ |
| 125 | getBackgroundScanCapabilities() |
Roshan Pius | 5e25466 | 2016-10-26 10:10:48 -0700 | [diff] [blame] | 126 | generates (WifiStatus status, StaBackgroundScanCapabilities capabilities); |
Roshan Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 127 | |
| 128 | /** |
Roshan Pius | 18680b7 | 2016-10-12 08:25:48 -0700 | [diff] [blame] | 129 | * 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 Pius | 5e25466 | 2016-10-26 10:10:48 -0700 | [diff] [blame] | 135 | * @param band Band for which the frequency list is being generated. |
Roshan Pius | 18680b7 | 2016-10-12 08:25:48 -0700 | [diff] [blame] | 136 | * @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 Pius | 120f94c | 2016-10-13 11:48:42 -0700 | [diff] [blame] | 143 | * @return frequencies vector of valid frequencies for the provided band. |
Roshan Pius | 18680b7 | 2016-10-12 08:25:48 -0700 | [diff] [blame] | 144 | */ |
Roshan Pius | 5e25466 | 2016-10-26 10:10:48 -0700 | [diff] [blame] | 145 | getValidFrequenciesForBackgroundScan(StaBackgroundScanBand band) |
Roshan Pius | 120f94c | 2016-10-13 11:48:42 -0700 | [diff] [blame] | 146 | generates (WifiStatus status, vec<WifiChannelInMhz> frequencies); |
Roshan Pius | 18680b7 | 2016-10-12 08:25:48 -0700 | [diff] [blame] | 147 | |
| 148 | /** |
Roshan Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 149 | * Start a background scan using the given cmdId as an identifier. Only one |
| 150 | * active background scan need be supported. |
Roshan Pius | 18680b7 | 2016-10-12 08:25:48 -0700 | [diff] [blame] | 151 | * Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set. |
Roshan Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 152 | * |
| 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 Pius | 1f9073c | 2016-10-10 10:32:22 -0700 | [diff] [blame] | 176 | * @params Background scan parameters. |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 177 | * @return status WifiStatus of the operation. |
Roshan Pius | 1f9073c | 2016-10-10 10:32:22 -0700 | [diff] [blame] | 178 | * Possible status codes: |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 179 | * |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 Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 184 | */ |
Roshan Pius | 5e25466 | 2016-10-26 10:10:48 -0700 | [diff] [blame] | 185 | startBackgroundScan(CommandId cmdId, StaBackgroundScanParameters params) |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 186 | generates (WifiStatus status); |
Roshan Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 187 | |
| 188 | /** |
| 189 | * Stop the background scan started. |
Roshan Pius | 18680b7 | 2016-10-12 08:25:48 -0700 | [diff] [blame] | 190 | * Must fail if |StaIfaceCapabilityMask.BACKGROUND_SCAN| is not set. |
Roshan Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 191 | * |
| 192 | * @param cmdId command Id corresponding to the request. |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 193 | * @return status WifiStatus of the operation. |
Roshan Pius | 1f9073c | 2016-10-10 10:32:22 -0700 | [diff] [blame] | 194 | * Possible status codes: |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 195 | * |WifiStatusCode.SUCCESS|, |
| 196 | * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, |
| 197 | * |WifiStatusCode.ERROR_NOT_SUPPORTED|, |
| 198 | * |WifiStatusCode.ERROR_NOT_AVAILABLE|, |
| 199 | * |WifiStatusCode.ERROR_UNKNOWN| |
Roshan Pius | 7b77747 | 2016-10-07 13:15:59 -0700 | [diff] [blame] | 200 | */ |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 201 | stopBackgroundScan(CommandId cmdId) generates (WifiStatus status); |
Roshan Pius | 18680b7 | 2016-10-12 08:25:48 -0700 | [diff] [blame] | 202 | |
| 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 Pius | 5e25466 | 2016-10-26 10:10:48 -0700 | [diff] [blame] | 252 | getLinkLayerStats() generates (WifiStatus status, StaLinkLayerStats stats); |
Roshan Pius | adcfba4 | 2016-10-05 10:19:06 -0700 | [diff] [blame] | 253 | }; |