1 /* 2 * Copyright (c) 2021 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 OHOS_DEVICE_MANAGER_IMPL_H 17 #define OHOS_DEVICE_MANAGER_IMPL_H 18 19 #include "device_manager.h" 20 #if !defined(__LITEOS_M__) 21 #include "ipc_client_manager.h" 22 #include "ipc_client_proxy.h" 23 #endif 24 25 namespace OHOS { 26 namespace DistributedHardware { 27 class DeviceManagerImpl : public DeviceManager { 28 public: 29 static DeviceManagerImpl &GetInstance(); 30 31 public: 32 virtual int32_t InitDeviceManager(const std::string &pkgName, 33 std::shared_ptr<DmInitCallback> dmInitCallback) override; 34 virtual int32_t UnInitDeviceManager(const std::string &pkgName) override; 35 virtual int32_t GetTrustedDeviceList(const std::string &pkgName, const std::string &extra, 36 std::vector<DmDeviceInfo> &deviceList) override; 37 virtual int32_t GetLocalDeviceInfo(const std::string &pkgName, DmDeviceInfo &deviceInfo) override; 38 virtual int32_t RegisterDevStateCallback(const std::string &pkgName, const std::string &extra, 39 std::shared_ptr<DeviceStateCallback> callback) override; 40 virtual int32_t UnRegisterDevStateCallback(const std::string &pkgName) override; 41 virtual int32_t StartDeviceDiscovery(const std::string &pkgName, const DmSubscribeInfo &subscribeInfo, 42 const std::string &extra, 43 std::shared_ptr<DiscoveryCallback> callback) override; 44 virtual int32_t StopDeviceDiscovery(const std::string &pkgName, uint16_t subscribeId) override; 45 virtual int32_t AuthenticateDevice(const std::string &pkgName, int32_t authType, const DmDeviceInfo &deviceInfo, 46 const std::string &extra, 47 std::shared_ptr<AuthenticateCallback> callback) override; 48 virtual int32_t UnAuthenticateDevice(const std::string &pkgName, const DmDeviceInfo &deviceInfo) override; 49 virtual int32_t VerifyAuthentication(const std::string &pkgName, const std::string &authPara, 50 std::shared_ptr<VerifyAuthCallback> callback) override; 51 /** 52 * @tc.name: DeviceManagerImpl::RegisterDeviceManagerFaCallback 53 * @tc.desc: Register Fa callback for device manager 54 * @tc.type: FUNC 55 */ 56 virtual int32_t RegisterDeviceManagerFaCallback(const std::string &packageName, 57 std::shared_ptr<DeviceManagerUiCallback> callback) override; 58 virtual int32_t UnRegisterDeviceManagerFaCallback(const std::string &pkgName) override; 59 virtual int32_t GetFaParam(const std::string &pkgName, DmAuthParam &faParam) override; 60 /** 61 * @tc.name: DeviceManagerImpl::SetUserOperation 62 * @tc.desc: Set User Actions 63 * @tc.type: FUNC 64 */ 65 virtual int32_t SetUserOperation(const std::string &pkgName, int32_t action, const std::string ¶ms) override; 66 virtual int32_t GetUdidByNetworkId(const std::string &pkgName, const std::string &netWorkId, 67 std::string &udid) override; 68 virtual int32_t GetUuidByNetworkId(const std::string &pkgName, const std::string &netWorkId, 69 std::string &uuid) override; 70 virtual int32_t RegisterDevStateCallback(const std::string &pkgName, const std::string &extra) override; 71 virtual int32_t UnRegisterDevStateCallback(const std::string &pkgName, const std::string &extra) override; 72 73 private: 74 DeviceManagerImpl() = default; 75 ~DeviceManagerImpl() = default; 76 DeviceManagerImpl(const DeviceManagerImpl &) = delete; 77 DeviceManagerImpl &operator=(const DeviceManagerImpl &) = delete; 78 DeviceManagerImpl(DeviceManagerImpl &&) = delete; 79 DeviceManagerImpl &operator=(DeviceManagerImpl &&) = delete; 80 81 private: 82 #if !defined(__LITEOS_M__) 83 std::shared_ptr<IpcClientProxy> ipcClientProxy_ = 84 std::make_shared<IpcClientProxy>(std::make_shared<IpcClientManager>()); 85 #endif 86 }; 87 } // namespace DistributedHardware 88 } // namespace OHOS 89 #endif // OHOS_DEVICE_MANAGER_IMPL_H 90