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 "app_pipe_handler.h"
17
18 #include <string>
19
20 #include "logger.h"
21
22 namespace OHOS {
23 namespace ObjectStore {
24 using namespace std;
25
~AppPipeHandler()26 AppPipeHandler::~AppPipeHandler()
27 {
28 LOG_INFO("destructor pipeId: %{public}s", pipeInfo_.pipeId.c_str());
29 }
30
AppPipeHandler(const PipeInfo & pipeInfo)31 AppPipeHandler::AppPipeHandler(const PipeInfo &pipeInfo) : pipeInfo_(pipeInfo)
32 {
33 LOG_INFO("constructor pipeId: %{public}s", pipeInfo_.pipeId.c_str());
34 softbusAdapter_ = SoftBusAdapter::GetInstance();
35 }
36
SendData(const PipeInfo & pipeInfo,const DeviceId & deviceId,const DataInfo & dataInfo,uint32_t totalLength,const MessageInfo & info)37 Status AppPipeHandler::SendData(const PipeInfo &pipeInfo, const DeviceId &deviceId, const DataInfo &dataInfo,
38 uint32_t totalLength, const MessageInfo &info)
39 {
40 return softbusAdapter_->SendData(pipeInfo, deviceId, dataInfo, totalLength, info);
41 }
42
StartWatchDataChange(const AppDataChangeListener * observer,const PipeInfo & pipeInfo)43 Status AppPipeHandler::StartWatchDataChange(const AppDataChangeListener *observer, const PipeInfo &pipeInfo)
44 {
45 return softbusAdapter_->StartWatchDataChange(observer, pipeInfo);
46 }
47
StopWatchDataChange(const AppDataChangeListener * observer,const PipeInfo & pipeInfo)48 Status AppPipeHandler::StopWatchDataChange(
49 __attribute__((unused)) const AppDataChangeListener *observer, const PipeInfo &pipeInfo)
50 {
51 return softbusAdapter_->StopWatchDataChange(observer, pipeInfo);
52 }
53
IsSameStartedOnPeer(const struct PipeInfo & pipeInfo,const struct DeviceId & peer)54 bool AppPipeHandler::IsSameStartedOnPeer(
55 const struct PipeInfo &pipeInfo, __attribute__((unused)) const struct DeviceId &peer)
56 {
57 return softbusAdapter_->IsSameStartedOnPeer(pipeInfo, peer);
58 }
59
CreateSessionServer(const std::string & sessionName) const60 int AppPipeHandler::CreateSessionServer(const std::string &sessionName) const
61 {
62 return softbusAdapter_->CreateSessionServerAdapter(sessionName);
63 }
64
RemoveSessionServer(const std::string & sessionName) const65 int AppPipeHandler::RemoveSessionServer(const std::string &sessionName) const
66 {
67 return softbusAdapter_->RemoveSessionServerAdapter(sessionName);
68 }
69 } // namespace ObjectStore
70 } // namespace OHOS
71