11c1b0f19Sopenharmony_ci/*
21c1b0f19Sopenharmony_ci * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
31c1b0f19Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
41c1b0f19Sopenharmony_ci * you may not use this file except in compliance with the License.
51c1b0f19Sopenharmony_ci * You may obtain a copy of the License at
61c1b0f19Sopenharmony_ci *
71c1b0f19Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
81c1b0f19Sopenharmony_ci *
91c1b0f19Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
101c1b0f19Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
111c1b0f19Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
121c1b0f19Sopenharmony_ci * See the License for the specific language governing permissions and
131c1b0f19Sopenharmony_ci * limitations under the License.
141c1b0f19Sopenharmony_ci */
151c1b0f19Sopenharmony_ci
161c1b0f19Sopenharmony_ci#ifndef OHOS_DISTRIBUTED_CAMERA_CONSTANTS_H
171c1b0f19Sopenharmony_ci#define OHOS_DISTRIBUTED_CAMERA_CONSTANTS_H
181c1b0f19Sopenharmony_ci
191c1b0f19Sopenharmony_ci#include <cstdint>
201c1b0f19Sopenharmony_ci#include <string>
211c1b0f19Sopenharmony_ci#include <unistd.h>
221c1b0f19Sopenharmony_ci
231c1b0f19Sopenharmony_cinamespace OHOS {
241c1b0f19Sopenharmony_cinamespace DistributedHardware {
251c1b0f19Sopenharmony_citypedef enum {
261c1b0f19Sopenharmony_ci    DCAMERA_SRV_STATE_NOT_START,
271c1b0f19Sopenharmony_ci    DCAMERA_SRV_STATE_RUNNING
281c1b0f19Sopenharmony_ci} DCameraServiceState;
291c1b0f19Sopenharmony_ci
301c1b0f19Sopenharmony_citypedef enum {
311c1b0f19Sopenharmony_ci    DCAMERA_AUTHORIZATION_DEFAULT = 0,
321c1b0f19Sopenharmony_ci    DCAMERA_AUTHORIZATION_AGREE = 1,
331c1b0f19Sopenharmony_ci    DCAMERA_AUTHORIZATION_REJECT = 2,
341c1b0f19Sopenharmony_ci    DCAMERA_AUTHORIZATION_TIMEOUT = 3,
351c1b0f19Sopenharmony_ci} AuthorizationState;
361c1b0f19Sopenharmony_ci
371c1b0f19Sopenharmony_citypedef enum {
381c1b0f19Sopenharmony_ci    DCAMERA_SAME_ACCOUNT = 0,
391c1b0f19Sopenharmony_ci    DCAMERA_DIFF_ACCOUNT = 1,
401c1b0f19Sopenharmony_ci    DCAMERA_NO_ACCOUNT = 2,
411c1b0f19Sopenharmony_ci} AccessControlType;
421c1b0f19Sopenharmony_ci
431c1b0f19Sopenharmony_citypedef enum {
441c1b0f19Sopenharmony_ci    DCAMERA_MESSAGE = 0,
451c1b0f19Sopenharmony_ci    DCAMERA_OPERATION = 1,
461c1b0f19Sopenharmony_ci    DCAMERA_SINK_STOP = 2,
471c1b0f19Sopenharmony_ci    DCAMERE_GETFULLCAP = 3,
481c1b0f19Sopenharmony_ci} DCameraEventType;
491c1b0f19Sopenharmony_ci
501c1b0f19Sopenharmony_citypedef enum {
511c1b0f19Sopenharmony_ci    DCAMERA_EVENT_CHANNEL_DISCONNECTED = 0,
521c1b0f19Sopenharmony_ci    DCAMERA_EVENT_CHANNEL_CONNECTED = 1,
531c1b0f19Sopenharmony_ci    DCAMERA_EVENT_CAMERA_SUCCESS = 2,
541c1b0f19Sopenharmony_ci    DCAMERA_EVENT_SINK_STOP = 3,
551c1b0f19Sopenharmony_ci
561c1b0f19Sopenharmony_ci    DCAMERA_EVENT_CAMERA_ERROR = -1,
571c1b0f19Sopenharmony_ci    DCAMERA_EVENT_OPEN_CHANNEL_ERROR = -2,
581c1b0f19Sopenharmony_ci    DCAMERA_EVENT_CLOSE_CHANNEL_ERROR = -3,
591c1b0f19Sopenharmony_ci    DCAMERA_EVENT_CONFIG_STREAMS_ERROR = -4,
601c1b0f19Sopenharmony_ci    DCAMERA_EVENT_RELEASE_STREAMS_ERROR = -5,
611c1b0f19Sopenharmony_ci    DCAMERA_EVENT_START_CAPTURE_ERROR = -6,
621c1b0f19Sopenharmony_ci    DCAMERA_EVENT_STOP_CAPTURE_ERROR = -7,
631c1b0f19Sopenharmony_ci    DCAMERA_EVENT_UPDATE_SETTINGS_ERROR = -8,
641c1b0f19Sopenharmony_ci    DCAMERA_EVENT_DEVICE_ERROR = -9,
651c1b0f19Sopenharmony_ci    DCAMERA_EVENT_DEVICE_PREEMPT = -10,
661c1b0f19Sopenharmony_ci    DCAMERA_EVENT_DEVICE_IN_USE = -11,
671c1b0f19Sopenharmony_ci    DCAMERA_EVENT_NO_PERMISSION = -12,
681c1b0f19Sopenharmony_ci} DCameraEventResult;
691c1b0f19Sopenharmony_ci
701c1b0f19Sopenharmony_citypedef enum {
711c1b0f19Sopenharmony_ci    OHOS_CAMERA_FORMAT_INVALID = 0,
721c1b0f19Sopenharmony_ci    OHOS_CAMERA_FORMAT_RGBA_8888,
731c1b0f19Sopenharmony_ci    OHOS_CAMERA_FORMAT_YCBCR_420_888,
741c1b0f19Sopenharmony_ci    OHOS_CAMERA_FORMAT_YCRCB_420_SP,
751c1b0f19Sopenharmony_ci    OHOS_CAMERA_FORMAT_YCBCR_420_SP,
761c1b0f19Sopenharmony_ci    OHOS_CAMERA_FORMAT_JPEG,
771c1b0f19Sopenharmony_ci} DCameraFormat;
781c1b0f19Sopenharmony_ci
791c1b0f19Sopenharmony_ciconst uint32_t DCAMERA_MAX_NUM = 1;
801c1b0f19Sopenharmony_ciconst uint32_t DCAMERA_PRODUCER_ONE_MINUTE_MS = 1000;
811c1b0f19Sopenharmony_ciconst uint32_t DCAMERA_PRODUCER_FPS_DEFAULT = 30;
821c1b0f19Sopenharmony_ciconst uint32_t DCAMERA_MAX_RECV_DATA_LEN = 104857600;
831c1b0f19Sopenharmony_ciconst uint16_t DCAMERA_MAX_RECV_EXT_LEN = 65535;
841c1b0f19Sopenharmony_ciconst uint32_t DISTRIBUTED_HARDWARE_CAMERA_SOURCE_SA_ID = 4803;
851c1b0f19Sopenharmony_ciconst uint32_t DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID = 4804;
861c1b0f19Sopenharmony_ciconst std::string SESSION_HEAD = "ohos.dhardware.dcamera_";
871c1b0f19Sopenharmony_ciconst std::string DEVICE_ID_0 = "device/0";
881c1b0f19Sopenharmony_ciconst std::string DEVICE_ID_1 = "device/1";
891c1b0f19Sopenharmony_ciconst std::string SENDER_SESSION_NAME_CONTROL = "_control_sender";
901c1b0f19Sopenharmony_ciconst std::string SENDER_SESSION_NAME_DATA_SNAPSHOT = "_dataSnapshot_sender";
911c1b0f19Sopenharmony_ciconst std::string SENDER_SESSION_NAME_DATA_CONTINUE = "_dataContinue_sender";
921c1b0f19Sopenharmony_ciconst std::string RECEIVER_SESSION_NAME_CONTROL = "_control_receiver";
931c1b0f19Sopenharmony_ciconst std::string RECEIVER_SESSION_NAME_DATA_SNAPSHOT = "_dataSnapshot_receiver";
941c1b0f19Sopenharmony_ciconst std::string RECEIVER_SESSION_NAME_DATA_CONTINUE = "_dataContinue_receiver";
951c1b0f19Sopenharmony_ciconst std::string DCAMERA_PKG_NAME = "ohos.dhardware.dcamera";
961c1b0f19Sopenharmony_ciconst std::string SNAP_SHOT_SESSION_FLAG = "dataSnapshot";
971c1b0f19Sopenharmony_ciconst std::string CONTINUE_SESSION_FLAG = "dataContinue";
981c1b0f19Sopenharmony_ciconst std::string TIME_STAMP_US = "timeStampUs";
991c1b0f19Sopenharmony_ciconst std::string FRAME_TYPE = "frameType";
1001c1b0f19Sopenharmony_ciconst std::string INDEX = "index";
1011c1b0f19Sopenharmony_ciconst std::string START_ENCODE_TIME_US = "startEncodeT";
1021c1b0f19Sopenharmony_ciconst std::string FINISH_ENCODE_TIME_US = "finishEncodeT";
1031c1b0f19Sopenharmony_ciconst std::string SEND_TIME_US = "sendT";
1041c1b0f19Sopenharmony_ciconst std::string RECV_TIME_US = "recvT";
1051c1b0f19Sopenharmony_ci
1061c1b0f19Sopenharmony_ciconst std::string DISTRIBUTED_HARDWARE_ID_KEY = "dhID";
1071c1b0f19Sopenharmony_ciconst std::string CAMERA_ID_PREFIX = "Camera_";
1081c1b0f19Sopenharmony_ciconst std::string CAMERA_PROTOCOL_VERSION_KEY = "ProtocolVer";
1091c1b0f19Sopenharmony_ciconst std::string CAMERA_PROTOCOL_VERSION_VALUE = "1.0";
1101c1b0f19Sopenharmony_ciconst std::string CAMERA_POSITION_KEY = "Position";
1111c1b0f19Sopenharmony_ciconst std::string CAMERA_POSITION_BACK = "BACK";
1121c1b0f19Sopenharmony_ciconst std::string CAMERA_POSITION_FRONT = "FRONT";
1131c1b0f19Sopenharmony_ciconst std::string CAMERA_POSITION_UNSPECIFIED = "UNSPECIFIED";
1141c1b0f19Sopenharmony_ciconst std::string CAMERA_METADATA_KEY = "MetaData";
1151c1b0f19Sopenharmony_ciconst std::string CAMERA_CODEC_TYPE_KEY = "CodecType";
1161c1b0f19Sopenharmony_ciconst std::string CAMERA_FORMAT_KEY = "OutputFormat";
1171c1b0f19Sopenharmony_ciconst std::string CAMERA_FORMAT_PREVIEW = "Preview";
1181c1b0f19Sopenharmony_ciconst std::string CAMERA_FORMAT_VIDEO = "Video";
1191c1b0f19Sopenharmony_ciconst std::string CAMERA_FORMAT_PHOTO = "Photo";
1201c1b0f19Sopenharmony_ciconst std::string CAMERA_RESOLUTION_KEY = "Resolution";
1211c1b0f19Sopenharmony_ciconst std::string CAMERA_SURFACE_FORMAT = "CAMERA_SURFACE_FORMAT";
1221c1b0f19Sopenharmony_ciconst std::string HDF_DCAMERA_EXT_SERVICE = "distributed_camera_provider_service";
1231c1b0f19Sopenharmony_ciconst std::string CAMERA_SUPPORT_MODE = "Mode";
1241c1b0f19Sopenharmony_ciconstexpr static int8_t FRAME_HEAD = 0;
1251c1b0f19Sopenharmony_ci
1261c1b0f19Sopenharmony_ciconst int32_t RESOLUTION_MAX_WIDTH_SNAPSHOT = 4096;
1271c1b0f19Sopenharmony_ciconst int32_t RESOLUTION_MAX_HEIGHT_SNAPSHOT = 3072;
1281c1b0f19Sopenharmony_ciconst int32_t RESOLUTION_MAX_WIDTH_CONTINUOUS = 1920;
1291c1b0f19Sopenharmony_ciconst int32_t RESOLUTION_MAX_HEIGHT_CONTINUOUS = 1080;
1301c1b0f19Sopenharmony_ciconst int32_t RESOLUTION_MIN_WIDTH = 320;
1311c1b0f19Sopenharmony_ciconst int32_t RESOLUTION_MIN_HEIGHT = 240;
1321c1b0f19Sopenharmony_ciconst int32_t DUMP_FILE_MAX_SIZE = 295 * 1024 *1024;
1331c1b0f19Sopenharmony_ciconst int32_t HICOLLIE_INTERVAL_TIME_MS = 20 * 1000;
1341c1b0f19Sopenharmony_ciconst int32_t HICOLLIE_DELAY_TIME_MS = 5 * 1000;
1351c1b0f19Sopenharmony_ciconst size_t HICOLLIE_SLEEP_TIME_US = 5 * 1000 * 1000;
1361c1b0f19Sopenharmony_ci
1371c1b0f19Sopenharmony_ciconst int32_t DCAMERA_QOS_TYPE_MIN_BW = 40 * 1024 * 1024;
1381c1b0f19Sopenharmony_ciconst int32_t DCAMERA_QOS_TYPE_MAX_LATENCY = 8000;
1391c1b0f19Sopenharmony_ciconst int32_t DCAMERA_QOS_TYPE_MIN_LATENCY = 2000;
1401c1b0f19Sopenharmony_ci
1411c1b0f19Sopenharmony_ciconst int32_t CAMERA_META_DATA_ITEM_CAPACITY = 10;
1421c1b0f19Sopenharmony_ciconst int32_t CAMERA_META_DATA_DATA_CAPACITY = 100;
1431c1b0f19Sopenharmony_ciconst int32_t DCAMERA_UID = 3052;
1441c1b0f19Sopenharmony_ci
1451c1b0f19Sopenharmony_ciconst uint32_t DCAMERA_SHIFT_32 = 32;
1461c1b0f19Sopenharmony_ciconst uint32_t DCAMERA_SHIFT_24 = 24;
1471c1b0f19Sopenharmony_ciconst uint32_t DCAMERA_SHIFT_16 = 16;
1481c1b0f19Sopenharmony_ciconst uint32_t DCAMERA_SHIFT_8 = 8;
1491c1b0f19Sopenharmony_ciconst uint32_t COUNT_INIT_NUM = 1;
1501c1b0f19Sopenharmony_ci
1511c1b0f19Sopenharmony_ciconst uint32_t UINT32_SHIFT_MASK_24 = 0xff000000;
1521c1b0f19Sopenharmony_ciconst uint32_t UINT32_SHIFT_MASK_16 = 0x00ff0000;
1531c1b0f19Sopenharmony_ciconst uint32_t UINT32_SHIFT_MASK_8 = 0x0000ff00;
1541c1b0f19Sopenharmony_ciconst uint32_t UINT32_SHIFT_MASK_0 = 0x000000ff;
1551c1b0f19Sopenharmony_ciconst uint16_t UINT16_SHIFT_MASK_0 = 0x00ff;
1561c1b0f19Sopenharmony_ci
1571c1b0f19Sopenharmony_ciconst std::string CHANNEL_DISCONNECTED = "disconnected";
1581c1b0f19Sopenharmony_ciconst std::string PRODUCER = "producer";
1591c1b0f19Sopenharmony_ciconst std::string REGISTER_SERVICE_NOTIFY = "regSvcNotify";
1601c1b0f19Sopenharmony_ciconst std::string SINK_START_EVENT = "sinkStartEvent";
1611c1b0f19Sopenharmony_ciconst std::string SOURCE_START_EVENT = "srcStartEvent";
1621c1b0f19Sopenharmony_ciconst std::string DECODE_DATA_EVENT = "srcDecEvent";
1631c1b0f19Sopenharmony_ciconst std::string PIPELINE_SRC_EVENT = "srcPipeEvent";
1641c1b0f19Sopenharmony_ciconst std::string UNREGISTER_SERVICE_NOTIFY = "unregSvcNotify";
1651c1b0f19Sopenharmony_ciconst std::string LOOPER_SMOOTH = "looperSmooth";
1661c1b0f19Sopenharmony_ciconst std::string DUMP_PATH = "/data/data/dcamera/";
1671c1b0f19Sopenharmony_ciconst std::string DUMP_PHOTO_PATH = "/data/data/dcamera/photodump/";
1681c1b0f19Sopenharmony_ciconst std::string TO_DISPLAY = "AfterDecodeToDisplay.yuv";
1691c1b0f19Sopenharmony_ciconst std::string SINK_PHOTO = "_SinkPhoto.jpg";
1701c1b0f19Sopenharmony_ciconst std::string AFTER_ENCODE = "SinkAfterEncode.h265";
1711c1b0f19Sopenharmony_ciconst std::string BEFORE_DECODE = "SourceBeforeDecode.h265";
1721c1b0f19Sopenharmony_ciconst std::string CAMERA_HICOLLIE = "CameraHicollie";
1731c1b0f19Sopenharmony_ciconst std::string SEPARATE_SINK_VERSION = "2.0";
1741c1b0f19Sopenharmony_ci} // namespace DistributedHardware
1751c1b0f19Sopenharmony_ci} // namespace OHOS
1761c1b0f19Sopenharmony_ci#endif // OHOS_DISTRIBUTED_CAMERA_CONSTANTS_H