1 /* 2 * Copyright (c) 2023 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 common_event_sys_errors.h 18 * 19 * @brief Provide value of 'Code' segment of ErrCode for 'EventSystem' module in 20 * commonlibrary subsystem. 21 */ 22 23 #ifndef UTILS_COMMON_EVENT_SYS_ERRORS_H 24 #define UTILS_COMMON_EVENT_SYS_ERRORS_H 25 26 #include <cerrno> 27 #include "errors.h" 28 #include "common_errors.h" 29 30 namespace OHOS { 31 namespace Utils { 32 33 /** 34 * ErrCode layout 35 * 36 * +-----+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ 37 * | Bit |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|09|08|07|06|05|04|03|02|01|00| 38 * +-----+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ 39 * |Field|Reserved| Subsystem | Module | Code | 40 * +-----+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ 41 * 42 * In this file, subsystem is "SUBSYS_COMMON" and module is "MODULE_EVENT_SYSTEM". 43 */ 44 45 using ErrCode = int; 46 47 // offset of event system module error, only be used in this file. 48 /** 49 * @brief Base ErrCode of module 'EventSystem' in commonlibrary subsystem. 50 */ 51 constexpr ErrCode COMMON_EVENT_SYS_ERR_OFFSET = ErrCodeOffset(SUBSYS_COMMON, MODULE_EVENT_SYS); 52 53 enum { 54 EVENT_SYS_ERR_OK = COMMON_EVENT_SYS_ERR_OFFSET + 0, 55 EVENT_SYS_ERR_FAILED = COMMON_EVENT_SYS_ERR_OFFSET + 1, 56 EVENT_SYS_ERR_ALREADY_STARTED = COMMON_EVENT_SYS_ERR_OFFSET + 2, 57 EVENT_SYS_ERR_NOT_FOUND = COMMON_EVENT_SYS_ERR_OFFSET + 3, 58 EVENT_SYS_ERR_BADF = COMMON_EVENT_SYS_ERR_OFFSET + 4, 59 EVENT_SYS_ERR_BADEVENT = COMMON_EVENT_SYS_ERR_OFFSET + 5, 60 EVENT_SYS_ERR_NOEVENT = COMMON_EVENT_SYS_ERR_OFFSET + 6, 61 }; 62 63 } // Utils 64 } // OHOS 65 66 #endif 67