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#include "wifi_p2p_iface.h" 17 18namespace OHOS { 19namespace HDI { 20namespace Wlan { 21namespace Chip { 22namespace V1_0 { 23WifiP2pIface::WifiP2pIface( 24 const std::string& ifname, const std::weak_ptr<WifiVendorHal> vendorHal, 25 const std::weak_ptr<IfaceUtil> ifaceUtil) 26 : ifname_(ifname), 27 vendorHal_(vendorHal), 28 ifaceUtil_(ifaceUtil), 29 isValid_(true) {} 30 31void WifiP2pIface::Invalidate() 32{ 33 vendorHal_.reset(); 34 isValid_ = false; 35} 36 37bool WifiP2pIface::IsValid() 38{ 39 return isValid_; 40} 41 42std::string WifiP2pIface::GetName() 43{ 44 return ifname_; 45} 46 47int32_t WifiP2pIface::GetIfaceType(IfaceType& type) 48{ 49 type = IfaceType::P2P; 50 return HDF_SUCCESS; 51} 52 53int32_t WifiP2pIface::GetIfaceName(std::string& name) 54{ 55 name = ifname_; 56 return HDF_SUCCESS; 57} 58 59int32_t WifiP2pIface::GetSupportFreqs(int band, std::vector<uint32_t>& frequencies) 60{ 61 return HDF_SUCCESS; 62} 63 64int32_t WifiP2pIface::GetIfaceCap(uint32_t& capabilities) 65{ 66 return HDF_SUCCESS; 67} 68 69int32_t WifiP2pIface::SetMacAddress(const std::string& mac) 70{ 71 return HDF_ERR_NOT_SUPPORT; 72} 73 74int32_t WifiP2pIface::SetCountryCode(const std::string& code) 75{ 76 return HDF_ERR_NOT_SUPPORT; 77} 78 79int32_t WifiP2pIface::GetPowerMode(int32_t& powerMode) 80{ 81 return HDF_ERR_NOT_SUPPORT; 82} 83 84int32_t WifiP2pIface::SetPowerMode(int32_t powerMode) 85{ 86 return HDF_ERR_NOT_SUPPORT; 87} 88 89int32_t WifiP2pIface::RegisterChipIfaceCallBack(const sptr<IChipIfaceCallback>& chipIfaceCallback) 90{ 91 return HDF_ERR_NOT_SUPPORT; 92} 93 94int32_t WifiP2pIface::UnRegisterChipIfaceCallBack(const sptr<IChipIfaceCallback>& chipIfaceCallback) 95{ 96 return HDF_ERR_NOT_SUPPORT; 97} 98 99int32_t WifiP2pIface::StartScan(const ScanParams& scanParam) 100{ 101 return HDF_ERR_NOT_SUPPORT; 102} 103 104int32_t WifiP2pIface::GetScanInfos(std::vector<ScanResultsInfo>& scanResultsInfo) 105{ 106 return HDF_ERR_NOT_SUPPORT; 107} 108 109int32_t WifiP2pIface::StartPnoScan(const PnoScanParams& pnoParams) 110{ 111 return HDF_ERR_NOT_SUPPORT; 112} 113 114int32_t WifiP2pIface::StopPnoScan() 115{ 116 return HDF_ERR_NOT_SUPPORT; 117} 118 119int32_t WifiP2pIface::GetSignalPollInfo(SignalPollResult& signalPollResult) 120{ 121 return HDF_ERR_NOT_SUPPORT; 122} 123 124int32_t WifiP2pIface::EnablePowerMode(int32_t mode) 125{ 126 return HDF_ERR_NOT_SUPPORT; 127} 128 129int32_t WifiP2pIface::SetDpiMarkRule(int32_t uid, int32_t protocol, int32_t enable) 130{ 131 return HDF_ERR_NOT_SUPPORT; 132} 133 134int32_t WifiP2pIface::SetTxPower(int32_t power) 135{ 136{ 137 WifiError status = vendorHal_.lock()->SetTxPower(ifname_, power); 138 return status; 139} 140} 141 142int32_t WifiP2pIface::SetIfaceState(bool state) 143{ 144 return HDF_ERR_NOT_SUPPORT; 145} 146 147int32_t WifiP2pIface::SendCmdToDriver(const std::string& ifName, int32_t cmdId, const std::vector<int8_t>& paramBuf) 148{ 149 WifiError status = vendorHal_.lock()->SendCmdToDriver(ifName, cmdId, paramBuf); 150 if (status == HAL_SUCCESS) { 151 return HDF_SUCCESS; 152 } 153 return HDF_FAILURE; 154} 155 156int32_t WifiP2pIface::SendActionFrame(const std::string& ifName, uint32_t freq, const std::vector<uint8_t>& frameData) 157{ 158 return HDF_ERR_NOT_SUPPORT; 159} 160 161int32_t WifiP2pIface::RegisterActionFrameReceiver(const std::string& ifName, const std::vector<uint8_t>& match) 162{ 163 return HDF_ERR_NOT_SUPPORT; 164} 165 166int32_t WifiP2pIface::GetCoexictenceChannelList(const std::string& ifName, std::vector<uint8_t>& paramBuf) 167{ 168 return HDF_ERR_NOT_SUPPORT; 169} 170 171} 172} 173} 174} 175}