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_host.h 18 * 19 * @brief Management class of the camera service that provides Hardware Driver Interfaces (HDIs) for the upper layer. 20 * 21 * @since 3.2 22 * @version 1.0 23 */ 24 25package ohos.hdi.camera.v1_0; 26 27import ohos.hdi.camera.v1_0.ICameraHostCallback; 28import ohos.hdi.camera.v1_0.ICameraDeviceCallback; 29import ohos.hdi.camera.v1_0.ICameraDevice; 30 31interface ICameraHost { 32 /** 33 * @brief Sets callbacks. For details about the callbacks, see {@link ICameraHostCallback}. 34 * 35 * @param callback Indicates the callbacks to set. 36 * 37 * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined 38 * in {@link CamRetCode} otherwise. 39 * 40 * @since 3.2 41 * @version 1.0 42 */ 43 SetCallback([in] ICameraHostCallback callbackObj); 44 45 /** 46 * @brief Obtains the IDs of available camera devices. 47 * 48 * @param cameraIds Indicates the IDs of available camera devices. 49 * 50 * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined 51 * in {@link CamRetCode} otherwise. 52 * 53 * @since 3.2 54 * @version 1.0 55 */ 56 GetCameraIds([out] String[] cameraIds); 57 58 /** 59 * @brief Obtains the abilities of a camera device. 60 * 61 * @param cameraId Indicates the ID of the camera device, which can be obtained by calling {@link GetCameraIds}. 62 * 63 * @param ability Returns the abilities of the camera device. 64 * 65 * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined 66 * in {@link CamRetCode} otherwise. 67 * 68 * @since 3.2 69 * @version 1.0 70 */ 71 GetCameraAbility([in] String cameraId, [out] unsigned char[] cameraAbility); 72 73 /** 74 * @brief Opens a camera device. 75 * 76 * By calling this function, you can obtain the <b>ICameraDevice</b> instance and operate the 77 * specific camera device mapping to the instance. 78 * 79 * @param cameraId Indicates the ID of the camera device, which can be obtained by calling {@link GetCameraIds}. 80 * @param callback Indicates the callback related to the camera. For details, see {@link ICameraDeviceCallback}. 81 * @param device Indicates the <b>ICameraDevice</b> instance corresponding to the ID of the camera device. 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 OpenCamera([in] String cameraId, [in] ICameraDeviceCallback callbackObj, [out] ICameraDevice device); 90 91 /** 92 * @brief Turns on or off the flash. 93 * 94 * This function can be used only by the caller who has opened the camera device specified by <b>cameraId</b>. 95 * 96 * @param cameraId Indicates the ID of the camera whose flash is to be turned on or off. 97 * @param isEnable Specifies whether to turn on or off the flash. The value <b>true</b> means to turn on the flash, 98 * and <b>false</b> means the opposite. 99 * 100 * @return Returns <b>NO_ERROR</b> if the operation is successful; returns an error code defined 101 * in {@link CamRetCode} otherwise. 102 * 103 * @since 3.2 104 * @version 1.0 105 */ 106 SetFlashlight([in] String cameraId, [in] boolean isEnable); 107} 108