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