• 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 /**
17  * @file idistributed_camera_provider_callback.h
18  *
19  * @brief Declares callbacks for distributed camera SA service. The caller needs to implement the callbacks.
20  *
21  * @since 1.0
22  * @version 1.0
23  */
24 
25 #ifndef HDI_DISTRIBUTED_CAMERA_PROVIDER_CALLBACK_H
26 #define HDI_DISTRIBUTED_CAMERA_PROVIDER_CALLBACK_H
27 
28 #include <vector>
29 #include <iremote_broker.h>
30 #include "types.h"
31 
32 namespace OHOS {
33 namespace DistributedHardware {
34 enum {
35     CMD_DISTRIBUTED_CAMERA_PROVIDER_CALLBACK_OPEN_SESSION = 0,
36     CMD_DISTRIBUTED_CAMERA_PROVIDER_CALLBACK_CLOSE_SESSION,
37     CMD_DISTRIBUTED_CAMERA_PROVIDER_CALLBACK_CONFIGURE_STREAMS,
38     CMD_DISTRIBUTED_CAMERA_PROVIDER_CALLBACK_RELEASE_STREAMS,
39     CMD_DISTRIBUTED_CAMERA_PROVIDER_CALLBACK_START_CAPTURE,
40     CMD_DISTRIBUTED_CAMERA_PROVIDER_CALLBACK_STOP_CAPTURE,
41     CMD_DISTRIBUTED_CAMERA_PROVIDER_CALLBACK_UPDATE_SETTINGS,
42 };
43 
44 class IDCameraProviderCallback : public IRemoteBroker {
45 public:
46     DECLARE_INTERFACE_DESCRIPTOR(u"HDI.DCamera.V1_0.ProviderCallback");
~IDCameraProviderCallback()47     virtual ~IDCameraProviderCallback() {}
48 
49 public:
50     /**
51      * @brief Create the transmission channel between the source device and the sink device.
52      * Open and initialize the distributed camera session.
53      *
54      * @param dhBase [in] Distributed hardware device base info
55      *
56      * @return Returns <b>NO_ERROR</b> if the operation is successful,
57      * returns an error code defined in {@link DCamRetCode} otherwise.
58      *
59      * @since 1.0
60      * @version 1.0
61      */
62     virtual DCamRetCode OpenSession(const std::shared_ptr<DHBase> &dhBase) = 0;
63 
64     /**
65      * @brief Close the distributed camera session, and destroy the transmission channel between
66      * the source device and the sink device.
67      *
68      * @param dhBase [in] Distributed hardware device base info
69      *
70      * @return Returns <b>NO_ERROR</b> if the operation is successful,
71      * returns an error code defined in {@link DCamRetCode} otherwise.
72      *
73      * @since 1.0
74      * @version 1.0
75      */
76     virtual DCamRetCode CloseSession(const std::shared_ptr<DHBase> &dhBase) = 0;
77 
78     /**
79      * @brief Configures streams.
80      *
81      * @param dhBase [in] Distributed hardware device base info
82      *
83      * @param streamInfos [in] Indicates the list of stream information, which is defined by {@link DCStreamInfo}.
84      *
85      * @return Returns <b>NO_ERROR</b> if the operation is successful,
86      * returns an error code defined in {@link DCamRetCode} otherwise.
87      *
88      * @since 1.0
89      * @version 1.0
90      */
91     virtual DCamRetCode ConfigureStreams(const std::shared_ptr<DHBase> &dhBase,
92         const std::vector<std::shared_ptr<DCStreamInfo>> &streamInfos) = 0;
93 
94     /**
95      * @brief Releases streams.
96      *
97      * @param dhBase [in] Distributed hardware device base info
98      *
99      * @param streamIds [IN] Indicates the IDs of the streams to release.
100      *
101      * @return Returns <b>NO_ERROR</b> if the operation is successful,
102      * returns an error code defined in {@link DCamRetCode} otherwise.
103      *
104      * @since 1.0
105      * @version 1.0
106      */
107     virtual DCamRetCode ReleaseStreams(const std::shared_ptr<DHBase> &dhBase, const std::vector<int> &streamIds) = 0;
108 
109     /**
110      * @brief Start capture images.
111      * This function must be called after {@link ConfigStreams}.
112      * There are two image capture modes: continuous capture and single capture.
113      *
114      * @param dhBase [in] Distributed hardware device base info
115      *
116      * @param captureInfos [in] Indicates the capture request configuration information.
117      * For details, see {@link DCCaptureInfo}.
118      *
119      * @return Returns <b>NO_ERROR</b> if the operation is successful,
120      * returns an error code defined in {@link DCamRetCode} otherwise.
121      *
122      * @since 1.0
123      * @version 1.0
124      */
125     virtual DCamRetCode StartCapture(const std::shared_ptr<DHBase> &dhBase,
126         const std::vector<std::shared_ptr<DCCaptureInfo>> &captureInfos) = 0;
127 
128     /**
129      * @brief Stop capture images.
130      *
131      * @param dhBase [in] Distributed hardware device base info
132      *
133      * @return Returns <b>NO_ERROR</b> if the operation is successful,
134      * returns an error code defined in {@link DCamRetCode} otherwise.
135      *
136      * @since 1.0
137      * @version 1.0
138      */
139     virtual DCamRetCode StopCapture(const std::shared_ptr<DHBase> &dhBase) = 0;
140 
141     /**
142      * @brief Updates distributed camera device control parameters.
143      *
144      * @param dhBase [in] Distributed hardware device base info
145      *
146      * @param settings [in] Indicates the camera parameters, including the sensor frame rate and 3A parameters.
147      * For details about the settings, see {@link DCameraSettings}.
148      *
149      * @return Returns <b>NO_ERROR</b> if the operation is successful,
150      * returns an error code defined in {@link DCamRetCode} otherwise.
151      *
152      * @since 1.0
153      * @version 1.0
154      */
155     virtual DCamRetCode UpdateSettings(const std::shared_ptr<DHBase> &dhBase,
156         const std::vector<std::shared_ptr<DCameraSettings>> &settings) = 0;
157 };
158 } // end namespace DistributedHardware
159 } // end namespace OHOS
160 
161 #endif // HDI_DISTRIBUTED_CAMERA_PROVIDER_CALLBACK_H