1 /* 2 * Copyright (c) 2024-2025 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 #include "distributed_device_profile_constants.h" 17 18 namespace OHOS { 19 namespace DistributedDeviceProfile { 20 namespace { 21 const std::string TAG = "DeviceProfileConstants"; 22 } 23 /* DeviceProfile Attribute */ 24 const std::string DEVICE_ID = "deviceId"; 25 const std::string DEVICE_TYPE_ID = "deviceTypeId"; 26 const std::string DEVICE_TYPE_NAME = "deviceTypeName"; 27 const std::string DEVICE_NAME = "deviceName"; 28 const std::string MANUFACTURE_NAME = "manufactureName"; 29 const std::string DEVICE_MODEL = "model"; 30 const std::string STORAGE_CAPACITY = "storageCapacity"; 31 const std::string OS_SYS_CAPACITY = "osSysCapacity"; 32 const std::string OS_API_LEVEL = "osApiLevel"; 33 const std::string OS_VERSION = "osVersion"; 34 const std::string OS_TYPE = "osType"; 35 const std::string TYPE = "type"; 36 const std::string OH_PROFILE_SUFFIX = "_OH"; 37 const std::string ID = "id"; 38 const std::string DEV_TYPE = "devType"; 39 const std::string MANU = "manu"; 40 const std::string SN = "sn"; 41 const std::string PRODUCT_ID = "productId"; 42 const std::string SUB_PRODUCT_ID = "subProductId"; 43 const std::string HIV = "hiv"; 44 const std::string MAC = "mac"; 45 const std::string BLE_MAC = "bleMac"; 46 const std::string BR_MAC = "brMac"; 47 const std::string SLE_MAC = "sleMac"; 48 const std::string FWV = "fwv"; 49 const std::string HWV = "hwv"; 50 const std::string SWV = "swv"; 51 const std::string PROT_TYPE = "protType"; 52 const std::string SETUP_TYPE = "setupType"; 53 const std::string WISE_USER_ID = "wiseUserId"; 54 const std::string WISE_DEVICE_ID = "wiseDeviceId"; 55 const std::string ROOM_NAME = "roomName"; 56 const std::string REGISTER_TIME = "registerTime"; 57 const std::string MODIFY_TIME = "modifyTime"; 58 const std::string SHARE_TIME = "shareTime"; 59 const std::string PRODUCTOR_INFO_VERSION = "productorInfoVersion"; 60 const std::string INTERNAL_MODEL = "internalModel"; 61 const std::string DEVICE_PROFILE_TABLE = "device_profile"; 62 const std::string DEVICE_ICON_INFO_TABLE = "device_icon_info"; 63 const std::string PRODUCT_INFO_TABLE = "product_info"; 64 const std::string SYSTEM = "system"; 65 const std::string RDB_TYPE_TEXT = "TEXT"; 66 const std::string RESULT = "result"; 67 /* ServiceProfile Attribute */ 68 const std::string SERVICE_NAME = "serviceName"; 69 const std::string SERVICE_PROFILE_SERVICE_ID = "serviceId"; 70 const std::string SERVICE_TYPE = "serviceType"; 71 const std::string SERVICE_PROFILE_TABLE = "service_profile"; 72 const std::string RDB_USER_ID = "userId"; 73 const std::string SERVICE_PROFILE_DEVICE_PROFILE_ID = "deviceProfileId"; 74 const std::string SERVICE_PROFILE_SERVICE_TYPE = "serviceType"; 75 /* CharacteristicProfile Attribute */ 76 const std::string SERVICE_PROFILE_ID = "serviceProfileId"; 77 const std::string CHARACTERISTIC_PROFILE_TABLE = "characteristic_profile"; 78 const std::string CHARACTERISTIC_KEY = "characteristicKey"; 79 const std::string CHARACTERISTIC_VALUE = "characteristicValue"; 80 /* ProductInfo Attribute */ 81 const std::string PRODUCT_NAME = "productName"; 82 const std::string PRODUCT_SHORT_NAME = "productShortName"; 83 const std::string IMAGE_VERSION = "imageVersion"; 84 /* DeviceIconInfo Attribute */ 85 const std::string IMAGE_TYPE = "imageType"; 86 const std::string SPEC_NAME = "specName"; 87 const std::string DEVICE_ICON = "icon"; 88 const std::string DEVICE_ICON_VERSION = "version"; 89 const std::string DEVICE_ICON_URL = "url"; 90 /* TrustDeviceProfile Attribute */ 91 const std::string SUBSCRIBE_TRUST_DEVICE_PROFILE = "trust_device_profile"; 92 const std::string DEVICE_ID_TYPE = "deviceIdType"; 93 const std::string DEVICE_ID_HASH = "deviceIdHash"; 94 const std::string PEER_USER_ID = "peerUserId"; 95 const std::string LOCAL_USER_ID = "localUserId"; 96 /* AccessControlProfile Attribute */ 97 const std::string ACCESS_CONTROL_ID = "accessControlId"; 98 const std::string ACCESSER_ID = "accesserId"; 99 const std::string ACCESSEE_ID = "accesseeId"; 100 const std::string TRUST_DEVICE_ID = "trustDeviceId"; 101 const std::string SESSION_KEY = "sessionKey"; 102 const std::string BIND_TYPE = "bindType"; 103 const std::string AUTHENTICATION_TYPE = "authenticationType"; 104 const std::string BIND_LEVEL = "bindLevel"; 105 const std::string STATUS = "status"; 106 const std::string VALID_PERIOD = "validPeriod"; 107 const std::string LAST_AUTH_TIME = "lastAuthTime"; 108 const std::string EXTRA_DATA = "extraData"; 109 /* Accesser Attribute */ 110 const std::string ACCESSER_DEVICE_ID = "accesserDeviceId"; 111 const std::string ACCESSER_USER_ID = "accesserUserId"; 112 const std::string ACCESSER_ACCOUNT_ID = "accesserAccountId"; 113 const std::string ACCESSER_TOKEN_ID = "accesserTokenId"; 114 const std::string ACCESSER_BUNDLE_NAME = "accesserBundleName"; 115 const std::string ACCESSER_HAP_SIGNATURE = "accesserHapSignature"; 116 const std::string ACCESSER_BIND_LEVEL = "accesserBindLevel"; 117 const std::string ACCESSER_DEVICE_NAME = "accesserDeviceName"; 118 const std::string ACCESSER_SERVICE_NAME = "accesserServiceName"; 119 const std::string ACCESSER_CREDENTIAL_ID = "accesserCredentialId"; 120 const std::string ACCESSER_CREDENTIAL_ID_STR = "accesserCredentialIdStr"; 121 const std::string ACCESSER_STATUS = "accesserStatus"; 122 const std::string ACCESSER_SESSION_KEY_ID = "accesserSessionKeyId"; 123 const std::string ACCESSER_SESSION_KEY_TIMESTAMP = "accesserSKTimeStamp"; 124 const std::string ACCESSER_EXTRA_DATA = "accesserExtraData"; 125 /* Accessee Attribute */ 126 const std::string ACCESSEE_DEVICE_ID = "accesseeDeviceId"; 127 const std::string ACCESSEE_USER_ID = "accesseeUserId"; 128 const std::string ACCESSEE_ACCOUNT_ID = "accesseeAccountId"; 129 const std::string ACCESSEE_TOKEN_ID = "accesseeTokenId"; 130 const std::string ACCESSEE_BUNDLE_NAME = "accesseeBundleName"; 131 const std::string ACCESSEE_HAP_SIGNATURE = "accesseeHapSignature"; 132 const std::string ACCESSEE_BIND_LEVEL = "accesseeBindLevel"; 133 const std::string ACCESSEE_DEVICE_NAME = "accesseeDeviceName"; 134 const std::string ACCESSEE_SERVICE_NAME = "accesseeServiceName"; 135 const std::string ACCESSEE_CREDENTIAL_ID = "accesseeCredentialId"; 136 const std::string ACCESSEE_CREDENTIAL_ID_STR = "accesseeCredentialIdStr"; 137 const std::string ACCESSEE_STATUS = "accesseeStatus"; 138 const std::string ACCESSEE_SESSION_KEY_ID = "accesseeSessionKeyId"; 139 const std::string ACCESSEE_SESSION_KEY_TIMESTAMP = "accesseeSKTimeStamp"; 140 const std::string ACCESSEE_EXTRA_DATA = "accesseeExtraData"; 141 /* subscribe info */ 142 const std::string SA_ID = "saId"; 143 const std::string SUBSCRIBE_KEY = "subscribeKey"; 144 const std::string SUBSCRIBE_CHANGE_TYPES = "subscribeChangeTypes"; 145 /* syncOptions */ 146 const std::string SYNC_MODE = "syncMode"; 147 const std::string SYNC_DEVICE_IDS = "syncDevices"; 148 /* ServiceInfoProfile Attribute */ 149 const std::string SRNETWORK_ID = "networkId"; 150 const std::string SISERVICE_ID = "serviceId"; 151 const std::string SERVICE_DISPLAY_NAME = "serviceDisplayName"; 152 const std::string CUSTOM_DATA = "customData"; 153 const std::string CUSTOM_DATA_LEN = "customDataLen"; 154 const std::string BUNDLE_NAME = "bundleName"; 155 const std::string MODULE_NAME = "moduleName"; 156 const std::string ABILITY_NAME = "abilityName"; 157 const std::string AUTH_BOX_TYPE = "authBoxType"; 158 const std::string AUTH_TYPE = "authType"; 159 const std::string PIN_EXCHANGE_TYPE = "pinExchangeType"; 160 const std::string PINCODE = "pinCode"; 161 const std::string DESCRIPTION = "description"; 162 const std::string SERVICE_DISCOVERY_SCOPE = "serviceDicoveryScope"; 163 const std::string EXTRAINFO = "extraInfo"; 164 const std::string PUT_SERVICE_INFO_PROFILE = "PutServiceInfoProfile"; 165 const std::string DELETE_SERVICE_INFO_PROFILE = "DeleteServiceInfoProfile"; 166 const std::string UPDATE_SERVICE_INFO_PROFILE = "UpdateServiceInfoProfile"; 167 const std::string GET_SERVICE_INFO_PROFILE_BY_UNIQUE_KEY = "GetServiceInfoProfileByUniqueKey"; 168 const std::string GET_SERVICE_INFO_PROFILE_LIST_BY_TOKEN_ID = "GetServiceInfoProfileListByTokenId"; 169 const std::string GET_ALL_SERVICE_INFO_PROFILE_LIST = "GetAllServiceInfoProfileList"; 170 const std::string GET_SERVICE_INFO_PROFILE_LIST_BY_BUNDLE_NAME = "GetServiceInfoProfileListByBundleName"; 171 /* LocalServiceInfo Attribute */ 172 const std::string PUT_LOCAL_SERVICE_INFO = "PutLocalServiceInfo"; 173 const std::string UPDATE_LOCAL_SERVICE_INFO = "UpdateLocalServiceInfo"; 174 const std::string GET_LOCAL_SERVICE_INFO_BY_BINDLE_AND_PINTYPE = "GetLocalServiceInfoByBundleAndPinType"; 175 const std::string DELETE_LOCAL_SERVICE_INFO = "DeleteLocalServiceInfo"; 176 /* Interface Name */ 177 const std::string PUT_SESSION_KEY = "PutSessionKey"; 178 const std::string GET_SESSION_KEY = "GetSessionKey"; 179 const std::string UPDATE_SESSION_KEY = "UpdateSessionKey"; 180 const std::string DELETE_SESSION_KEY = "DeleteSessionKey"; 181 const std::string PUT_ACCESS_CONTROL_PROFILE = "PutAccessControlProfile"; 182 const std::string UPDATE_ACCESS_CONTROL_PROFILE = "UpdateAccessControlProfile"; 183 const std::string GET_ACCESS_CONTROL_PROFILE = "GetAccessControlProfile"; 184 const std::string DELETE_ACCESS_CONTROL_PROFILE = "DeleteAccessControlProfile"; 185 const std::string GET_TRUST_DEVICE_PROFILE = "GetTrustDeviceProfile"; 186 const std::string GET_ALL_TRUST_DEVICE_PROFILE = "GetAllTrustDeviceProfile"; 187 const std::string GET_ALL_ACCESS_CONTROL_PROFILE = "GetAllAccessControlProfile"; 188 const std::string GET_ALL_ACL_INCLUDE_LNN_ACL = "GetAllAclIncludeLnnAcl"; 189 const std::string PUT_SERVICE_PROFILE = "PutServiceProfile"; 190 const std::string PUT_SERVICE_PROFILE_BATCH = "PutServiceProfileBatch"; 191 const std::string PUT_CHARACTERISTIC_PROFILE = "PutCharacteristicProfile"; 192 const std::string PUT_CHARACTERISTIC_PROFILE_BATCH = "PutCharacteristicProfileBatch"; 193 const std::string GET_DEVICE_PROFILE = "GetDeviceProfile"; 194 const std::string GET_SERVICE_PROFILE = "GetServiceProfile"; 195 const std::string GET_CHARACTERISTIC_PROFILE = "GetCharacteristicProfile"; 196 const std::string DELETE_SERVICE_PROFILE = "DeleteServiceProfile"; 197 const std::string DELETE_CHARACTERISTIC_PROFILE = "DeleteCharacteristicProfile"; 198 const std::string SUBSCRIBE_DEVICE_PROFILE = "SubscribeDeviceProfile"; 199 const std::string UNSUBSCRIBE_DEVICE_PROFILE = "UnSubscribeDeviceProfile"; 200 const std::string SYNC_DEVICE_PROFILE = "SyncDeviceProfile"; 201 const std::string PUT_ALL_TRUSTED_DEVICES = "PutAllTrustedDevices"; 202 const std::string PUT_DEVICE_PROFILE_BATCH = "PutDeviceProfileBatch"; 203 const std::string DELETE_DEVICE_PROFILE_BATCH = "DeleteDeviceProfileBatch"; 204 const std::string GET_DEVICE_PROFILES = "GetDeviceProfiles"; 205 const std::string PUT_PRODUCT_INFO_BATCH = "PutProductInfoBatch"; 206 const std::string PUT_DEVICE_ICON_INFO_BATCH = "PutDeviceIconInfoBatch"; 207 const std::string GET_DEVICE_ICON_INFOS = "GetDeviceIconInfos"; 208 /* Common constants */ 209 const std::string IS_MULTI_USER = "is_multi_user"; 210 const std::string SEPARATOR = "#"; 211 const std::string SLASHES = "/"; 212 const std::string DEV_PREFIX = "dev"; 213 const std::string SVR_PREFIX = "svr"; 214 const std::string CHAR_PREFIX = "char"; 215 const std::string USER_ID = "user_id"; 216 const std::string DEVICE_PROFILE_ID = "deviceProfile_id"; 217 const std::string TOKEN_ID = "token_id"; 218 const std::string ALL_PROC = "all"; 219 const std::string TYPE_UNKNOWN = "default"; 220 const std::string TYPE_PHONE = "phone"; 221 const std::string TYPE_PAD = "tablet"; 222 const std::string TYPE_TV = "tv"; 223 const std::string TYPE_CAR = "car"; 224 const std::string TYPE_WATCH = "wearable"; 225 const std::string TYPE_PC = "pc"; 226 const std::string TYPE_2IN1 = "2in1"; 227 const std::string HIV_VERSION = "1.0"; 228 const std::string INVALID_PINCODE = "******"; 229 const std::string DP_PKG_NAME = "ohos.deviceprofile"; 230 const std::string IS_NUMSTRING_RULES = "^[-+]?[0-9]+$"; 231 /* rdb constants */ 232 const std::string RDB_PATH = "/data/service/el1/public/database/distributed_device_profile_service/"; 233 const std::string DATABASE_NAME = "dp_rdb.db"; 234 /* TrustProfile Manager */ 235 const std::string USERID = "userId"; 236 const std::string BUNDLENAME = "bundleName"; 237 const std::string TOKENID = "tokenId"; 238 const std::string ACCOUNTID = "accountId"; 239 const std::string PRODUCTID = "productId"; 240 const std::string DEVICEID_EQUAL_CONDITION = "deviceId = ?"; 241 const std::string ACCESSCONTROLID_EQUAL_CONDITION = "accessControlId = ?"; 242 const std::string ACCESSERID_EQUAL_CONDITION = "accesserId = ? "; 243 const std::string ACCESSEEID_EQUAL_CONDITION = "accesseeId = ? "; 244 const std::string IS_LNN_ACL = "IsLnnAcl"; 245 const std::string LNN_ACL_TRUE = "true"; 246 const std::string BUSINESS_KEY = "businessKey"; 247 const std::string BUSINESS_VALUE = "businessValue"; 248 249 const std::string CREATE_TURST_DEVICE_TABLE_SQL = "CREATE TABLE IF NOT EXISTS trust_device_table\ 250 (\ 251 deviceId TEXT PRIMARY KEY,\ 252 deviceIdType INTEGER,\ 253 deviceIdHash TEXT,\ 254 status INTEGER);"; 255 const std::string CREATE_ACCESS_CONTROL_TABLE_SQL = "CREATE TABLE IF NOT EXISTS access_control_table\ 256 (\ 257 accessControlId INTEGER PRIMARY KEY,\ 258 accesserId INTEGER,\ 259 accesseeId INTEGER,\ 260 trustDeviceId TEXT,\ 261 sessionKey TEXT,\ 262 bindType INTEGER,\ 263 authenticationType INTEGER,\ 264 deviceIdType INTEGER,\ 265 deviceIdHash TEXT,\ 266 status INTEGER,\ 267 validPeriod INTEGER,\ 268 lastAuthTime INTEGER,\ 269 bindLevel INTEGER,\ 270 extraData TEXT);"; 271 const std::string CREATE_ACCESSER_TABLE_SQL = "CREATE TABLE IF NOT EXISTS accesser_table\ 272 (\ 273 accesserId INTEGER PRIMARY KEY,\ 274 accesserDeviceId TEXT,\ 275 accesserUserId INTEGER,\ 276 accesserAccountId TEXT,\ 277 accesserTokenId INTEGER,\ 278 accesserBundleName TEXT,\ 279 accesserHapSignature TEXT,\ 280 accesserBindLevel INTEGER,\ 281 accesserDeviceName TEXT,\ 282 accesserServiceName TEXT,\ 283 accesserCredentialId INTEGER,\ 284 accesserCredentialIdStr TEXT,\ 285 accesserStatus INTEGER,\ 286 accesserSessionKeyId INTEGER,\ 287 accesserSKTimeStamp INTEGER,\ 288 accesserExtraData TEXT);"; 289 const std::string CREATE_ACCESSEE_TABLE_SQL = "CREATE TABLE IF NOT EXISTS accessee_table\ 290 (\ 291 accesseeId INTEGER PRIMARY KEY,\ 292 accesseeDeviceId TEXT,\ 293 accesseeUserId INTEGER,\ 294 accesseeAccountId TEXT,\ 295 accesseeTokenId INTEGER,\ 296 accesseeBundleName TEXT,\ 297 accesseeHapSignature TEXT,\ 298 accesseeBindLevel INTEGER,\ 299 accesseeDeviceName TEXT,\ 300 accesseeServiceName TEXT,\ 301 accesseeCredentialId INTEGER,\ 302 accesseeCredentialIdStr TEXT,\ 303 accesseeStatus INTEGER,\ 304 accesseeSessionKeyId INTEGER,\ 305 accesseeSKTimeStamp INTEGER,\ 306 accesseeExtraData TEXT);"; 307 const std::string CREATE_TURST_DEVICE_TABLE_UNIQUE_INDEX_SQL = 308 "CREATE UNIQUE INDEX if not exists unique_trust_device_table ON trust_device_table \ 309 (\ 310 deviceId,\ 311 deviceIdType,\ 312 deviceIdHash,\ 313 status);"; 314 const std::string CREATE_ACCESS_CONTROL_TABLE_UNIQUE_INDEX_SQL = 315 "CREATE UNIQUE INDEX if not exists unique_access_control_table ON access_control_table \ 316 (\ 317 accesserId,\ 318 accesseeId,\ 319 trustDeviceId,\ 320 sessionKey,\ 321 bindType,\ 322 authenticationType,\ 323 deviceIdType,\ 324 deviceIdHash,\ 325 validPeriod,\ 326 lastAuthTime,\ 327 bindLevel);"; 328 const std::string CREATE_ACCESSER_TABLE_UNIQUE_INDEX_SQL = 329 "CREATE UNIQUE INDEX if not exists unique_accesser_table ON accesser_table \ 330 (\ 331 accesserDeviceId,\ 332 accesserUserId,\ 333 accesserAccountId,\ 334 accesserTokenId,\ 335 accesserBundleName,\ 336 accesserHapSignature,\ 337 accesserBindLevel,\ 338 accesserDeviceName,\ 339 accesserServiceName,\ 340 accesserCredentialIdStr,\ 341 accesserStatus,\ 342 accesserSessionKeyId);"; 343 const std::string CREATE_ACCESSEE_TABLE_UNIQUE_INDEX_SQL = 344 "CREATE UNIQUE INDEX if not exists unique_accessee_table ON accessee_table \ 345 (\ 346 accesseeDeviceId,\ 347 accesseeUserId,\ 348 accesseeAccountId,\ 349 accesseeTokenId,\ 350 accesseeBundleName,\ 351 accesseeHapSignature,\ 352 accesseeBindLevel,\ 353 accesseeDeviceName,\ 354 accesseeServiceName,\ 355 accesseeCredentialIdStr,\ 356 accesseeStatus,\ 357 accesseeSessionKeyId);"; 358 const std::string PRAGMA_ACCESSEE_TABLE = "PRAGMA table_info(accessee_table)"; 359 const std::string DROP_OLD_UNIQUE_INDEX_ON_ACER = "DROP INDEX unique_accesser_table"; 360 const std::string DROP_OLD_UNIQUE_INDEX_ON_ACEE = "DROP INDEX unique_accessee_table"; 361 const std::string ALTER_TABLE_ACCESS_CONTROL_ADD_COLUMN_EXTRA_DATA = 362 "ALTER TABLE access_control_table ADD COLUMN extraData TEXT DEFAULT ''";; 363 const std::string ALTER_TABLE_ACER_ADD_COLUMN_ACER_DEVICE_NAME = 364 "ALTER TABLE accesser_table ADD COLUMN accesserDeviceName TEXT DEFAULT ''"; 365 const std::string ALTER_TABLE_ACER_ADD_COLUMN_ACER_SERVICE_NAME = 366 "ALTER TABLE accesser_table ADD COLUMN accesserServiceName TEXT DEFAULT ''"; 367 const std::string ALTER_TABLE_ACER_ADD_COLUMN_ACER_CREDENTIAL_ID = 368 "ALTER TABLE accesser_table ADD COLUMN accesserCredentialId INTERGER DEFAULT -1"; 369 const std::string ALTER_TABLE_ACER_ADD_COLUMN_ACER_CREDENTIAL_ID_STR = 370 "ALTER TABLE accesser_table ADD COLUMN accesserCredentialIdStr TEXT DEFAULT ''"; 371 const std::string ALTER_TABLE_ACER_ADD_COLUMN_ACER_STATUS = 372 "ALTER TABLE accesser_table ADD COLUMN accesserStatus INTERGER DEFAULT -1"; 373 const std::string ALTER_TABLE_ACER_ADD_COLUMN_ACER_SESSION_KEY_ID = 374 "ALTER TABLE accesser_table ADD COLUMN accesserSessionKeyId INTERGER DEFAULT -1"; 375 const std::string ALTER_TABLE_ACER_ADD_COLUMN_ACER_SESSION_KEY_TIMESTAMP = 376 "ALTER TABLE accesser_table ADD COLUMN accesserSKTimeStamp INTERGER DEFAULT -1"; 377 const std::string ALTER_TABLE_ACER_ADD_COLUMN_ACER_EXTRA_DATA = 378 "ALTER TABLE accesser_table ADD COLUMN accesserExtraData TEXT DEFAULT ''"; 379 const std::string ALTER_TABLE_ACEE_ADD_COLUMN_ACEE_DEVICE_NAME = 380 "ALTER TABLE accessee_table ADD COLUMN accesseeDeviceName TEXT DEFAULT ''"; 381 const std::string ALTER_TABLE_ACEE_ADD_COLUMN_ACEE_SERVICE_NAME = 382 "ALTER TABLE accessee_table ADD COLUMN accesseeServiceName TEXT DEFAULT ''"; 383 const std::string ALTER_TABLE_ACEE_ADD_COLUMN_ACEE_CREDENTIAL_ID = 384 "ALTER TABLE accessee_table ADD COLUMN accesseeCredentialId INTERGER DEFAULT -1"; 385 const std::string ALTER_TABLE_ACEE_ADD_COLUMN_ACEE_CREDENTIAL_ID_STR = 386 "ALTER TABLE accessee_table ADD COLUMN accesseeCredentialIdStr TEXT DEFAULT ''"; 387 const std::string ALTER_TABLE_ACEE_ADD_COLUMN_ACEE_STATUS = 388 "ALTER TABLE accessee_table ADD COLUMN accesseeStatus INTERGER DEFAULT -1"; 389 const std::string ALTER_TABLE_ACEE_ADD_COLUMN_ACEE_SESSION_KEY_ID = 390 "ALTER TABLE accessee_table ADD COLUMN accesseeSessionKeyId INTERGER DEFAULT -1"; 391 const std::string ALTER_TABLE_ACEE_ADD_COLUMN_ACEE_SESSION_KEY_TIMESTAMP = 392 "ALTER TABLE accessee_table ADD COLUMN accesseeSKTimeStamp INTERGER DEFAULT -1"; 393 const std::string ALTER_TABLE_ACEE_ADD_COLUMN_ACEE_EXTRA_DATA = 394 "ALTER TABLE accessee_table ADD COLUMN accesseeExtraData TEXT DEFAULT ''"; 395 const std::string TRUST_DEVICE_TABLE = "trust_device_table"; 396 const std::string ACCESS_CONTROL_TABLE = "access_control_table"; 397 const std::string ACCESSER_TABLE = "accesser_table"; 398 const std::string ACCESSEE_TABLE = "accessee_table"; 399 const std::string SELECT_TRUST_DEVICE_TABLE = "SELECT * FROM trust_device_table"; 400 const std::string SELECT_TRUST_DEVICE_TABLE_WHERE_DEVICEID = 401 "SELECT * FROM trust_device_table WHERE deviceId = ?"; 402 const std::string SELECT_ACCESS_CONTROL_TABLE_WHERE_ACCESSCONTROLID = 403 "SELECT * FROM access_control_table WHERE accessControlId = ?"; 404 const std::string SELECT_ACCESS_CONTROL_TABLE_WHERE_ACCESSEEID = 405 "SELECT * FROM access_control_table WHERE accesseeId = ? "; 406 const std::string SELECT_ACCESS_CONTROL_TABLE_WHERE_ACCESSERID = 407 "SELECT * FROM access_control_table WHERE accesserId = ? "; 408 const std::string SELECT_ACCESS_CONTROL_TABLE_WHERE_BINDTYPE_AND_STATUS = 409 "SELECT * FROM access_control_table WHERE bindType = ? and status = ? "; 410 const std::string SELECT_ACCESS_CONTROL_TABLE = "SELECT * FROM access_control_table"; 411 const std::string SELECT_ACCESS_CONTROL_TABLE_WHERE_TRUSTDEVICEID = 412 "SELECT * FROM access_control_table WHERE trustDeviceId = ? "; 413 const std::string SELECT_ACCESS_CONTROL_TABLE_WHERE_TRUSTDEVICEID_AND_STATUS = 414 "SELECT * FROM access_control_table WHERE trustDeviceId = ? and status = ?"; 415 const std::string SELECT_ACCESS_CONTROL_TABLE_WHERE_STATUS = 416 "SELECT * FROM access_control_table WHERE status = ?"; 417 const std::string SELECT_ACCESSEE_TABLE_WHERE_ACCESSEEID = "SELECT * FROM accessee_table WHERE accesseeId = ? "; 418 const std::string SELECT_ACCESSER_TABLE_WHERE_ACCESSERID = "SELECT * FROM accesser_table WHERE accesserId = ? "; 419 const std::string SELECT_ACCESSER_TABLE_WHERE_ACCESSERID_AND_ACCESSERUSERID_ACCESSERTOKENID = 420 "SELECT * FROM accesser_table WHERE accesserId = ? and accesserUserId = ? and accesserTokenId = ?"; 421 const std::string SELECT_ACCESSEE_TABLE_WHERE_ACCESSEEID_AND_ACCESSEEUSEEID_ACCESSEETOKENID = 422 "SELECT * FROM accessee_table WHERE accesseeId = ? and accesseeUserId = ? and accesseeTokenId = ?"; 423 const std::string SELECT_ACCESSER_TABLE_WHERE_ACCESSERID_AND_ACCESSERUSERID_ACCESSERBUNDLENAME = 424 "SELECT * FROM accesser_table WHERE accesserId = ? and accesserUserId = ? and accesserBundleName = ?"; 425 const std::string SELECT_ACCESSEE_TABLE_WHERE_ACCESSEEID_AND_ACCESSEEUSEEID_ACCESSEEBUNDLENAME = 426 "SELECT * FROM accessee_table WHERE accesseeId = ? and accesseeUserId = ? and accesseeBundleName = ?"; 427 const std::string SELECT_ACCESSER_TABLE_WHERE_ACCESSERID_AND_ACCESSERUSERID_ACCESSERACCOUNTID = 428 "SELECT * FROM accesser_table WHERE accesserId = ? and accesserUserId = ? and accesserAccountId = ?"; 429 const std::string SELECT_ACCESSEE_TABLE_WHERE_ACCESSEEID_AND_ACCESSEEUSEEID_ACCESSEEACCOUNTID = 430 "SELECT * FROM accessee_table WHERE accesseeId = ? and accesseeUserId = ? and accesseeAccountId = ?"; 431 const std::string SELECT_ACCESSER_TABLE_WHERE_ACCESSERID_AND_ACCESSERUSERID = 432 "SELECT * FROM accesser_table WHERE accesserId = ? and accesserUserId = ? "; 433 const std::string SELECT_ACCESSEE_TABLE_WHERE_ACCESSEEID_AND_ACCESSEEUSERID = 434 "SELECT * FROM accessee_table WHERE accesseeId = ? and accesseeUserId = ? "; 435 const std::string SELECT_ACCESSER_TABLE_WHERE_ACCESSERID_AND_ACCESSERTOKENID = 436 "SELECT * FROM accesser_table WHERE accesserId = ? and accesserTokenId = ? "; 437 const std::string SELECT_ACCESSEE_TABLE_WHERE_ACCESSEEID_AND_ACCESSEETOKENID = 438 "SELECT * FROM accessee_table WHERE accesseeId = ? and accesseeTokenId = ? "; 439 const std::string SELECT_ACCESSER_TABLE_WHERE_ACCESSERID_AND_DEVICEID_AND_ACCESSERTOKENID = 440 "SELECT * FROM accesser_table WHERE accesserId = ? and accesserDeviceId = ? and accesserTokenId = ? "; 441 const std::string SELECT_ACCESSEE_TABLE_WHERE_ACCESSEEID_AND_DEVICEID_AND_ACCESSEETOKENID = 442 "SELECT * FROM accessee_table WHERE accesseeId = ? and accesseeDeviceId = ? and accesseeTokenId = ? "; 443 const std::string SELECT_ACCESSER_TABLE_WHERE_ACCESSERID_AND_DEVICEID_AND_USERID = 444 "SELECT * FROM accesser_table WHERE accesserId = ? and accesserDeviceId = ? and accesserUserId = ? "; 445 const std::string SELECT_ACCESSEE_TABLE_WHERE_ACCESSEEID_AND_DEVICEID_AND_USERID = 446 "SELECT * FROM accessee_table WHERE accesseeId = ? and accesseeDeviceId = ? and accesseeUserId = ? "; 447 const std::string SELECT_ACCESSER_TABLE_WHERE_ACCESSERID_AND_ACCESSERDEVICEID = 448 "SELECT * FROM accesser_table WHERE accesserId = ? and accesserDeviceId = ? "; 449 const std::string SELECT_ACCESSEE_TABLE_WHERE_ACCESSEEID_AND_ACCESSEEDEVICEID = 450 "SELECT * FROM accessee_table WHERE accesseeId = ? and accesseeDeviceId = ? "; 451 const std::string SELECT_ACCESSER_TABLE_WHERE_ACCESSERID_AND_ACCESSERBUNDLENAME = 452 "SELECT * FROM accesser_table WHERE accesserId = ? and accesserBundleName = ? "; 453 const std::string SELECT_ACCESSEE_TABLE_WHERE_ACCESSEEID_AND_ACCESSEEBUNDLENAME = 454 "SELECT * FROM accessee_table WHERE accesseeId = ? and accesseeBundleName = ? "; 455 const std::string SELECT_ACCESSEE_TABLE = "SELECT * FROM accessee_table "; 456 const std::string SELECT_ACCESSER_TABLE = "SELECT * FROM accesser_table "; 457 const std::string SELECT_ACCESS_CONTROL_TABLE_WHERE_ALL_EXCEPT_STATUS = 458 "SELECT * FROM access_control_table WHERE accesserId = ? and accesseeId = ? and trustDeviceId = ? and \ 459 sessionKey = ? and bindType = ? and authenticationType = ? and deviceIdType = ? and deviceIdHash = ? \ 460 and validPeriod = ? and lastAuthTime = ? and bindLevel = ? "; 461 const std::string SELECT_ACCESSER_TABLE_WHERE_ALL = 462 "SELECT * FROM accesser_table WHERE accesserDeviceId = ? and accesserUserId = ? and accesserAccountId = ? and \ 463 accesserTokenId = ? and accesserBundleName = ? and accesserHapSignature = ? and accesserBindLevel = ? and \ 464 accesserDeviceName = ? and accesserServiceName = ? and accesserCredentialIdStr = ? and accesserStatus = ? and \ 465 accesserSessionKeyId = ? "; 466 const std::string SELECT_ACCESSEE_TABLE_WHERE_ALL = 467 "SELECT * FROM accessee_table WHERE accesseeDeviceId = ? and accesseeUserId = ? and accesseeAccountId = ? and \ 468 accesseeTokenId = ? and accesseeBundleName = ? and accesseeHapSignature = ? and accesseeBindLevel = ? and \ 469 accesseeDeviceName = ? and accesseeServiceName = ? and accesseeCredentialIdStr = ? and accesseeStatus = ? and \ 470 accesseeSessionKeyId = ? "; 471 const std::string SELECT_ACCESSER_TABLE_WHERE_ACCESSERDEVICEID_AND_ACCESSERUSERID = 472 "SELECT * FROM accesser_table WHERE accesserDeviceId = ? and accesserUserId = ? "; 473 const std::string SELECT_ACCESSEE_TABLE_WHERE_ACCESSEEDEVICEID_AND_ACCESSEEUSERID = 474 "SELECT * FROM accessee_table WHERE accesseeDeviceId = ? and accesseeUserId = ? "; 475 const std::string SELECT_ACCESS_CONTROL_TABLE_WHERE_ACCESSERID_AND_ACCESSEEID = 476 "SELECT * FROM access_control_table WHERE accesserId = ? and accesseeId = ? "; 477 const std::string TABLE_EXIST_COLUMN_SQL = 478 "SELECT EXISTS (\n" 479 " SELECT 1 \n" 480 " FROM PRAGMA_TABLE_INFO(?) \n" 481 " WHERE \n" 482 " name = ? AND\n" 483 " type = ?\n" 484 ") AS result;"; 485 /* SubscribeTrustInfoManager */ 486 const std::string SUBSCRIBE_TRUST_INFO_TABLE = "subscribe_trust_info_table"; 487 const std::string CREATE_SUBSCRIBE_TRUST_INFO_TABLE_SQL = 488 "CREATE TABLE IF NOT EXISTS subscribe_trust_info_table\ 489 (\ 490 saId INTEGER PRIMARY KEY,\ 491 subscribeTable TEXT,\ 492 );"; 493 const std::string CREATE_SUBSCRIBE_TRUST_INFO_TABLE_UNIQUE_INDEX_SQL = 494 "CREATE UNIQUE INDEX if not exists unique_subscribe_trust_info_table ON subscribe_trust_info_table \ 495 (said,\ 496 subscribeTable);"; 497 const std::string TRUST_DEVICE_DELETE = "TrustDeviceDelete"; 498 const std::string TRUST_DEVICE_ADD = "TrustDeviceAdd"; 499 const std::string TRUST_DEVICE_UPDATE = "TrustDeviceUpdate"; 500 /* event handler factory */ 501 const std::string DP_HANDLER = "dp_handler"; 502 const std::string EMPTY_STRING = ""; 503 /* switch attribute */ 504 const std::string SWITCH_CAPABILITY_PATH = "etc/deviceprofile/dp_switch_status_cfg.json"; 505 const std::string SWITCH_CALLERS = "DP_Callers"; 506 const std::string SWITCH_SERVICE_NAMES = "name"; 507 const std::string SWITCH_STATUS = "SwitchStatus"; 508 const std::string SWITCH_ON = "1"; 509 const std::string SWITCH_OFF = "0"; 510 const std::string SWITCH_OPERATE_PUT = "PutSwitch"; 511 const std::string SWITCH_OPERATE_GET = "GetSwitch"; 512 /* static attribute */ 513 const std::string STATIC_CAPABILITY_SVR_ID = "static_cap_svr_id"; 514 const std::string STATIC_CAPABILITY_CHAR_ID = "static_capability"; 515 const std::string STATIC_CAPABILITY_PATH = "etc/deviceprofile/dp_static_capability_cfg.json"; 516 const std::string STATIC_INFO_PATH = "etc/deviceprofile/dp_static_info_cfg.json"; 517 const std::string STATIC_CAPABILITY_ATTRIBUTE = "static_capability"; 518 const std::string STATIC_INFO = "static_info"; 519 const std::string DEFAULT_STATIC_VAL = "0"; 520 const std::string STATIC_CHARACTERISTIC_KEY = "static_capability"; 521 const std::string STATIC_CAPABILITY_VERSION = "staticCapabilityVersion"; 522 const std::string STATIC_CAPABILITY_VALUE = "staticCapabilityValue"; 523 const std::string DP_VERSION = "DPVersion"; 524 const std::string ABILITIES = "abilities"; 525 const std::string ABILITY_KEY = "abilityKey"; 526 const std::string ABILITY_VALUE = "abilityValue"; 527 const std::string STATIC_CAP_HANDLER_NAME = "service_name"; 528 const std::string STATIC_CAP_HANDLER_LOC = "handler_loc"; 529 const std::string DMS_HANDLER_LOC = "libdistributed_sdk.z.so"; 530 const std::string STATIC_VERSION_RULES = "^(\\d+\\.){3}\\d+$"; 531 } // namespace DistributedDeviceProfile 532 } // namespace OHOS 533