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 #ifndef DISTRIBUTEDDATAFWK_SRC_DEVICE_HANDLER_H 17 #define DISTRIBUTEDDATAFWK_SRC_DEVICE_HANDLER_H 18 #include "softbus_adapter.h" 19 #include "dev_manager.h" 20 21 namespace OHOS { 22 namespace ObjectStore { 23 class AppDeviceHandler { 24 public: 25 ~AppDeviceHandler(); 26 explicit AppDeviceHandler(); 27 void Init(); 28 29 // add DeviceChangeListener to watch device change; 30 Status StartWatchDeviceChange(const AppDeviceStatusChangeListener *observer, const PipeInfo &pipeInfo); 31 // stop DeviceChangeListener to watch device change; 32 Status StopWatchDeviceChange(const AppDeviceStatusChangeListener *observer, const PipeInfo &pipeInfo); 33 34 DeviceInfo GetLocalDevice(); 35 std::vector<DeviceInfo> GetDeviceList() const; 36 37 std::string GetUuidByNodeId(const std::string &nodeId) const; 38 // get local device node information; 39 DeviceInfo GetLocalBasicInfo() const; 40 // get all remote connected device's node information; 41 std::vector<DeviceInfo> GetRemoteNodesBasicInfo() const; 42 43 private: 44 std::shared_ptr<SoftBusAdapter> softbusAdapter_{}; 45 DevManager *devManager_ = nullptr; 46 }; 47 } // namespace ObjectStore 48 } // namespace OHOS 49 #endif // DISTRIBUTEDDATAFWK_SRC_DEVICE_HANDLER_H 50