• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 version;
39     std::string attrs;
40 };
41 
42 class IDistributedHardwareSource {
43 public:
44     virtual int32_t InitSource(const std::string &params) = 0;
45     virtual int32_t ReleaseSource() = 0;
46     virtual int32_t RegisterDistributedHardware(const std::string &uuid, const std::string &dhId,
47         const EnableParam &param, std::shared_ptr<RegisterCallback> callback) = 0;
48     virtual int32_t UnregisterDistributedHardware(const std::string &uuid, const std::string &dhId,
49         std::shared_ptr<UnregisterCallback> callback) = 0;
50     virtual int32_t ConfigDistributedHardware(const std::string &uuid, const std::string &dhId, const std::string &key,
51         const std::string &value) = 0;
52 };
53 extern "C" __attribute__((visibility("default"))) IDistributedHardwareSource* GetSourceHardwareHandler();
54 }
55 }
56 #endif