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