• 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_DCAMERA_SOURCE_HANDLER_H
17 #define OHOS_DCAMERA_SOURCE_HANDLER_H
18 
19 #include <mutex>
20 
21 #include "iremote_proxy.h"
22 #include "iremote_broker.h"
23 #include "refbase.h"
24 
25 #include "dcamera_source_callback.h"
26 #include "idistributed_hardware_source.h"
27 #include "single_instance.h"
28 
29 namespace OHOS {
30 namespace DistributedHardware {
31 class DCameraSourceHandler : public IDistributedHardwareSource {
32 DECLARE_SINGLE_INSTANCE_BASE(DCameraSourceHandler);
33 public:
34     int32_t InitSource(const std::string& params) override;
35     int32_t ReleaseSource() override;
36     int32_t RegisterDistributedHardware(const std::string& devId, const std::string& dhId,
37         const EnableParam& param, std::shared_ptr<RegisterCallback> callback) override;
38     int32_t UnregisterDistributedHardware(const std::string& devId, const std::string& dhId,
39         std::shared_ptr<UnregisterCallback> callback) override;
40     int32_t ConfigDistributedHardware(const std::string& devId, const std::string& dhId, const std::string& key,
41         const std::string& value) override;
42 
43 private:
44     DCameraSourceHandler() = default;
45     ~DCameraSourceHandler();
46 
47 private:
48     std::mutex optLock_;
49     sptr<DCameraSourceCallback> callback_;
50 };
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 __attribute__((visibility("default"))) IDistributedHardwareSource *GetSourceHardwareHandler();
56 #ifdef __cplusplus
57 }
58 #endif
59 }
60 }
61 #endif