1 /* 2 * Copyright (c) 2021-2023 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_DISTRIBUTED_HARDWARE_IDISTRIBUTED_HARDWARE_SOURCE_H 17 #define OHOS_DISTRIBUTED_HARDWARE_IDISTRIBUTED_HARDWARE_SOURCE_H 18 19 #include <memory> 20 #include <string> 21 22 namespace OHOS { 23 namespace DistributedHardware { 24 const std::string COMPONENT_LOADER_GET_SOURCE_HANDLER = "GetSourceHardwareHandler"; 25 class RegisterCallback { 26 public: 27 virtual int32_t OnRegisterResult(const std::string &uuid, const std::string &dhId, int32_t status, 28 const std::string &data) = 0; 29 }; 30 31 class UnregisterCallback { 32 public: 33 virtual int32_t OnUnregisterResult(const std::string &uuid, const std::string &dhId, int32_t status, 34 const std::string &data) = 0; 35 }; 36 37 struct EnableParam { 38 std::string sourceVersion; 39 std::string sourceAttrs; 40 std::string sinkVersion; 41 std::string sinkAttrs; 42 std::string subtype; 43 }; 44 45 class IDistributedHardwareSource { 46 public: 47 virtual int32_t InitSource(const std::string ¶ms) = 0; 48 virtual int32_t ReleaseSource() = 0; 49 virtual int32_t RegisterDistributedHardware(const std::string &uuid, const std::string &dhId, 50 const EnableParam ¶m, std::shared_ptr<RegisterCallback> callback) = 0; 51 virtual int32_t UnregisterDistributedHardware(const std::string &uuid, const std::string &dhId, 52 std::shared_ptr<UnregisterCallback> callback) = 0; 53 virtual int32_t ConfigDistributedHardware(const std::string &uuid, const std::string &dhId, const std::string &key, 54 const std::string &value) = 0; 55 }; 56 extern "C" __attribute__((visibility("default"))) IDistributedHardwareSource* GetSourceHardwareHandler(); 57 } // namespace DistributedHardware 58 } // namespace OHOS 59 #endif 60