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 DCameraTypes.idl 18 * 19 * @brief Declares data types. 20 * used by the Hardware Driver Interfaces (HDIs) of this module. 21 * 22 * @since 3.2 23 * @version 1.0 24 */ 25 26package ohos.hdi.distributed_camera.v1_0; 27 28sequenceable ohos.hdi.sequenceable.v1_0.BufferHandleSequenceable; 29 30/** 31 * @brief Enumerates distributed camera metadata updating types. 32 */ 33enum DCSettingsType { 34 /** 35 * Set the whole package metadata. 36 */ 37 UPDATE_METADATA = 0, 38 /** 39 * Enable metadata configuration. 40 */ 41 ENABLE_METADATA = 1, 42 /** 43 * Disable metadata configuration. 44 */ 45 DISABLE_METADATA = 2, 46 /** 47 * Return metadata result from distributed camera. 48 */ 49 METADATA_RESULT = 3, 50 /** 51 * Set flash light to distribtued camera. 52 */ 53 SET_FLASH_LIGHT = 4, 54 /** 55 * Set fps range to distributed camera. 56 */ 57 FPS_RANGE = 5, 58 /** 59 * Set the frame metadata to distributed camera. 60 */ 61 UPDATE_FRAME_METADATA = 6, 62}; 63 64/** 65 * @brief Enumerates return values of the HDIs. 66 */ 67enum DCamRetCode { 68 /** 69 * Successful call. 70 */ 71 SUCCESS = 0, 72 /** 73 * The camera device is busy. 74 */ 75 CAMERA_BUSY = 1, 76 /** 77 * Invalid parameters. 78 */ 79 INVALID_ARGUMENT = 2, 80 /** 81 * Unsupported function. 82 */ 83 METHOD_NOT_SUPPORTED = 3, 84 /** 85 * The camera device is offlined. 86 */ 87 CAMERA_OFFLINE = 4, 88 /** 89 * The number of distributed camera devices enabled exceeds the limit. 90 */ 91 EXCEED_MAX_NUMBER = 5, 92 /** 93 * The device is not initialized. 94 */ 95 DEVICE_NOT_INIT = 6, 96 /** 97 * Failed call. 98 */ 99 FAILED = 7, 100}; 101 102/** 103 * @brief Enumerates encoding types of stream data. 104 */ 105enum DCEncodeType { 106 /** 107 * Unspecified encode type. 108 */ 109 ENCODE_TYPE_NULL = 0, 110 /** 111 * H.264 encode type. 112 */ 113 ENCODE_TYPE_H264 = 1, 114 /** 115 * H.265 encode type 116 */ 117 ENCODE_TYPE_H265 = 2, 118 /** 119 * JPEG encode type 120 */ 121 ENCODE_TYPE_JPEG = 3, 122 /** 123 * mpeg4-es encode type 124 */ 125 ENCODE_TYPE_MPEG4_ES = 4, 126}; 127 128/** 129 * @brief Enumerates distributed camera inner stream types. 130 */ 131enum DCStreamType { 132 /** 133 * Continuous capture stream. For example preview streams, video streams. 134 */ 135 CONTINUOUS_FRAME = 0, 136 /** 137 * Single capture stream. For example photographing streams. 138 */ 139 SNAPSHOT_FRAME = 1, 140}; 141 142/** 143 * @brief Distributed hardware device base info. 144 */ 145struct DHBase { 146 /** 147 * The device id, here is networkId. 148 */ 149 String deviceId_; 150 /** 151 * The distributed hardware id. 152 */ 153 String dhId_; 154}; 155 156/** 157 * @brief The control settings of the distributed camera device. 158 */ 159struct DCameraSettings { 160 /** 161 * Settings type, see {@link DCSettingsType}. 162 */ 163 enum DCSettingsType type_; 164 /** 165 * Settings value. Serialized from bool, array, structure, etc. 166 */ 167 String value_; 168}; 169 170/** 171 * @brief Defines the inner stream information of the distributed camera, 172 * which is used to pass configuration parameters during stream creation. 173 */ 174struct DCStreamInfo { 175 /** 176 * Stream ID, which uniquely identifies a stream on a camera device. 177 */ 178 int streamId_; 179 /** 180 * Image width. 181 */ 182 int width_; 183 /** 184 * Image height. 185 */ 186 int height_; 187 /** 188 * Image stride. 189 */ 190 int stride_; 191 /** 192 * Image format. 193 */ 194 int format_; 195 /** 196 * Image color space. 197 */ 198 int dataspace_; 199 /** 200 * Encoding type, see {@link DCEncodeType}. 201 */ 202 enum DCEncodeType encodeType_; 203 /** 204 * Stream type, see {@link DCStreamType}. 205 */ 206 enum DCStreamType type_; 207}; 208 209/** 210 * @brief Defines the information about a inner capture request of the distributed camera. 211 */ 212struct DCCaptureInfo { 213 /** 214 * IDs of captured streams. 215 */ 216 int[] streamIds_; 217 /** 218 * Image width. 219 */ 220 int width_; 221 /** 222 * Image height. 223 */ 224 int height_; 225 /** 226 * Image stride. 227 */ 228 int stride_; 229 /** 230 * Image format. 231 */ 232 int format_; 233 /** 234 * Image color space. 235 */ 236 int dataspace_; 237 /** 238 * Is trigger sink capture. 239 */ 240 boolean isCapture_; 241 /** 242 * Encoding type, see {@link DCEncodeType}. 243 */ 244 enum DCEncodeType encodeType_; 245 /** 246 * Stream type, see {@link DCStreamType}. 247 */ 248 enum DCStreamType type_; 249 /** 250 * Stream settings, see {@link DCameraSettings}. 251 */ 252 struct DCameraSettings[] captureSettings_; 253}; 254 255/** 256 * @brief Defines the inner buffer of the distributed camera, 257 * which is used to acquire buffer during processing capture requests. 258 */ 259struct DCameraBuffer { 260 /** 261 * Buffer index. 262 */ 263 int index_; 264 /** 265 * Buffer size. 266 */ 267 unsigned int size_; 268 /** 269 * Buffer handle sequenceable, see {@link BufferHandleSequenceable}. 270 */ 271 BufferHandleSequenceable bufferHandle_; 272}; 273 274/** 275 * @brief Notification event of the distributed camera. 276 */ 277struct DCameraHDFEvent { 278 /** 279 * Event type. 280 */ 281 int type_; 282 /** 283 * Event result. 284 */ 285 int result_; 286 /** 287 * Extended content (optional). 288 */ 289 String content_; 290}; 291