• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2023 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     ERR_DM_STOP_DISCOVERY = -20031,
61 };
62 
63 constexpr const char* TAG_GROUP_ID = "groupId";
64 constexpr const char* TAG_GROUP_NAME = "GROUPNAME";
65 constexpr const char* TAG_REQUEST_ID = "REQUESTID";
66 constexpr const char* TAG_DEVICE_ID = "DEVICEID";
67 constexpr const char* TAG_AUTH_TYPE = "AUTHTYPE";
68 constexpr const char* TAG_CRYPTO_SUPPORT = "CRYPTOSUPPORT";
69 constexpr const char* TAG_VER = "ITF_VER";
70 constexpr const char* TAG_MSG_TYPE = "MSG_TYPE";
71 constexpr const char* DM_ITF_VER = "1.1";
72 constexpr const char* DM_PKG_NAME = "ohos.distributedhardware.devicemanager";
73 constexpr const char* DM_SESSION_NAME = "ohos.distributedhardware.devicemanager.resident";
74 const static char *DM_CAPABILITY_OSD = "osdCapability";
75 
76 // Auth
77 constexpr const char* AUTH_TYPE = "authType";
78 constexpr const char* APP_OPERATION = "appOperation";
79 constexpr const char* CUSTOM_DESCRIPTION = "customDescription";
80 constexpr const char* TOKEN = "token";
81 constexpr const char* PIN_TOKEN = "pinToken";
82 constexpr const char* PIN_CODE_KEY = "pinCode";
83 constexpr int32_t CHECK_AUTH_ALWAYS_POS = 0;
84 constexpr const char AUTH_ALWAYS = '1';
85 constexpr const char AUTH_ONCE = '0';
86 
87 // HiChain
88 constexpr int32_t AUTH_TYPE_PIN = 1;
89 constexpr int32_t SERVICE_INIT_TRY_MAX_NUM = 200;
90 constexpr int32_t DEVICE_UUID_LENGTH = 65;
91 constexpr int32_t GROUP_TYPE_INVALID_GROUP = -1;
92 constexpr int32_t GROUP_TYPE_IDENTICAL_ACCOUNT_GROUP = 1;
93 constexpr int32_t GROUP_TYPE_PEER_TO_PEER_GROUP = 256;
94 constexpr int32_t GROUP_TYPE_ACROSS_ACCOUNT_GROUP = 1282;
95 constexpr int32_t GROUP_VISIBILITY_PUBLIC = -1;
96 constexpr int64_t MIN_REQUEST_ID = 1000000000;
97 constexpr int64_t MAX_REQUEST_ID = 9999999999;
98 
99 // ACE
100 constexpr const char* EVENT_CONFIRM = "EVENT_CONFIRM";
101 constexpr const char* EVENT_CANCEL = "EVENT_CANCEL";
102 constexpr const char* EVENT_INIT = "EVENT_INIT";
103 constexpr const char* EVENT_CONFIRM_CODE = "0";
104 constexpr const char* EVENT_CANCEL_CODE = "1";
105 constexpr const char* EVENT_INIT_CODE = "2";
106 
107 } // namespace DistributedHardware
108 } // namespace OHOS
109 #endif // OHOS_DM_CONSTANTS_H