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 "softbus_session_mock.h"
17
18 namespace OHOS::FileManagement::CloudSync {
19
SoftbusSession(const std::string & peerDeviceId,const std::string & sessionName,DataType type)20 SoftbusSession::SoftbusSession(const std::string &peerDeviceId, const std::string &sessionName, DataType type)
21 : peerDeviceId_(peerDeviceId), sessionName_(sessionName), type_(type)
22 {
23 }
24
Start()25 int32_t SoftbusSession::Start()
26 {
27 if (ISoftbusSessionMock::iSoftbusSessionMock_ == nullptr) {
28 return -1;
29 }
30 return ISoftbusSessionMock::iSoftbusSessionMock_->Start();
31 }
32
Stop()33 int32_t SoftbusSession::Stop()
34 {
35 return 0;
36 }
37
SendData(const void * data,uint32_t dataLen)38 int32_t SoftbusSession::SendData(const void *data, uint32_t dataLen)
39 {
40 if (ISoftbusSessionMock::iSoftbusSessionMock_ == nullptr) {
41 return -1;
42 }
43 return ISoftbusSessionMock::iSoftbusSessionMock_->SendData(data, dataLen);
44 }
45
SendFile(const std::vector<std::string> & sFileList,const std::vector<std::string> & dFileList)46 int32_t SoftbusSession::SendFile(const std::vector<std::string> &sFileList, const std::vector<std::string> &dFileList)
47 {
48 if (ISoftbusSessionMock::iSoftbusSessionMock_ == nullptr) {
49 return -1;
50 }
51 return ISoftbusSessionMock::iSoftbusSessionMock_->SendFile(sFileList, dFileList);
52 }
53
WaitSessionOpened(int sessionId)54 int32_t SoftbusSession::WaitSessionOpened(int sessionId)
55 {
56 return 0;
57 }
58
GetDataType()59 SoftbusSession::DataType SoftbusSession::GetDataType()
60 {
61 return type_;
62 }
63
GetPeerDeviceId()64 std::string SoftbusSession::GetPeerDeviceId()
65 {
66 return peerDeviceId_;
67 }
68
GetSessionId()69 int32_t SoftbusSession::GetSessionId()
70 {
71 return 0;
72 }
73 }
74