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#ifndef OHOS_HDI_CAMERA_V1_2_TYPES_H 17#define OHOS_HDI_CAMERA_V1_2_TYPES_H 18 19#include <cstdbool> 20#include <cstdint> 21#include "buffer_handle_sequenceable.h" 22#include "camera/v1_1/types.h" 23#include "map_data_sequenceable.h" 24 25#ifndef HDI_BUFF_MAX_SIZE 26#define HDI_BUFF_MAX_SIZE (1024 * 200) 27#endif 28 29#ifndef HDI_CHECK_VALUE_RETURN 30#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \ 31 if ((lv) compare (rv)) { \ 32 return ret; \ 33 } \ 34} while (false) 35#endif 36 37#ifndef HDI_CHECK_VALUE_RET_GOTO 38#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \ 39 if ((lv) compare (rv)) { \ 40 ret = value; \ 41 goto table; \ 42 } \ 43} while (false) 44#endif 45 46namespace OHOS { 47class MessageParcel; 48} 49 50namespace OHOS { 51namespace HDI { 52namespace Camera { 53namespace V1_2 { 54 55using namespace OHOS; 56using namespace OHOS::HDI::Camera::V1_1; 57using namespace OHOS::HDI::Camera::V1_0; 58 59enum CamRetCode : int32_t { 60 NO_ERROR = 0, 61 CAMERA_BUSY = -1, 62 INSUFFICIENT_RESOURCES = -2, 63 INVALID_ARGUMENT = -3, 64 METHOD_NOT_SUPPORTED = -4, 65 CAMERA_CLOSED = -5, 66 DEVICE_ERROR = -6, 67 NO_PERMISSION = -7, 68 DEVICE_CONFLICT = -8, 69}; 70 71enum ExtendedStreamInfoType_V1_2 : int32_t { 72 EXTENDED_STREAM_INFO_QUICK_THUMBNAIL = 0, 73 EXTENDED_STREAM_INFO_SKETCH = 1, 74}; 75 76enum OperationMode_V1_2 : int32_t { 77 NORMAL = 0, 78 CAPTURE = 1, 79 VIDEO = 2, 80 PORTRAIT = 3, 81 NIGHT = 4, 82 PROFESSIONAL = 5, 83 SLOW_MOTION = 6, 84 SCAN_CODE = 7, 85 CAPTURE_MACRO = 8, 86 VIDEO_MACRO = 9, 87 SUPER_STAB = 10, 88 OPERATION_MODE_MAX, 89}; 90 91enum DeferredDeliveryImageType : int32_t { 92 NONE = 0, 93 STILL_IMAGE = 1, 94 MOVING_IMAGE = 2, 95}; 96 97enum SessionStatus : int32_t { 98 SESSION_STATUS_READY = 0, 99 SESSION_STATUS_READY_SPACE_LIMIT_REACHED = 1, 100 SESSSON_STATUS_NOT_READY_TEMPORARILY = 2, 101 SESSION_STATUS_NOT_READY_OVERHEAT = 3, 102 SESSION_STATUS_NOT_READY_PREEMPTED = 4, 103}; 104 105enum ErrorCode : int32_t { 106 ERROR_INVALID_ID = 0, 107 ERROR_PROCESS = 1, 108 ERROR_TIMEOUT = 2, 109 ERROR_HIGH_TEMPERATURE = 3, 110 ERROR_ABNORMAL = 4, 111 ERROR_ABORT = 5, 112}; 113 114enum ExecutionMode : int32_t { 115 HIGH_PREFORMANCE = 0, 116 BALANCED = 1, 117 LOW_POWER = 2, 118}; 119 120struct ImageBufferInfo { 121 sptr<OHOS::HDI::Camera::V1_0::MapDataSequenceable> metadata; 122 sptr<OHOS::HDI::Camera::V1_0::BufferHandleSequenceable> imageHandle; 123 bool isGainMapValid; 124 sptr<OHOS::HDI::Camera::V1_0::BufferHandleSequenceable> gainMapHandle; 125 bool isDepthMapValid; 126 sptr<OHOS::HDI::Camera::V1_0::BufferHandleSequenceable> depthMapHandle; 127}; 128 129struct CaptureStartedInfo { 130 int32_t streamId_; 131 int32_t exposureTime_; 132} __attribute__ ((aligned(8))); 133 134bool ImageBufferInfoBlockMarshalling(OHOS::MessageParcel &data, const OHOS::HDI::Camera::V1_2::ImageBufferInfo& dataBlock); 135 136bool ImageBufferInfoBlockUnmarshalling(OHOS::MessageParcel &data, OHOS::HDI::Camera::V1_2::ImageBufferInfo& dataBlock); 137 138bool CaptureStartedInfoBlockMarshalling(OHOS::MessageParcel &data, const OHOS::HDI::Camera::V1_2::CaptureStartedInfo& dataBlock); 139 140bool CaptureStartedInfoBlockUnmarshalling(OHOS::MessageParcel &data, OHOS::HDI::Camera::V1_2::CaptureStartedInfo& dataBlock); 141 142} // V1_2 143} // Camera 144} // HDI 145} // OHOS 146 147#endif // OHOS_HDI_CAMERA_V1_2_TYPES_H 148 149