• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 #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 } DCameraEventType;
47 
48 typedef enum {
49     DCAMERA_EVENT_CHANNEL_DISCONNECTED = 0,
50     DCAMERA_EVENT_CHANNEL_CONNECTED = 1,
51     DCAMERA_EVENT_CAMERA_SUCCESS = 2,
52 
53     DCAMERA_EVENT_CAMERA_ERROR = -1,
54     DCAMERA_EVENT_OPEN_CHANNEL_ERROR = -2,
55     DCAMERA_EVENT_CLOSE_CHANNEL_ERROR = -3,
56     DCAMERA_EVENT_CONFIG_STREAMS_ERROR = -4,
57     DCAMERA_EVENT_RELEASE_STREAMS_ERROR = -5,
58     DCAMERA_EVENT_START_CAPTURE_ERROR = -6,
59     DCAMERA_EVENT_STOP_CAPTURE_ERROR = -7,
60     DCAMERA_EVENT_UPDATE_SETTINGS_ERROR = -8,
61     DCAMERA_EVENT_DEVICE_ERROR = -9,
62     DCAMERA_EVENT_DEVICE_PREEMPT = -10,
63     DCAMERA_EVENT_DEVICE_IN_USE = -11,
64     DCAMERA_EVENT_NO_PERMISSION = -12,
65 } DCameraEventResult;
66 
67 typedef enum {
68     OHOS_CAMERA_FORMAT_INVALID = 0,
69     OHOS_CAMERA_FORMAT_RGBA_8888,
70     OHOS_CAMERA_FORMAT_YCBCR_420_888,
71     OHOS_CAMERA_FORMAT_YCRCB_420_SP,
72     OHOS_CAMERA_FORMAT_JPEG,
73 } DCameraFormat;
74 
75 const uint32_t DCAMERA_MAX_NUM = 1;
76 const uint32_t DCAMERA_PRODUCER_ONE_MINUTE_MS = 1000;
77 const uint32_t DCAMERA_PRODUCER_FPS_DEFAULT = 30;
78 const uint32_t DCAMERA_MAX_RECV_DATA_LEN = 104857600;
79 const uint32_t DISTRIBUTED_HARDWARE_CAMERA_SOURCE_SA_ID = 4803;
80 const uint32_t DISTRIBUTED_HARDWARE_CAMERA_SINK_SA_ID = 4804;
81 const std::string DCAMERA_PKG_NAME = "ohos.dhardware.dcamera";
82 const std::string SNAP_SHOT_SESSION_FLAG = "dataSnapshot";
83 const std::string CONTINUE_SESSION_FLAG = "dataContinue";
84 
85 const std::string DISTRIBUTED_HARDWARE_ID_KEY = "dhID";
86 const std::string CAMERA_ID_PREFIX = "Camera_";
87 const std::string CAMERA_PROTOCOL_VERSION_KEY = "ProtocolVer";
88 const std::string CAMERA_PROTOCOL_VERSION_VALUE = "1.0";
89 const std::string CAMERA_POSITION_KEY = "Position";
90 const std::string CAMERA_POSITION_BACK = "BACK";
91 const std::string CAMERA_POSITION_FRONT = "FRONT";
92 const std::string CAMERA_POSITION_UNSPECIFIED = "UNSPECIFIED";
93 const std::string CAMERA_METADATA_KEY = "MetaData";
94 const std::string CAMERA_CODEC_TYPE_KEY = "CodecType";
95 const std::string CAMERA_FORMAT_KEY = "OutputFormat";
96 const std::string CAMERA_FORMAT_PREVIEW = "Preview";
97 const std::string CAMERA_FORMAT_VIDEO = "Video";
98 const std::string CAMERA_FORMAT_PHOTO = "Photo";
99 const std::string CAMERA_RESOLUTION_KEY = "Resolution";
100 const std::string CAMERA_SURFACE_FORMAT = "CAMERA_SURFACE_FORMAT";
101 const std::string HDF_DCAMERA_EXT_SERVICE = "distributed_camera_provider_service";
102 
103 const int32_t RESOLUTION_MAX_WIDTH_SNAPSHOT = 4096;
104 const int32_t RESOLUTION_MAX_HEIGHT_SNAPSHOT = 3072;
105 const int32_t RESOLUTION_MAX_WIDTH_CONTINUOUS = 1920;
106 const int32_t RESOLUTION_MAX_HEIGHT_CONTINUOUS = 1080;
107 const int32_t RESOLUTION_MIN_WIDTH = 320;
108 const int32_t RESOLUTION_MIN_HEIGHT = 240;
109 
110 const uint32_t DCAMERA_SHIFT_32 = 32;
111 const uint32_t DCAMERA_SHIFT_24 = 24;
112 const uint32_t DCAMERA_SHIFT_16 = 16;
113 const uint32_t DCAMERA_SHIFT_8 = 8;
114 
115 const uint32_t UINT32_SHIFT_MASK_24 = 0xff000000;
116 const uint32_t UINT32_SHIFT_MASK_16 = 0x00ff0000;
117 const uint32_t UINT32_SHIFT_MASK_8 = 0x0000ff00;
118 const uint32_t UINT32_SHIFT_MASK_0 = 0x000000ff;
119 const uint16_t UINT16_SHIFT_MASK_0 = 0x00ff;
120 } // namespace DistributedHardware
121 } // namespace OHOS
122 #endif // OHOS_DISTRIBUTED_CAMERA_CONSTANTS_H