1794c9f46Sopenharmony_ci/*
2794c9f46Sopenharmony_ci * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
3794c9f46Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4794c9f46Sopenharmony_ci * you may not use this file except in compliance with the License.
5794c9f46Sopenharmony_ci * You may obtain a copy of the License at
6794c9f46Sopenharmony_ci *
7794c9f46Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8794c9f46Sopenharmony_ci *
9794c9f46Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10794c9f46Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11794c9f46Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12794c9f46Sopenharmony_ci * See the License for the specific language governing permissions and
13794c9f46Sopenharmony_ci * limitations under the License.
14794c9f46Sopenharmony_ci */
15794c9f46Sopenharmony_ci
16794c9f46Sopenharmony_ci#ifndef OHOS_DISTRIBUTED_HARDWARE_CONSTANTS_H
17794c9f46Sopenharmony_ci#define OHOS_DISTRIBUTED_HARDWARE_CONSTANTS_H
18794c9f46Sopenharmony_ci
19794c9f46Sopenharmony_ci#include <string>
20794c9f46Sopenharmony_ci#include <unistd.h>
21794c9f46Sopenharmony_ci
22794c9f46Sopenharmony_cinamespace OHOS {
23794c9f46Sopenharmony_cinamespace DistributedHardware {
24794c9f46Sopenharmony_ci    constexpr int32_t LOG_MAX_LEN = 4096;
25794c9f46Sopenharmony_ci    constexpr int32_t ENABLE_TIMEOUT_MS = 1000;
26794c9f46Sopenharmony_ci    constexpr int32_t DISABLE_TIMEOUT_MS = 500;
27794c9f46Sopenharmony_ci    constexpr uint32_t MAX_MESSAGE_LEN = 40 * 1024 * 1024;
28794c9f46Sopenharmony_ci    constexpr uint32_t MIN_MESSAGE_LEN = 0;
29794c9f46Sopenharmony_ci    constexpr uint32_t MAX_ID_LEN = 256;
30794c9f46Sopenharmony_ci    constexpr uint32_t MAX_TOPIC_SIZE = 128;
31794c9f46Sopenharmony_ci    constexpr uint32_t MAX_LISTENER_SIZE = 256;
32794c9f46Sopenharmony_ci    constexpr uint32_t MAX_COMP_SIZE = 128;
33794c9f46Sopenharmony_ci    constexpr uint32_t MAX_ARR_SIZE = 10000;
34794c9f46Sopenharmony_ci    constexpr uint32_t MAX_DB_RECORD_SIZE = 10000;
35794c9f46Sopenharmony_ci    constexpr uint32_t MAX_ONLINE_DEVICE_SIZE = 10000;
36794c9f46Sopenharmony_ci    constexpr int32_t MODE_ENABLE = 0;
37794c9f46Sopenharmony_ci    constexpr int32_t MODE_DISABLE = 1;
38794c9f46Sopenharmony_ci    constexpr uint32_t MAX_SWITCH_SIZE = 256;
39794c9f46Sopenharmony_ci    constexpr uint32_t MAX_ROUND_SIZE = 1000;
40794c9f46Sopenharmony_ci    constexpr uint32_t MAX_JSON_SIZE = 40 * 1024 * 1024;
41794c9f46Sopenharmony_ci    constexpr uint32_t MAX_HASH_SIZE = 64;
42794c9f46Sopenharmony_ci    constexpr uint32_t MAX_KEY_SIZE = 256;
43794c9f46Sopenharmony_ci
44794c9f46Sopenharmony_ci    const std::string LOW_LATENCY_KEY = "identity";
45794c9f46Sopenharmony_ci    const std::u16string DHMS_STUB_INTERFACE_TOKEN = u"ohos.distributedhardware.accessToken";
46794c9f46Sopenharmony_ci    const std::string APP_ID = "dtbhardware_manager_service";
47794c9f46Sopenharmony_ci    const std::string GLOBAL_CAPABILITY_ID = "global_capability_info";
48794c9f46Sopenharmony_ci    const std::string GLOBAL_VERSION_ID = "global_version_info";
49794c9f46Sopenharmony_ci    const std::string LOCAL_CAPABILITY_ID = "local_capability_info";
50794c9f46Sopenharmony_ci    const std::string GLOBAL_META_INFO = "global_meta_info";
51794c9f46Sopenharmony_ci    const std::string RESOURCE_SEPARATOR = "###";
52794c9f46Sopenharmony_ci    const std::string DH_ID = "dh_id";
53794c9f46Sopenharmony_ci    const std::string DEV_ID = "dev_id";
54794c9f46Sopenharmony_ci    const std::string DEV_NAME = "dev_name";
55794c9f46Sopenharmony_ci    const std::string DEV_TYPE = "dev_type";
56794c9f46Sopenharmony_ci    const std::string DH_TYPE = "dh_type";
57794c9f46Sopenharmony_ci    const std::string DH_ATTRS = "dh_attrs";
58794c9f46Sopenharmony_ci    const std::string DH_SUBTYPE = "dh_subtype";
59794c9f46Sopenharmony_ci    const std::string DEV_UDID_HASH = "udid_hash";
60794c9f46Sopenharmony_ci    const std::string DH_LOG_TITLE_TAG = "DHFWK";
61794c9f46Sopenharmony_ci    const std::string DH_VER = "dh_ver";
62794c9f46Sopenharmony_ci    const std::string COMP_VER = "comp_ver";
63794c9f46Sopenharmony_ci    const std::string NAME = "name";
64794c9f46Sopenharmony_ci    const std::string TYPE = "type";
65794c9f46Sopenharmony_ci    const std::string HANDLER = "handler";
66794c9f46Sopenharmony_ci    const std::string SOURCE_VER = "source_ver";
67794c9f46Sopenharmony_ci    const std::string SINK_VER = "sink_ver";
68794c9f46Sopenharmony_ci    const std::string DH_TASK_NAME_PREFIX = "Task_";
69794c9f46Sopenharmony_ci    const std::string DH_FWK_PKG_NAME = "ohos.dhardware";
70794c9f46Sopenharmony_ci    const std::string DH_FWK_SESSION_NAME = "ohos.dhardware.session_";
71794c9f46Sopenharmony_ci    const std::string DH_COMPONENT_VERSIONS = "componentVersions";
72794c9f46Sopenharmony_ci    const std::string DH_COMPONENT_TYPE = "dhType";
73794c9f46Sopenharmony_ci    const std::string DH_COMPONENT_SINK_VER = "version";
74794c9f46Sopenharmony_ci    const std::string DH_COMPONENT_DEFAULT_VERSION = "1.0";
75794c9f46Sopenharmony_ci    const std::string LOW_LATENCY_ENABLE = "low_latency_enable";
76794c9f46Sopenharmony_ci    constexpr const char *DO_RECOVER = "DoRecover";
77794c9f46Sopenharmony_ci    constexpr const char *SEND_ONLINE = "SendOnLine";
78794c9f46Sopenharmony_ci    constexpr const char *DISABLE_TASK_INNER = "DisableTask";
79794c9f46Sopenharmony_ci    constexpr const char *ENABLE_TASK_INNER = "EnableTask";
80794c9f46Sopenharmony_ci    constexpr const char *META_DISABLE_TASK_INNER = "MetaDisableTask";
81794c9f46Sopenharmony_ci    constexpr const char *META_ENABLE_TASK_INNER = "MetaEnableTask";
82794c9f46Sopenharmony_ci    constexpr const char *OFFLINE_TASK_INNER = "OffLineTask";
83794c9f46Sopenharmony_ci    constexpr const char *TRIGGER_TASK = "TriggerTask";
84794c9f46Sopenharmony_ci    constexpr const char *EVENT_RUN = "EventRun";
85794c9f46Sopenharmony_ci    constexpr const char *START_EVENT = "StartEvent";
86794c9f46Sopenharmony_ci    constexpr const char *COMPONENTSLOAD_PROFILE_PATH =
87794c9f46Sopenharmony_ci        "etc/distributedhardware/distributed_hardware_components_cfg.json";
88794c9f46Sopenharmony_ci
89794c9f46Sopenharmony_ci    const uint32_t EVENT_VERSION_INFO_DB_RECOVER = 101;
90794c9f46Sopenharmony_ci    const uint32_t EVENT_CAPABILITY_INFO_DB_RECOVER = 201;
91794c9f46Sopenharmony_ci    const uint32_t EVENT_DATA_SYNC_MANUAL = 301;
92794c9f46Sopenharmony_ci    const uint32_t EVENT_META_INFO_DB_RECOVER = 401;
93794c9f46Sopenharmony_ci
94794c9f46Sopenharmony_ci    const std::string ISOMERISM_EVENT_KEY = "isomerism_event";
95794c9f46Sopenharmony_ci    const std::string ISOMERISM_EVENT_CONNECT_VAL = "isomerism_connect";
96794c9f46Sopenharmony_ci    const std::string ISOMERISM_EVENT_DISCONNECT_VAL = "isomerism_disconnect";
97794c9f46Sopenharmony_ci} // namespace DistributedHardware
98794c9f46Sopenharmony_ci} // namespace OHOS
99794c9f46Sopenharmony_ci#endif
100