• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 "client_bus_center_manager_mock.h"
17 
18 #include <securec.h>
19 
20 #include "softbus_common.h"
21 #include "softbus_error_code.h"
22 
23 using namespace testing;
24 using namespace testing::ext;
25 namespace OHOS {
26 void *g_clientBusCenterManagerInterface;
ClientBusCenterManagerInterfaceMock()27 ClientBusCenterManagerInterfaceMock::ClientBusCenterManagerInterfaceMock()
28 {
29     g_clientBusCenterManagerInterface = reinterpret_cast<void *>(this);
30 }
31 
~ClientBusCenterManagerInterfaceMock()32 ClientBusCenterManagerInterfaceMock::~ClientBusCenterManagerInterfaceMock()
33 {
34     g_clientBusCenterManagerInterface = nullptr;
35 }
36 
GetBusCenterManagerInterface()37 static ClientBusCenterManagerInterfaceMock *GetBusCenterManagerInterface()
38 {
39     return reinterpret_cast<ClientBusCenterManagerInterfaceMock *>(g_clientBusCenterManagerInterface);
40 }
41 
42 extern "C" {
BusCenterServerProxyInit(void)43 int32_t BusCenterServerProxyInit(void)
44 {
45     return GetBusCenterManagerInterface()->BusCenterServerProxyInit();
46 }
47 
BusCenterServerProxyDeInit(void)48 void BusCenterServerProxyDeInit(void)
49 {
50     return GetBusCenterManagerInterface()->BusCenterServerProxyDeInit();
51 }
52 
SoftbusGetConfig(ConfigType type,unsigned char * val,uint32_t len)53 int32_t SoftbusGetConfig(ConfigType type, unsigned char *val, uint32_t len)
54 {
55     return GetBusCenterManagerInterface()->SoftbusGetConfig(type, val, len);
56 }
57 
ServerIpcGetAllOnlineNodeInfo(const char * pkgName,void ** info,uint32_t infoTypeLen,int32_t * infoNum)58 int32_t ServerIpcGetAllOnlineNodeInfo(const char *pkgName, void **info, uint32_t infoTypeLen, int32_t *infoNum)
59 {
60     return GetBusCenterManagerInterface()->ServerIpcGetAllOnlineNodeInfo(pkgName, info, infoTypeLen, infoNum);
61 }
62 
ServerIpcGetLocalDeviceInfo(const char * pkgName,void * info,uint32_t infoTypeLen)63 int32_t ServerIpcGetLocalDeviceInfo(const char *pkgName, void *info, uint32_t infoTypeLen)
64 {
65     return GetBusCenterManagerInterface()->ServerIpcGetLocalDeviceInfo(pkgName, info, infoTypeLen);
66 }
67 
ServerIpcGetNodeKeyInfo(const char * pkgName,const char * networkId,int32_t key,unsigned char * buf,uint32_t len)68 int32_t ServerIpcGetNodeKeyInfo(
69     const char *pkgName, const char *networkId, int32_t key, unsigned char *buf, uint32_t len)
70 {
71     return GetBusCenterManagerInterface()->ServerIpcGetNodeKeyInfo(pkgName, networkId, key, buf, len);
72 }
73 
ServerIpcSetNodeDataChangeFlag(const char * pkgName,const char * networkId,uint16_t dataChangeFlag)74 int32_t ServerIpcSetNodeDataChangeFlag(const char *pkgName, const char *networkId, uint16_t dataChangeFlag)
75 {
76     return GetBusCenterManagerInterface()->ServerIpcSetNodeDataChangeFlag(pkgName, networkId, dataChangeFlag);
77 }
78 
ServerIpcJoinLNN(const char * pkgName,void * addr,unsigned int addrTypeLen,bool isForceJoin)79 int32_t ServerIpcJoinLNN(const char *pkgName, void *addr, unsigned int addrTypeLen, bool isForceJoin)
80 {
81     return GetBusCenterManagerInterface()->ServerIpcJoinLNN(pkgName, addr, addrTypeLen, isForceJoin);
82 }
83 
ServerIpcLeaveLNN(const char * pkgName,const char * networkId)84 int32_t ServerIpcLeaveLNN(const char *pkgName, const char *networkId)
85 {
86     return GetBusCenterManagerInterface()->ServerIpcLeaveLNN(pkgName, networkId);
87 }
88 
ServerIpcStartTimeSync(const char * pkgName,const char * targetNetworkId,int32_t accuracy,int32_t period)89 int32_t ServerIpcStartTimeSync(const char *pkgName, const char *targetNetworkId, int32_t accuracy, int32_t period)
90 {
91     return GetBusCenterManagerInterface()->ServerIpcStartTimeSync(pkgName, targetNetworkId, accuracy, period);
92 }
93 
ServerIpcStopTimeSync(const char * pkgName,const char * targetNetworkId)94 int32_t ServerIpcStopTimeSync(const char *pkgName, const char *targetNetworkId)
95 {
96     return GetBusCenterManagerInterface()->ServerIpcStopTimeSync(pkgName, targetNetworkId);
97 }
98 
ServerIpcPublishLNN(const char * pkgName,const PublishInfo * info)99 int32_t ServerIpcPublishLNN(const char *pkgName, const PublishInfo *info)
100 {
101     return GetBusCenterManagerInterface()->ServerIpcPublishLNN(pkgName, info);
102 }
103 
ServerIpcStopPublishLNN(const char * pkgName,int32_t publishId)104 int32_t ServerIpcStopPublishLNN(const char *pkgName, int32_t publishId)
105 {
106     return GetBusCenterManagerInterface()->ServerIpcStopPublishLNN(pkgName, publishId);
107 }
108 
ServerIpcRefreshLNN(const char * pkgName,const SubscribeInfo * info)109 int32_t ServerIpcRefreshLNN(const char *pkgName, const SubscribeInfo *info)
110 {
111     return GetBusCenterManagerInterface()->ServerIpcRefreshLNN(pkgName, info);
112 }
113 
ServerIpcStopRefreshLNN(const char * pkgName,int32_t refreshId)114 int32_t ServerIpcStopRefreshLNN(const char *pkgName, int32_t refreshId)
115 {
116     return GetBusCenterManagerInterface()->ServerIpcStopRefreshLNN(pkgName, refreshId);
117 }
118 
ServerIpcRegDataLevelChangeCb(const char * pkgName)119 int32_t ServerIpcRegDataLevelChangeCb(const char *pkgName)
120 {
121     return GetBusCenterManagerInterface()->ServerIpcRegDataLevelChangeCb(pkgName);
122 }
123 
ServerIpcUnregDataLevelChangeCb(const char * pkgName)124 int32_t ServerIpcUnregDataLevelChangeCb(const char *pkgName)
125 {
126     return GetBusCenterManagerInterface()->ServerIpcUnregDataLevelChangeCb(pkgName);
127 }
128 
ServerIpcSetDataLevel(const DataLevel * dataLevel)129 int32_t ServerIpcSetDataLevel(const DataLevel *dataLevel)
130 {
131     return GetBusCenterManagerInterface()->ServerIpcSetDataLevel(dataLevel);
132 }
133 
ServerIpcRegRangeCbForMsdp(const char * pkgName)134 int32_t ServerIpcRegRangeCbForMsdp(const char *pkgName)
135 {
136     return GetBusCenterManagerInterface()->ServerIpcRegRangeCbForMsdp(pkgName);
137 }
138 
ServerIpcUnregRangeCbForMsdp(const char * pkgName)139 int32_t ServerIpcUnregRangeCbForMsdp(const char *pkgName)
140 {
141     return GetBusCenterManagerInterface()->ServerIpcUnregRangeCbForMsdp(pkgName);
142 }
143 
ServerIpcTriggerRangeForMsdp(const char * pkgName,const RangeConfig * config)144 int32_t ServerIpcTriggerRangeForMsdp(const char *pkgName, const RangeConfig *config)
145 {
146     return GetBusCenterManagerInterface()->ServerIpcTriggerRangeForMsdp(pkgName, config);
147 }
148 
SoftBusMutexLockInner(SoftBusMutex * mutex)149 int32_t SoftBusMutexLockInner(SoftBusMutex *mutex)
150 {
151     return GetBusCenterManagerInterface()->SoftBusMutexLockInner(mutex);
152 }
153 
SoftBusMutexUnlockInner(SoftBusMutex * mutex)154 int32_t SoftBusMutexUnlockInner(SoftBusMutex *mutex)
155 {
156     return GetBusCenterManagerInterface()->SoftBusMutexUnlockInner(mutex);
157 }
158 } // extern "C"
159 } // namespace OHOS
160