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 OHOS_I_DM_SERVICE_IMPL_H 17 #define OHOS_I_DM_SERVICE_IMPL_H 18 19 #include <string> 20 #include <vector> 21 22 #include "idevice_manager_service_listener.h" 23 #include "dm_device_info.h" 24 #include "dm_publish_info.h" 25 #include "dm_subscribe_info.h" 26 27 namespace OHOS { 28 namespace DistributedHardware { 29 class IDeviceManagerServiceImpl { 30 public: ~IDeviceManagerServiceImpl()31 virtual ~IDeviceManagerServiceImpl() {} 32 33 /** 34 * @tc.name: IDeviceManagerServiceImpl::Initialize 35 * @tc.desc: Initialize the device manager service impl 36 * @tc.type: FUNC 37 */ 38 virtual int32_t Initialize(const std::shared_ptr<IDeviceManagerServiceListener> &listener); 39 40 /** 41 * @tc.name: IDeviceManagerServiceImpl::Release 42 * @tc.desc: Release the device manager service impl 43 * @tc.type: FUNC 44 */ 45 virtual void Release(); 46 47 /** 48 * @tc.name: IDeviceManagerServiceImpl::StartDeviceDiscovery 49 * @tc.desc: Start Device Discovery of the device manager service impl 50 * @tc.type: FUNC 51 */ 52 virtual int32_t StartDeviceDiscovery(const std::string &pkgName, const DmSubscribeInfo &subscribeInfo, 53 const std::string &extra); 54 55 /** 56 * @tc.name: IDeviceManagerServiceImpl::StopDeviceDiscovery 57 * @tc.desc: Stop Device Discovery of the device manager service impl 58 * @tc.type: FUNC 59 */ 60 virtual int32_t StopDeviceDiscovery(const std::string &pkgName, uint16_t subscribeId); 61 62 /** 63 * @tc.name: IDeviceManagerServiceImpl::PublishDeviceDiscovery 64 * @tc.desc: Publish Device Discovery of the device manager service impl 65 * @tc.type: FUNC 66 */ 67 virtual int32_t PublishDeviceDiscovery(const std::string &pkgName, const DmPublishInfo &publishInfo); 68 69 /** 70 * @tc.name: IDeviceManagerServiceImpl::UnPublishDeviceDiscovery 71 * @tc.desc: UnPublish Device Discovery of the device manager service impl 72 * @tc.type: FUNC 73 */ 74 virtual int32_t UnPublishDeviceDiscovery(const std::string &pkgName, int32_t publishId); 75 76 /** 77 * @tc.name: IDeviceManagerServiceImpl::AuthenticateDevice 78 * @tc.desc: Authenticate Device of the device manager service impl 79 * @tc.type: FUNC 80 */ 81 virtual int32_t AuthenticateDevice(const std::string &pkgName, int32_t authType, const std::string &deviceId, 82 const std::string &extra); 83 84 /** 85 * @tc.name: IDeviceManagerServiceImpl::UnAuthenticateDevice 86 * @tc.desc: UnAuthenticate Device of the device manager service impl 87 * @tc.type: FUNC 88 */ 89 virtual int32_t UnAuthenticateDevice(const std::string &pkgName, const std::string &deviceId); 90 91 /** 92 * @tc.name: IDeviceManagerServiceImpl::VerifyAuthentication 93 * @tc.desc: Verify Authentication of the device manager service impl 94 * @tc.type: FUNC 95 */ 96 virtual int32_t VerifyAuthentication(const std::string &authParam); 97 98 /** 99 * @tc.name: IDeviceManagerServiceImpl::GetFaParam 100 * @tc.desc: Get FaParam of the device manager service impl 101 * @tc.type: FUNC 102 */ 103 virtual int32_t GetFaParam(std::string &pkgName, DmAuthParam &authParam); 104 105 /** 106 * @tc.name: IDeviceManagerServiceImpl::SetUserOperation 107 * @tc.desc: Se tUser Operation of device manager service impl 108 * @tc.type: FUNC 109 */ 110 virtual int32_t SetUserOperation(std::string &pkgName, int32_t action, const std::string ¶ms); 111 112 /** 113 * @tc.name: IDeviceManagerServiceImpl::RegisterDevStateCallback 114 * @tc.desc: Register Device State Callback to device manager service impl 115 * @tc.type: FUNC 116 */ 117 virtual int32_t RegisterDevStateCallback(const std::string &pkgName, const std::string &extra); 118 119 /** 120 * @tc.name: IDeviceManagerServiceImpl::UnRegisterDevStateCallback 121 * @tc.desc: UnRegister Device State Callback to device manager service impl 122 * @tc.type: FUNC 123 */ 124 virtual int32_t UnRegisterDevStateCallback(const std::string &pkgName, const std::string &extra); 125 126 /** 127 * @tc.name: IDeviceManagerServiceImpl::HandleDeviceOnline 128 * @tc.desc: Handle Device Online to the device manager service impl 129 * @tc.type: FUNC 130 */ 131 virtual void HandleDeviceOnline(const DmDeviceInfo &info); 132 133 /** 134 * @tc.name: IDeviceManagerServiceImpl::HandleDeviceOffline 135 * @tc.desc: Handle Device Offline to the device manager service impl 136 * @tc.type: FUNC 137 */ 138 virtual void HandleDeviceOffline(const DmDeviceInfo &info); 139 140 /** 141 * @tc.name: IDeviceManagerServiceImpl::OnSessionOpened 142 * @tc.desc: Send Session Opened event to the device manager service impl 143 * @tc.type: FUNC 144 */ 145 virtual int OnSessionOpened(int sessionId, int result); 146 147 /** 148 * @tc.name: IDeviceManagerServiceImpl::OnSessionClosed 149 * @tc.desc: Send Session Closed event to the device manager service impl 150 * @tc.type: FUNC 151 */ 152 virtual void OnSessionClosed(int sessionId); 153 154 /** 155 * @tc.name: IDeviceManagerServiceImpl::OnBytesReceived 156 * @tc.desc: Send Bytes Received event to the device manager service impl 157 * @tc.type: FUNC 158 */ 159 virtual void OnBytesReceived(int sessionId, const void *data, unsigned int dataLen); 160 161 /** 162 * @tc.name: DeviceManagerService::RequestCredential 163 * @tc.desc: RequestCredential of the Device Manager Service 164 * @tc.type: FUNC 165 */ 166 virtual int32_t RequestCredential(const std::string &reqJsonStr, std::string &returnJsonStr); 167 /** 168 * @tc.name: DeviceManagerService::ImportCredential 169 * @tc.desc: ImportCredential of the Device Manager Service 170 * @tc.type: FUNC 171 */ 172 virtual int32_t ImportCredential(const std::string &pkgName, const std::string &credentialInfo); 173 /** 174 * @tc.name: DeviceManagerService::DeleteCredential 175 * @tc.desc: DeleteCredential of the Device Manager Service 176 * @tc.type: FUNC 177 */ 178 virtual int32_t DeleteCredential(const std::string &pkgName, const std::string &deleteInfo); 179 /** 180 * @tc.name: DeviceManagerService::RegisterCredentialCallback 181 * @tc.desc: RegisterCredentialCallback 182 * @tc.type: FUNC 183 */ 184 virtual int32_t RegisterCredentialCallback(const std::string &pkgName); 185 /** 186 * @tc.name: DeviceManagerService::UnRegisterCredentialCallback 187 * @tc.desc: UnRegisterCredentialCallback 188 * @tc.type: FUNC 189 */ 190 virtual int32_t UnRegisterCredentialCallback(const std::string &pkgName); 191 192 /** 193 * @tc.name: DeviceManagerService::NotifyEvent 194 * @tc.desc: NotifyEvent 195 * @tc.type: FUNC 196 */ 197 virtual int32_t NotifyEvent(const std::string &pkgName, const int32_t eventId, const std::string &event); 198 199 /** 200 * @tc.name: DeviceManagerService::LoadHardwareFwkService 201 * @tc.desc: LoadHardwareFwkService 202 * @tc.type: FUNC 203 */ 204 virtual void LoadHardwareFwkService(); 205 }; 206 207 using CreateDMServiceFuncPtr = IDeviceManagerServiceImpl *(*)(void); 208 } // namespace DistributedHardware 209 } // namespace OHOS 210 #endif // OHOS_I_DM_SERVICE_IMPL_H 211