• 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 icamera_device.h
18  *
19  * @brief Declares APIs for camera device operations.
20  *
21  * @since 1.0
22  * @version 1.0
23  */
24 
25 #ifndef HDI_CAMERA_DEVICE_CLIENT_INF_H
26 #define HDI_CAMERA_DEVICE_CLIENT_INF_H
27 
28 #include <list>
29 #include <map>
30 #include <vector>
31 #include "types.h"
32 #include "icamera_device_callback.h"
33 #include "istream_operator.h"
34 #include "istream_operator_callback.h"
35 #include "icamera_interface.h"
36 
37 namespace OHOS::Camera {
38 class ICameraDevice : public ICameraInterface {
39 public:
40     DECLARE_INTERFACE_DESCRIPTOR(u"HDI.Camera.V1_0.Device");
~ICameraDevice()41     virtual ~ICameraDevice() {}
42 
43     /**
44      * @brief Obtains the stream operation handle.
45      *
46      * @param callback Indicates a stream callback. For details, see {@link IStreamOperatorCallback}.
47      * {@link OnCaptureStarted} and {@link OnCaptureEnded} are used to report the start and end of capture,
48      * and {@link OnCaptureError} is used to report a capture error.
49      *
50      * @param streamOperator Indicates the stream operation handle.
51      *
52      * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined in {@link CamRetCode} otherwise.
53      *
54      * @since 1.0
55      * @version 1.0
56      */
57     virtual CamRetCode GetStreamOperator(
58         const OHOS::sptr<IStreamOperatorCallback> &callback,
59         OHOS::sptr<IStreamOperator> &streamOperator) = 0;
60 
61     /**
62      * @brief Updates camera device control parameters.
63      *
64      * @param settings Indicates the camera parameters, including the sensor frame rate and 3A parameters. 3A stands for automatic focus (AF), automatic exposure (AE), and automatic white-balance (​AWB).
65      *
66      * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined in {@link CamRetCode} otherwise.
67      *
68      * @since 1.0
69      * @version 1.0
70      */
71     virtual CamRetCode UpdateSettings(const std::shared_ptr<CameraSetting> &settings) = 0;
72 
73     /**
74      * @brief Sets the metadata reporting mode.
75      *
76      * @param mode Indicates the metadata reporting mode to set, which can be frame-by-frame reporting or reporting upon device status change. For details, see {@link ResultCallbackMode}.
77      *
78      * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined in {@link CamRetCode} otherwise.
79      *
80      * @since 1.0
81      * @version 1.0
82      */
83     virtual CamRetCode SetResultMode(const ResultCallbackMode &mode) = 0;
84 
85     /**
86      * @brief Obtains enabled metadata.
87      *
88      * Metadata to be reported is enabled by calling {@link EnableResult}.
89      *
90      * @param results Indicates all enabled metadata.
91      *
92      * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined in {@link CamRetCode} otherwise.
93      *
94      * @since 1.0
95      * @version 1.0
96      */
97     virtual CamRetCode GetEnabledResults(std::vector<MetaType> &results) = 0;
98 
99     /**
100      * @brief Enables metadata reporting.
101      *
102      * Only metadata that is enabled can be reported by using {@link OnResult}.
103      *
104      * @param results Indicates the metadata for which reporting is to be enabled.
105      *
106      * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined in {@link CamRetCode} otherwise.
107      *
108      * @since 1.0
109      * @version 1.0
110      */
111     virtual CamRetCode EnableResult(const std::vector<MetaType> &results) = 0;
112 
113     /**
114      * @brief Disables metadata reporting.
115      *
116      * After metadata reporting is disabled, the metadata is not reported by calling {@link OnResult}. To enable metadata reporting, you must call {@link EnableResult}.
117      *
118      * @param results Indicates the metadata for which reporting is to be disabled.
119      *
120      * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined in {@link CamRetCode} otherwise.
121      *
122      * @since 1.0
123      * @version 1.0
124      */
125     virtual CamRetCode DisableResult(const std::vector<MetaType> &results) = 0;
126 
127     /**
128      * @brief Closes the camera device.
129      *
130      * @since 1.0
131      * @version 1.0
132      */
133     virtual void Close() = 0;
134 };
135 }
136 #endif // HDI_CAMERA_DEVICE_CLIENT_INF_H