• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "lnn_lane_power_ctrl_deps_mock.h"
17 #include "softbus_error_code.h"
18 #include "softbus_socket.h"
19 
20 using namespace testing::ext;
21 using namespace testing;
22 
23 namespace OHOS {
24 void *g_lanePowerCtrlDepsInterface;
25 
LanePowerCtrlDepsInterfaceMock()26 LanePowerCtrlDepsInterfaceMock::LanePowerCtrlDepsInterfaceMock()
27 {
28     g_lanePowerCtrlDepsInterface = reinterpret_cast<void *>(this);
29 }
30 
~LanePowerCtrlDepsInterfaceMock()31 LanePowerCtrlDepsInterfaceMock::~LanePowerCtrlDepsInterfaceMock()
32 {
33     g_lanePowerCtrlDepsInterface = nullptr;
34 }
35 
GetLanePowerCtrlDepsInterface()36 static LanePowerCtrlDepsInterface *GetLanePowerCtrlDepsInterface()
37 {
38     return reinterpret_cast<LanePowerCtrlDepsInterface *>(g_lanePowerCtrlDepsInterface);
39 }
40 
41 extern "C" {
IsPowerControlEnabled(void)42 bool IsPowerControlEnabled(void)
43 {
44     return GetLanePowerCtrlDepsInterface()->IsPowerControlEnabled();
45 }
46 
EnablePowerControl(const WifiDirectLinkInfo * wifiDirectInfo)47 int32_t EnablePowerControl(const WifiDirectLinkInfo *wifiDirectInfo)
48 {
49     return GetLanePowerCtrlDepsInterface()->EnablePowerControl(wifiDirectInfo);
50 }
51 
DisablePowerControl(const WifiDirectLinkInfo * wifiDirectInfo)52 void DisablePowerControl(const WifiDirectLinkInfo *wifiDirectInfo)
53 {
54     GetLanePowerCtrlDepsInterface()->DisablePowerControl(wifiDirectInfo);
55 }
56 }
57 } // namespace OHOS