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_NOT_SUPPORT_SWITCH_PORT, 79 UEC_SERVICE_END, 80 UEC_SERVICE_PRE_MANAGE_INTERFACE_FAILED, 81 UEC_SERVICE_EXECUTE_POLICY_FAILED, 82 UEC_SERVICE_PREPARE_EDM_SA_FAILED, 83 UEC_SERVICE_GET_EDM_SERVICE_FAILED, 84 UEC_SERVICE_EDM_DEVICE_SIZE_EXCEED, 85 UEC_SERVICE_EDM_SA_TIME_OUT_FAILED, 86 UEC_SERVICE_EDM_SEND_REQUEST_FAILED, 87 }; 88 89 enum UsbRightErrCode { 90 USB_RIGHT_OK = 0, 91 USB_RIGHT_FAILURE = -1, 92 USB_RIGHT_RDB_EXECUTE_FAILTURE = -2, 93 USB_RIGHT_RDB_NO_INIT = -3, 94 USB_RIGHT_RDB_EMPTY = -4, 95 USB_RIGHT_PERMISSION_DENIED = -5, 96 USB_RIGHT_NOP = -6, 97 USB_RIGHT_OVERFLOW = -7, 98 }; 99 100 } // namespace USB 101 } // namespace OHOS 102 #endif // USB_ERRORS_H 103