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 #ifndef OHOS_WIFI_HAL_DEVICE_MANAGE_TEST_H 16 #define OHOS_WIFI_HAL_DEVICE_MANAGE_TEST_H 17 #ifdef HDI_CHIP_INTERFACE_SUPPORT 18 19 #include <gtest/gtest.h> 20 #include "hal_device_manage.h" 21 22 namespace OHOS { 23 namespace Wifi { 24 class WifiHalDeviceManagerTest : public testing::Test { 25 public: SetUpTestCase()26 static void SetUpTestCase() 27 {} TearDownTestCase()28 static void TearDownTestCase() 29 {} SetUp()30 virtual void SetUp() 31 { 32 HalDeviceManager::GetInstance().StartChipHdi(); 33 } TearDown()34 virtual void TearDown() 35 {} 36 37 static void DestoryCallback(std::string &destoryIfaceName, int createIfaceType); 38 static void OnRssiReportCallback(int index, int antRssi); 39 static void OnNetlinkReportCallback(int type, const std::vector<uint8_t>& recvMsg); 40 }; 41 42 class IChipIfaceTest : public IChipIface { 43 public: 44 IChipIfaceTest() = default; 45 ~IChipIfaceTest() = default; GetIfaceType(IfaceType & type)46 virtual int32_t GetIfaceType(IfaceType& type) 47 { 48 return 0; 49 } GetIfaceName(std::string & name)50 virtual int32_t GetIfaceName(std::string& name) 51 { 52 return 0; 53 } GetIfaceCap(uint32_t & capabilities)54 virtual int32_t GetIfaceCap(uint32_t& capabilities) 55 { 56 return 0; 57 } GetSupportFreqs(int32_t band,std::vector<uint32_t> & frequencies)58 virtual int32_t GetSupportFreqs(int32_t band, std::vector<uint32_t>& frequencies) 59 { 60 return 0; 61 } SetMacAddress(const std::string & mac)62 virtual int32_t SetMacAddress(const std::string& mac) 63 { 64 return 0; 65 } SetCountryCode(const std::string & code)66 virtual int32_t SetCountryCode(const std::string& code) 67 { 68 return 0; 69 } GetPowerMode(int32_t & powerMode)70 virtual int32_t GetPowerMode(int32_t& powerMode) 71 { 72 return 0; 73 } RegisterChipIfaceCallBack(const sptr<IChipIfaceCallback> & chipIfaceCallback)74 virtual int32_t RegisterChipIfaceCallBack(const sptr<IChipIfaceCallback>& chipIfaceCallback) 75 { 76 return 0; 77 } UnRegisterChipIfaceCallBack(const sptr<IChipIfaceCallback> & chipIfaceCallback)78 virtual int32_t UnRegisterChipIfaceCallBack(const sptr<IChipIfaceCallback>& chipIfaceCallback) 79 { 80 return 0; 81 } StartScan(const ScanParams & scanParam)82 virtual int32_t StartScan(const ScanParams& scanParam) 83 { 84 return 0; 85 } GetScanInfos(std::vector<ScanResultsInfo> & scanResultsInfo)86 virtual int32_t GetScanInfos(std::vector<ScanResultsInfo>& scanResultsInfo) 87 { 88 return 0; 89 } StartPnoScan(const PnoScanParams & pnoParams)90 virtual int32_t StartPnoScan(const PnoScanParams& pnoParams) 91 { 92 return 0; 93 } StopPnoScan()94 virtual int32_t StopPnoScan() 95 { 96 return 0; 97 } GetSignalPollInfo(SignalPollResult & signalPollresult)98 virtual int32_t GetSignalPollInfo(SignalPollResult& signalPollresult) 99 { 100 return 0; 101 } EnablePowerMode(int32_t mode)102 virtual int32_t EnablePowerMode(int32_t mode) 103 { 104 return 0; 105 } SetDpiMarkRule(int32_t uid,int32_t protocol,int32_t enable)106 virtual int32_t SetDpiMarkRule(int32_t uid, int32_t protocol, int32_t enable) 107 { 108 return 0; 109 } SetTxPower(int32_t power)110 virtual int32_t SetTxPower(int32_t power) 111 { 112 return 0; 113 } SetPowerMode(int32_t powerMode)114 virtual int32_t SetPowerMode(int32_t powerMode) 115 { 116 return 0; 117 } SetIfaceState(bool state)118 virtual int32_t SetIfaceState(bool state) 119 { 120 return 0; 121 } SendCmdToDriver(const std::string & ifName,int32_t cmdId,const std::vector<int8_t> & paramBuf,std::vector<int8_t> & result)122 virtual int32_t SendCmdToDriver(const std::string& ifName, int32_t cmdId, 123 const std::vector<int8_t>& paramBuf, std::vector<int8_t>& result) 124 { 125 return 0; 126 } SendActionFrame(const std::string & ifName,uint32_t freq,const std::vector<uint8_t> & frameData)127 virtual int32_t SendActionFrame(const std::string& ifName, uint32_t freq, const std::vector<uint8_t>& frameData) 128 { 129 return 0; 130 } RegisterActionFrameReceiver(const std::string & ifName,const std::vector<uint8_t> & match)131 virtual int32_t RegisterActionFrameReceiver(const std::string& ifName, const std::vector<uint8_t>& match) 132 { 133 return 0; 134 } GetCoexictenceChannelList(const std::string & ifName,std::vector<uint8_t> & paramBuf)135 virtual int32_t GetCoexictenceChannelList(const std::string& ifName, std::vector<uint8_t>& paramBuf) 136 { 137 return 0; 138 } SetProjectionScreenParam(const std::string & ifName,const OHOS::HDI::Wlan::Chip::V2_0::ProjectionScreenCmdParam & param)139 virtual int32_t SetProjectionScreenParam(const std::string& ifName, 140 const OHOS::HDI::Wlan::Chip::V2_0::ProjectionScreenCmdParam& param) 141 { 142 return 0; 143 } 144 }; 145 146 class IConcreteChipTest : public IConcreteChip { 147 public: 148 IConcreteChipTest() = default; 149 ~IConcreteChipTest() = default; GetChipId(int32_t & id)150 virtual int32_t GetChipId(int32_t& id) 151 { 152 return 0; 153 } RegisterChipEventCallback(const sptr<IConcreteChipCallback> & chipEventcallback)154 virtual int32_t RegisterChipEventCallback(const sptr<IConcreteChipCallback>& chipEventcallback) 155 { 156 return 0; 157 } GetChipModes(std::vector<UsableMode> & modes)158 virtual int32_t GetChipModes(std::vector<UsableMode>& modes) 159 { 160 return 0; 161 } GetChipCaps(uint32_t & capabilities)162 virtual int32_t GetChipCaps(uint32_t& capabilities) 163 { 164 return 0; 165 } GetCurrentMode(uint32_t & modeId)166 virtual int32_t GetCurrentMode(uint32_t& modeId) 167 { 168 return 0; 169 } CreateApService(sptr<IChipIface> & iface)170 virtual int32_t CreateApService(sptr<IChipIface>& iface) 171 { 172 return 0; 173 } GetApServiceIfNames(std::vector<std::string> & ifnames)174 virtual int32_t GetApServiceIfNames(std::vector<std::string>& ifnames) 175 { 176 return 0; 177 } GetApService(const std::string & ifname,sptr<IChipIface> & iface)178 virtual int32_t GetApService(const std::string& ifname, sptr<IChipIface>& iface) 179 { 180 return 0; 181 } RemoveApService(const std::string & ifname)182 virtual int32_t RemoveApService(const std::string& ifname) 183 { 184 return 0; 185 } CreateP2pService(sptr<IChipIface> & iface)186 virtual int32_t CreateP2pService(sptr<IChipIface>& iface) 187 { 188 return 0; 189 } GetP2pServiceIfNames(std::vector<std::string> & ifnames)190 virtual int32_t GetP2pServiceIfNames(std::vector<std::string>& ifnames) 191 { 192 return 0; 193 } GetP2pService(const std::string & ifname,sptr<IChipIface> & iface)194 virtual int32_t GetP2pService(const std::string& ifname, sptr<IChipIface>& iface) 195 { 196 return 0; 197 } RemoveP2pService(const std::string & ifname)198 virtual int32_t RemoveP2pService(const std::string& ifname) 199 { 200 return 0; 201 } CreateStaService(sptr<IChipIface> & iface)202 virtual int32_t CreateStaService(sptr<IChipIface>& iface) 203 { 204 return 0; 205 } GetStaServiceIfNames(std::vector<std::string> & ifnames)206 virtual int32_t GetStaServiceIfNames(std::vector<std::string>& ifnames) 207 { 208 return 0; 209 } GetStaService(const std::string & ifname,sptr<IChipIface> & iface)210 virtual int32_t GetStaService(const std::string& ifname, sptr<IChipIface>& iface) 211 { 212 return 0; 213 } RemoveStaService(const std::string & ifname)214 virtual int32_t RemoveStaService(const std::string& ifname) 215 { 216 return 0; 217 } SetChipMode(uint32_t modeId)218 virtual int32_t SetChipMode(uint32_t modeId) 219 { 220 return 0; 221 } CreateExtService(const std::string & ifName,sptr<IChipIface> & iface)222 virtual int32_t CreateExtService(const std::string& ifName, sptr<IChipIface>& iface) 223 { 224 return 0; 225 } GetExtService(const std::string & ifName,sptr<IChipIface> & iface)226 virtual int32_t GetExtService(const std::string& ifName, sptr<IChipIface>& iface) 227 { 228 return 0; 229 } RemoveExtService(const std::string & ifName)230 virtual int32_t RemoveExtService(const std::string& ifName) 231 { 232 return 0; 233 } 234 }; 235 } // namespace Wifi 236 } // namespace OHOS 237 #endif 238 #endif