1794c9f46Sopenharmony_ci/* 2794c9f46Sopenharmony_ci * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3794c9f46Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4794c9f46Sopenharmony_ci * you may not use this file except in compliance with the License. 5794c9f46Sopenharmony_ci * You may obtain a copy of the License at 6794c9f46Sopenharmony_ci * 7794c9f46Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8794c9f46Sopenharmony_ci * 9794c9f46Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10794c9f46Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11794c9f46Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12794c9f46Sopenharmony_ci * See the License for the specific language governing permissions and 13794c9f46Sopenharmony_ci * limitations under the License. 14794c9f46Sopenharmony_ci */ 15794c9f46Sopenharmony_ci 16794c9f46Sopenharmony_ci#ifndef OHOS_DISTRIBUTED_HARDWARE_IHARDWARE_HANDLER_H 17794c9f46Sopenharmony_ci#define OHOS_DISTRIBUTED_HARDWARE_IHARDWARE_HANDLER_H 18794c9f46Sopenharmony_ci 19794c9f46Sopenharmony_ci#include <map> 20794c9f46Sopenharmony_ci#include <memory> 21794c9f46Sopenharmony_ci#include <string> 22794c9f46Sopenharmony_ci#include <vector> 23794c9f46Sopenharmony_ci 24794c9f46Sopenharmony_cinamespace OHOS { 25794c9f46Sopenharmony_cinamespace DistributedHardware { 26794c9f46Sopenharmony_ciconst std::string COMPONENT_LOADER_GET_HARDWARE_HANDLER = "GetHardwareHandler"; 27794c9f46Sopenharmony_cistruct DHItem { 28794c9f46Sopenharmony_ci std::string dhId; 29794c9f46Sopenharmony_ci std::string attrs; 30794c9f46Sopenharmony_ci std::string subtype; 31794c9f46Sopenharmony_ci}; 32794c9f46Sopenharmony_ci 33794c9f46Sopenharmony_ciclass PluginListener { 34794c9f46Sopenharmony_cipublic: 35794c9f46Sopenharmony_ci virtual void PluginHardware(const std::string &dhId, const std::string &attrs, const std::string &subtype) = 0; 36794c9f46Sopenharmony_ci virtual void UnPluginHardware(const std::string &dhId) = 0; 37794c9f46Sopenharmony_ci}; 38794c9f46Sopenharmony_ci 39794c9f46Sopenharmony_ciclass IHardwareHandler { 40794c9f46Sopenharmony_cipublic: 41794c9f46Sopenharmony_ci virtual int32_t Initialize() = 0; 42794c9f46Sopenharmony_ci virtual std::vector<DHItem> QueryMeta() = 0; 43794c9f46Sopenharmony_ci virtual std::vector<DHItem> Query() = 0; 44794c9f46Sopenharmony_ci virtual std::map<std::string, std::string> QueryExtraInfo() = 0; 45794c9f46Sopenharmony_ci virtual bool IsSupportPlugin() = 0; 46794c9f46Sopenharmony_ci virtual void RegisterPluginListener(std::shared_ptr<PluginListener> listener) = 0; 47794c9f46Sopenharmony_ci virtual void UnRegisterPluginListener() = 0; 48794c9f46Sopenharmony_ci}; 49794c9f46Sopenharmony_ciextern "C" __attribute__((visibility("default"))) IHardwareHandler* GetHardwareHandler(); 50794c9f46Sopenharmony_ci} // namespace DistributedHardware 51794c9f46Sopenharmony_ci} // namespace OHOS 52794c9f46Sopenharmony_ci#endif 53