• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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_DM_CONSTANTS_H
17 #define OHOS_DM_CONSTANTS_H
18 
19 #include <string>
20 
21 namespace OHOS {
22 namespace DistributedHardware {
23 const std::string DM_PKG_NAME = "ohos.distributedhardware.devicemanager";
24 const std::string DM_SESSION_NAME = "ohos.distributedhardware.devicemanager.resident";
25 
26 const std::string DISCOVER_STATUS_KEY = "persist.distributed_hardware.device_manager.discover_status";
27 const std::string DISCOVER_STATUS_ON = "1";
28 const std::string DISCOVER_STATUS_OFF = "0";
29 const std::string AUTH_LOAD_JSON_KEY = "devicemanager_auth_components";
30 const std::string ADAPTER_LOAD_JSON_KEY = "devicemanager_adapter_components";
31 const std::string AUTH_JSON_TYPE_KEY = "AUTHENTICATE";
32 const std::string CPYPTO_JSON_TYPE_KEY = "CPYPTO";
33 const std::string PROFILE_JSON_TYPE_KEY = "PROFILE";
34 const std::string DECISION_JSON_TYPE_KEY = "DECISION";
35 
36 const int32_t DM_NAPI_SUBSCRIBE_CAPABILITY_DDMP = 0;
37 const int32_t DM_NAPI_SUBSCRIBE_CAPABILITY_OSD = 1;
38 const int32_t MIN_PIN_TOKEN = 10000000;
39 const int32_t MAX_PIN_TOKEN = 90000000;
40 const int32_t MIN_PIN_CODE = 100000;
41 const int32_t MAX_PIN_CODE = 999999;
42 const int32_t DISCOVER_STATUS_LEN = 20;
43 const int32_t COMMON_CALLBACK_MAX_SIZE = 200;
44 
45 const int32_t DM_AUTH_TYPE_MAX = 4;
46 const int32_t DM_AUTH_TYPE_MIN = 1;
47 
48 enum {
49     DM_OK = 0,
50     DM_FAILED = 1000,
51     DM_TIME_OUT,
52     DM_NOT_INIT,
53     DM_INT_MULTIPLE,
54     DM_INIT_FAILED,
55     DM_UNINIT_FAILED,
56     DM_POINT_NULL,
57     DM_INPUT_PARA_EMPTY,
58     DM_NO_PERMISSION,
59     DM_INVALID_VALUE,
60     DM_FLATTEN_OBJECT,
61     DM_MALLOC_ERROR,
62     DM_COPY_FAILED,
63     DM_WRITE_FAILED,
64     DM_DISCOVERY_FAILED,
65     DM_MAKE_SHARED_FAIL,
66     DM_SERVICE_NOT_READY,
67     DM_DEVICE_ALREADY_TRUSTED,
68     ERR_DM_KEY_ALREADY_EXISTS,
69     ERR_DM_INPUT_PARA_INVALID,
70     ERR_DM_SUBSCRIBE_DP_EVENTS,
71     ERR_DM_UNSUBSCRIBE_DP_EVENTS,
72     DM_IPC_FAILED = 2000,
73     DM_IPC_TRANSACTION_FAILED,
74     DM_IPC_FLATTEN_OBJECT,
75     DM_IPC_COPY_FAILED,
76     DM_IPC_SEND_REQUEST_FAILED,
77     DM_IPC_NOT_REGISTER_FUNC,
78     DM_IPC_RESPOND_ERROR,
79     DM_IPC_WRITE_TOKEN_ERROR,
80     DM_DISCOVERY_REPEATED,
81     DM_AUTH_NOT_SUPPORT,
82     DM_AUTH_BUSINESS_BUSY,
83     DM_AUTH_INPUT_FAILED,
84     DM_AUTH_STATE_FAILED,
85     DM_AUTH_DEVICE_AUTHED,
86     DM_AUTH_OPEN_SESSION_FAILED,
87     DM_AUTH_PEER_REJECT,
88     DM_AUTH_NOT_AUTH,
89     DM_AUTH_DONT_AUTH,
90     DM_AUTH_NOT_START,
91     DM_AUTH_INPUT_PARAMETER_FAILED,
92     DM_SOFTBUS_FAILED = 3000,
93     DM_SOFTBUS_CREATE_SESSION_SERVER_FAILED,
94     DM_HICHAIN_FAILED = 4000,
95     DM_HICHAIN_GROUP_CREATE_FAILED,
96     DM_HICHAIN_MEMBER_ADD_FAILED,
97     DM_HICHAIN_CREATE_CHANNEL_FAILED,
98 };
99 const std::string TARGET_PKG_NAME_KEY = "targetPkgName";
100 const std::string HOST_PKG_NAME_KEY = "hostPackageName";
101 const std::string TAG_REQUESTER = "REQUESTER";
102 const std::string TAG_TOKEN = "TOKEN";
103 const std::string TAG_HOST = "HOST";
104 const std::string TAG_TARGET = "TARGET";
105 const std::string TAG_VISIBILITY = "VISIBILITY";
106 const std::string TAG_GROUPIDS = "GROUPIDLIST";
107 const std::string TAG_REPLY = "REPLY";
108 const std::string TAG_NET_ID = "NETID";
109 const std::string TAG_GROUP_ID = "groupId";
110 const std::string TAG_GROUP_NAME = "GROUPNAME";
111 const std::string TAG_REQUEST_ID = "REQUESTID";
112 const std::string TAG_DEVICE_ID = "DEVICEID";
113 const std::string TAG_LOCAL_DEVICE_ID = "LOCALDEVICEID";
114 const std::string TAG_DEVICE_TYPE = "DEVICETYPE";
115 const std::string TAG_APP_NAME = "APPNAME";
116 const std::string TAG_APP_DESCRIPTION = "APPDESC";
117 const std::string TAG_APP_ICON = "APPICON";
118 const std::string TAG_APP_THUMBNAIL = "APPTHUM";
119 const std::string TAG_INDEX = "INDEX";
120 const std::string TAG_SLICE_NUM = "SLICE";
121 const std::string TAG_THUMBNAIL_SIZE = "THUMSIZE";
122 const std::string TAG_AUTH_TYPE = "AUTHTYPE";
123 const std::string TAG_CRYPTO_SUPPORT = "CRYPTOSUPPORT";
124 const std::string TAG_CRYPTO_NAME = "CRYPTONAME";
125 const std::string TAG_CRYPTO_VERSION = "CRYPTOVERSION";
126 const std::string TAG_VER = "ITF_VER";
127 const std::string TAG_TYPE = "MSG_TYPE";
128 const std::string DM_ITF_VER_1_0 = "1.0";
129 const std::string DM_ITF_VER = "1.1";
130 const std::string TAG = "DM_MSG_CODEC";
131 const std::string APP_NAME_KEY = "appName";
132 const std::string APP_DESCRIPTION_KEY = "appDescription";
133 const std::string APP_ICON_KEY = "appIcon";
134 const std::string APP_THUMBNAIL_KEY = "appThumbnailKey";
135 const std::string APP_THUMBNAIL_LEN = "appThumbnailLen";
136 const std::string APP_THUMBNAIL = "appThumbnail";
137 const std::string CANCEL_DISPLAY_KEY = "cancelPinCodeDisplay";
138 const int32_t MSG_MAX_SIZE = 45 * 1024;
139 const int32_t AUTH_REPLY_ACCEPT = 0;
140 const int32_t ENCRYPT_TAG_LEN = 32;
141 const int32_t SERVICE_INIT_TRY_MAX_NUM = 200;
142 const int32_t SLEEP_TIME_MS = 50000; // 50ms
143 
144 // pin
145 const int32_t DISPLAY_OWNER_SYSTEM = 0;
146 const int32_t DISPLAY_OWNER_OTHER = 1;
147 const int32_t BUSINESS_FA_MIRGRATION = 0;
148 const int32_t BUSINESS_RESOURCE_ACCESS = 1;
149 
150 // json
151 const std::string AUTH_TYPE = "authType";
152 const std::string TOKEN = "token";
153 const std::string PIN_TOKEN = "pinToken";
154 const std::string PIN_CODE_KEY = "pinCode";
155 const std::string NFC_CODE_KEY = "nfcCode";
156 const std::string QR_CODE_KEY = "qrCode";
157 const std::string TAG_AUTH_TOKEN = "authToken";
158 const int32_t AUTH_TYPE_PIN = 1;
159 const int32_t AUTH_TYPE_SCAN = 2;
160 const int32_t AUTH_TYPE_TOUCH = 3;
161 const int32_t DEFAULT_PIN_CODE = 0;
162 const int32_t DEFAULT_PIN_TOKEN = 0;
163 const int32_t DEFAULT_PIN_CODE_LENGTH = 6;
164 // Softbus
165 const int32_t SOFTBUS_CHECK_INTERVAL = 100000; // 100ms
166 const uint32_t SOFTBUS_SUBSCRIBE_ID_PREFIX_LEN = 16;
167 const int32_t SOFTBUS_SUBSCRIBE_ID_MASK = 0x0000FFFF;
168 const int32_t SOFTBUS_DISCOVER_DEVICE_INFO_MAX_SIZE = 20;
169 const int32_t AUTH_SESSION_SIDE_SERVER = 0;
170 const int32_t AUTH_SESSION_SIDE_CLIENT = 1;
171 const static char *DM_CAPABILITY_OSD = "osdCapability";
172 
173 // HiChain
174 const int32_t DEVICE_UUID_LENGTH = 65;
175 const int32_t GROUP_TYPE_IDENTICAL_ACCOUNT_GROUP = 1;
176 const int32_t GROUP_TYPE_PEER_TO_PEER_GROUP = 256;
177 const int32_t GROUP_VISIBILITY_PUBLIC = -1;
178 const int64_t MIN_REQUEST_ID = 1000000000;
179 const int64_t MAX_REQUEST_ID = 9999999999;
180 const int32_t FIELD_EXPIRE_TIME_VALUE = 7;
181 const int32_t GROUP_VISIBILITY_IS_PUBLIC = -1;
182 const int32_t GROUP_VISIBILITY_IS_PRIVATE = 0;
183 const std::string DEVICE_ID = "DEVICE_ID";
184 const std::string WIFI_IP = "WIFI_IP";
185 const std::string WIFI_PORT = "WIFI_PORT";
186 const std::string BR_MAC = "BR_MAC";
187 const std::string BLE_MAC = "BLE_MAC";
188 const std::string ETH_IP = "ETH_IP";
189 const std::string ETH_PORT = "ETH_PORT";
190 
191 // ACE
192 const int32_t ACE_X = 50;
193 const int32_t ACE_Y = 300;
194 const int32_t ACE_WIDTH = 580;
195 const int32_t ACE_HEIGHT = 520;
196 const std::string EVENT_CONFIRM = "EVENT_CONFIRM";
197 const std::string EVENT_CANCEL = "EVENT_CANCEL";
198 const std::string EVENT_INIT = "EVENT_INIT";
199 const std::string EVENT_CONFIRM_CODE = "0";
200 const std::string EVENT_CANCEL_CODE = "1";
201 const std::string EVENT_INIT_CODE = "2";
202 
203 // timer
204 const std::string TIMER_PREFIX = "deviceManagerTimer:";
205 const std::string AUTHENTICATE_TIMEOUT_TASK = TIMER_PREFIX + "authenticate";
206 const std::string NEGOTIATE_TIMEOUT_TASK = TIMER_PREFIX + "negotiate";
207 const std::string CONFIRM_TIMEOUT_TASK = TIMER_PREFIX + "confirm";
208 const std::string SHOW_TIMEOUT_TASK = TIMER_PREFIX + "show";
209 const std::string INPUT_TIMEOUT_TASK = TIMER_PREFIX + "input";
210 const std::string ADD_TIMEOUT_TASK = TIMER_PREFIX + "add";
211 const std::string WAIT_NEGOTIATE_TIMEOUT_TASK = TIMER_PREFIX + "waitNegotiate";
212 const std::string WAIT_REQUEST_TIMEOUT_TASK = TIMER_PREFIX + "waitRequest";
213 const std::string STATE_TIMER_PREFIX = "stateTimer_";
214 const int32_t TIMER_PREFIX_LENGTH = 19;
215 const int32_t TIMER_DEFAULT = 0;
216 } // namespace DistributedHardware
217 } // namespace OHOS
218 #endif
219