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_IDL_IWIFI_EVENT_P2P_CALLBACK_H
17 #define OHOS_IDL_IWIFI_EVENT_P2P_CALLBACK_H
18 
19 #include "i_wifi_struct.h"
20 #include <stddef.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 typedef struct IWifiEventP2pCallback {
27     void (*onP2pSupplicantConnect)(int status);
28     void (*onDeviceFound)(const P2pDeviceInfo *device);
29     void (*onDeviceLost)(const char *p2pDeviceAddress);
30     void (*onGoNegotiationRequest)(const char *srcAddress, short passwordId);
31     void (*onGoNegotiationSuccess)(void);
32     void (*onGoNegotiationFailure)(int status);
33     void (*onInvitationReceived)(const P2pInvitationInfo *info);
34     void (*onInvitationResult)(const char *bssid, int status);
35     void (*onGroupFormationSuccess)(void);
36     void (*onGroupFormationFailure)(const char *failureReason);
37     void (*onGroupStarted)(const P2pGroupInfo *group);
38     void (*onGroupRemoved)(const char *groupIfName, int isGo);
39     void (*onProvisionDiscoveryPbcRequest)(const char *p2pDeviceAddress);
40     void (*onProvisionDiscoveryPbcResponse)(const char *p2pDeviceAddress);
41     void (*onProvisionDiscoveryEnterPin)(const char *p2pDeviceAddress);
42     void (*onProvisionDiscoveryShowPin)(const char *p2pDeviceAddress, const char *generatedPin);
43     void (*onProvisionDiscoveryFailure)(void);
44     void (*onFindStopped)(void);
45     void (*onServiceDiscoveryResponse)(
46         const char *srcAddress, short updateIndicator, const unsigned char *tlvs, size_t tlvsLength);
47     void (*onStaDeauthorized)(const char *p2pDeviceAddress);
48     void (*onStaAuthorized)(const char *p2pDeviceAddress, const char *p2pGroupAddress);
49     void (*connectSupplicantFailed)(void);
50     void (*onP2pServDiscReq)(const P2pServDiscReqInfo *info);
51     void (*onP2pIfaceCreated)(const char *ifName, int isGo);
52     void (*onP2pConnectFailed)(const char *bssid, int reason);
53     void (*onP2pChannelSwitch)(int freq);
54 } IWifiEventP2pCallback;
55 
56 #ifdef __cplusplus
57 }
58 #endif
59 #endif
60