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 "client_trans_proxy_file_helper_mock.h"
17
18 using namespace testing;
19 using namespace testing::ext;
20
21 namespace OHOS {
22 void *g_clientTransProxyFileHelperInterface;
ClientTransProxyFileHelperInterfaceMock()23 ClientTransProxyFileHelperInterfaceMock::ClientTransProxyFileHelperInterfaceMock()
24 {
25 g_clientTransProxyFileHelperInterface = reinterpret_cast<void *>(this);
26 }
27
~ClientTransProxyFileHelperInterfaceMock()28 ClientTransProxyFileHelperInterfaceMock::~ClientTransProxyFileHelperInterfaceMock()
29 {
30 g_clientTransProxyFileHelperInterface = nullptr;
31 }
32
GetClientTransProxyFileHelperInterface()33 static ClientTransProxyFileHelperInterface *GetClientTransProxyFileHelperInterface()
34 {
35 return reinterpret_cast<ClientTransProxyFileHelperInterface *>(g_clientTransProxyFileHelperInterface);
36 }
37
38 extern "C" {
ClientTransProxyPackAndSendData(int32_t channelId,const void * data,uint32_t len,ProxyChannelInfoDetail * info,SessionPktType pktType)39 int32_t ClientTransProxyPackAndSendData(int32_t channelId, const void* data, uint32_t len,
40 ProxyChannelInfoDetail* info, SessionPktType pktType)
41 {
42 return GetClientTransProxyFileHelperInterface()->ClientTransProxyPackAndSendData(
43 channelId, data, len, info, pktType);
44 }
ClientTransProxyGetInfoByChannelId(int32_t channelId,ProxyChannelInfoDetail * info)45 int32_t ClientTransProxyGetInfoByChannelId(int32_t channelId, ProxyChannelInfoDetail *info)
46 {
47 return GetClientTransProxyFileHelperInterface()->ClientTransProxyGetInfoByChannelId(channelId, info);
48 }
SoftBusLtoHl(uint32_t value)49 uint32_t SoftBusLtoHl(uint32_t value)
50 {
51 return GetClientTransProxyFileHelperInterface()->SoftBusLtoHl(value);
52 }
53
SoftBusHtoLl(uint32_t value)54 uint32_t SoftBusHtoLl(uint32_t value)
55 {
56 return GetClientTransProxyFileHelperInterface()->SoftBusHtoLl(value);
57 }
58
SoftBusLtoHll(uint64_t value)59 uint64_t SoftBusLtoHll(uint64_t value)
60 {
61 return GetClientTransProxyFileHelperInterface()->SoftBusLtoHll(value);
62 }
63
SoftBusHtoLll(uint64_t value)64 uint64_t SoftBusHtoLll(uint64_t value)
65 {
66 return GetClientTransProxyFileHelperInterface()->SoftBusHtoLll(value);
67 }
SoftBusNtoHl(uint32_t value)68 uint32_t SoftBusNtoHl(uint32_t value)
69 {
70 return GetClientTransProxyFileHelperInterface()->SoftBusNtoHl(value);
71 }
SoftBusHtoLs(uint16_t value)72 uint16_t SoftBusHtoLs(uint16_t value)
73 {
74 return GetClientTransProxyFileHelperInterface()->SoftBusHtoLs(value);
75 }
SoftBusPreadFile(int32_t fd,void * buf,uint64_t readBytes,uint64_t offset)76 int64_t SoftBusPreadFile(int32_t fd, void *buf, uint64_t readBytes, uint64_t offset)
77 {
78 return GetClientTransProxyFileHelperInterface()->SoftBusPreadFile(fd, buf, readBytes, offset);
79 }
RTU_CRC(const unsigned char * puchMsg,uint16_t usDataLen)80 uint16_t RTU_CRC(const unsigned char *puchMsg, uint16_t usDataLen)
81 {
82 return GetClientTransProxyFileHelperInterface()->RTU_CRC(puchMsg, usDataLen);
83 }
84
FrameIndexToType(uint64_t index,uint64_t frameNumber)85 int32_t FrameIndexToType(uint64_t index, uint64_t frameNumber)
86 {
87 return GetClientTransProxyFileHelperInterface()->FrameIndexToType(index, frameNumber);
88 }
89 }
90 }
91