• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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 USB_ERRORS_H
17 #define USB_ERRORS_H
18 
19 #include <errors.h>
20 #include <cstdint>
21 
22 namespace OHOS {
23 namespace USB {
24 enum UsbModuleType {
25     USB_MODULE_TYPE_SERVICE = 0,
26     USB_MODULE_TYPE_KIT = 1,
27 };
28 
29 const std::string PERMISSION_DENIED_SYSAPI = "PERMISSION_DENIED_SYSAPI";
30 
31 #define USB_OFFSET 100
32 
33 constexpr int32_t USBFWK_SERVICE_ERR_OFFSET = ErrCodeOffset(SUBSYS_USB, USB_MODULE_TYPE_SERVICE);
34 
35 enum UsbErrCode {
36     UEC_OK = 0,
37 
38     UEC_INTERFACE_NO_MEMORY = USBFWK_SERVICE_ERR_OFFSET,
39     UEC_INTERFACE_INVALID_OPERATION,
40     UEC_INTERFACE_INVALID_VALUE,
41     UEC_INTERFACE_NAME_NOT_FOUND,
42     UEC_INTERFACE_PERMISSION_DENIED,
43     UEC_INTERFACE_NO_INIT,
44     UEC_INTERFACE_ALREADY_EXISTS,
45     UEC_INTERFACE_DEAD_OBJECT,
46     UEC_INTERFACE_OVERFLOW,
47     UEC_INTERFACE_ENOUGH_DATA,
48     UEC_INTERFACE_WOULD_BLOCK,
49     UEC_INTERFACE_TIMED_OUT,
50     UEC_INTERFACE_WRITE_PARCEL_ERROR,
51     UEC_INTERFACE_READ_PARCEL_ERROR,
52     UEC_INTERFACE_GET_SYSTEM_ABILITY_MANAGER_FAILED,
53     UEC_INTERFACE_GET_USB_SERVICE_FAILED,
54     UEC_INTERFACE_ADD_DEATH_RECIPIENT_FAILED,
55     UEC_INTERFACE_INNER_ERR,
56     UEC_INTREFACE_END,
57 
58     UEC_SERVICE_NO_MEMORY = USBFWK_SERVICE_ERR_OFFSET + USB_OFFSET,
59     UEC_SERVICE_INVALID_OPERATION,
60     UEC_SERVICE_INVALID_VALUE,
61     UEC_SERVICE_NAME_NOT_FOUND,
62     UEC_SERVICE_PERMISSION_DENIED,
63     UEC_SERVICE_NO_INIT,
64     UEC_SERVICE_ALREADY_EXISTS,
65     UEC_SERVICE_DEAD_OBJECT,
66     UEC_SERVICE_OVERFLOW,
67     UEC_SERVICE_ENOUGH_DATA,
68     UEC_SERVICE_WOULD_BLOCK,
69     UEC_SERVICE_TIMED_OUT,
70     UEC_SERVICE_WRITE_PARCEL_ERROR,
71     UEC_SERVICE_READ_PARCEL_ERROR,
72     UEC_SERVICE_GET_SYSTEM_ABILITY_MANAGER_FAILED,
73     UEC_SERVICE_GET_USB_SERVICE_FAILED,
74     UEC_SERVICE_ADD_DEATH_RECIPIENT_FAILED,
75     UEC_SERVICE_INNER_ERR,
76     UEC_SERVICE_PERMISSION_DENIED_SYSAPI,
77     UEC_SERVICE_PERMISSION_CHECK_HDC,
78     UEC_SERVICE_END,
79 };
80 
81 enum UsbRightErrCode {
82     USB_RIGHT_OK = 0,
83     USB_RIGHT_FAILURE = -1,
84     USB_RIGHT_RDB_EXECUTE_FAILTURE = -2,
85     USB_RIGHT_RDB_NO_INIT = -3,
86     USB_RIGHT_RDB_EMPTY = -4,
87     USB_RIGHT_PERMISSION_DENIED = -5,
88     USB_RIGHT_NOP = -6,
89     USB_RIGHT_OVERFLOW = -7,
90 };
91 
92 } // namespace USB
93 } // namespace OHOS
94 #endif // USB_ERRORS_H
95