1 /* 2 * Copyright (c) 2021-2024 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_DISTRIBUTED_HARDWARE_CONSTANTS_H 17 #define OHOS_DISTRIBUTED_HARDWARE_CONSTANTS_H 18 19 #include <string> 20 #include <unistd.h> 21 22 namespace OHOS { 23 namespace DistributedHardware { 24 constexpr int32_t LOG_MAX_LEN = 4096; 25 constexpr int32_t ENABLE_TIMEOUT_MS = 1000; 26 constexpr int32_t DISABLE_TIMEOUT_MS = 500; 27 constexpr uint32_t MAX_MESSAGE_LEN = 40 * 1024 * 1024; 28 constexpr uint32_t MIN_MESSAGE_LEN = 0; 29 constexpr uint32_t MAX_ID_LEN = 256; 30 constexpr uint32_t MAX_TOPIC_SIZE = 128; 31 constexpr uint32_t MAX_LISTENER_SIZE = 256; 32 constexpr uint32_t MAX_COMP_SIZE = 128; 33 constexpr uint32_t MAX_ARR_SIZE = 10000; 34 constexpr uint32_t MAX_DB_RECORD_SIZE = 10000; 35 constexpr uint32_t MAX_ONLINE_DEVICE_SIZE = 10000; 36 constexpr int32_t MODE_ENABLE = 0; 37 constexpr int32_t MODE_DISABLE = 1; 38 constexpr uint32_t MAX_SWITCH_SIZE = 256; 39 constexpr uint32_t MAX_ROUND_SIZE = 1000; 40 constexpr uint32_t MAX_JSON_SIZE = 40 * 1024 * 1024; 41 constexpr uint32_t MAX_HASH_SIZE = 64; 42 constexpr uint32_t MAX_KEY_SIZE = 256; 43 44 const std::string LOW_LATENCY_KEY = "identity"; 45 const std::u16string DHMS_STUB_INTERFACE_TOKEN = u"ohos.distributedhardware.accessToken"; 46 const std::string APP_ID = "dtbhardware_manager_service"; 47 const std::string GLOBAL_CAPABILITY_ID = "global_capability_info"; 48 const std::string GLOBAL_VERSION_ID = "global_version_info"; 49 const std::string LOCAL_CAPABILITY_ID = "local_capability_info"; 50 const std::string GLOBAL_META_INFO = "global_meta_info"; 51 const std::string RESOURCE_SEPARATOR = "###"; 52 const std::string DH_ID = "dh_id"; 53 const std::string DEV_ID = "dev_id"; 54 const std::string DEV_NAME = "dev_name"; 55 const std::string DEV_TYPE = "dev_type"; 56 const std::string DH_TYPE = "dh_type"; 57 const std::string DH_ATTRS = "dh_attrs"; 58 const std::string DH_SUBTYPE = "dh_subtype"; 59 const std::string DEV_UDID_HASH = "udid_hash"; 60 const std::string DH_LOG_TITLE_TAG = "DHFWK"; 61 const std::string DH_VER = "dh_ver"; 62 const std::string COMP_VER = "comp_ver"; 63 const std::string NAME = "name"; 64 const std::string TYPE = "type"; 65 const std::string HANDLER = "handler"; 66 const std::string SOURCE_VER = "source_ver"; 67 const std::string SINK_VER = "sink_ver"; 68 const std::string DH_TASK_NAME_PREFIX = "Task_"; 69 const std::string DH_FWK_PKG_NAME = "ohos.dhardware"; 70 const std::string DH_FWK_SESSION_NAME = "ohos.dhardware.session_"; 71 const std::string DH_COMPONENT_VERSIONS = "componentVersions"; 72 const std::string DH_COMPONENT_TYPE = "dhType"; 73 const std::string DH_COMPONENT_SINK_VER = "version"; 74 const std::string DH_COMPONENT_DEFAULT_VERSION = "1.0"; 75 const std::string LOW_LATENCY_ENABLE = "low_latency_enable"; 76 constexpr const char *DO_RECOVER = "DoRecover"; 77 constexpr const char *SEND_ONLINE = "SendOnLine"; 78 constexpr const char *DISABLE_TASK_INNER = "DisableTask"; 79 constexpr const char *ENABLE_TASK_INNER = "EnableTask"; 80 constexpr const char *META_DISABLE_TASK_INNER = "MetaDisableTask"; 81 constexpr const char *META_ENABLE_TASK_INNER = "MetaEnableTask"; 82 constexpr const char *OFFLINE_TASK_INNER = "OffLineTask"; 83 constexpr const char *TRIGGER_TASK = "TriggerTask"; 84 constexpr const char *EVENT_RUN = "EventRun"; 85 constexpr const char *START_EVENT = "StartEvent"; 86 constexpr const char *COMPONENTSLOAD_PROFILE_PATH = 87 "etc/distributedhardware/distributed_hardware_components_cfg.json"; 88 89 const uint32_t EVENT_VERSION_INFO_DB_RECOVER = 101; 90 const uint32_t EVENT_CAPABILITY_INFO_DB_RECOVER = 201; 91 const uint32_t EVENT_DATA_SYNC_MANUAL = 301; 92 const uint32_t EVENT_META_INFO_DB_RECOVER = 401; 93 94 const std::string ISOMERISM_EVENT_KEY = "isomerism_event"; 95 const std::string ISOMERISM_EVENT_CONNECT_VAL = "isomerism_connect"; 96 const std::string ISOMERISM_EVENT_DISCONNECT_VAL = "isomerism_disconnect"; 97 } // namespace DistributedHardware 98 } // namespace OHOS 99 #endif 100