Roshan Pius | 39f588f | 2016-10-31 14:51:27 -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.supplicant@1.0; |
| 18 | |
| 19 | /** |
Roshan Pius | 8c6a877 | 2016-11-03 09:37:57 -0700 | [diff] [blame] | 20 | * Callback Interface exposed by the supplicant service |
Roshan Pius | 39f588f | 2016-10-31 14:51:27 -0700 | [diff] [blame] | 21 | * for each P2P mode interface (ISupplicantP2pIface). |
| 22 | * |
| 23 | * Clients need to host an instance of this HIDL interface object and |
Roshan Pius | 8c6a877 | 2016-11-03 09:37:57 -0700 | [diff] [blame] | 24 | * pass a reference of the object to the supplicant via the |
Roshan Pius | 39f588f | 2016-10-31 14:51:27 -0700 | [diff] [blame] | 25 | * corresponding |ISupplicantP2pIface.registerCallback| method. |
| 26 | */ |
| 27 | interface ISupplicantP2pIfaceCallback { |
| 28 | /** |
Roshan Pius | 09f2ce3 | 2017-01-11 14:05:17 -0800 | [diff] [blame^] | 29 | * WPS config methods. |
| 30 | */ |
| 31 | enum WpsConfigMethods : uint16_t { |
| 32 | USBA = 0x0001, |
| 33 | ETHERNET = 0x0002, |
| 34 | LABEL = 0x0004, |
| 35 | DISPLAY = 0x0008, |
| 36 | EXT_NFC_TOKEN = 0x0010, |
| 37 | INT_NFC_TOKEN = 0x0020, |
| 38 | NFC_INTERFACE = 0x0040, |
| 39 | PUSHBUTTON = 0x0080, |
| 40 | KEYPAD = 0x0100, |
| 41 | VIRT_PUSHBUTTON = 0x0280, |
| 42 | PHY_PUSHBUTTON = 0x0480, |
| 43 | P2PS = 0x1000, |
| 44 | VIRT_DISPLAY = 0x2008, |
| 45 | PHY_DISPLAY = 0x4008 |
| 46 | }; |
| 47 | |
| 48 | /** |
| 49 | * WPS Device Password ID |
| 50 | */ |
| 51 | enum WpsDevPasswordId : uint16_t { |
| 52 | DEFAULT = 0x0000, |
| 53 | USER_SPECIFIED = 0x0001, |
| 54 | MACHINE_SPECIFIED = 0x0002, |
| 55 | REKEY = 0x0003, |
| 56 | PUSHBUTTON = 0x0004, |
| 57 | REGISTRAR_SPECIFIED = 0x0005, |
| 58 | NFC_CONNECTION_HANDOVER = 0x0007, |
| 59 | P2PS_DEFAULT = 0x0008 |
| 60 | }; |
| 61 | |
| 62 | /** |
| 63 | * Status codes for P2P operations. |
| 64 | */ |
| 65 | enum P2pStatusCode : uint32_t { |
| 66 | SUCCESS = 0, |
| 67 | FAIL_INFO_CURRENTLY_UNAVAILABLE = 1, |
| 68 | FAIL_INCOMPATIBLE_PARAMS = 2, |
| 69 | FAIL_LIMIT_REACHED = 3, |
| 70 | FAIL_INVALID_PARAMS = 4, |
| 71 | FAIL_UNABLE_TO_ACCOMMODATE = 5, |
| 72 | FAIL_PREV_PROTOCOL_ERROR = 6, |
| 73 | FAIL_NO_COMMON_CHANNELS = 7, |
| 74 | FAIL_UNKNOWN_GROUP = 8, |
| 75 | FAIL_BOTH_GO_INTENT_15 = 9, |
| 76 | FAIL_INCOMPATIBLE_PROV_METHOD = 10, |
| 77 | FAIL_REJECTED_BY_USER = 11, |
| 78 | SUCCESS_DEFERRED = 12, |
| 79 | }; |
| 80 | |
| 81 | /** |
| 82 | * Status codes for P2P discovery. |
| 83 | */ |
| 84 | enum P2pProvDiscStatusCode : uint8_t { |
| 85 | SUCCESS = 0, |
| 86 | TIMEOUT = 1, |
| 87 | REJECTED = 2, |
| 88 | TIMEOUT_JOIN = 3, |
| 89 | INFO_UNAVAILABLE = 4 |
| 90 | }; |
| 91 | |
| 92 | /** |
Roshan Pius | 39f588f | 2016-10-31 14:51:27 -0700 | [diff] [blame] | 93 | * Used to indicate that a new network has been added. |
| 94 | * |
| 95 | * @param id Network ID allocated to the corresponding network. |
| 96 | */ |
| 97 | oneway onNetworkAdded(SupplicantNetworkId id); |
| 98 | |
| 99 | /** |
| 100 | * Used to indicate that a network has been removed. |
| 101 | * |
| 102 | * @param id Network ID allocated to the corresponding network. |
| 103 | */ |
| 104 | oneway onNetworkRemoved(SupplicantNetworkId id); |
Roshan Pius | 09f2ce3 | 2017-01-11 14:05:17 -0800 | [diff] [blame^] | 105 | |
| 106 | /** |
| 107 | * Used to indicate that a P2P device has been found. |
| 108 | * |
| 109 | * @param srcAddress MAC address of the device found. This must either |
| 110 | * be the P2P device address or the P2P interface address. |
| 111 | * @param p2pDeviceAddress P2P device address. |
| 112 | * @param primaryDeviceType Type of device. Refer to section B.1 of Wifi P2P |
| 113 | * Technical specification v1.2. |
| 114 | * @param deviceName Name of the device. |
| 115 | * @param configMethods Mask of WPS configuration methods supported by the |
| 116 | * device. |
| 117 | * @param deviceCapabilities Refer to section 4.1.4 of Wifi P2P Technical |
| 118 | * specification v1.2. |
| 119 | * @param groupCapabilites Refer to section 4.1.4 of Wifi P2P Technical |
| 120 | * specification v1.2. |
| 121 | * @param wfdDeviceInfo WFD device info as described in section 5.1.2 of WFD |
| 122 | * technical specification v1.0.0. |
| 123 | */ |
| 124 | oneway onDeviceFound( |
| 125 | MacAddress srcAddress, MacAddress p2pDeviceAddress, |
| 126 | uint8_t[8] primaryDeviceType, string deviceName, |
| 127 | bitfield<WpsConfigMethods> configMethods, uint8_t deviceCapabilities, |
| 128 | bitfield<P2pGroupCapabilityMask> groupCapabilities, uint8_t[8] wfdDeviceInfo); |
| 129 | |
| 130 | /** |
| 131 | * Used to indicate that a P2P device has been lost. |
| 132 | * |
| 133 | * @param p2pDeviceAddress P2P device address. |
| 134 | */ |
| 135 | oneway onDeviceLost(MacAddress p2pDeviceAddress); |
| 136 | |
| 137 | /** |
| 138 | * Used to indicate the termination of P2P find operation. |
| 139 | */ |
| 140 | oneway onFindStopped(); |
| 141 | |
| 142 | /** |
| 143 | * Used to indicate the reception of a P2P Group Owner negotiation request. |
| 144 | * |
| 145 | * @param srcAddress MAC address of the device that initiated the GO |
| 146 | * negotiation request. |
| 147 | * @param passwordId Type of password. |
| 148 | */ |
| 149 | oneway onGoNegotiationRequest( |
| 150 | MacAddress srcAddress, WpsDevPasswordId passwordId); |
| 151 | |
| 152 | /** |
| 153 | * Used to indicate the completion of a P2P Group Owner negotiation request. |
| 154 | * |
| 155 | * @param status Status of the GO negotiation. |
| 156 | */ |
| 157 | oneway onGoNegotiationCompleted(P2pStatusCode status); |
| 158 | |
| 159 | /** |
| 160 | * Used to indicate a successful formation of a P2P group. |
| 161 | */ |
| 162 | oneway onGroupFormationSuccess(); |
| 163 | |
| 164 | /** |
| 165 | * Used to indicate a failure to form a P2P group. |
| 166 | * |
| 167 | * @param failureReason Failure reason string for debug purposes. |
| 168 | */ |
| 169 | oneway onGroupFormationFailure(string failureReason); |
| 170 | |
| 171 | /** |
| 172 | * Used to indicate the start of a P2P group. |
| 173 | * |
| 174 | * @param groupIfName Interface name of the group. (For ex: p2p-p2p0-1) |
| 175 | * @param isGo Whether this device is owner of the group. |
| 176 | * @param ssid SSID of the group. |
| 177 | * @param frequency Frequency on which this group is created. |
| 178 | * @param psk PSK used to secure the group. |
| 179 | * @param passphrase PSK passphrase used to secure the group. |
| 180 | * @param goDeviceAddress MAC Address of the owner of this group. |
| 181 | * @param isPersistent Whether this group is persisted or not. |
| 182 | */ |
| 183 | oneway onGroupStarted( |
| 184 | string groupIfname, bool isGo, Ssid ssid, uint32_t frequency, |
| 185 | uint8_t[32] psk, string passphrase, MacAddress goDeviceAddress, |
| 186 | bool isPersistent); |
| 187 | |
| 188 | /** |
| 189 | * Used to indicate the removal of a P2P group. |
| 190 | * |
| 191 | * @param groupIfName Interface name of the group. (For ex: p2p-p2p0-1) |
| 192 | * @param isGo Whether this device is owner of the group. |
| 193 | */ |
| 194 | oneway onGroupRemoved(string groupIfname, bool isGo); |
| 195 | |
| 196 | /** |
| 197 | * Used to indicate the reception of a P2P invitation. |
| 198 | * |
| 199 | * @param srcAddress MAC address of the device that sent the invitation. |
| 200 | * @param goDeviceAddress MAC Address of the owner of this group. |
| 201 | * @param Bssid Bssid of the group. |
| 202 | * @param persistentNetworkId Persistent network Id of the group. |
| 203 | * @param operatingFrequency Frequency on which the invitation was received. |
| 204 | */ |
| 205 | oneway onInvitationReceived( |
| 206 | MacAddress srcAddress, MacAddress goDeviceAddress, Bssid bssid, |
| 207 | SupplicantNetworkId persistentNetworkId, uint32_t operatingFrequency); |
| 208 | |
| 209 | /** |
| 210 | * Used to indicate the result of the P2P invitation request. |
| 211 | * |
| 212 | * @param Bssid Bssid of the group. |
| 213 | * @param status Status of the invitation. |
| 214 | */ |
| 215 | oneway onInvitationResult(Bssid bssid, P2pStatusCode status); |
| 216 | |
| 217 | /** |
| 218 | * Used to indicate a push-button request generated during provision discovery. |
| 219 | * |
| 220 | * @param p2pDeviceAddress P2P device address. |
| 221 | */ |
| 222 | oneway onProvisionDiscoveryPbcRequest(MacAddress p2pDeviceAddress); |
| 223 | |
| 224 | /** |
| 225 | * Used to indicate a push-button response generated during provision discovery. |
| 226 | * |
| 227 | * @param p2pDeviceAddress P2P device address. |
| 228 | */ |
| 229 | oneway onProvisionDiscoveryPbcResponse(MacAddress p2pDeviceAddress); |
| 230 | |
| 231 | /** |
| 232 | * Used to indicate the pin generated during provision discovery. |
| 233 | * |
| 234 | * @param p2pDeviceAddress P2P device address. |
| 235 | * @param generatedPin 8 digit pin generated. |
| 236 | */ |
| 237 | oneway onProvisionDiscoveryShowPin( |
| 238 | MacAddress p2pDeviceAddress, string generatedPin); |
| 239 | |
| 240 | /** |
| 241 | * Used to indicate that a pin needs to be entered during provision discovery. |
| 242 | * |
| 243 | * @param p2pDeviceAddress P2P device address. |
| 244 | */ |
| 245 | oneway onProvisionDiscoveryEnterPin(MacAddress p2pDeviceAddress); |
| 246 | |
| 247 | /** |
| 248 | * Used to indicate a provision discovery failure. |
| 249 | * |
| 250 | * @param p2pDeviceAddress P2P device address. |
| 251 | */ |
| 252 | oneway onProvisionDiscoveryFailure(MacAddress p2pDeviceAddress); |
| 253 | |
| 254 | /** |
| 255 | * Used to indicate the completion of a P2P provision discovery request. |
| 256 | * |
| 257 | * @param p2pDeviceAddress P2P device address. |
| 258 | * @param isRequest Whether we received or sent the provision discovery. |
| 259 | * @param status Status of the provision discovery. |
| 260 | * @param configMethods Mask of WPS configuration methods supported. |
| 261 | * @param generatedPin 8 digit pin generated. |
| 262 | */ |
| 263 | oneway onProvisionDiscoveryCompleted( |
| 264 | MacAddress p2pDeviceAddress, bool isRequest, P2pProvDiscStatusCode status, |
| 265 | bitfield<WpsConfigMethods> configMethods, string generatedPin); |
| 266 | |
| 267 | /** |
| 268 | * Used to indicate the reception of a P2P service discovery response. |
| 269 | * |
| 270 | * @param srcAddress MAC address of the device that sent the service discovery. |
| 271 | * @param updateIndicator Service update indicator. Refer to section 3.1.3 of |
| 272 | * Wifi P2P Technical specification v1.2. |
| 273 | * @parm tlvs Refer to section 3.1.3.1 of Wifi P2P Technical specification v1.2. |
| 274 | */ |
| 275 | oneway onServiceDiscoveryResponse( |
| 276 | MacAddress srcAddress, uint16_t updateIndicator, vec<uint8_t> tlvs); |
| 277 | |
| 278 | /** |
| 279 | * Used to indicate when a STA device is connected to this device. |
| 280 | * |
| 281 | * @param srcAddress MAC address of the device that was authorized. |
| 282 | * @param p2pDeviceAddress P2P device address. |
| 283 | */ |
| 284 | oneway onStaAuthorized(MacAddress srcAddress, MacAddress p2pDeviceAddress); |
| 285 | |
| 286 | /** |
| 287 | * Used to indicate when a STA device is disconnected from this device. |
| 288 | * |
| 289 | * @param srcAddress MAC address of the device that was deauthorized. |
| 290 | * @param p2pDeviceAddress P2P device address. |
| 291 | */ |
| 292 | oneway onStaDeauthorized(MacAddress srcAddress, MacAddress p2pDeviceAddress); |
Roshan Pius | 39f588f | 2016-10-31 14:51:27 -0700 | [diff] [blame] | 293 | }; |