1 /*
2 * Copyright (c) 2025 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 "br_proxy_ext_test_mock.h"
17
18 using namespace testing;
19 using namespace testing::ext;
20
21 namespace OHOS {
22 void *g_brProxyExtInterfaceMock;
BrProxyExtInterfaceMock()23 BrProxyExtInterfaceMock::BrProxyExtInterfaceMock()
24 {
25 g_brProxyExtInterfaceMock = reinterpret_cast<void *>(this);
26 }
27
~BrProxyExtInterfaceMock()28 BrProxyExtInterfaceMock::~BrProxyExtInterfaceMock()
29 {
30 g_brProxyExtInterfaceMock = nullptr;
31 }
32
GetBrProxyExtInterface()33 static BrProxyExtInterface *GetBrProxyExtInterface()
34 {
35 return reinterpret_cast<BrProxyExtInterface *>(g_brProxyExtInterfaceMock);
36 }
37
38 extern "C" {
CreateSoftBusList(void)39 SoftBusList *CreateSoftBusList(void)
40 {
41 return GetBrProxyExtInterface()->CreateSoftBusList();
42 }
43
DestroySoftBusList(SoftBusList * list)44 void DestroySoftBusList(SoftBusList *list)
45 {
46 return GetBrProxyExtInterface()->DestroySoftBusList(list);
47 }
48
ClientStubInit(void)49 int32_t ClientStubInit(void)
50 {
51 return GetBrProxyExtInterface()->ClientStubInit();
52 }
53
ClientRegisterBrProxyService(const char * pkgName)54 int32_t ClientRegisterBrProxyService(const char *pkgName)
55 {
56 return GetBrProxyExtInterface()->ClientRegisterBrProxyService(pkgName);
57 }
58
ServerIpcOpenBrProxy(const char * brMac,const char * uuid)59 int32_t ServerIpcOpenBrProxy(const char *brMac, const char *uuid)
60 {
61 return GetBrProxyExtInterface()->ServerIpcOpenBrProxy(brMac, uuid);
62 }
63
ServerIpcIsProxyChannelEnabled(int32_t uid,bool * isEnable)64 int32_t ServerIpcIsProxyChannelEnabled(int32_t uid, bool *isEnable)
65 {
66 return GetBrProxyExtInterface()->ServerIpcIsProxyChannelEnabled(uid, isEnable);
67 }
68
ServerIpcSendBrProxyData(int32_t channelId,char * data,uint32_t dataLen)69 int32_t ServerIpcSendBrProxyData(int32_t channelId, char *data, uint32_t dataLen)
70 {
71 return GetBrProxyExtInterface()->ServerIpcSendBrProxyData(channelId, data, dataLen);
72 }
73
ServerIpcCloseBrProxy(int32_t channelId)74 int32_t ServerIpcCloseBrProxy(int32_t channelId)
75 {
76 return GetBrProxyExtInterface()->ServerIpcCloseBrProxy(channelId);
77 }
78
ServerIpcSetListenerState(int32_t channelId,int32_t type,bool CbEnabled)79 int32_t ServerIpcSetListenerState(int32_t channelId, int32_t type, bool CbEnabled)
80 {
81 return GetBrProxyExtInterface()->ServerIpcSetListenerState(channelId, type, CbEnabled);
82 }
83
ClientRegisterService(const char * pkgName)84 int ClientRegisterService(const char *pkgName)
85 {
86 return GetBrProxyExtInterface()->ClientRegisterService(pkgName);
87 }
88 }
89 }