1/*
2 * Copyright (c) 2022 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 3.2
22 * @version 1.0
23 */
24
25package ohos.hdi.camera.v1_0;
26
27import ohos.hdi.camera.v1_0.IStreamOperatorCallback;
28import ohos.hdi.camera.v1_0.IStreamOperator;
29import ohos.hdi.camera.v1_0.Types;
30
31interface ICameraDevice {
32    /**
33     * @brief Obtains the stream operation handle.
34     *
35     * @param callback Indicates a stream callback. For details, see {@link IStreamOperatorCallback}.
36     * {@link OnCaptureStarted} and {@link OnCaptureEnded} are used to report the start and end of capture,
37     * and {@link OnCaptureError} is used to report a capture error.
38     *
39     * @param streamOperator Indicates the stream operation handle.
40     *
41     * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined
42     * in {@link CamRetCode} otherwise.
43     *
44     * @since 3.2
45     * @version 1.0
46     */
47    GetStreamOperator([in] IStreamOperatorCallback callbackObj, [out] IStreamOperator streamOperator);
48
49    /**
50     * @brief Updates camera device control parameters.
51     *
52     * @param settings Indicates the camera parameters, including the sensor frame rate and 3A parameters.
53     * 3A stands for automatic focus (AF), automatic exposure (AE), and automatic white-balance (?AWB).
54     *
55     * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined
56     * in {@link CamRetCode} otherwise.
57     *
58     * @since 3.2
59     * @version 1.0
60     */
61    UpdateSettings([in] unsigned char[] settings);
62
63    /**
64     * @brief Sets the metadata reporting mode.
65     *
66     * @param mode Indicates the metadata reporting mode to set, which can be frame-by-frame reporting or reporting
67     * upon device status change. For details, see {@link ResultCallbackMode}.
68     *
69     * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined
70     * in {@link CamRetCode} otherwise.
71     *
72     * @since 3.2
73     * @version 1.0
74     */
75    SetResultMode([in] enum ResultCallbackMode mode);
76
77    /**
78     * @brief Obtains enabled metadata.
79     *
80     * Metadata to be reported is enabled by calling {@link EnableResult}.
81     *
82     * @param results Indicates all enabled metadata.
83     *
84     * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined
85     * in {@link CamRetCode} otherwise.
86     *
87     * @since 3.2
88     * @version 1.0
89     */
90    GetEnabledResults([out] int[] results);
91
92    /**
93     * @brief Enables metadata reporting.
94     *
95     * Only metadata that is enabled can be reported by using {@link OnResult}.
96     *
97     * @param results Indicates the metadata for which reporting is to be enabled.
98     *
99     * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined
100     * in {@link CamRetCode} otherwise.
101     *
102     * @since 3.2
103     * @version 1.0
104     */
105    EnableResult([in] int[] results);
106
107    /**
108     * @brief Disables metadata reporting.
109     *
110     * After metadata reporting is disabled, the metadata is not reported by calling {@link OnResult}.
111     * To enable metadata reporting, you must call {@link EnableResult}.
112     *
113     * @param results Indicates the metadata for which reporting is to be disabled.
114     *
115     * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined
116     * in {@link CamRetCode} otherwise.
117     *
118     * @since 3.2
119     * @version 1.0
120     */
121    DisableResult([in] int[] results);
122
123    /**
124     * @brief Closes the camera device.
125     *
126     * @since 3.2
127     * @version 1.0
128     */
129    Close();
130}
131