1 /* 2 * Copyright (c) 2022-2024 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_LISTENER_H 17 #define OHOS_I_DM_SERVICE_LISTENER_H 18 19 #include <map> 20 #include <string> 21 22 #include "dm_device_info.h" 23 24 namespace OHOS { 25 namespace DistributedHardware { 26 class IDeviceManagerServiceListener { 27 public: ~IDeviceManagerServiceListener()28 virtual ~IDeviceManagerServiceListener() {} 29 30 /** 31 * @tc.name: IDeviceManagerServiceListener::OnDeviceStateChange 32 * @tc.desc: Device State Change of the DeviceManager Service Listener 33 * @tc.type: FUNC 34 */ 35 virtual void OnDeviceStateChange(const std::string &pkgName, const DmDeviceState &state, 36 const DmDeviceInfo &info) = 0; 37 38 /** 39 * @tc.name: IDeviceManagerServiceListener::OnDeviceFound 40 * @tc.desc: Device Found of the DeviceManager Service Listener 41 * @tc.type: FUNC 42 */ 43 virtual void OnDeviceFound(const std::string &pkgName, uint16_t subscribeId, const DmDeviceInfo &info) = 0; 44 45 /** 46 * @tc.name: IDeviceManagerServiceListener::OnDeviceFound 47 * @tc.desc: Device Found of the DeviceManager Service Listener 48 * @tc.type: FUNC 49 */ 50 virtual void OnDeviceFound(const std::string &pkgName, uint16_t subscribeId, DmDeviceBasicInfo &info) = 0; 51 52 /** 53 * @tc.name: IDeviceManagerServiceListener::OnDiscoveryFailed 54 * @tc.desc: Discovery Failed of the DeviceManager Service Listener 55 * @tc.type: FUNC 56 */ 57 virtual void OnDiscoveryFailed(const std::string &pkgName, uint16_t subscribeId, int32_t failedReason) = 0; 58 59 /** 60 * @tc.name: IDeviceManagerServiceListener::OnDiscoverySuccess 61 * @tc.desc: Discovery Success of the DeviceManager Service Listener 62 * @tc.type: FUNC 63 */ 64 virtual void OnDiscoverySuccess(const std::string &pkgName, int32_t subscribeId) = 0; 65 66 /** 67 * @tc.name: IDeviceManagerServiceListener::OnPublishResult 68 * @tc.desc: OnPublish Result of the Dm Publish Manager 69 * @tc.type: FUNC 70 */ 71 virtual void OnPublishResult(const std::string &pkgName, int32_t publishId, int32_t publishResult) = 0; 72 73 /** 74 * @tc.name: IDeviceManagerServiceListener::OnAuthResult 75 * @tc.desc: Auth Result of the DeviceManager Service Listener 76 * @tc.type: FUNC 77 */ 78 virtual void OnAuthResult(const std::string &pkgName, const std::string &deviceId, const std::string &token, 79 int32_t status, int32_t reason) = 0; 80 81 /** 82 * @tc.name: IDeviceManagerServiceListener::OnUiCall 83 * @tc.desc: Fa Call of the DeviceManager Service Listener 84 * @tc.type: FUNC 85 */ 86 virtual void OnUiCall(std::string &pkgName, std::string ¶mJson) = 0; 87 88 /** 89 * @tc.name: IDeviceManagerServiceListener::OnCredentialResult 90 * @tc.desc: Credential Result of the DeviceManager Service Listener 91 * @tc.type: FUNC 92 */ 93 virtual void OnCredentialResult(const std::string &pkgName, int32_t action, const std::string &resultInfo) = 0; 94 95 /** 96 * @tc.name: IDeviceManagerServiceListener::OnBindResult 97 * @tc.desc: Bind target Result of the DeviceManager Service Listener 98 * @tc.type: FUNC 99 */ 100 virtual void OnBindResult(const std::string &pkgName, const PeerTargetId &targetId, int32_t result, 101 int32_t status, std::string content) = 0; 102 103 /** 104 * @tc.name: IDeviceManagerServiceListener::OnUnbindResult 105 * @tc.desc: Unbind target Result of the DeviceManager Service Listener 106 * @tc.type: FUNC 107 */ 108 virtual void OnUnbindResult(const std::string &pkgName, const PeerTargetId &targetId, int32_t result, 109 std::string content) = 0; 110 111 /** 112 * @tc.name: IDeviceManagerServiceListener::OnPinHolderCreate 113 * @tc.desc: Unbind target Result of the DeviceManager Service Listener 114 * @tc.type: FUNC 115 */ 116 virtual void OnPinHolderCreate(const std::string &pkgName, const std::string &deviceId, DmPinType pinType, 117 const std::string &payload) = 0; 118 119 /** 120 * @tc.name: IDeviceManagerServiceListener::OnPinHolderDestroy 121 * @tc.desc: Unbind target Result of the DeviceManager Service Listener 122 * @tc.type: FUNC 123 */ 124 virtual void OnPinHolderDestroy(const std::string &pkgName, DmPinType pinType, const std::string &payload) = 0; 125 126 /** 127 * @tc.name: IDeviceManagerServiceListener::OnCreateResult 128 * @tc.desc: Create Pin Holder Result of the DeviceManager Service Listener 129 * @tc.type: FUNC 130 */ 131 virtual void OnCreateResult(const std::string &pkgName, int32_t result) = 0; 132 133 /** 134 * @tc.name: IDeviceManagerServiceListener::OnDestroyResult 135 * @tc.desc: Destroy Pin Holder Result of the DeviceManager Service Listener 136 * @tc.type: FUNC 137 */ 138 virtual void OnDestroyResult(const std::string &pkgName, int32_t result) = 0; 139 140 /** 141 * @tc.name: IDeviceManagerServiceListener::OnPinHolderEvent 142 * @tc.desc: Pin Holder Event of the DeviceManager Service Listener 143 * @tc.type: FUNC 144 */ 145 virtual void OnPinHolderEvent(const std::string &pkgName, DmPinHolderEvent event, int32_t result, 146 const std::string &content) = 0; 147 148 /** 149 * @tc.name: IDeviceManagerServiceListener::OnDeviceScreenStateChange 150 * @tc.desc: Device Screen State Change of the DeviceManager Service Listener 151 * @tc.type: FUNC 152 */ 153 virtual void OnDeviceScreenStateChange(const std::string &pkgName, DmDeviceInfo &devInfo) = 0; 154 155 /** 156 * @tc.name: IDeviceManagerServiceListener::OnCredentialAuthStatus 157 * @tc.desc: Candidate Restrict Status Change of the DeviceManager Service Listener 158 * @tc.type: FUNC 159 */ 160 virtual void OnCredentialAuthStatus(const std::string &pkgName, const std::string &proofInfo, 161 uint16_t deviceTypeId, int32_t errcode) = 0; 162 }; 163 } // namespace DistributedHardware 164 } // namespace OHOS 165 #endif // OHOS_I_DM_SERVICE_LISTENER_H 166