1 /* 2 * Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development 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 SHARING_DM_KIT_H 17 #define SHARING_DM_KIT_H 18 19 #include "common/sharing_log.h" 20 #include "device_manager.h" 21 #include "device_manager_callback.h" 22 #include "dm_device_info.h" 23 24 namespace OHOS { 25 namespace Sharing { 26 27 class DmKitInitDMCallback : public OHOS::DistributedHardware::DmInitCallback { 28 public: 29 DmKitInitDMCallback() = default; 30 ~DmKitInitDMCallback() override = default; 31 OnRemoteDied()32 void OnRemoteDied() override{}; 33 }; 34 35 class DmKit { 36 public: 37 static void InitDeviceManager(); 38 static std::string GetIpAddrByNetworkId(const std::string &networkId); 39 static std::vector<OHOS::DistributedHardware::DmDeviceInfo> &GetTrustedDevicesInfo(); 40 41 static OHOS::DistributedHardware::DmDeviceInfo &GetLocalDevicesInfo(); 42 43 private: 44 static bool isInited; 45 static std::vector<OHOS::DistributedHardware::DmDeviceInfo> trustedDeviceInfos_; 46 47 static OHOS::DistributedHardware::DmDeviceInfo localDeviceInfo_; 48 }; 49 50 } // namespace Sharing 51 } // namespace OHOS 52 53 #endif 54