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
18 namespace OHOS {
19 namespace HDI {
20 namespace Wlan {
21 namespace Chip {
22 namespace V1_0 {
WifiP2pIface(const std::string & ifname,const std::weak_ptr<WifiVendorHal> vendorHal,const std::weak_ptr<IfaceUtil> ifaceUtil)23 WifiP2pIface::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
Invalidate()31 void WifiP2pIface::Invalidate()
32 {
33 vendorHal_.reset();
34 isValid_ = false;
35 }
36
IsValid()37 bool WifiP2pIface::IsValid()
38 {
39 return isValid_;
40 }
41
GetName()42 std::string WifiP2pIface::GetName()
43 {
44 return ifname_;
45 }
46
GetIfaceType(IfaceType & type)47 int32_t WifiP2pIface::GetIfaceType(IfaceType& type)
48 {
49 type = IfaceType::P2P;
50 return HDF_SUCCESS;
51 }
52
GetIfaceName(std::string & name)53 int32_t WifiP2pIface::GetIfaceName(std::string& name)
54 {
55 name = ifname_;
56 return HDF_SUCCESS;
57 }
58
GetSupportFreqs(int band,std::vector<uint32_t> & frequencies)59 int32_t WifiP2pIface::GetSupportFreqs(int band, std::vector<uint32_t>& frequencies)
60 {
61 return HDF_SUCCESS;
62 }
63
GetIfaceCap(uint32_t & capabilities)64 int32_t WifiP2pIface::GetIfaceCap(uint32_t& capabilities)
65 {
66 return HDF_SUCCESS;
67 }
68
SetMacAddress(const std::string & mac)69 int32_t WifiP2pIface::SetMacAddress(const std::string& mac)
70 {
71 return HDF_ERR_NOT_SUPPORT;
72 }
73
SetCountryCode(const std::string & code)74 int32_t WifiP2pIface::SetCountryCode(const std::string& code)
75 {
76 return HDF_ERR_NOT_SUPPORT;
77 }
78
GetPowerMode(int32_t & powerMode)79 int32_t WifiP2pIface::GetPowerMode(int32_t& powerMode)
80 {
81 return HDF_ERR_NOT_SUPPORT;
82 }
83
SetPowerMode(int32_t powerMode)84 int32_t WifiP2pIface::SetPowerMode(int32_t powerMode)
85 {
86 return HDF_ERR_NOT_SUPPORT;
87 }
88
RegisterChipIfaceCallBack(const sptr<IChipIfaceCallback> & chipIfaceCallback)89 int32_t WifiP2pIface::RegisterChipIfaceCallBack(const sptr<IChipIfaceCallback>& chipIfaceCallback)
90 {
91 return HDF_ERR_NOT_SUPPORT;
92 }
93
UnRegisterChipIfaceCallBack(const sptr<IChipIfaceCallback> & chipIfaceCallback)94 int32_t WifiP2pIface::UnRegisterChipIfaceCallBack(const sptr<IChipIfaceCallback>& chipIfaceCallback)
95 {
96 return HDF_ERR_NOT_SUPPORT;
97 }
98
StartScan(const ScanParams & scanParam)99 int32_t WifiP2pIface::StartScan(const ScanParams& scanParam)
100 {
101 return HDF_ERR_NOT_SUPPORT;
102 }
103
GetScanInfos(std::vector<ScanResultsInfo> & scanResultsInfo)104 int32_t WifiP2pIface::GetScanInfos(std::vector<ScanResultsInfo>& scanResultsInfo)
105 {
106 return HDF_ERR_NOT_SUPPORT;
107 }
108
StartPnoScan(const PnoScanParams & pnoParams)109 int32_t WifiP2pIface::StartPnoScan(const PnoScanParams& pnoParams)
110 {
111 return HDF_ERR_NOT_SUPPORT;
112 }
113
StopPnoScan()114 int32_t WifiP2pIface::StopPnoScan()
115 {
116 return HDF_ERR_NOT_SUPPORT;
117 }
118
GetSignalPollInfo(SignalPollResult & signalPollResult)119 int32_t WifiP2pIface::GetSignalPollInfo(SignalPollResult& signalPollResult)
120 {
121 return HDF_ERR_NOT_SUPPORT;
122 }
123
EnablePowerMode(int32_t mode)124 int32_t WifiP2pIface::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 WifiP2pIface::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 WifiP2pIface::SetTxPower(int32_t power)
135 {
136 {
137 WifiError status = vendorHal_.lock()->SetTxPower(ifname_, power);
138 return status;
139 }
140 }
141
SetIfaceState(bool state)142 int32_t WifiP2pIface::SetIfaceState(bool state)
143 {
144 return HDF_ERR_NOT_SUPPORT;
145 }
146 }
147 }
148 }
149 }
150 }