1 /* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_WIFI_HAL_CALLBACK_H 17 #define OHOS_WIFI_HAL_CALLBACK_H 18 19 #include "wifi_hal_struct.h" 20 #include "wifi_hal_p2p_struct.h" 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 /** 25 * @Description Wi-Fi Hal callback notification indicating that the scanning is complete. 26 * 27 * @param status 28 */ 29 void WifiHalCbNotifyScanEnd(int status); 30 /** 31 * @Description Wi-Fi Hal callback notification of the connection change. 32 * 33 * @param status 34 * @param networkId 35 * @param pos 36 */ 37 void WifiHalCbNotifyConnectChanged(int status, int networkId, const char *pos); 38 /** 39 * @Description Wi-Fi Hal callback notification of the disconnect reason. 40 * 41 * @param reason 42 * @param bssid 43 */ 44 void WifiHalCbNotifyDisConnectReason(int reason, const char *bssid); 45 /** 46 * @Description Wi-Fi Hal module notifies the WPA module of the status change. 47 * 48 * @param status 49 */ 50 void WifiHalCbNotifyWpaStateChange(int status); 51 /** 52 * @Description Wi-Fi Hal module notifies the bssid change. 53 * 54 * @param reasonPos: reason in the return string 55 * @param bssidPos: bssid in the return string 56 */ 57 void WifiHalCbNotifyBssidChanged(const char *reasonPos, const char *bssidPos); 58 /** 59 * @Description Wi-Fi Hal callback notification error key. 60 * 61 * @param status 62 */ 63 void WifiHalCbNotifyWrongKey(int status); 64 65 /** 66 * @Description Wi-Fi Hal callback notification connection full 67 * 68 * @param status 69 */ 70 void WifiHalCbNotifyConnectionFull(int status); 71 72 /** 73 * @Description Wi-Fi Hal callback notification connection reject 74 * 75 * @param status 76 */ 77 void WifiHalCbNotifyConnectionReject(int status); 78 79 /** 80 * @Description Wi-Fi Hal callback notification WPS overlaps. 81 * 82 * @param event 83 */ 84 void WifiHalCbNotifyWpsOverlap(int event); 85 /** 86 * @Description Wi-Fi Hal callback notification WPS times out. 87 * 88 * @param event 89 */ 90 void WifiHalCbNotifyWpsTimeOut(int event); 91 /** 92 * @Description Wi-Fi Hal calls back the STA to join the AP. 93 * 94 * @param content 95 * @param id - ap id 96 */ 97 void WifiHalCbStaJoin(const char *content, int id); 98 99 /** 100 * @Description Wi-Fi Hal callback AP status. 101 * 102 * @param content 103 */ 104 void WifiHalCbApState(const char *content, int id); 105 106 /** 107 * @Description wpa_supplicant client connection result event 108 * 109 * @param state - event value 110 * @param id - ap id 111 */ 112 void WifiP2pHalCbNotifyConnectSupplicant(int state); 113 114 /** 115 * @Description Indicates that a P2P device has been found 116 * 117 * @param device 118 */ 119 void P2pHalCbDeviceFound(const P2pDeviceInfo *device); 120 121 /** 122 * @Description Indicates that a P2P device is lost 123 * 124 * @param p2pDeviceAddress 125 */ 126 void P2pHalCbDeviceLost(const char *p2pDeviceAddress); 127 128 /** 129 * @Description This parameter indicates that a P2P group owner negotiation request is received 130 * 131 * @param srcAddress 132 * @param passwordId 133 */ 134 void P2pHalCbGoNegotiationRequest(const char *srcAddress, short passwordId); 135 136 /** 137 * @Description Go negotiation succeeded 138 * 139 */ 140 void P2pHalCbGoNegotiationSuccess(); 141 142 /** 143 * @Description Go negotiation failed 144 * 145 * @param status 146 */ 147 void P2pHalCbGoNegotiationFailure(int status); 148 149 /** 150 * @Description P2p Connect Failed 151 * 152 * @param bssid 153 * @param reason 154 */ 155 void P2pHalCbP2pConnectFailed(const char *bssid, int reason); 156 157 /** 158 * @Description P2p Channel Switch 159 * 160 * @param freq 161 */ 162 void P2pHalCbP2pChannelSwitch(int freq); 163 164 /** 165 * @Description Receive a P2P invitation 166 * 167 * @param info 168 */ 169 void P2pHalCbInvitationReceived(const P2pInvitationInfo *info); 170 171 /** 172 * @Description Indicates the result of a P2P invitation request 173 * 174 * @param bssid 175 * @param status 176 */ 177 void P2pHalCbInvitationResult(const char *bssid, int status); 178 179 /** 180 * @Description Indicates that a P2P group is successfully formed 181 * 182 */ 183 void P2pHalCbGroupFormationSuccess(); 184 185 /** 186 * @Description Group Failure and Cause 187 * 188 * @param reason 189 */ 190 void P2pHalCbGroupFormationFailure(const char *reason); 191 192 /** 193 * @Description This parameter specifies the start of a P2P group 194 * 195 * @param info 196 */ 197 void P2pHalCbGroupStarted(const P2pGroupInfo *info); 198 199 /** 200 * @Description Deletes a P2P group 201 * 202 * @param groupIfName 203 * @param isGo 204 */ 205 void P2pHalCbGroupRemoved(const char *groupIfName, int isGo); 206 207 /** 208 * @Description Deletes a P2P client 209 * 210 * @param groupIfName 211 * @param gcMacAddress 212 */ 213 void P2pHalCbclientRemoved(const char *deviceMac); 214 /** 215 * @Description Sets the PBC discovery request 216 * 217 * @param address 218 */ 219 void P2pHalCbProvisionDiscoveryPbcRequest(const char *address); 220 221 /** 222 * @Description Provision Discovery Pbc Response 223 * 224 * @param address 225 */ 226 void P2pHalCbProvisionDiscoveryPbcResponse(const char *address); 227 228 /** 229 * @Description Sets the discovery access PIN 230 * 231 * @param address 232 */ 233 void P2pHalCbProvisionDiscoveryEnterPin(const char *address); 234 235 /** 236 * @Description Setting the PIN to be displayed during discovery 237 * 238 * @param address 239 * @param pin 240 */ 241 void P2pHalCbProvisionDiscoveryShowPin(const char *address, const char *pin); 242 243 /** 244 * @Description Failed to discover the Provision 245 * 246 */ 247 void P2pHalCbProvisionDiscoveryFailure(); 248 249 /** 250 * @Description Indicates the termination of the P2P find operation 251 * 252 */ 253 void P2pHalCbFindStopped(); 254 255 /** 256 * @Description Indicates that a P2P service discovery response is received 257 * 258 * @param srcAddress 259 * @param updateIndicator 260 * @param tlvs 261 * @param tlvsLength 262 */ 263 void P2pHalCbServiceDiscoveryResponse(const P2pServDiscRespInfo *info); 264 265 /** 266 * @Description Indicates when a STA device is connected/disconnected to this device 267 * 268 * @param p2pDeviceAddress 269 * @param p2pGroupAddress 270 * @param type - 0 disconnect, 1 connected 271 */ 272 void P2pHalCbStaConnectState(const char *p2pDeviceAddress, const char *p2pGroupAddress, int type); 273 274 /** 275 * @Description Reporting Link Failure Events 276 * 277 * @param iface 278 */ 279 void P2pHalCbConnectSupplicantFailed(); 280 281 /** 282 * @Description Service Discovery Request 283 * 284 * @param info 285 */ 286 void P2pHalCbServDiscReq(const P2pServDiscReqInfo *info); 287 288 /** 289 * @Description Indicates that a P2P interface is created 290 * 291 * @param ifName 292 * @param isGo 293 */ 294 void P2pHalCbP2pIfaceCreated(const char *ifName, int isGo); 295 #ifdef __cplusplus 296 } 297 #endif 298 #endif 299