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_WIFI_DEVICE_CALLBACK_PROXY_H
16 #define OHOS_WIFI_DEVICE_CALLBACK_PROXY_H
17 
18 #include "i_wifi_device_callback.h"
19 #ifdef OHOS_ARCH_LITE
20 #include "serializer.h"
21 #else
22 #include "iremote_proxy.h"
23 #endif
24 #include "wifi_msg.h"
25 
26 namespace OHOS {
27 namespace Wifi {
28 #ifdef OHOS_ARCH_LITE
29 class WifiDeviceCallBackProxy : public IWifiDeviceCallBack {
30 public:
31     explicit WifiDeviceCallBackProxy(SvcIdentity *sid);
32     virtual ~WifiDeviceCallBackProxy();
33 #else
34 class WifiDeviceCallBackProxy : public IRemoteProxy<IWifiDeviceCallBack> {
35 public:
36     explicit WifiDeviceCallBackProxy(const sptr<IRemoteObject> &remote);
37 
38     virtual ~WifiDeviceCallBackProxy() {}
39 #endif
40 
41     /**
42      * @Description Deal wifi state change message
43      *
44      * @param state - Wifi State
45      */
46     void OnWifiStateChanged(int state) override;
47 
48     /**
49      * @Description Deal wifi connection state change message
50      *
51      * @param state - Wifi connect state
52      * @param info - WifiLinkedInfo object
53      */
54     void OnWifiConnectionChanged(int state, const WifiLinkedInfo &info) override;
55 
56     /**
57      * @Description Deal wifi rssi change message
58      *
59      * @param rssi - rssi
60      */
61     void OnWifiRssiChanged(int rssi) override;
62 
63     /**
64      * @Description Deal wps state change message
65      *
66      * @param state - wps state
67      * @param pinCode - when wps pin mode, open wps successfully, return the pin code
68      */
69     void OnWifiWpsStateChanged(int state, const std::string &pinCode) override;
70 
71     /**
72      * @Description Deal stream change message
73      *
74      * @param direction - stream direction
75      */
76     void OnStreamChanged(int direction) override;
77 
78 	/**
79      * @Description Deal device config change message
80      *
81      * @param ConfigChange - change type of config
82      */
83     void OnDeviceConfigChanged(ConfigChange value) override;
84 
85 private:
86 #ifdef OHOS_ARCH_LITE
87     SvcIdentity sid_;
88     static const int DEFAULT_IPC_SIZE = 256;
89 #else
90     static inline BrokerDelegator<WifiDeviceCallBackProxy> g_delegator;
91 #endif
92 };
93 }  // namespace Wifi
94 }  // namespace OHOS
95 #endif
96