• 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 
16 #ifndef WLAN_HAL_PROXY_H
17 #define WLAN_HAL_PROXY_H
18 
19 #include <hdf_remote_service.h>
20 #include "wlan_hdi_service_stub.h"
21 #include "Iwifi_hal.h"
22 #include <iremote_proxy.h>
23 #include <hdf_log.h>
24 #include <iservmgr_hdi.h>
25 #include <ipc_object_stub.h>
26 
27 namespace OHOS {
28 namespace HDI {
29 namespace WLAN {
30 namespace V1_0 {
31 
32 class WlanInterfaceProxy : public IRemoteProxy<IWlan> {
33 public:
WlanInterfaceProxy(const sptr<IRemoteObject> & impl)34     explicit WlanInterfaceProxy(const sptr<IRemoteObject>& impl) : IRemoteProxy<IWlan>(impl) {}
~WlanInterfaceProxy()35     virtual ~WlanInterfaceProxy() override {}
36     virtual int32_t wifiConstruct() override;
37     virtual int32_t wifiDestruct() override;
38     virtual int32_t start() override;
39     virtual int32_t stop() override;
40     virtual int32_t getSupportFeature(std::vector<uint8_t>& supType) override;
41     virtual int32_t getSupportCombo(std::vector<uint64_t>& combo) override;
42     virtual int32_t createFeature(int32_t type, std::shared_ptr<WifiFeatureInfo>& ifeature) override;
43     virtual int32_t getFeatureByIfName(std::string& ifName, std::shared_ptr<WifiFeatureInfo>& ifeature) override;
44     virtual int32_t registerEventCallback(std::function<int32_t(int32_t event, struct HdfSBuf *sbuf)> cb) override;
45     virtual int32_t unregisterEventCallback() override;
46     virtual int32_t destroyFeature(std::shared_ptr<WifiFeatureInfo> ifeature) override;
47     virtual int32_t resetDriver(const uint8_t chipId) override;
48     virtual int32_t getAsscociatedStas(std::shared_ptr<WifiFeatureInfo> ifeature, std::shared_ptr<StaInfo> staInfo,
49         uint32_t count, std::vector<uint32_t>& num) override;
50     virtual int32_t setCountryCode(std::shared_ptr<WifiFeatureInfo> ifeature, std::string& code, uint32_t len) override;
51     virtual int32_t getNetworkIfaceName(std::shared_ptr<WifiFeatureInfo> ifeature) override;
52     virtual int32_t getFeatureType(std::shared_ptr<WifiFeatureInfo> ifeature) override;
53     virtual int32_t setMacAddress(std::shared_ptr<WifiFeatureInfo> ifeature, std::vector<uint8_t>& mac) override;
54     virtual int32_t getDeviceMacAddress(std::shared_ptr<WifiFeatureInfo> ifeature, std::vector<uint8_t>& mac,
55         uint8_t len) override;
56     virtual int32_t getFreqsWithBand(std::shared_ptr<WifiFeatureInfo> ifeature, int32_t band, std::vector<int32_t> freq,
57         uint32_t count, uint32_t& num) override;
58     virtual int32_t setTxPower(std::shared_ptr<WifiFeatureInfo> ifeature, int32_t power) override;
59     virtual int32_t getChipId(std::shared_ptr<WifiFeatureInfo> ifeature, uint8_t& chipId) override;
60     virtual int32_t getIfNamesByChipId(const uint8_t chipId, std::string& ifNames, uint32_t& num) override;
61     virtual int32_t setScanningMacAddress(std::shared_ptr<WifiFeatureInfo> ifeature, std::vector<uint8_t>& scanMac,
62         uint8_t len) override;
63     static int32_t CallbackWlanProxy(int32_t event, struct HdfSBuf *reqData);
64     static std::function<int32_t(int32_t event, struct HdfSBuf *sbuf)> callback_;
65 private:
66     static inline BrokerDelegator<WlanInterfaceProxy> delegator_;
67 };
68 
69 class IPCObjectStubWlan: public OHOS::IPCObjectStub {
70 public:
IPCObjectStubWlan()71     explicit IPCObjectStubWlan() : OHOS::IPCObjectStub(u"") {}
72     virtual ~IPCObjectStubWlan() = default;
73     int OnRemoteRequest(uint32_t code, OHOS::MessageParcel &data,
74         OHOS::MessageParcel &reply, OHOS::MessageOption &option) override;
75 };
76 }
77 }
78 }
79 }
80 
81 #endif