1 /* 2 * Copyright (c) 2021-2024 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_DISTRIBUTED_CAMERA_CONSTANTS_H 17 #define OHOS_DISTRIBUTED_CAMERA_CONSTANTS_H 18 19 #include <cstdint> 20 #include <string> 21 #include <unistd.h> 22 23 namespace OHOS { 24 namespace DistributedHardware { 25 typedef enum { 26 DCAMERA_SRV_STATE_NOT_START, 27 DCAMERA_SRV_STATE_RUNNING 28 } DCameraServiceState; 29 30 typedef enum { 31 DCAMERA_AUTHORIZATION_DEFAULT = 0, 32 DCAMERA_AUTHORIZATION_AGREE = 1, 33 DCAMERA_AUTHORIZATION_REJECT = 2, 34 DCAMERA_AUTHORIZATION_TIMEOUT = 3, 35 } AuthorizationState; 36 37 typedef enum { 38 DCAMERA_SAME_ACCOUNT = 0, 39 DCAMERA_DIFF_ACCOUNT = 1, 40 DCAMERA_NO_ACCOUNT = 2, 41 } AccessControlType; 42 43 typedef enum { 44 DCAMERA_MESSAGE = 0, 45 DCAMERA_OPERATION = 1, 46 DCAMERA_SINK_STOP = 2, 47 DCAMERE_GETFULLCAP = 3, 48 } DCameraEventType; 49 50 typedef enum { 51 DCAMERA_EVENT_CHANNEL_DISCONNECTED = 0, 52 DCAMERA_EVENT_CHANNEL_CONNECTED = 1, 53 DCAMERA_EVENT_CAMERA_SUCCESS = 2, 54 DCAMERA_EVENT_SINK_STOP = 3, 55 56 DCAMERA_EVENT_CAMERA_ERROR = -1, 57 DCAMERA_EVENT_OPEN_CHANNEL_ERROR = -2, 58 DCAMERA_EVENT_CLOSE_CHANNEL_ERROR = -3, 59 DCAMERA_EVENT_CONFIG_STREAMS_ERROR = -4, 60 DCAMERA_EVENT_RELEASE_STREAMS_ERROR = -5, 61 DCAMERA_EVENT_START_CAPTURE_ERROR = -6, 62 DCAMERA_EVENT_STOP_CAPTURE_ERROR = -7, 63 DCAMERA_EVENT_UPDATE_SETTINGS_ERROR = -8, 64 DCAMERA_EVENT_DEVICE_ERROR = -9, 65 DCAMERA_EVENT_DEVICE_PREEMPT = -10, 66 DCAMERA_EVENT_DEVICE_IN_USE = -11, 67 DCAMERA_EVENT_NO_PERMISSION = -12, 68 } DCameraEventResult; 69 70 typedef enum { 71 OHOS_CAMERA_FORMAT_INVALID = 0, 72 OHOS_CAMERA_FORMAT_RGBA_8888, 73 OHOS_CAMERA_FORMAT_YCBCR_420_888, 74 OHOS_CAMERA_FORMAT_YCRCB_420_SP, 75 OHOS_CAMERA_FORMAT_YCBCR_420_SP, 76 OHOS_CAMERA_FORMAT_JPEG, 77 } DCameraFormat; 78 79 const uint32_t DCAMERA_MAX_NUM = 1; 80 const uint32_t DCAMERA_PRODUCER_ONE_MINUTE_MS = 1000; 81 const uint32_t DCAMERA_PRODUCER_FPS_DEFAULT = 30; 82 const uint32_t DCAMERA_MAX_RECV_DATA_LEN = 104857600; 83 const uint16_t DCAMERA_MAX_RECV_EXT_LEN = 65535; 84 const uint32_t DISTRIBUTED_HARDWARE_CAMERA_SOURCE_SA_ID = 4803; 85 const uint32_t DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID = 4804; 86 const std::string SESSION_HEAD = "ohos.dhardware.dcamera_"; 87 const std::string DEVICE_ID_0 = "device/0"; 88 const std::string DEVICE_ID_1 = "device/1"; 89 const std::string SENDER_SESSION_NAME_CONTROL = "_control_sender"; 90 const std::string SENDER_SESSION_NAME_DATA_SNAPSHOT = "_dataSnapshot_sender"; 91 const std::string SENDER_SESSION_NAME_DATA_CONTINUE = "_dataContinue_sender"; 92 const std::string RECEIVER_SESSION_NAME_CONTROL = "_control_receiver"; 93 const std::string RECEIVER_SESSION_NAME_DATA_SNAPSHOT = "_dataSnapshot_receiver"; 94 const std::string RECEIVER_SESSION_NAME_DATA_CONTINUE = "_dataContinue_receiver"; 95 const std::string DCAMERA_PKG_NAME = "ohos.dhardware.dcamera"; 96 const std::string SNAP_SHOT_SESSION_FLAG = "dataSnapshot"; 97 const std::string CONTINUE_SESSION_FLAG = "dataContinue"; 98 const std::string TIME_STAMP_US = "timeStampUs"; 99 const std::string FRAME_TYPE = "frameType"; 100 const std::string INDEX = "index"; 101 const std::string START_ENCODE_TIME_US = "startEncodeT"; 102 const std::string FINISH_ENCODE_TIME_US = "finishEncodeT"; 103 const std::string SEND_TIME_US = "sendT"; 104 const std::string RECV_TIME_US = "recvT"; 105 106 const std::string DISTRIBUTED_HARDWARE_ID_KEY = "dhID"; 107 const std::string CAMERA_ID_PREFIX = "Camera_"; 108 const std::string CAMERA_PROTOCOL_VERSION_KEY = "ProtocolVer"; 109 const std::string CAMERA_PROTOCOL_VERSION_VALUE = "1.0"; 110 const std::string CAMERA_POSITION_KEY = "Position"; 111 const std::string CAMERA_POSITION_BACK = "BACK"; 112 const std::string CAMERA_POSITION_FRONT = "FRONT"; 113 const std::string CAMERA_POSITION_UNSPECIFIED = "UNSPECIFIED"; 114 const std::string CAMERA_METADATA_KEY = "MetaData"; 115 const std::string CAMERA_CODEC_TYPE_KEY = "CodecType"; 116 const std::string CAMERA_FORMAT_KEY = "OutputFormat"; 117 const std::string CAMERA_FORMAT_PREVIEW = "Preview"; 118 const std::string CAMERA_FORMAT_VIDEO = "Video"; 119 const std::string CAMERA_FORMAT_PHOTO = "Photo"; 120 const std::string CAMERA_RESOLUTION_KEY = "Resolution"; 121 const std::string CAMERA_SURFACE_FORMAT = "CAMERA_SURFACE_FORMAT"; 122 const std::string HDF_DCAMERA_EXT_SERVICE = "distributed_camera_provider_service"; 123 const std::string CAMERA_SUPPORT_MODE = "Mode"; 124 constexpr static int8_t FRAME_HEAD = 0; 125 126 const int32_t RESOLUTION_MAX_WIDTH_SNAPSHOT = 4096; 127 const int32_t RESOLUTION_MAX_HEIGHT_SNAPSHOT = 3072; 128 const int32_t RESOLUTION_MAX_WIDTH_CONTINUOUS = 1920; 129 const int32_t RESOLUTION_MAX_HEIGHT_CONTINUOUS = 1080; 130 const int32_t RESOLUTION_MIN_WIDTH = 320; 131 const int32_t RESOLUTION_MIN_HEIGHT = 240; 132 const int32_t DUMP_FILE_MAX_SIZE = 295 * 1024 *1024; 133 const int32_t HICOLLIE_INTERVAL_TIME_MS = 20 * 1000; 134 const int32_t HICOLLIE_DELAY_TIME_MS = 5 * 1000; 135 const size_t HICOLLIE_SLEEP_TIME_US = 5 * 1000 * 1000; 136 137 const int32_t DCAMERA_QOS_TYPE_MIN_BW = 40 * 1024 * 1024; 138 const int32_t DCAMERA_QOS_TYPE_MAX_LATENCY = 8000; 139 const int32_t DCAMERA_QOS_TYPE_MIN_LATENCY = 2000; 140 141 const int32_t CAMERA_META_DATA_ITEM_CAPACITY = 10; 142 const int32_t CAMERA_META_DATA_DATA_CAPACITY = 100; 143 const int32_t DCAMERA_UID = 3052; 144 145 const uint32_t DCAMERA_SHIFT_32 = 32; 146 const uint32_t DCAMERA_SHIFT_24 = 24; 147 const uint32_t DCAMERA_SHIFT_16 = 16; 148 const uint32_t DCAMERA_SHIFT_8 = 8; 149 const uint32_t COUNT_INIT_NUM = 1; 150 151 const uint32_t UINT32_SHIFT_MASK_24 = 0xff000000; 152 const uint32_t UINT32_SHIFT_MASK_16 = 0x00ff0000; 153 const uint32_t UINT32_SHIFT_MASK_8 = 0x0000ff00; 154 const uint32_t UINT32_SHIFT_MASK_0 = 0x000000ff; 155 const uint16_t UINT16_SHIFT_MASK_0 = 0x00ff; 156 157 const std::string CHANNEL_DISCONNECTED = "disconnected"; 158 const std::string PRODUCER = "producer"; 159 const std::string REGISTER_SERVICE_NOTIFY = "regSvcNotify"; 160 const std::string SINK_START_EVENT = "sinkStartEvent"; 161 const std::string SOURCE_START_EVENT = "srcStartEvent"; 162 const std::string DECODE_DATA_EVENT = "srcDecEvent"; 163 const std::string PIPELINE_SRC_EVENT = "srcPipeEvent"; 164 const std::string UNREGISTER_SERVICE_NOTIFY = "unregSvcNotify"; 165 const std::string LOOPER_SMOOTH = "looperSmooth"; 166 const std::string DUMP_PATH = "/data/data/dcamera/"; 167 const std::string DUMP_PHOTO_PATH = "/data/data/dcamera/photodump/"; 168 const std::string TO_DISPLAY = "AfterDecodeToDisplay.yuv"; 169 const std::string SINK_PHOTO = "_SinkPhoto.jpg"; 170 const std::string AFTER_ENCODE = "SinkAfterEncode.h265"; 171 const std::string BEFORE_DECODE = "SourceBeforeDecode.h265"; 172 const std::string CAMERA_HICOLLIE = "CameraHicollie"; 173 const std::string SEPARATE_SINK_VERSION = "2.0"; 174 } // namespace DistributedHardware 175 } // namespace OHOS 176 #endif // OHOS_DISTRIBUTED_CAMERA_CONSTANTS_H