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 Types.h 18 * 19 * @brief Declares data types 20 * used by the Hardware Driver Interfaces (HDIs) of this module. 21 * 22 * @since 4.1 23 * @version 1.2 24 */ 25 26package ohos.hdi.camera.v1_2; 27 28import ohos.hdi.camera.v1_1.Types; 29 30sequenceable ohos.hdi.camera.v1_0.BufferHandleSequenceable; 31sequenceable ohos.hdi.camera.v1_0.MapDataSequenceable; 32 33/** 34 * @brief Enumerates return values of the HDIs. 35 */ 36enum CamRetCode { 37 /** 38 * Successful call. 39 */ 40 NO_ERROR = 0, 41 42 /** 43 * The camera device is busy. 44 */ 45 CAMERA_BUSY = -1, 46 47 /** 48 * Insufficient resources. 49 */ 50 INSUFFICIENT_RESOURCES = -2, 51 52 /** 53 * Invalid parameters. 54 */ 55 INVALID_ARGUMENT = -3, 56 57 /** 58 * Unsupported function. 59 */ 60 METHOD_NOT_SUPPORTED = -4, 61 62 /** 63 * The camera device is closed. 64 */ 65 CAMERA_CLOSED = -5, 66 67 /** 68 * A critical error occurs at the driver layer. 69 */ 70 DEVICE_ERROR = -6, 71 72 /** 73 * No permission to access the camera device. 74 */ 75 NO_PERMISSION = -7, 76 77 /** 78 * Device conflicts. 79 */ 80 DEVICE_CONFLICT = -8 81}; 82 83/** 84 * @brief Enumerates types of the extended stream information. 85 */ 86enum ExtendedStreamInfoType_V1_2 { 87 /** 88 * Extended stream information of quick thumbnail. 89 */ 90 EXTENDED_STREAM_INFO_QUICK_THUMBNAIL = 0, 91 92 /** 93 * Extended stream information of sketch. 94 */ 95 EXTENDED_STREAM_INFO_SKETCH = 1, 96}; 97 98/** 99 * @brief Enumerates stream operation modes. 100 */ 101enum OperationMode_V1_2 { 102 /** 103 * Normal mode, which supports both photo and video scenes 104 */ 105 NORMAL = 0, 106 107 /** 108 * Capture mode, which dedicated to photo scene 109 * IF this mode is implemented, then the NORMAL mode should no longer be implemented 110 */ 111 CAPTURE = 1, 112 113 /** 114 * Video mode, which dedicated to video secne 115 * IF this mode is implemented, then the NORMAL mode should no longer be implemented 116 */ 117 VIDEO = 2, 118 119 /** 120 * Portrait mode, which dedicated to portrait photo secne 121 */ 122 PORTRAIT = 3, 123 124 /** 125 * Night mode, which dedicated to night shooting scene 126 */ 127 NIGHT = 4, 128 129 /** 130 * Professional mode, which dedicated to professional photo scene 131 */ 132 PROFESSIONAL = 5, 133 134 /** 135 * Slow motion mode, which dedicated to capturing slow motion 136 */ 137 SLOW_MOTION = 6, 138 139 /** 140 * Scan mode, which dedicated to scan code 141 */ 142 SCAN_CODE = 7, 143 144 /** 145 * Macro mode, which dedicated to capture code 146 */ 147 CAPTURE_MACRO = 8, 148 149 /** 150 * Macro mode, which dedicated to video code 151 */ 152 VIDEO_MACRO = 9, 153 154 /** 155 * Super stabilization mode, which dedicated to use Suprt stabilization mode 156 */ 157 SUPER_STAB = 10, 158 159 /** 160 * Operation mode max 161 */ 162 OPERATION_MODE_MAX, 163}; 164 165/** 166 * @brief Enumerates types of the deferred delivery image. 167 */ 168enum DeferredDeliveryImageType { 169 /** 170 * Not support deferred delivery image. 171 */ 172 NONE = 0, 173 174 /** 175 * Support still image. 176 */ 177 STILL_IMAGE = 1, 178 179 /** 180 * Support moving image. 181 */ 182 MOVING_IMAGE = 2, 183}; 184 185/** 186 * @brief Enumerates types of the session statues. 187 */ 188enum SessionStatus { 189 /** 190 * Session is ready. 191 */ 192 SESSION_STATUS_READY = 0, 193 194 /** 195 * Session is ready but the storage limit has been reached. 196 */ 197 SESSION_STATUS_READY_SPACE_LIMIT_REACHED = 1, 198 199 /** 200 * Session is not ready temporarily. 201 */ 202 SESSSON_STATUS_NOT_READY_TEMPORARILY = 2, 203 204 /** 205 * Session is not ready because of overheat. 206 */ 207 SESSION_STATUS_NOT_READY_OVERHEAT = 3, 208 209 /** 210 * Session is not ready because of preempted. 211 */ 212 SESSION_STATUS_NOT_READY_PREEMPTED = 4, 213}; 214 215/** 216 * @brief Enumerates types of the error codes. 217 */ 218enum ErrorCode { 219 /** 220 * The imageId is Invalid. 221 */ 222 ERROR_INVALID_ID = 0, 223 /** 224 * Processing error, no image can provide 225 */ 226 ERROR_PROCESS = 1, 227 /** 228 * Processing timeout, can be retried. 229 */ 230 ERROR_TIMEOUT = 2, 231 /** 232 * Processing error due to high temperature. 233 */ 234 ERROR_HIGH_TEMPERATURE = 3, 235 /** 236 * Processing is abnormal, can be retried 237 */ 238 ERROR_ABNORMAL = 4, 239 /** 240 * Processing is abort. 241 */ 242 ERROR_ABORT = 5, 243}; 244 245/** 246 * @brief Enumerates types of the execution modes. 247 */ 248enum ExecutionMode { 249 /** 250 * High performance mode. 251 */ 252 HIGH_PREFORMANCE = 0, 253 254 /** 255 * Balance mode. 256 */ 257 BALANCED = 1, 258 259 /** 260 * Low power mode. 261 */ 262 LOW_POWER = 2, 263}; 264 265/** 266 * @brief Defines the ImageBufferInfo, which is used by {@link IImageProcessCallback::OnProcessDone}. 267 */ 268struct ImageBufferInfo { 269 /** 270 * Data of metadata. 271 */ 272 MapDataSequenceable metadata; 273 274 /** 275 * Data of ImageHandle. 276 */ 277 BufferHandleSequenceable imageHandle; 278 279 /** 280 * Is gainMapHandle valid. 281 */ 282 boolean isGainMapValid; 283 284 /** 285 * Data of gainMapHandle. 286 */ 287 BufferHandleSequenceable gainMapHandle; 288 289 /** 290 * Is depthMapHandle valid. 291 */ 292 boolean isDepthMapValid; 293 294 /** 295 * Data of depthMapHandle. 296 */ 297 BufferHandleSequenceable depthMapHandle; 298}; 299 300/** 301 * @brief Defines the CaptureStartedInfo, which is used by {@link IStreamOperatorCallback::OnCaptureStarted_V1_2}. 302 */ 303struct CaptureStartedInfo { 304 /** 305 * ID of a captured stream. 306 */ 307 int streamId_; 308 309 /** 310 * Time of exposure time, the unit is ms. 311 */ 312 int exposureTime_; 313};