• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "channel_manager_mock.h"
17 
18 namespace OHOS {
19 namespace Storage {
20 namespace DistributedFile {
21 
GetInstance()22 ChannelManager &ChannelManager::GetInstance()
23 {
24     static ChannelManager instance;
25     return instance;
26 }
27 
CreateClientChannel(const std::string & networkId)28 int32_t ChannelManager::CreateClientChannel(const std::string &networkId)
29 {
30     return IChannelManagerMock::iChannelManagerMock->CreateClientChannel(networkId);
31 }
32 
DestroyClientChannel(const std::string & networkId)33 int32_t ChannelManager::DestroyClientChannel(const std::string &networkId)
34 {
35     return IChannelManagerMock::iChannelManagerMock->DestroyClientChannel(networkId);
36 }
37 
HasExistChannel(const std::string & networkId)38 bool ChannelManager::HasExistChannel(const std::string &networkId)
39 {
40     return IChannelManagerMock::iChannelManagerMock->HasExistChannel(networkId);
41 }
42 
SendBytes(const std::string & networkId,const std::string & data)43 int32_t ChannelManager::SendBytes(const std::string &networkId, const std::string &data)
44 {
45     return IChannelManagerMock::iChannelManagerMock->SendBytes(networkId, data);
46 }
47 
SendRequest(const std::string & networkId,ControlCmd & request,ControlCmd & response,bool needResponse)48 int32_t ChannelManager::SendRequest(const std::string &networkId,
49                                     ControlCmd &request,
50                                     ControlCmd &response,
51                                     bool needResponse)
52 {
53     return IChannelManagerMock::iChannelManagerMock->SendRequest(networkId, request, response, needResponse);
54 }
55 
56 } // namespace DistributedFile
57 } // namespace Storage
58 } // namespace OHOS