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_P2P_IFACE_H
17  #define WIFI_P2P_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 WifiP2pIface : public IChipIface {
32  public:
33      WifiP2pIface(const std::string& ifname, const std::weak_ptr<WifiVendorHal> vendorHal,
34          const std::weak_ptr<IfaceUtil> ifaceUtil);
35      void Invalidate();
36      bool IsValid();
37      std::string GetName();
38      int32_t GetIfaceName(std::string& name) override;
39      int32_t GetIfaceType(IfaceType& type) override;
40      int32_t GetSupportFreqs(int band, std::vector<uint32_t>& frequencies) override;
41      int32_t GetIfaceCap(uint32_t& capabilities) override;
42      int32_t SetMacAddress(const std::string& mac) override;
43      int32_t SetCountryCode(const std::string& code) override;
44      int32_t GetPowerMode(int32_t& powerMode) override;
45      int32_t SetPowerMode(int32_t powerMode) override;
46      int32_t RegisterChipIfaceCallBack(const sptr<IChipIfaceCallback>& chipIfaceCallback) override;
47      int32_t UnRegisterChipIfaceCallBack(const sptr<IChipIfaceCallback>& chipIfaceCallback) override;
48      int32_t StartScan(const ScanParams& scanParam) override;
49      int32_t GetScanInfos(std::vector<ScanResultsInfo>& scanResultsInfo) override;
50      int32_t StartPnoScan(const PnoScanParams& pnoParams) override;
51      int32_t StopPnoScan() override;
52      int32_t GetSignalPollInfo(SignalPollResult& signalPollResult) override;
53      int32_t EnablePowerMode(int32_t mode) override;
54      int32_t SetDpiMarkRule(int32_t uid, int32_t protocol, int32_t enable) override;
55      int32_t SetTxPower(int32_t power) override;
56      int32_t SetIfaceState(bool state) override;
57  
58  private:
59      std::string ifname_;
60      std::vector<std::string> instances_;
61      std::weak_ptr<WifiVendorHal> vendorHal_;
62      std::weak_ptr<IfaceUtil> ifaceUtil_;
63      bool isValid_;
64  };
65  }
66  }
67  }
68  }
69  }
70  #endif