• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef OHOS_I_WIFI_P2P_CALLBACK_H
16 #define OHOS_I_WIFI_P2P_CALLBACK_H
17 
18 #include <string>
19 #include <iremote_stub.h>
20 #include "define.h"
21 #include "message_option.h"
22 #include "message_parcel.h"
23 #include "wifi_errcode.h"
24 #include "wifi_hid2d_msg.h"
25 #include "wifi_p2p_msg.h"
26 
27 namespace OHOS {
28 namespace Wifi {
29 class IWifiP2pCallback : public IRemoteBroker {
30 public:
31     /**
32      * @Description Deal p2p state change message.
33      *
34      * @param state - P2P_STATE_IDLE/P2P_STATE_STARTED/P2P_STATE_CLOSED
35      */
36     virtual void OnP2pStateChanged(int state) = 0;
37 
38     /**
39      * @Description Persistent Group Changed Resources
40      *
41      */
42     virtual void OnP2pPersistentGroupsChanged(void) = 0;
43 
44     /**
45      * @Description The device is changed.
46      *
47      * @param device - WifiP2pDevice object
48      */
49     virtual void OnP2pThisDeviceChanged(const WifiP2pDevice &device) = 0;
50 
51     /**
52      * @Description If the discover P2P device information is updated, all the
53      *        latest WifiP2P devices are reported.
54      *
55      * @param device - std::vector<WifiP2pDevice> object
56      */
57     virtual void OnP2pPeersChanged(const std::vector<WifiP2pDevice> &device) = 0;
58 
59     /**
60      * @Description This event is triggered when the discovered services are updated.
61      *
62      * @param srvInfo - std::vector<WifiP2pServiceInfo> object
63      */
64     virtual void OnP2pServicesChanged(const std::vector<WifiP2pServiceInfo> &srvInfo) = 0;
65 
66     /**
67      * @Description Connection status change.
68      *
69      * @param info - WifiP2pLinkedInfo object
70      */
71     virtual void OnP2pConnectionChanged(const WifiP2pLinkedInfo &info) = 0;
72 
73     /**
74      * @Description Discover status change.
75      *
76      * @param isChange - true : change, false : not change
77      */
78     virtual void OnP2pDiscoveryChanged(bool isChange) = 0;
79 
80     /**
81      * @Description P2p callback result.
82      *
83      * @param action - DiscoverDevices/StopDiscoverDevices/DiscoverServices/StopDiscoverServices
84      *                 /PutLocalP2pService/StartP2pListen/StopP2pListen/CreateGroup/RemoveGroup
85      *                 /DeleteGroup/P2pConnect/P2pCancelConnect
86      * @param code   - Return code
87      */
88     virtual void OnP2pActionResult(P2pActionCallback action, ErrCode code) = 0;
89 
90     /**
91      * @Description Config changed callback.
92      *
93      * @param type - Config type
94      * @param data - Config data
95      * @param len  - Config data length
96      */
97     virtual void OnConfigChanged(CfgType type, char* data, int dataLen) = 0;
98 
99 public:
100     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.wifi.IWifiP2pCallback");
101 };
102 }  // namespace Wifi
103 }  // namespace OHOS
104 #endif