Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -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 IWifiChipEventCallback; |
Roshan Pius | adcfba4 | 2016-10-05 10:19:06 -0700 | [diff] [blame^] | 20 | import IWifiApIface; |
| 21 | import IWifiNanIface; |
| 22 | import IWifiP2pIface; |
| 23 | import IWifiStaIface; |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 24 | |
| 25 | /** |
| 26 | * Interface that represents a chip that must be configured as a single unit. |
| 27 | * The HAL/driver/firmware will be responsible for determining which phy is used |
| 28 | * to perform operations like NAN, RTT, etc. |
| 29 | */ |
| 30 | interface IWifiChip { |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 31 | /** |
| 32 | * Set of interface types with the maximum number of interfaces that can have |
Roshan Pius | 271f2c2 | 2016-10-04 17:01:01 -0700 | [diff] [blame] | 33 | * one of the specified type for a given ChipIfaceCombination. See |
| 34 | * ChipIfaceCombination for examples. |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 35 | */ |
Roshan Pius | 271f2c2 | 2016-10-04 17:01:01 -0700 | [diff] [blame] | 36 | struct ChipIfaceCombinationLimit { |
| 37 | vec<IfaceType> types; // Each IfaceType may occur at most once |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 38 | uint32_t maxIfaces; |
| 39 | }; |
| 40 | |
| 41 | /** |
| 42 | * Set of interfaces that can operate concurrently when in a given mode. See |
| 43 | * ChipMode below. |
| 44 | * |
| 45 | * For example: |
| 46 | * [{STA} <= 2] |
| 47 | * At most two STA interfaces are supported |
| 48 | * [], [STA], [STA+STA] |
| 49 | * |
| 50 | * [{STA} <= 1, {NAN} <= 1, {AP} <= 1] |
| 51 | * Any combination of STA, NAN, AP |
| 52 | * [], [STA], [NAN], [AP], [STA+NAN], [STA+AP], [NAN+AP], [STA+NAN+AP] |
| 53 | * |
| 54 | * [{STA} <= 1, {NAN,P2P} <= 1] |
| 55 | * Optionally a STA and either NAN or P2P |
| 56 | * [], [STA], [STA+NAN], [STA+P2P], [NAN], [P2P] |
| 57 | * Not included [NAN+P2P], [STA+NAN+P2P] |
| 58 | * |
| 59 | * [{STA} <= 1, {STA,NAN} <= 1] |
| 60 | * Optionally a STA and either a second STA or a NAN |
| 61 | * [], [STA], [STA+NAN], [STA+STA], [NAN] |
| 62 | * Not included [STA+STA+NAN] |
| 63 | */ |
Roshan Pius | 271f2c2 | 2016-10-04 17:01:01 -0700 | [diff] [blame] | 64 | struct ChipIfaceCombination { |
| 65 | vec<ChipIfaceCombinationLimit> limits; |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 66 | }; |
| 67 | |
| 68 | /** |
| 69 | * A mode that the chip can be put in. A mode defines a set of constraints on |
| 70 | * the interfaces that can exist while in that mode. Modes define a unit of |
| 71 | * configuration where all interfaces must be torn down to switch to a |
| 72 | * different mode. Some HALs may only have a single mode, but an example where |
| 73 | * multiple modes would be required is if a chip has different firmwares with |
| 74 | * different capabilities. |
| 75 | * |
| 76 | * When in a mode, it must be possible to perform any combination of creating |
| 77 | * and removing interfaces as long as at least one of the |
Roshan Pius | 271f2c2 | 2016-10-04 17:01:01 -0700 | [diff] [blame] | 78 | * ChipIfaceCombinations is satisfied. This means that if a chip has two |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 79 | * available combinations, [{STA} <= 1] and [{AP} <= 1] then it is expected |
| 80 | * that exactly one STA interface or one AP interface can be created, but it |
| 81 | * is not expected that both a STA and AP interface could be created. If it |
| 82 | * was then there would be a single available combination |
| 83 | * [{STA} <=1, {AP} <= 1]. |
| 84 | * |
| 85 | * When switching between two available combinations it is expected that |
| 86 | * interfaces only supported by the initial combination will be removed until |
| 87 | * the target combination is also satisfied. At that point new interfaces |
| 88 | * satisfying only the target combination can be added (meaning the initial |
| 89 | * combination limits will no longer satisfied). The addition of these new |
| 90 | * interfaces should not impact the existence of interfaces that satisfy both |
| 91 | * combinations. |
| 92 | * |
| 93 | * For example, a chip with available combinations: |
| 94 | * [{STA} <= 2, {NAN} <=1] and [{STA} <=1, {NAN} <= 1, {AP} <= 1}] |
| 95 | * If the chip currently has 3 interfaces STA, STA and NAN and wants to add an |
| 96 | * AP interface in place of one of the STAs then first one of the STA |
| 97 | * interfaces must be removed and then the AP interface can be created after |
| 98 | * the STA had been torn down. During this process the remaining STA and NAN |
| 99 | * interfaces should not be removed/recreated. |
| 100 | * |
| 101 | * If a chip does not support this kind of reconfiguration in this mode then |
| 102 | * the combinations should be separated into two separate modes. Before |
| 103 | * switching modes all interfaces will be torn down, the mode switch will be |
| 104 | * enacted and when it completes the new interfaces will be brought up. |
| 105 | */ |
| 106 | struct ChipMode { |
| 107 | /** |
| 108 | * Id that can be used to put the chip in this mode. |
| 109 | */ |
| 110 | ChipModeId id; |
| 111 | |
| 112 | /** |
| 113 | * A list of the possible interface combinations that the chip can have |
| 114 | * while in this mode. |
| 115 | */ |
Roshan Pius | 271f2c2 | 2016-10-04 17:01:01 -0700 | [diff] [blame] | 116 | vec<ChipIfaceCombination> availableCombinations; |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 117 | }; |
| 118 | |
| 119 | /** |
Roshan Pius | adcfba4 | 2016-10-05 10:19:06 -0700 | [diff] [blame^] | 120 | * Get the id assigned to this chip. |
| 121 | * |
| 122 | * @return id Assigned chip Id. |
| 123 | */ |
| 124 | getId() generates (ChipId id); |
| 125 | |
| 126 | /** |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 127 | * Requests notifications of significant events on this chip. Multiple calls |
| 128 | * to this will register multiple callbacks each of which will receive all |
| 129 | * events. |
Roshan Pius | 6f31d92 | 2016-10-04 15:08:05 -0700 | [diff] [blame] | 130 | * |
| 131 | * @param callback An instance of the |IWifiChipEventCallback| HIDL interface |
| 132 | * object. |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 133 | */ |
| 134 | oneway registerEventCallback(IWifiChipEventCallback callback); |
| 135 | |
| 136 | /** |
| 137 | * Get the set of operation modes that the chip supports. |
Roshan Pius | 6f31d92 | 2016-10-04 15:08:05 -0700 | [diff] [blame] | 138 | * |
| 139 | * @return modes List of modes supported by the device. |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 140 | */ |
| 141 | getAvailableModes() generates (vec<ChipMode> modes); |
| 142 | |
| 143 | /** |
Roshan Pius | 6f31d92 | 2016-10-04 15:08:05 -0700 | [diff] [blame] | 144 | * Reconfigure the Chip. |
| 145 | * Must trigger |IWifiChipEventCallback.onChipReconfigured| on sucess, |
| 146 | * or |IWifiChipEventCallback.onChipReconfigureFailure| on failure. |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 147 | * |
| 148 | * @param modeId The mode that the chip should switch to, corresponding to the |
Roshan Pius | 6f31d92 | 2016-10-04 15:08:05 -0700 | [diff] [blame] | 149 | * id property of the target ChipMode. |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 150 | */ |
| 151 | oneway configureChip(ChipModeId modeId); |
| 152 | |
| 153 | /** |
| 154 | * Get the current mode that the chip is in. |
Roshan Pius | 6f31d92 | 2016-10-04 15:08:05 -0700 | [diff] [blame] | 155 | * |
| 156 | * @return modeId The mode that the chip is currently configured to, |
| 157 | * corresponding to the id property of the target ChipMode. |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 158 | */ |
| 159 | getMode() generates (ChipModeId modeId); |
| 160 | |
| 161 | /** |
Roshan Pius | 6f31d92 | 2016-10-04 15:08:05 -0700 | [diff] [blame] | 162 | * Request information about the chip. |
| 163 | * Must trigger |IWifiChipEventCallback.onChipDebugInfoAvailable| on sucess, |
| 164 | * or |IWifiChipEventCallback.onChipDebugInfoFailure| on failure. |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 165 | */ |
| 166 | oneway requestChipDebugInfo(); |
| 167 | |
| 168 | /** |
Roshan Pius | 6f31d92 | 2016-10-04 15:08:05 -0700 | [diff] [blame] | 169 | * Request vendor debug info from the driver. |
| 170 | * Must trigger |IWifiChipEventCallback.onDriverDebugDumpAvailable| on success, |
| 171 | * or |IWifiChipEventCallback.onDriverDebugDumpFailure| on failure. |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 172 | */ |
| 173 | oneway requestDriverDebugDump(); |
| 174 | |
| 175 | /** |
Roshan Pius | 6f31d92 | 2016-10-04 15:08:05 -0700 | [diff] [blame] | 176 | * Request vendor debug info from the firmware. |
| 177 | * Must trigger |IWifiChipEventCallback.onFirmwareDebugDumpAvailable| on |
| 178 | * success, or |IWifiChipEventCallback.onFirmwareDebugDumpFailure| on failure. |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 179 | */ |
| 180 | oneway requestFirmwareDebugDump(); |
Roshan Pius | adcfba4 | 2016-10-05 10:19:06 -0700 | [diff] [blame^] | 181 | |
| 182 | /** |
| 183 | * Create an AP iface on the chip. |
| 184 | * |
| 185 | * Depending on the mode the chip is configured in, the interface creation |
| 186 | * may fail if we've already reached the maximum allowed |
| 187 | * (specified in |ChipIfaceCombination|) number of ifaces of the AP type. |
| 188 | * |
| 189 | * @return iface HIDL interface object representing the iface if |
| 190 | * successful, null otherwise. |
| 191 | */ |
| 192 | createApIface() generates (IWifiApIface iface); |
| 193 | |
| 194 | /** |
| 195 | * List all the AP iface names configured on the chip. |
| 196 | * The corresponding |IWifiApIface| object for any iface are |
| 197 | * retrieved using |getApIface| method. |
| 198 | * |
| 199 | * @return ifnames List of all AP iface names on the chip. |
| 200 | */ |
| 201 | getApIfaceNames() generates (vec<string> ifnames); |
| 202 | |
| 203 | /** |
| 204 | * Gets a HIDL interface object for the AP Iface corresponding |
| 205 | * to the provided ifname. |
| 206 | * |
| 207 | * @param ifname Name of the iface. |
| 208 | * @return iface HIDL interface object representing the iface if |
| 209 | * it exists, null otherwise. |
| 210 | */ |
| 211 | getApIface(string ifname) generates (IWifiApIface iface); |
| 212 | |
| 213 | /** |
| 214 | * Create a NAN iface on the chip. |
| 215 | * |
| 216 | * Depending on the mode the chip is configured in, the interface creation |
| 217 | * may fail if we've already reached the maximum allowed |
| 218 | * (specified in |ChipIfaceCombination|) number of ifaces of the NAN type. |
| 219 | * |
| 220 | * @return iface HIDL interface object representing the iface if |
| 221 | * successful, null otherwise. |
| 222 | */ |
| 223 | createNanIface() generates (IWifiNanIface iface); |
| 224 | |
| 225 | /** |
| 226 | * List all the NAN iface names configured on the chip. |
| 227 | * The corresponding |IWifiNanIface| object for any iface are |
| 228 | * retrieved using |getNanIface| method. |
| 229 | * |
| 230 | * @return ifnames List of all NAN iface names on the chip. |
| 231 | */ |
| 232 | getNanIfaceNames() generates (vec<string> ifnames); |
| 233 | |
| 234 | /** |
| 235 | * Gets a HIDL interface object for the NAN Iface corresponding |
| 236 | * to the provided ifname. |
| 237 | * |
| 238 | * @param ifname Name of the iface. |
| 239 | * @return iface HIDL interface object representing the iface if |
| 240 | * it exists, null otherwise. |
| 241 | */ |
| 242 | getNanIface(string ifname) generates (IWifiNanIface iface); |
| 243 | |
| 244 | /** |
| 245 | * Create a P2P iface on the chip. |
| 246 | * |
| 247 | * Depending on the mode the chip is configured in, the interface creation |
| 248 | * may fail if we've already reached the maximum allowed |
| 249 | * (specified in |ChipIfaceCombination|) number of ifaces of the P2P type. |
| 250 | * |
| 251 | * @return iface HIDL interface object representing the iface if |
| 252 | * successful, null otherwise. |
| 253 | */ |
| 254 | createP2pIface() generates (IWifiP2pIface iface); |
| 255 | |
| 256 | /** |
| 257 | * List all the P2P iface names configured on the chip. |
| 258 | * The corresponding |IWifiP2pIface| object for any iface are |
| 259 | * retrieved using |getP2pIface| method. |
| 260 | * |
| 261 | * @return ifnames List of all P2P iface names on the chip. |
| 262 | */ |
| 263 | getP2pIfaceNames() generates (vec<string> ifnames); |
| 264 | |
| 265 | /** |
| 266 | * Gets a HIDL interface object for the P2P Iface corresponding |
| 267 | * to the provided ifname. |
| 268 | * |
| 269 | * @param ifname Name of the iface. |
| 270 | * @return iface HIDL interface object representing the iface if |
| 271 | * it exists, null otherwise. |
| 272 | */ |
| 273 | getP2pIface(string ifname) generates (IWifiP2pIface iface); |
| 274 | |
| 275 | /** |
| 276 | * Create an STA iface on the chip. |
| 277 | * |
| 278 | * Depending on the mode the chip is configured in, the interface creation |
| 279 | * may fail if we've already reached the maximum allowed |
| 280 | * (specified in |ChipIfaceCombination|) number of ifaces of the STA type. |
| 281 | * |
| 282 | * @return iface HIDL interface object representing the iface if |
| 283 | * successful, null otherwise. |
| 284 | */ |
| 285 | createStaIface() generates (IWifiStaIface iface); |
| 286 | |
| 287 | /** |
| 288 | * List all the STA iface names configured on the chip. |
| 289 | * The corresponding |IWifiStaIface| object for any iface are |
| 290 | * retrieved using |getStaIface| method. |
| 291 | * |
| 292 | * @return ifnames List of all STA iface names on the chip. |
| 293 | */ |
| 294 | getStaIfaceNames() generates (vec<string> ifnames); |
| 295 | |
| 296 | /** |
| 297 | * Gets a HIDL interface object for the STA Iface corresponding |
| 298 | * to the provided ifname. |
| 299 | * |
| 300 | * @param ifname Name of the iface. |
| 301 | * @return iface HIDL interface object representing the iface if |
| 302 | * it exists, null otherwise. |
| 303 | */ |
| 304 | getStaIface(string ifname) generates (IWifiStaIface iface); |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 305 | }; |