1 /* 2 * Copyright (c) 2021 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 /** 17 * @file camera_errors.h 18 * 19 * @brief Declares the <b>camera_errors</b> class to define errors that may occur during camera operations. 20 * 21 * 22 * @since 1.0 23 * @version 1.0 24 */ 25 26 #ifndef CAMERA_ERRORS_H 27 #define CAMERA_ERRORS_H 28 29 #include <cstdint> 30 31 32 namespace OHOS::Camera { 33 constexpr int MODULE_CAMERA = 1; 34 35 using ErrCode = int32_t; 36 37 /** 38 * @brief Generates a start error code with a unique identifier based on specified subsystem and module bit numbers. 39 * 40 * @param subsystem Indicates the subsystem bit number. 41 * @param module Indicates the module bit number. 42 * @return 43 * @since 1.0 44 * @version 1.0 45 */ 46 47 constexpr int32_t BASE_CAMERA_ERR_OFFSET = ErrCodeOffset(SUBSYS_CAMERA, MODULE_CAMERA); 48 49 /** Status error */ 50 const int32_t ERR_ILLEGAL_STATE = BASE_CAMERA_ERR_OFFSET; 51 52 /** Invalid parameter */ 53 const int32_t ERR_INVALID_PARAM = BASE_CAMERA_ERR_OFFSET + 1; 54 55 /** Null Ptr */ 56 const int32_t ERR_NULL_PTR = BASE_CAMERA_ERR_OFFSET + 2; 57 58 /** Alloc Fail */ 59 const int32_t ERR_MEM_ALLOC_FAIL = BASE_CAMERA_ERR_OFFSET + 3; 60 61 /** Invalid operation */ 62 const int32_t ERR_INVALID_OPERATION = BASE_CAMERA_ERR_OFFSET + 4; 63 64 /** Device Unexist */ 65 const int32_t ERR_DEVICE_UNEXIST = BASE_CAMERA_ERR_OFFSET + 5; 66 67 /** Device Busy */ 68 const int32_t ERR_DEVICE_BUSY = BASE_CAMERA_ERR_OFFSET + 6; 69 70 /** Device Connect Fail */ 71 const int32_t ERR_DEVICE_CONNECT_FAIL = BASE_CAMERA_ERR_OFFSET + 7; 72 73 /** Process Fail */ 74 const int32_t ERR_PROCESS_FAIL = BASE_CAMERA_ERR_OFFSET + 8; 75 76 /** Wait TimeOut */ 77 const int32_t ERR_WAIT_TIMEOUT = BASE_CAMERA_ERR_OFFSET + 9; 78 79 /** Config TimeOut */ 80 const int32_t ERR_CFG_TIMEOUT = BASE_CAMERA_ERR_OFFSET + 10; 81 82 /** Invalid Pattern */ 83 const int32_t ERR_INVALID_PATTERN = BASE_CAMERA_ERR_OFFSET + 11; 84 85 /** Invalid Camera Id */ 86 const int32_t ERR_INVALID_CAMERA_ID = BASE_CAMERA_ERR_OFFSET + 12; 87 88 /** Unknown error */ 89 const int32_t ERR_UNKNOWN = BASE_CAMERA_ERR_OFFSET + 200; 90 } // namespace OHOS::Camera 91 #endif // CAMERA_ERRORS_H 92