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_device_handler.h"
17
18 #include <logger.h>
19
20 namespace OHOS {
21 namespace ObjectStore {
AppDeviceHandler()22 AppDeviceHandler::AppDeviceHandler()
23 {
24 softbusAdapter_ = SoftBusAdapter::GetInstance();
25 devManager_ = DevManager::GetInstance();
26 }
27
~AppDeviceHandler()28 AppDeviceHandler::~AppDeviceHandler()
29 {
30 LOG_INFO("destruct");
31 }
Init()32 void AppDeviceHandler::Init()
33 {
34 devManager_->RegisterDevCallback();
35 }
36
StartWatchDeviceChange(const AppDeviceStatusChangeListener * observer,const PipeInfo & pipeInfo)37 Status AppDeviceHandler::StartWatchDeviceChange(
38 const AppDeviceStatusChangeListener *observer, __attribute__((unused)) const PipeInfo &pipeInfo)
39 {
40 return softbusAdapter_->StartWatchDeviceChange(observer, pipeInfo);
41 }
42
StopWatchDeviceChange(const AppDeviceStatusChangeListener * observer,const PipeInfo & pipeInfo)43 Status AppDeviceHandler::StopWatchDeviceChange(
44 const AppDeviceStatusChangeListener *observer, __attribute__((unused)) const PipeInfo &pipeInfo)
45 {
46 return softbusAdapter_->StopWatchDeviceChange(observer, pipeInfo);
47 }
48
GetDeviceList() const49 std::vector<DeviceInfo> AppDeviceHandler::GetDeviceList() const
50 {
51 return softbusAdapter_->GetDeviceList();
52 }
53
GetLocalDevice()54 DeviceInfo AppDeviceHandler::GetLocalDevice()
55 {
56 return softbusAdapter_->GetLocalDevice();
57 }
58
GetLocalBasicInfo() const59 DeviceInfo AppDeviceHandler::GetLocalBasicInfo() const
60 {
61 return softbusAdapter_->GetLocalBasicInfo();
62 }
63
GetRemoteNodesBasicInfo() const64 std::vector<DeviceInfo> AppDeviceHandler::GetRemoteNodesBasicInfo() const
65 {
66 return softbusAdapter_->GetRemoteNodesBasicInfo();
67 }
68
GetUuidByNodeId(const std::string & nodeId) const69 std::string AppDeviceHandler::GetUuidByNodeId(const std::string &nodeId) const
70 {
71 return devManager_->GetUuidByNodeId(nodeId);
72 }
73 } // namespace ObjectStore
74 } // namespace OHOS
75