142103316Sopenharmony_ci/*
242103316Sopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
342103316Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
442103316Sopenharmony_ci * you may not use this file except in compliance with the License.
542103316Sopenharmony_ci * You may obtain a copy of the License at
642103316Sopenharmony_ci *
742103316Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
842103316Sopenharmony_ci *
942103316Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1042103316Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1142103316Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1242103316Sopenharmony_ci * See the License for the specific language governing permissions and
1342103316Sopenharmony_ci * limitations under the License.
1442103316Sopenharmony_ci */
1542103316Sopenharmony_ci
1642103316Sopenharmony_ci#ifndef USB_ERRORS_H
1742103316Sopenharmony_ci#define USB_ERRORS_H
1842103316Sopenharmony_ci
1942103316Sopenharmony_ci#include <errors.h>
2042103316Sopenharmony_ci#include <cstdint>
2142103316Sopenharmony_ci#include <string>
2242103316Sopenharmony_ci
2342103316Sopenharmony_cinamespace OHOS {
2442103316Sopenharmony_cinamespace USB {
2542103316Sopenharmony_cienum UsbModuleType {
2642103316Sopenharmony_ci    USB_MODULE_TYPE_SERVICE = 0,
2742103316Sopenharmony_ci    USB_MODULE_TYPE_KIT = 1,
2842103316Sopenharmony_ci};
2942103316Sopenharmony_ci
3042103316Sopenharmony_ciconst std::string PERMISSION_DENIED_SYSAPI = "PERMISSION_DENIED_SYSAPI";
3142103316Sopenharmony_ci
3242103316Sopenharmony_ci#define USB_OFFSET 100
3342103316Sopenharmony_ci
3442103316Sopenharmony_ciconstexpr int32_t USBFWK_SERVICE_ERR_OFFSET = ErrCodeOffset(SUBSYS_USB, USB_MODULE_TYPE_SERVICE);
3542103316Sopenharmony_ci
3642103316Sopenharmony_cienum UsbErrCode {
3742103316Sopenharmony_ci    UEC_OK = 0,
3842103316Sopenharmony_ci
3942103316Sopenharmony_ci    UEC_INTERFACE_NO_MEMORY = USBFWK_SERVICE_ERR_OFFSET,
4042103316Sopenharmony_ci    UEC_INTERFACE_INVALID_OPERATION,
4142103316Sopenharmony_ci    UEC_INTERFACE_INVALID_VALUE,
4242103316Sopenharmony_ci    UEC_INTERFACE_NAME_NOT_FOUND,
4342103316Sopenharmony_ci    UEC_INTERFACE_PERMISSION_DENIED,
4442103316Sopenharmony_ci    UEC_INTERFACE_NO_INIT,
4542103316Sopenharmony_ci    UEC_INTERFACE_ALREADY_EXISTS,
4642103316Sopenharmony_ci    UEC_INTERFACE_DEAD_OBJECT,
4742103316Sopenharmony_ci    UEC_INTERFACE_OVERFLOW,
4842103316Sopenharmony_ci    UEC_INTERFACE_ENOUGH_DATA,
4942103316Sopenharmony_ci    UEC_INTERFACE_WOULD_BLOCK,
5042103316Sopenharmony_ci    UEC_INTERFACE_TIMED_OUT,
5142103316Sopenharmony_ci    UEC_INTERFACE_WRITE_PARCEL_ERROR,
5242103316Sopenharmony_ci    UEC_INTERFACE_READ_PARCEL_ERROR,
5342103316Sopenharmony_ci    UEC_INTERFACE_GET_SYSTEM_ABILITY_MANAGER_FAILED,
5442103316Sopenharmony_ci    UEC_INTERFACE_GET_USB_SERVICE_FAILED,
5542103316Sopenharmony_ci    UEC_INTERFACE_ADD_DEATH_RECIPIENT_FAILED,
5642103316Sopenharmony_ci    UEC_INTERFACE_INNER_ERR,
5742103316Sopenharmony_ci    UEC_INTREFACE_END,
5842103316Sopenharmony_ci
5942103316Sopenharmony_ci    UEC_SERVICE_NO_MEMORY = USBFWK_SERVICE_ERR_OFFSET + USB_OFFSET,
6042103316Sopenharmony_ci    UEC_SERVICE_INVALID_OPERATION,
6142103316Sopenharmony_ci    UEC_SERVICE_INVALID_VALUE,
6242103316Sopenharmony_ci    UEC_SERVICE_NAME_NOT_FOUND,
6342103316Sopenharmony_ci    UEC_SERVICE_PERMISSION_DENIED,
6442103316Sopenharmony_ci    UEC_SERVICE_NO_INIT,
6542103316Sopenharmony_ci    UEC_SERVICE_ALREADY_EXISTS,
6642103316Sopenharmony_ci    UEC_SERVICE_DEAD_OBJECT,
6742103316Sopenharmony_ci    UEC_SERVICE_OVERFLOW,
6842103316Sopenharmony_ci    UEC_SERVICE_ENOUGH_DATA,
6942103316Sopenharmony_ci    UEC_SERVICE_WOULD_BLOCK,
7042103316Sopenharmony_ci    UEC_SERVICE_TIMED_OUT,
7142103316Sopenharmony_ci    UEC_SERVICE_WRITE_PARCEL_ERROR,
7242103316Sopenharmony_ci    UEC_SERVICE_READ_PARCEL_ERROR,
7342103316Sopenharmony_ci    UEC_SERVICE_GET_SYSTEM_ABILITY_MANAGER_FAILED,
7442103316Sopenharmony_ci    UEC_SERVICE_GET_USB_SERVICE_FAILED,
7542103316Sopenharmony_ci    UEC_SERVICE_ADD_DEATH_RECIPIENT_FAILED,
7642103316Sopenharmony_ci    UEC_SERVICE_INNER_ERR,
7742103316Sopenharmony_ci    UEC_SERVICE_PERMISSION_DENIED_SYSAPI,
7842103316Sopenharmony_ci    UEC_SERVICE_PERMISSION_CHECK_HDC,
7942103316Sopenharmony_ci    UEC_SERVICE_NOT_SUPPORT_SWITCH_PORT,
8042103316Sopenharmony_ci    UEC_SERVICE_END,
8142103316Sopenharmony_ci    UEC_SERVICE_PRE_MANAGE_INTERFACE_FAILED,
8242103316Sopenharmony_ci    UEC_SERVICE_EXECUTE_POLICY_FAILED,
8342103316Sopenharmony_ci    UEC_SERVICE_PREPARE_EDM_SA_FAILED,
8442103316Sopenharmony_ci    UEC_SERVICE_GET_EDM_SERVICE_FAILED,
8542103316Sopenharmony_ci    UEC_SERVICE_EDM_DEVICE_SIZE_EXCEED,
8642103316Sopenharmony_ci    UEC_SERVICE_EDM_SA_TIME_OUT_FAILED,
8742103316Sopenharmony_ci    UEC_SERVICE_EDM_SEND_REQUEST_FAILED,
8842103316Sopenharmony_ci    UEC_SERVICE_OBJECT_CREATE_FAILED,
8942103316Sopenharmony_ci};
9042103316Sopenharmony_ci
9142103316Sopenharmony_cienum UsbRightErrCode {
9242103316Sopenharmony_ci    USB_RIGHT_OK = 0,
9342103316Sopenharmony_ci    USB_RIGHT_FAILURE = -1,
9442103316Sopenharmony_ci    USB_RIGHT_RDB_EXECUTE_FAILTURE = -2,
9542103316Sopenharmony_ci    USB_RIGHT_RDB_NO_INIT = -3,
9642103316Sopenharmony_ci    USB_RIGHT_RDB_EMPTY = -4,
9742103316Sopenharmony_ci    USB_RIGHT_PERMISSION_DENIED = -5,
9842103316Sopenharmony_ci    USB_RIGHT_NOP = -6,
9942103316Sopenharmony_ci    USB_RIGHT_OVERFLOW = -7,
10042103316Sopenharmony_ci};
10142103316Sopenharmony_ci
10242103316Sopenharmony_ci} // namespace USB
10342103316Sopenharmony_ci} // namespace OHOS
10442103316Sopenharmony_ci#endif // USB_ERRORS_H
105