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_DM_SERVICE_LISTENER_H 17 #define OHOS_DM_SERVICE_LISTENER_H 18 19 #include <map> 20 #include <string> 21 22 #include "dm_device_info.h" 23 #include "idevice_manager_service_listener.h" 24 #if !defined(__LITEOS_M__) 25 #include "ipc_notify_dmfa_result_req.h" 26 #include "ipc_server_listener.h" 27 #endif 28 29 namespace OHOS { 30 namespace DistributedHardware { 31 class DeviceManagerServiceListener : public IDeviceManagerServiceListener { 32 public: DeviceManagerServiceListener()33 DeviceManagerServiceListener() {}; ~DeviceManagerServiceListener()34 virtual ~DeviceManagerServiceListener() {}; 35 36 void OnDeviceStateChange(const std::string &pkgName, const DmDeviceState &state, const DmDeviceInfo &info); 37 38 void OnDeviceFound(const std::string &pkgName, uint16_t subscribeId, const DmDeviceInfo &info); 39 40 void OnDiscoveryFailed(const std::string &pkgName, uint16_t subscribeId, int32_t failedReason); 41 42 void OnDiscoverySuccess(const std::string &pkgName, int32_t subscribeId); 43 44 void OnPublishResult(const std::string &pkgName, int32_t publishId, int32_t publishResult); 45 46 void OnAuthResult(const std::string &pkgName, const std::string &deviceId, const std::string &token, int32_t status, 47 int32_t reason); 48 49 void OnVerifyAuthResult(const std::string &pkgName, const std::string &deviceId, int32_t resultCode, 50 const std::string &flag); 51 52 void OnUiCall(std::string &pkgName, std::string ¶mJson); 53 54 void OnCredentialResult(const std::string &pkgName, int32_t action, const std::string &resultInfo); 55 private: 56 #if !defined(__LITEOS_M__) 57 IpcServerListener ipcServerListener_; 58 #endif 59 }; 60 } // namespace DistributedHardware 61 } // namespace OHOS 62 #endif // OHOS_DM_SERVICE_LISTENER_H