1/*
2 * Copyright (c) 2023 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_host.h
18 *
19 * @brief Management class of the camera service that provides Hardware Driver Interfaces (HDIs) for the upper layer.
20 *
21 * @since 4.1
22 * @version 1.2
23 */
24
25package ohos.hdi.camera.v1_2;
26
27import ohos.hdi.camera.v1_1.ICameraHost;
28import ohos.hdi.camera.v1_2.ICameraDevice;
29import ohos.hdi.camera.v1_2.ICameraHostCallback;
30import ohos.hdi.camera.v1_0.ICameraDeviceCallback;
31interface ICameraHost extends ohos.hdi.camera.v1_1.ICameraHost {
32    /**
33     * @brief Opens a camera device.
34     *
35     * By calling this function, you can obtain the <b>ICameraDevice</b> instance and operate the
36     * specific camera device mapping to the instance.
37     *
38     * @param cameraId Indicates the ID of the camera device, which can be obtained by calling {@link GetCameraIds}.
39     * @param callback Indicates the callback related to the camera. For details, see {@link ICameraDeviceCallback}.
40     * @param device Indicates the <b>ICameraDevice</b> instance corresponding to the ID of the camera device.
41     *
42     * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined
43     * in {@link CamRetCode} otherwise.
44     *
45     * @since 4.1
46     * @version 1.2
47     */
48    OpenCamera_V1_2([in] String cameraId, [in] ICameraDeviceCallback callbackObj, [out] ICameraDevice device);
49
50    /**
51     * @brief Notify the device vendor of the device status change.
52     *
53     * By calling this function, you can notify the device vendor of the device status change.
54     *
55     * @param notifyType Indicates the type of the notify.
56     * @param deviceState Indicates the state of the device.
57     *
58     * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined
59     * in {@link CamRetCode} otherwise.
60     *
61     * @since 4.1
62     * @version 1.2
63     */
64    NotifyDeviceStateChangeInfo([in] int notifyType, [in] int deviceState);
65
66    /**
67     * @brief Sets callbacks. For details about the callbacks, see {@link ICameraHostCallback}.
68     *
69     * @param callback Indicates the callbacks to set.
70     *
71     * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined
72     * in {@link CamRetCode} otherwise.
73     *
74     * @since 4.1
75     * @version 1.2
76     */
77    SetCallback_V1_2([in] ICameraHostCallback callbackObj);
78
79    /**
80     * @brief Turns on or off the flash.
81     *
82     * This function can be used only by the caller who has opened the camera device.
83     *
84     * @param level Specifies whether to turn on or off the flash. The value 1 means to turn on the flash,
85     * and 0 means the opposite.
86     *
87     * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined
88     * in {@link CamRetCode} otherwise.
89     *
90     * @since 4.1
91     * @version 1.2
92     */
93    SetFlashlight_V1_2([in] float level);
94
95    /**
96     * @brief Warm-up a camera device when lens switching.
97     *
98     * This function can be called when user touch camera application lens switch icon to accelerate the startup
99     * of the camera device specified by <b>cameraId</b>.
100     *
101     * @param cameraId Indicates the ID of the camera device, which can be obtained by calling {@link GetCameraIds}.
102     *
103     * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined
104     * in {@link CamRetCode} otherwise.
105     *
106     * @since 4.1
107     * @version 1.2
108     */
109    PreCameraSwitch([in] String cameraId);
110
111    /**
112     * @brief Prelaunch a camera device.
113     *
114     * This function can be called when user touch camera application icon to accelerate the startup
115     * of the camera device specified by <b>cameraId</b>.
116     *
117     * @param config Indicates the preluanch configuration. For details, see {@link PrelaunchConfig}.
118     * @param operationMode Indicates the stream operation mode. For details, see {@link OperationMode}.
119     *
120     * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined
121     * in {@link CamRetCode} otherwise.
122     *
123     * @since 4.1
124     * @version 1.2
125     */
126    PrelaunchWithOpMode([in] struct PrelaunchConfig config, [in] int operationMode);
127}
128