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_query_deps_mock.h"
17
18 using namespace testing::ext;
19 using namespace testing;
20
21 namespace OHOS {
22 void *g_laneQueryDepsInterface;
LaneQueryDepsInterfaceMock()23 LaneQueryDepsInterfaceMock::LaneQueryDepsInterfaceMock()
24 {
25 g_laneQueryDepsInterface = reinterpret_cast<void *>(this);
26 }
27
~LaneQueryDepsInterfaceMock()28 LaneQueryDepsInterfaceMock::~LaneQueryDepsInterfaceMock()
29 {
30 g_laneQueryDepsInterface = nullptr;
31 }
32
GetLaneQueryDepsInterface()33 static LaneQueryDepsInterface *GetLaneQueryDepsInterface()
34 {
35 return reinterpret_cast<LaneQueryDepsInterface *>(g_laneQueryDepsInterface);
36 }
37
38 extern "C" {
LnnGetRemoteNodeInfoById(const char * id,IdCategory type,NodeInfo * info)39 int32_t LnnGetRemoteNodeInfoById(const char *id, IdCategory type, NodeInfo *info)
40 {
41 return GetLaneQueryDepsInterface()->LnnGetRemoteNodeInfoById(id, type, info);
42 }
43
LnnHasDiscoveryType(const NodeInfo * info,DiscoveryType type)44 bool LnnHasDiscoveryType(const NodeInfo *info, DiscoveryType type)
45 {
46 return GetLaneQueryDepsInterface()->LnnHasDiscoveryType(info, type);
47 }
48
GetWifiDirectManager(void)49 struct WifiDirectManager* GetWifiDirectManager(void)
50 {
51 return GetLaneQueryDepsInterface()->GetWifiDirectManager();
52 }
53
LnnGetRemoteNumU32Info(const char * networkId,InfoKey key,uint32_t * info)54 int32_t LnnGetRemoteNumU32Info(const char *networkId, InfoKey key, uint32_t *info)
55 {
56 return GetLaneQueryDepsInterface()->LnnGetRemoteNumU32Info(networkId, key, info);
57 }
58
LnnGetLocalNumU32Info(InfoKey key,uint32_t * info)59 int32_t LnnGetLocalNumU32Info(InfoKey key, uint32_t *info)
60 {
61 return GetLaneQueryDepsInterface()->LnnGetLocalNumU32Info(key, info);
62 }
63
SoftBusGetWifiState(void)64 SoftBusWifiDetailState SoftBusGetWifiState(void)
65 {
66 return GetLaneQueryDepsInterface()->SoftBusGetWifiState();
67 }
68
SoftBusIsWifiActive(void)69 bool SoftBusIsWifiActive(void)
70 {
71 return GetLaneQueryDepsInterface()->SoftBusIsWifiActive();
72 }
73
IsFeatureSupport(uint64_t feature,FeatureCapability capaBit)74 bool IsFeatureSupport(uint64_t feature, FeatureCapability capaBit)
75 {
76 return GetLaneQueryDepsInterface()->IsFeatureSupport(feature, capaBit);
77 }
78
LnnGetRemoteBoolInfo(const char * networkId,InfoKey key,bool * info)79 int32_t LnnGetRemoteBoolInfo(const char *networkId, InfoKey key, bool *info)
80 {
81 return GetLaneQueryDepsInterface()->LnnGetRemoteBoolInfo(networkId, key, info);
82 }
83
LnnGetFeatureCapabilty(void)84 uint64_t LnnGetFeatureCapabilty(void)
85 {
86 return GetLaneQueryDepsInterface()->LnnGetFeatureCapabilty();
87 }
88
LnnGetOnlineStateById(const char * id,IdCategory type)89 bool LnnGetOnlineStateById(const char *id, IdCategory type)
90 {
91 return GetLaneQueryDepsInterface()->LnnGetOnlineStateById(id, type);
92 }
93 }
94 } // namespace OHOS