• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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_DM_CONSTANTS_H
17 #define OHOS_DM_CONSTANTS_H
18 
19 #include <string>
20 
21 #ifdef __LP64__
22 constexpr const char* LIB_LOAD_PATH = "/system/lib64/";
23 #else
24 constexpr const char* LIB_LOAD_PATH = "/system/lib/";
25 #endif
26 
27 namespace OHOS {
28 namespace DistributedHardware {
29 enum {
30     DM_OK = 0,
31     ERR_DM_FAILED = -20000,
32     ERR_DM_TIME_OUT = -20001,
33     ERR_DM_NOT_INIT = -20002,
34     ERR_DM_INIT_FAILED = -20004,
35     ERR_DM_POINT_NULL = -20005,
36     ERR_DM_INPUT_PARA_INVALID = -20006,
37     ERR_DM_NO_PERMISSION = -20007,
38     ERR_DM_MALLOC_FAILED = -20008,
39     ERR_DM_DISCOVERY_FAILED = -20009,
40     ERR_DM_MAP_KEY_ALREADY_EXISTS = -20010,
41     ERR_DM_IPC_WRITE_FAILED = -20012,
42     ERR_DM_IPC_COPY_FAILED = -20013,
43     ERR_DM_IPC_SEND_REQUEST_FAILED = -20014,
44     ERR_DM_UNSUPPORTED_IPC_COMMAND = -20015,
45     ERR_DM_IPC_RESPOND_FAILED = -20016,
46     ERR_DM_DISCOVERY_REPEATED = -20017,
47     ERR_DM_UNSUPPORTED_AUTH_TYPE = -20018,
48     ERR_DM_AUTH_BUSINESS_BUSY = -20019,
49     ERR_DM_AUTH_OPEN_SESSION_FAILED = -20020,
50     ERR_DM_AUTH_PEER_REJECT = -20021,
51     ERR_DM_AUTH_REJECT = -20022,
52     ERR_DM_AUTH_FAILED = -20023,
53     ERR_DM_AUTH_NOT_START = -20024,
54     ERR_DM_AUTH_MESSAGE_INCOMPLETE = -20025,
55     ERR_DM_CREATE_GROUP_FAILED = -20026,
56     ERR_DM_IPC_READ_FAILED = -20027,
57     ERR_DM_ENCRYPT_FAILED = -20028,
58     ERR_DM_PUBLISH_FAILED = -20029,
59     ERR_DM_PUBLISH_REPEATED = -20030,
60 };
61 
62 constexpr const char* TAG_REPLY = "REPLY";
63 constexpr const char* TAG_NET_ID = "NETID";
64 constexpr const char* TAG_TARGET = "TARGET";
65 constexpr const char* TAG_APP_NAME = "APPNAME";
66 constexpr const char* TAG_GROUPIDS = "GROUPIDLIST";
67 constexpr const char* TAG_APP_DESCRIPTION = "APPDESC";
68 constexpr const char* TAG_LOCAL_DEVICE_ID = "LOCALDEVICEID";
69 constexpr const char* TAG_INDEX = "INDEX";
70 constexpr const char* TAG_SLICE_NUM = "SLICE";
71 constexpr const char* TAG_TOKEN = "TOKEN";
72 constexpr const char* TAG_GROUP_ID = "groupId";
73 constexpr const char* TAG_GROUP_NAME = "GROUPNAME";
74 constexpr const char* TAG_REQUEST_ID = "REQUESTID";
75 constexpr const char* TAG_DEVICE_ID = "DEVICEID";
76 constexpr const char* TAG_AUTH_TYPE = "AUTHTYPE";
77 constexpr const char* TAG_CRYPTO_SUPPORT = "CRYPTOSUPPORT";
78 constexpr const char* TAG_CRYPTO_NAME = "CRYPTONAME";
79 constexpr const char* TAG_CRYPTO_VERSION = "CRYPTOVERSION";
80 constexpr const char* TAG_IDENTICAL_ACCOUNT = "IDENTICALACCOUNT";
81 constexpr const char* TAG_VER = "ITF_VER";
82 constexpr const char* TAG_MSG_TYPE = "MSG_TYPE";
83 constexpr const char* DM_ITF_VER = "1.1";
84 constexpr const char* APP_THUMBNAIL = "appThumbnail";
85 constexpr const char* DM_PKG_NAME = "ohos.distributedhardware.devicemanager";
86 constexpr const char* DM_SESSION_NAME = "ohos.distributedhardware.devicemanager.resident";
87 const static char *DM_CAPABILITY_OSD = "osdCapability";
88 
89 // Auth
90 constexpr const char* AUTH_TYPE = "authType";
91 constexpr const char* TOKEN = "token";
92 constexpr const char* PIN_TOKEN = "pinToken";
93 constexpr const char* PIN_CODE_KEY = "pinCode";
94 constexpr const char* NFC_CODE_KEY = "nfcCode";
95 constexpr const char* QR_CODE_KEY = "qrCode";
96 constexpr const char* TAG_AUTH_TOKEN = "authToken";
97 
98 // HiChain
99 const int32_t AUTH_TYPE_PIN = 1;
100 const int32_t SERVICE_INIT_TRY_MAX_NUM = 200;
101 const int32_t DEVICE_UUID_LENGTH = 65;
102 const int32_t GROUP_TYPE_IDENTICAL_ACCOUNT_GROUP = 1;
103 const int32_t GROUP_TYPE_PEER_TO_PEER_GROUP = 256;
104 const int32_t GROUP_VISIBILITY_PUBLIC = -1;
105 const int64_t MIN_REQUEST_ID = 1000000000;
106 const int64_t MAX_REQUEST_ID = 9999999999;
107 
108 // ACE
109 const int32_t ACE_X = 50;
110 const int32_t ACE_Y = 300;
111 const int32_t ACE_WIDTH = 580;
112 const int32_t ACE_HEIGHT = 520;
113 constexpr const char* EVENT_CONFIRM = "EVENT_CONFIRM";
114 constexpr const char* EVENT_CANCEL = "EVENT_CANCEL";
115 constexpr const char* EVENT_INIT = "EVENT_INIT";
116 constexpr const char* EVENT_CONFIRM_CODE = "0";
117 constexpr const char* EVENT_CANCEL_CODE = "1";
118 constexpr const char* EVENT_INIT_CODE = "2";
119 
120 constexpr uint32_t MAX_MESSAGE_LEN = 40 * 1024 * 1024;
121 } // namespace DistributedHardware
122 } // namespace OHOS
123 #endif // OHOS_DM_CONSTANTS_H