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_DEVICE_MANAGER_CONSTANTS_H 17 #define OHOS_DEVICE_MANAGER_CONSTANTS_H 18 19 #include <cstdint> 20 #include <string> 21 22 namespace OHOS { 23 namespace DistributedHardware { 24 const std::string TARGET_PKG_NAME_KEY = "targetPkgName"; 25 const std::string HOST_PKG_NAME_KEY = "hostPackageName"; 26 27 const int32_t LOG_MAX_LEN = 512; 28 const int32_t MIN_PIN_TOKEN = 10000000; 29 const int32_t MAX_PIN_TOKEN = 90000000; 30 const int32_t MIN_PIN_CODE = 100000; 31 const int32_t MAX_PIN_CODE = 999999; 32 const int32_t TOKEN_LEN = 9; 33 34 const int32_t FAIL = -1; 35 const int32_t SUCCESS = 0; 36 const int32_t ERROR_INPUT_PARA_EMPTY = 2000; 37 const int32_t ERROR_INPUT_PARA_INVALID = 2001; 38 const int32_t ERROR_TARGET_PKG_NAME_NULL = 2002; 39 const int32_t ERROR_PKG_NAME_NOT_ON_DISCOVERY = 2003; 40 const int32_t ERROR_START_REMOTE_DM = 2006; 41 const int32_t ERROR_OPEN_CHANNEL_FAIL = 2008; 42 const int32_t ERROR_SEND_COMMAND_FAIL = 2009; 43 const int32_t ERROR_CHANNEL_BROKEN = 2010; 44 const int32_t ERROR_DUPLICATE_REQUEST = 2011; 45 const int32_t ERROR_TIME_OUT = 2012; 46 const int32_t ERROR_REQUEST_CANCEL = 2013; 47 const int32_t ERROR_USER_REJECT = 2015; 48 const int32_t ERROR_USER_BUSY = 2016; 49 const int32_t ERROR_API_NOT_SUPPORT = 2018; 50 const int32_t ERROR_SESSION_NOT_EXIT = 2019; 51 const int32_t ERROR_CREAT_GROUP_FAIL = 2020; 52 const int32_t ERROR_JOIN_GROUP_FAIL = 2021; 53 const int32_t ERROR_GET_LOCAL_DEVICE_INFO_FAIL = 2022; 54 const int32_t ERROR_CHECK_AUTH_FAIL = 2023; 55 const int32_t ERROR_NETWORK_UNAVAILABLE = 2028; 56 const int32_t ERROR_DEVICE_INFO_NULL = 2030; 57 const int32_t ERROR_APP_NAME_NULL = 2031; 58 const int32_t ERROR_APP_DESCRIPTION_INVALID = 2032; 59 const int32_t ERROR_APP_ICON_INVALID = 2033; 60 const int32_t ERROR_APP_THUMBNAIL_INVALID = 2034; 61 const int32_t ERROR_FA_START_FAIL = 2100; 62 63 const int32_t ENCRYPT_TAG_LEN = 32; 64 65 const std::string TAG_REQUESTER = "REQUESTER"; 66 const std::string TAG_TOKEN = "TOKEN"; 67 const std::string TAG_HOST = "HOST"; 68 const std::string TAG_TARGET = "TARGET"; 69 const std::string TAG_VISIBILITY = "VISIBILITY"; 70 const std::string TAG_GROUPIDS = "GROUPIDLIST"; 71 const std::string TAG_REPLY = "REPLY"; 72 const std::string TAG_NET_ID = "NETID"; 73 const std::string TAG_GROUP_ID = "GROUPID"; 74 const std::string TAG_GROUP_NAME = "GROUPNAME"; 75 const std::string TAG_REQUEST_ID = "REQUESTID"; 76 const std::string TAG_DEVICE_ID = "DEVICEID"; 77 const std::string TAG_DEVICE_TYPE = "DEVICETYPE"; 78 const std::string TAG_APP_NAME = "APPNAME"; 79 const std::string TAG_APP_DESCRIPTION = "APPDESC"; 80 const std::string TAG_APP_ICON = "APPICON"; 81 const std::string TAG_APP_THUMBNAIL = "APPTHUM"; 82 const std::string TAG_INDEX = "INDEX"; 83 const std::string TAG_SLICE_NUM = "SLICE"; 84 const std::string TAG_THUMBNAIL_SIZE = "THUMSIZE"; 85 const std::string TAG_AUTH_TYPE = "AUTHTYPE"; 86 87 const std::string TAG_VER = "ITF_VER"; 88 const std::string TAG_TYPE = "MSG_TYPE"; 89 const std::string DM_ITF_VER = "1.0"; 90 const std::string TAG = "DM_MSG_CODEC"; 91 92 // GroupConstants 93 const int32_t GROUP_VISIBILITY_IS_PUBLIC = -1; 94 const int32_t GROUP_VISIBILITY_IS_PRIVATE = 0; 95 const std::string REQUEST_AUTH_ADD_ID = "REQUEST_AUTH_ADD_ID"; 96 const std::string INVITATE_AUTH_ADD_ID = "INVITE_AUTH_ADD_ID"; 97 const int32_t PIN_CODE_INVALID = -1; 98 99 // AuthConstants 100 const int32_t AUTH_SESSION_SIDE_SERVER = 0; 101 const int32_t AUTH_SESSION_SIDE_CLIENT = 1; 102 const int32_t SESSION_TYPE_IS_DEVICE_AUTH = 0; 103 const int32_t SESSION_TYPE_IS_APP_AUTH = 1; 104 const int32_t SESSION_REPLY_UNKNOWN = -1; 105 const int32_t SESSION_REPLY_ACCEPT = 0; 106 const int32_t SESSION_REPLY_CANCEL = 1; 107 const int32_t SESSION_REPLY_TIMEOUT = 2; 108 const int32_t SESSION_REPLY_AUTH_CONFIRM_TIMEOUT = 2; 109 const int32_t SESSION_REPLY_CANCEL_PINCODE_DISPLAY = 3; 110 const int32_t SESSION_REPLY_CANCEL_PINCODE_INPUT = 4; 111 const int32_t SESSION_REPLY_CREAT_GROUP_FAILED = 7; 112 const int32_t REQUEST_OPERATION = 0; 113 const int32_t QR_OPERATION = 1; 114 const int32_t PIN_OPERATION = 2; 115 const int32_t START_ACTIVITY_DIALOG = 1; 116 const int32_t START_ACTIVITY_QR = 2; 117 const int32_t START_ACTIVITY_FINISH = 3; 118 const int32_t START_ACTIVITY_PIN = 4; 119 const int32_t AUTH_STATUS_SKIP = 3; 120 const int32_t DEFAULT_PIN_CODE = 0; 121 const int32_t DEFAULT_PIN_TOKEN = 0; 122 const std::string DEVICE_NAME_KEY = "deviceName"; 123 const std::string DISPLAY_TIME_KEY = "displayTime"; 124 const std::string QR_BITMAP_KEY = "qrBitMap"; 125 const std::string PIN_CODE_KEY = "pinCode"; 126 const std::string START_ACTIVITY_KEY = "startActivityType"; 127 const std::string AUTH_TYPE = "authType"; 128 const std::string TOKEN = "token"; 129 const std::string PIN_TOKEN = "pinToken"; 130 const int32_t MSG_TYPE_TO_REMOTE = 0; 131 const int32_t MSG_TYPE_TO_CLOSED_CHANNEL = 1; 132 const std::string APP_NAME_KEY = "appName"; 133 const std::string APP_DESCRIPTION_KEY = "appDescription"; 134 const std::string APP_ICON_KEY = "appIcon"; 135 const std::string APP_THUMBNAIL_KEY = "appThumbnail"; 136 const std::string CANCEL_DISPLAY_KEY = "cancelPinCodeDisplay"; 137 const int32_t SLICE_NUM_INVALID = -1; 138 const int32_t AUTH_TYPE_QR = 0; 139 const int32_t AUTH_TYPE_PIN = 1; 140 const std::string DISPLAY_OWNER = "displayOwner"; 141 const int32_t DISPLAY_OWNER_SYSTEM = 0; 142 const int32_t DISPLAY_OWNER_OTHER = 1; 143 144 // DmService constants 145 const int32_t MSG_MAX_SIZE = 45 * 1024; 146 const int32_t DES_SLICE_MAX_NUM = 5; 147 const int32_t ABILITY_ON = 1; 148 const int32_t ABILITY_INVALID = -1; 149 const int32_t DES_MAX_LEN = 256; 150 const int32_t ICON_MAX_LEN = 32 * 1024; 151 const int32_t THUMB_MAX_LEN = 153 * 1024; 152 153 const int32_t DEVICE_UUID_LENGTH = 65; 154 const int32_t GROUP_TYPE_IDENTICAL_ACCOUNT_GROUP = 1; 155 const int32_t GROUP_TYPE_PEER_TO_PEER_GROUP = 256; 156 157 const int32_t GROUP_VISIBILITY_PUBLIC = -1; 158 159 const int32_t BUSINESS_FA_MIRGRATION = 0; 160 const int32_t BUSINESS_RESOURCE_ACCESS = 1; 161 162 // Base64 Constants 163 const int32_t BASE64_BYTE_LEN_3 = 3; 164 const int32_t BASE64_BYTE_LEN_4 = 4; 165 } 166 } 167 #endif 168