1f857971dSopenharmony_ci/*
2f857971dSopenharmony_ci * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
3f857971dSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4f857971dSopenharmony_ci * you may not use this file except in compliance with the License.
5f857971dSopenharmony_ci * You may obtain a copy of the License at
6f857971dSopenharmony_ci *
7f857971dSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8f857971dSopenharmony_ci *
9f857971dSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10f857971dSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11f857971dSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12f857971dSopenharmony_ci * See the License for the specific language governing permissions and
13f857971dSopenharmony_ci * limitations under the License.
14f857971dSopenharmony_ci */
15f857971dSopenharmony_ci
16f857971dSopenharmony_ci#ifndef DEVICESTATUS_ERRORS_H
17f857971dSopenharmony_ci#define DEVICESTATUS_ERRORS_H
18f857971dSopenharmony_ci
19f857971dSopenharmony_ci#include <errors.h>
20f857971dSopenharmony_ci
21f857971dSopenharmony_cinamespace OHOS {
22f857971dSopenharmony_cinamespace Msdp {
23f857971dSopenharmony_cinamespace DeviceStatus {
24f857971dSopenharmony_cienum {
25f857971dSopenharmony_ci    DEVICESTATUS_MODULE_TYPE_SERVICE = 0,
26f857971dSopenharmony_ci    DEVICESTATUS_MODULE_TYPE_KIT = 1,
27f857971dSopenharmony_ci    DEVICESTATUS_MODULE_TYPE_CLIENT = 2
28f857971dSopenharmony_ci};
29f857971dSopenharmony_ci
30f857971dSopenharmony_ciconstexpr ErrCode DEVICESTATUS_SERVICE_ERR_OFFSET = ErrCodeOffset(SUBSYS_MSDP, DEVICESTATUS_MODULE_TYPE_SERVICE);
31f857971dSopenharmony_ci
32f857971dSopenharmony_cienum {
33f857971dSopenharmony_ci    E_DEVICESTATUS_WRITE_PARCEL_ERROR = DEVICESTATUS_SERVICE_ERR_OFFSET,
34f857971dSopenharmony_ci    E_DEVICESTATUS_READ_PARCEL_ERROR,
35f857971dSopenharmony_ci    E_DEVICESTATUS_GET_SYSTEM_ABILITY_MANAGER_FAILED,
36f857971dSopenharmony_ci    E_DEVICESTATUS_GET_SERVICE_FAILED,
37f857971dSopenharmony_ci    E_DEVICESTATUS_ADD_DEATH_RECIPIENT_FAILED,
38f857971dSopenharmony_ci    E_DEVICESTATUS_INNER_ERR,
39f857971dSopenharmony_ci    ETASKS_INIT_FAIL,
40f857971dSopenharmony_ci    ETASKS_WAIT_TIMEOUT,
41f857971dSopenharmony_ci    ETASKS_WAIT_DEFERRED,
42f857971dSopenharmony_ci    ETASKS_POST_SYNCTASK_FAIL,
43f857971dSopenharmony_ci    ETASKS_POST_ASYNCTASK_FAIL,
44f857971dSopenharmony_ci    EPOLL_CREATE_FAIL,
45f857971dSopenharmony_ci    MSG_SEND_FAIL
46f857971dSopenharmony_ci};
47f857971dSopenharmony_ci
48f857971dSopenharmony_cienum {
49f857971dSopenharmony_ci    FILE_OPEN_FAIL = ErrCodeOffset(SUBSYS_MSDP, DEVICESTATUS_MODULE_TYPE_KIT),
50f857971dSopenharmony_ci    STREAM_BUF_READ_FAIL,
51f857971dSopenharmony_ci    EVENT_REG_FAIL,
52f857971dSopenharmony_ci    PARAM_INPUT_FAIL
53f857971dSopenharmony_ci};
54f857971dSopenharmony_ci
55f857971dSopenharmony_cienum {
56f857971dSopenharmony_ci    NON_STD_EVENT = ErrCodeOffset(SUBSYS_MSDP, DEVICESTATUS_MODULE_TYPE_CLIENT),
57f857971dSopenharmony_ci    VAL_NOT_EXP,
58f857971dSopenharmony_ci    ERROR_UNSUPPORT,
59f857971dSopenharmony_ci    ERROR_NULL_POINTER
60f857971dSopenharmony_ci};
61f857971dSopenharmony_ci
62f857971dSopenharmony_cienum {
63f857971dSopenharmony_ci    DEVICESTATUS_OK = 0,
64f857971dSopenharmony_ci    DEVICESTATUS_FAILED = -1,
65f857971dSopenharmony_ci    DEVICESTATUS_INVALID_FD = -2,
66f857971dSopenharmony_ci    DEVICESTATUS_NOT_FIND_JSON_ITEM = -3
67f857971dSopenharmony_ci};
68f857971dSopenharmony_ci
69f857971dSopenharmony_cienum {
70f857971dSopenharmony_ci    INIT_FAIL = -1,
71f857971dSopenharmony_ci    INIT_SUCCESS = 0,
72f857971dSopenharmony_ci    INIT_CANCEL = 1
73f857971dSopenharmony_ci};
74f857971dSopenharmony_ci
75f857971dSopenharmony_cienum ErrorCode : int32_t {
76f857971dSopenharmony_ci    OTHER_ERROR = -1,
77f857971dSopenharmony_ci    COMMON_PERMISSION_CHECK_ERROR = 201,
78f857971dSopenharmony_ci    COMMON_NOT_SYSTEM_APP = 202,
79f857971dSopenharmony_ci    COMMON_PARAMETER_ERROR = 401,
80f857971dSopenharmony_ci    COMMON_NOT_ALLOWED_DISTRIBUTED = 40101,
81f857971dSopenharmony_ci    COOPERATOR_FAIL = 20900001
82f857971dSopenharmony_ci};
83f857971dSopenharmony_ci
84f857971dSopenharmony_cienum CustomErrCode : int32_t {
85f857971dSopenharmony_ci    UNKNOWN_ERROR = -1,
86f857971dSopenharmony_ci    OPEN_SESSION_FAILED = 20900002,
87f857971dSopenharmony_ci    SEND_PACKET_FAILED = 20900003,
88f857971dSopenharmony_ci    UNEXPECTED_START_CALL = 20900004,
89f857971dSopenharmony_ci    WORKER_THREAD_TIMEOUT = 20900005,
90f857971dSopenharmony_ci};
91f857971dSopenharmony_ci} // namespace DeviceStatus
92f857971dSopenharmony_ci} // namespace Msdp
93f857971dSopenharmony_ci} // namespace OHOS
94f857971dSopenharmony_ci
95f857971dSopenharmony_ci#endif // DEVICESTATUS_ERRORS_H
96