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_ERRNO
17 #define OHOS_DISTRIBUTED_HARDWARE_ERRNO
18 
19 #include <cstdint>
20 
21 namespace OHOS {
22 namespace DistributedHardware {
23     /*
24      * The distributed hardware module define errno, range: [-10000, -19999]
25      * Here's common errno, range: [-10000, -10199]
26      */
27     constexpr int32_t DH_FWK_SUCCESS = 0;
28     constexpr int32_t ERR_DH_FWK_PARA_INVALID = -10000;
29     constexpr int32_t ERR_DH_FWK_REMOTE_NETWORK_ID_IS_EMPTY = -10001;
30     constexpr int32_t ERR_DH_FWK_REMOTE_DEVICE_ID_IS_EMPTY = -10002;
31     constexpr int32_t ERR_DH_FWK_TYPE_NOT_EXIST = -10003;
32     constexpr int32_t ERR_DH_FWK_JSON_PARSE_FAILED = -10004;
33     constexpr int32_t ERR_DH_FWK_POINTER_IS_NULL = -10005;
34 
35     /* VersionManager errno, range: [-10200, -10299] */
36     constexpr int32_t ERR_DH_FWK_VERSION_DEVICE_ID_NOT_EXIST = -10200;
37 
38     /* ComponentManager errno, range: [-10302, -10399] */
39     constexpr int32_t ERR_DH_FWK_COMPONENT_ENABLE_FAILED = -10302;
40     constexpr int32_t ERR_DH_FWK_COMPONENT_DISABLE_FAILED = -10303;
41     constexpr int32_t ERR_DH_FWK_COMPONENT_ENABLE_TIMEOUT = -10304;
42     constexpr int32_t ERR_DH_FWK_COMPONENT_DISABLE_TIMEOUT = -10305;
43     constexpr int32_t ERR_DH_FWK_COMPONENT_REGISTER_FAILED = -10306;
44     constexpr int32_t ERR_DH_FWK_COMPONENT_UNREGISTER_FAILED = -10007;
45     constexpr int32_t ERR_DH_FWK_COMPONENT_GET_REMOTE_SA_FAILED = -10008;
46     constexpr int32_t ERR_DH_FWK_COMPONENT_GET_SINK_VERSION_FAILED = -10009;
47     constexpr int32_t ERR_DH_FWK_COMPONENT_DHTYPE_NOT_FOUND = -10010;
48     constexpr int32_t ERR_DH_FWK_COMPONENT_MONITOR_NULL = -10011;
49     constexpr int32_t ERR_DH_FWK_COMPONENT_TRANSPORT_OPT_FAILED = -10012;
50     constexpr int32_t ERR_DH_FWK_COMPONENT_GET_ENABLE_PARAM_FAILED = -10013;
51 
52     /* ResourceManager errno, range: [-10400, -10499] */
53     constexpr int32_t ERR_DH_FWK_RESOURCE_DB_ADAPTER_POINTER_NULL = -10400;
54     constexpr int32_t ERR_DH_FWK_RESOURCE_KV_STORAGE_POINTER_NULL = -10401;
55     constexpr int32_t ERR_DH_FWK_RESOURCE_DB_ADAPTER_OPERATION_FAIL = -10402;
56     constexpr int32_t ERR_DH_FWK_RESOURCE_KV_STORAGE_OPERATION_FAIL = -10403;
57     constexpr int32_t ERR_DH_FWK_RESOURCE_CAPABILITY_MAP_NOT_FOUND = -10404;
58     constexpr int32_t ERR_DH_FWK_RESOURCE_DB_MANUAL_SYNC_FAIL = -10405;
59     constexpr int32_t ERR_DH_FWK_RESOURCE_INIT_DB_FAILED = -10406;
60     constexpr int32_t ERR_DH_FWK_RESOURCE_UNINIT_DB_FAILED = -10407;
61     constexpr int32_t ERR_DH_FWK_RESOURCE_REGISTER_DB_FAILED = -10408;
62     constexpr int32_t ERR_DH_FWK_RESOURCE_UNREGISTER_DB_FAILED = -10409;
63     constexpr int32_t ERR_DH_FWK_RESOURCE_KEY_IS_EMPTY = -10410;
64     constexpr int32_t ERR_DH_FWK_RESOURCE_SYNC_VERSIONINFO_FAIL = -10411;
65     constexpr int32_t ERR_DH_FWK_RESOURCE_DEVICE_ID_NOT_EXIST = -10412;
66     constexpr int32_t ERR_DH_FWK_RESOURCE_UUID_NOT_FOUND = -10413;
67     constexpr int32_t ERR_DH_FWK_RESOURCE_CAPINFO_POINTER_NULL = -10414;
68     constexpr int32_t ERR_DH_FWK_RESOURCE_RES_DB_DATA_INVALID = -10415;
69 
70     /* DistributedHardwareManager errno, range: [-10500, -10599] */
71     constexpr int32_t ERR_DH_FWK_HARDWARE_MANAGER_DEVICE_REPEAT_ONLINE = -10500;
72     constexpr int32_t ERR_DH_FWK_HARDWARE_MANAGER_DEVICE_REPEAT_OFFLINE = -10501;
73     constexpr int32_t ERR_DH_FWK_HARDWARE_MANAGER_INIT_FAILED = -10502;
74 
75     /* ComponentLoader errno, range: [-10600, -10699] */
76     constexpr int32_t ERR_DH_FWK_LOADER_HANDLER_IS_NULL = -10600;
77     constexpr int32_t ERR_DH_FWK_LOADER_CONFIG_JSON_INVALID = -10601;
78     constexpr int32_t ERR_DH_FWK_LOADER_GET_LOCAL_VERSION_FAIL = -10602;
79     constexpr int32_t ERR_DH_FWK_LOADER_DLCLOSE_FAIL = -10603;
80     constexpr int32_t ERR_DH_FWK_LOADER_PROFILE_PATH_IS_NULL = -10604;
81 
82     /* Task errno, range: [-10700, -10799] */
83     constexpr int32_t ERR_DH_FWK_TASK_TIMEOUT = -10700;
84 
85     /* DistributedHardwareService errno, range: [-10800, -10899] */
86     constexpr int32_t ERR_DH_FWK_SERVICE_IPC_WRITE_PARA_FAIL = -10800;
87     constexpr int32_t ERR_DH_FWK_SERVICE_IPC_SEND_REQUEST_FAIL = -10801;
88     constexpr int32_t ERR_DH_FWK_SERVICE_IPC_READ_PARA_FAIL = -10802;
89     constexpr int32_t ERR_DH_FWK_SERVICE_STRING_IS_EMPTY = -10803;
90     constexpr int32_t ERR_DH_FWK_SERVICE_LOCAL_VERSION_NOT_EXIST = -10804;
91     constexpr int32_t ERR_DH_FWK_SERVICE_WRITE_TOKEN_FAIL = -10805;
92     constexpr int32_t ERR_DH_FWK_SERVICE_REMOTE_IS_NULL = -10806;
93     constexpr int32_t ERR_DH_FWK_SERVICE_WRITE_INFO_FAIL = -10807;
94     constexpr int32_t ERR_DH_FWK_PUBLISHER_LISTENER_IS_NULL = -10808;
95     constexpr int32_t ERR_DH_FWK_SERVICE_MSG_INVALID = -10809;
96     constexpr int32_t ERR_DH_FWK_AVTRANS_CALLBACK_IS_NULL = -10810;
97 
98     /* AccessManager errno, range: [-10900, -10999] */
99     constexpr int32_t ERR_DH_FWK_ACCESS_INIT_DM_FAILED = -10900;
100     constexpr int32_t ERR_DH_FWK_ACCESS_UNINIT_DM_FAILED = -10901;
101     constexpr int32_t ERR_DH_FWK_ACCESS_REGISTER_DM_FAILED = -10902;
102     constexpr int32_t ERR_DH_FWK_ACCESS_UNREGISTER_DM_FAILED = -10903;
103 
104     /* Hidump errno, range: [-11000, -11099] */
105     constexpr int32_t ERR_DH_FWK_HIDUMP_ERROR = -11000;
106     constexpr int32_t ERR_DH_FWK_HIDUMP_INVALID_ARGS = -11001;
107     constexpr int32_t ERR_DH_FWK_HIDUMP_DPRINTF_ERROR = -11002;
108 
109     /* DHFWK Publisher errno, range: [-11100, -11199] */
110     constexpr int32_t ERR_DH_FWK_PUBLISH_MSG_FAILED = -11100;
111     constexpr uint32_t ERR_DH_FWK_PUBLISH_LISTENER_OVER_SIZE = -11101;
112 
113     /* DHFWK Check Permission errno, range: [-11200, -11299] */
114     constexpr int32_t ERR_DH_FWK_ACCESS_PERMISSION_CHECK_FAIL = -11200;
115     constexpr int32_t ERR_DH_FWK_IS_SYSTEM_HAP_CHECK_FAIL = -11201;
116 } // namespace DistributedHardware
117 } // namespace OHOS
118 #endif // OHOS_DISTRIBUTED_HARDWARE_ERRNO
119