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