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