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 Device Password ID |
| 30 | */ |
| 31 | enum WpsDevPasswordId : uint16_t { |
| 32 | DEFAULT = 0x0000, |
| 33 | USER_SPECIFIED = 0x0001, |
| 34 | MACHINE_SPECIFIED = 0x0002, |
| 35 | REKEY = 0x0003, |
| 36 | PUSHBUTTON = 0x0004, |
| 37 | REGISTRAR_SPECIFIED = 0x0005, |
| 38 | NFC_CONNECTION_HANDOVER = 0x0007, |
| 39 | P2PS_DEFAULT = 0x0008 |
| 40 | }; |
| 41 | |
| 42 | /** |
| 43 | * Status codes for P2P operations. |
| 44 | */ |
| 45 | enum P2pStatusCode : uint32_t { |
| 46 | SUCCESS = 0, |
| 47 | FAIL_INFO_CURRENTLY_UNAVAILABLE = 1, |
| 48 | FAIL_INCOMPATIBLE_PARAMS = 2, |
| 49 | FAIL_LIMIT_REACHED = 3, |
| 50 | FAIL_INVALID_PARAMS = 4, |
| 51 | FAIL_UNABLE_TO_ACCOMMODATE = 5, |
| 52 | FAIL_PREV_PROTOCOL_ERROR = 6, |
| 53 | FAIL_NO_COMMON_CHANNELS = 7, |
| 54 | FAIL_UNKNOWN_GROUP = 8, |
| 55 | FAIL_BOTH_GO_INTENT_15 = 9, |
| 56 | FAIL_INCOMPATIBLE_PROV_METHOD = 10, |
| 57 | FAIL_REJECTED_BY_USER = 11, |
| 58 | SUCCESS_DEFERRED = 12, |
| 59 | }; |
| 60 | |
| 61 | /** |
| 62 | * Status codes for P2P discovery. |
| 63 | */ |
| 64 | enum P2pProvDiscStatusCode : uint8_t { |
| 65 | SUCCESS = 0, |
| 66 | TIMEOUT = 1, |
| 67 | REJECTED = 2, |
| 68 | TIMEOUT_JOIN = 3, |
| 69 | INFO_UNAVAILABLE = 4 |
| 70 | }; |
| 71 | |
| 72 | /** |
Roshan Pius | 39f588f | 2016-10-31 14:51:27 -0700 | [diff] [blame] | 73 | * Used to indicate that a new network has been added. |
| 74 | * |
| 75 | * @param id Network ID allocated to the corresponding network. |
| 76 | */ |
| 77 | oneway onNetworkAdded(SupplicantNetworkId id); |
| 78 | |
| 79 | /** |
| 80 | * Used to indicate that a network has been removed. |
| 81 | * |
| 82 | * @param id Network ID allocated to the corresponding network. |
| 83 | */ |
| 84 | oneway onNetworkRemoved(SupplicantNetworkId id); |
Roshan Pius | 09f2ce3 | 2017-01-11 14:05:17 -0800 | [diff] [blame] | 85 | |
| 86 | /** |
| 87 | * Used to indicate that a P2P device has been found. |
| 88 | * |
| 89 | * @param srcAddress MAC address of the device found. This must either |
| 90 | * be the P2P device address or the P2P interface address. |
| 91 | * @param p2pDeviceAddress P2P device address. |
| 92 | * @param primaryDeviceType Type of device. Refer to section B.1 of Wifi P2P |
| 93 | * Technical specification v1.2. |
| 94 | * @param deviceName Name of the device. |
| 95 | * @param configMethods Mask of WPS configuration methods supported by the |
| 96 | * device. |
| 97 | * @param deviceCapabilities Refer to section 4.1.4 of Wifi P2P Technical |
| 98 | * specification v1.2. |
| 99 | * @param groupCapabilites Refer to section 4.1.4 of Wifi P2P Technical |
| 100 | * specification v1.2. |
| 101 | * @param wfdDeviceInfo WFD device info as described in section 5.1.2 of WFD |
| 102 | * technical specification v1.0.0. |
| 103 | */ |
| 104 | oneway onDeviceFound( |
| 105 | MacAddress srcAddress, MacAddress p2pDeviceAddress, |
| 106 | uint8_t[8] primaryDeviceType, string deviceName, |
| 107 | bitfield<WpsConfigMethods> configMethods, uint8_t deviceCapabilities, |
Roshan Pius | d65be16 | 2017-03-17 15:44:56 -0700 | [diff] [blame] | 108 | bitfield<P2pGroupCapabilityMask> groupCapabilities, uint8_t[6] wfdDeviceInfo); |
Roshan Pius | 09f2ce3 | 2017-01-11 14:05:17 -0800 | [diff] [blame] | 109 | |
| 110 | /** |
| 111 | * Used to indicate that a P2P device has been lost. |
| 112 | * |
| 113 | * @param p2pDeviceAddress P2P device address. |
| 114 | */ |
| 115 | oneway onDeviceLost(MacAddress p2pDeviceAddress); |
| 116 | |
| 117 | /** |
| 118 | * Used to indicate the termination of P2P find operation. |
| 119 | */ |
| 120 | oneway onFindStopped(); |
| 121 | |
| 122 | /** |
| 123 | * Used to indicate the reception of a P2P Group Owner negotiation request. |
| 124 | * |
| 125 | * @param srcAddress MAC address of the device that initiated the GO |
| 126 | * negotiation request. |
| 127 | * @param passwordId Type of password. |
| 128 | */ |
| 129 | oneway onGoNegotiationRequest( |
| 130 | MacAddress srcAddress, WpsDevPasswordId passwordId); |
| 131 | |
| 132 | /** |
| 133 | * Used to indicate the completion of a P2P Group Owner negotiation request. |
| 134 | * |
| 135 | * @param status Status of the GO negotiation. |
| 136 | */ |
| 137 | oneway onGoNegotiationCompleted(P2pStatusCode status); |
| 138 | |
| 139 | /** |
| 140 | * Used to indicate a successful formation of a P2P group. |
| 141 | */ |
| 142 | oneway onGroupFormationSuccess(); |
| 143 | |
| 144 | /** |
| 145 | * Used to indicate a failure to form a P2P group. |
| 146 | * |
| 147 | * @param failureReason Failure reason string for debug purposes. |
| 148 | */ |
| 149 | oneway onGroupFormationFailure(string failureReason); |
| 150 | |
| 151 | /** |
| 152 | * Used to indicate the start of a P2P group. |
| 153 | * |
| 154 | * @param groupIfName Interface name of the group. (For ex: p2p-p2p0-1) |
| 155 | * @param isGo Whether this device is owner of the group. |
| 156 | * @param ssid SSID of the group. |
| 157 | * @param frequency Frequency on which this group is created. |
| 158 | * @param psk PSK used to secure the group. |
| 159 | * @param passphrase PSK passphrase used to secure the group. |
| 160 | * @param goDeviceAddress MAC Address of the owner of this group. |
| 161 | * @param isPersistent Whether this group is persisted or not. |
| 162 | */ |
| 163 | oneway onGroupStarted( |
| 164 | string groupIfname, bool isGo, Ssid ssid, uint32_t frequency, |
| 165 | uint8_t[32] psk, string passphrase, MacAddress goDeviceAddress, |
| 166 | bool isPersistent); |
| 167 | |
| 168 | /** |
| 169 | * Used to indicate the removal of a P2P group. |
| 170 | * |
| 171 | * @param groupIfName Interface name of the group. (For ex: p2p-p2p0-1) |
| 172 | * @param isGo Whether this device is owner of the group. |
| 173 | */ |
| 174 | oneway onGroupRemoved(string groupIfname, bool isGo); |
| 175 | |
| 176 | /** |
| 177 | * Used to indicate the reception of a P2P invitation. |
| 178 | * |
| 179 | * @param srcAddress MAC address of the device that sent the invitation. |
| 180 | * @param goDeviceAddress MAC Address of the owner of this group. |
| 181 | * @param Bssid Bssid of the group. |
| 182 | * @param persistentNetworkId Persistent network Id of the group. |
| 183 | * @param operatingFrequency Frequency on which the invitation was received. |
| 184 | */ |
| 185 | oneway onInvitationReceived( |
| 186 | MacAddress srcAddress, MacAddress goDeviceAddress, Bssid bssid, |
| 187 | SupplicantNetworkId persistentNetworkId, uint32_t operatingFrequency); |
| 188 | |
| 189 | /** |
| 190 | * Used to indicate the result of the P2P invitation request. |
| 191 | * |
| 192 | * @param Bssid Bssid of the group. |
| 193 | * @param status Status of the invitation. |
| 194 | */ |
| 195 | oneway onInvitationResult(Bssid bssid, P2pStatusCode status); |
| 196 | |
| 197 | /** |
Roshan Pius | 09f2ce3 | 2017-01-11 14:05:17 -0800 | [diff] [blame] | 198 | * Used to indicate the completion of a P2P provision discovery request. |
| 199 | * |
| 200 | * @param p2pDeviceAddress P2P device address. |
| 201 | * @param isRequest Whether we received or sent the provision discovery. |
| 202 | * @param status Status of the provision discovery. |
| 203 | * @param configMethods Mask of WPS configuration methods supported. |
| 204 | * @param generatedPin 8 digit pin generated. |
| 205 | */ |
| 206 | oneway onProvisionDiscoveryCompleted( |
| 207 | MacAddress p2pDeviceAddress, bool isRequest, P2pProvDiscStatusCode status, |
| 208 | bitfield<WpsConfigMethods> configMethods, string generatedPin); |
| 209 | |
| 210 | /** |
| 211 | * Used to indicate the reception of a P2P service discovery response. |
| 212 | * |
| 213 | * @param srcAddress MAC address of the device that sent the service discovery. |
| 214 | * @param updateIndicator Service update indicator. Refer to section 3.1.3 of |
| 215 | * Wifi P2P Technical specification v1.2. |
| 216 | * @parm tlvs Refer to section 3.1.3.1 of Wifi P2P Technical specification v1.2. |
| 217 | */ |
| 218 | oneway onServiceDiscoveryResponse( |
| 219 | MacAddress srcAddress, uint16_t updateIndicator, vec<uint8_t> tlvs); |
| 220 | |
| 221 | /** |
| 222 | * Used to indicate when a STA device is connected to this device. |
| 223 | * |
| 224 | * @param srcAddress MAC address of the device that was authorized. |
| 225 | * @param p2pDeviceAddress P2P device address. |
| 226 | */ |
| 227 | oneway onStaAuthorized(MacAddress srcAddress, MacAddress p2pDeviceAddress); |
| 228 | |
| 229 | /** |
| 230 | * Used to indicate when a STA device is disconnected from this device. |
| 231 | * |
| 232 | * @param srcAddress MAC address of the device that was deauthorized. |
| 233 | * @param p2pDeviceAddress P2P device address. |
| 234 | */ |
| 235 | oneway onStaDeauthorized(MacAddress srcAddress, MacAddress p2pDeviceAddress); |
Roshan Pius | 39f588f | 2016-10-31 14:51:27 -0700 | [diff] [blame] | 236 | }; |