• 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_WIFI_DEVICE_CALLBACK_STUB_H
16 #define OHOS_WIFI_DEVICE_CALLBACK_STUB_H
17 
18 #include "iremote_stub.h"
19 #include "iremote_object.h"
20 #include "i_wifi_device_callback.h"
21 
22 
23 namespace OHOS {
24 namespace Wifi {
25 class WifiDeviceCallBackStub : public IRemoteStub<IWifiDeviceCallBack> {
26 public:
27     WifiDeviceCallBackStub();
28     virtual ~WifiDeviceCallBackStub();
29 
30     virtual int OnRemoteRequest(
31         uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
32 
33     void OnWifiStateChanged(int state) override;
34     void OnWifiConnectionChanged(int state, const WifiLinkedInfo &info) override;
35     void OnWifiRssiChanged(int rssi) override;
36     void OnWifiWpsStateChanged(int state, const std::string &pinCode) override;
37     void OnStreamChanged(int direction) override;
38     void RegisterUserCallBack(const sptr<IWifiDeviceCallBack> &callBack);
39     bool IsRemoteDied() const;
40     void SetRemoteDied(bool val);
41 
42 private:
43     int RemoteOnWifiStateChanged(uint32_t code, MessageParcel &data, MessageParcel &reply);
44     int RemoteOnWifiConnectionChanged(uint32_t code, MessageParcel &data, MessageParcel &reply);
45     int RemoteOnWifiRssiChanged(uint32_t code, MessageParcel &data, MessageParcel &reply);
46     int RemoteOnWifiWpsStateChanged(uint32_t code, MessageParcel &data, MessageParcel &reply);
47     int RemoteOnStreamChanged(uint32_t code, MessageParcel &data, MessageParcel &reply);
48 
49     sptr<IWifiDeviceCallBack> callback_;
50 
51     bool mRemoteDied;
52 };
53 }  // namespace Wifi
54 }  // namespace OHOS
55 #endif