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