1 /*
2  * Copyright (c) 2024 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 WIFI_AP_IFACE_H
17 #define WIFI_AP_IFACE_H
18 
19 #include "v1_0/ichip_iface.h"
20 #include "v1_0/chip_types.h"
21 #include "wifi_vendor_hal.h"
22 #include "v1_0/ichip_iface_callback.h"
23 #include "iface_util.h"
24 
25 namespace OHOS {
26 namespace HDI {
27 namespace Wlan {
28 namespace Chip {
29 namespace V1_0 {
30 
31 class WifiApIface : public IChipIface {
32 public:
33     WifiApIface(const std::string& ifname, const std::vector<std::string>& instances,
34         const std::weak_ptr<WifiVendorHal> vendorHal, const std::weak_ptr<IfaceUtil> ifaceUtil);
35     void Invalidate();
36     bool IsValid();
37     std::string GetName();
38     void RemoveInstance(std::string instance);
39 
40     int32_t GetIfaceName(std::string& name) override;
41     int32_t GetIfaceType(IfaceType& type) override;
42     int32_t GetSupportFreqs(int band, std::vector<uint32_t>& frequencies) override;
43     int32_t GetIfaceCap(uint32_t& capabilities) override;
44     int32_t SetMacAddress(const std::string& mac) override;
45     int32_t SetCountryCode(const std::string& code) override;
46     int32_t GetPowerMode(int32_t& powerMode) override;
47     int32_t SetPowerMode(int32_t powerMode) override;
48     int32_t RegisterChipIfaceCallBack(const sptr<IChipIfaceCallback>& chipIfaceCallback) override;
49     int32_t UnRegisterChipIfaceCallBack(const sptr<IChipIfaceCallback>& chipIfaceCallback) override;
50     int32_t StartScan(const ScanParams& scanParam) override;
51     int32_t GetScanInfos(std::vector<ScanResultsInfo>& scanResultsInfo) override;
52     int32_t StartPnoScan(const PnoScanParams& pnoParams) override;
53     int32_t StopPnoScan() override;
54     int32_t GetSignalPollInfo(SignalPollResult& signalPollResult) override;
55     int32_t EnablePowerMode(int32_t mode) override;
56     int32_t SetDpiMarkRule(int32_t uid, int32_t protocol, int32_t enable) override;
57     int32_t SetTxPower(int32_t power) override;
58     int32_t SetIfaceState(bool state) override;
59 
60 private:
61     std::string ifname_;
62     std::vector<std::string> instances_;
63     std::weak_ptr<WifiVendorHal> vendorHal_;
64     std::weak_ptr<IfaceUtil> ifaceUtil_;
65     bool isValid_;
66 };
67 
68 }
69 }
70 }
71 }
72 }
73 #endif