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 ERROR_MULTIMODAL_H 17 #define ERROR_MULTIMODAL_H 18 19 #include <errors.h> 20 21 namespace OHOS { 22 namespace MMI { 23 inline constexpr int32_t ERROR_UNSUPPORT = -2; 24 inline constexpr int32_t ARGV_VALID = 2; 25 inline constexpr int32_t ERROR_NO_PERMISSION = -201; 26 27 enum MmiModuleType { 28 MODULE_CLIENT = 0x00, 29 MODULE_EVENT_SIMULATE = 0x01, 30 MODULE_SERVER = 0x02, 31 MODULE_UTIL = 0x03 32 }; 33 // Error code for client 34 constexpr ErrCode CLIENT_ERR_OFFSET = ErrCodeOffset(SUBSYS_MULTIMODAINPUT, MODULE_CLIENT); 35 36 enum { 37 EVENT_CONSUM_FAIL = CLIENT_ERR_OFFSET, // 事件消费失败 38 CHECK_PERMISSION_FAIL // APL鉴权失败 39 }; 40 // Error code for event simulate 41 constexpr ErrCode EVENT_SIMULATE_ERR_OFFSET = ErrCodeOffset(SUBSYS_MULTIMODAINPUT, MODULE_EVENT_SIMULATE); 42 43 enum { 44 FILE_OPEN_FAIL = EVENT_SIMULATE_ERR_OFFSET, // 文件打开失败 45 STREAM_BUF_READ_FAIL, // 流缓冲读取失败 46 EVENT_REG_FAIL, // 事件注册失败 47 PARAM_INPUT_FAIL // 注入携带参数错误 48 }; 49 // Error code for server 50 constexpr ErrCode SERVER_ERR_OFFSET = ErrCodeOffset(SUBSYS_MULTIMODAINPUT, MODULE_SERVER); 51 52 enum { 53 MSG_SEND_FAIL = SERVER_ERR_OFFSET, // 发送消息失败 54 UNKNOWN_EVENT, // 未知的事件 55 ERROR_NULL_POINTER, // 空指针 56 WINDOWS_MSG_INIT_FAIL, // 窗口管理器初始化失败 57 LIBINPUT_INIT_FAIL, // libinput初始化失败 58 PARAM_INPUT_INVALID, // 无效的输入参数 59 KEY_EVENT_DISP_FAIL, // 键盘事件派发失败 60 MEMCPY_SEC_FUN_FAIL, // memcpy安全函数错误 61 KEY_EVENT_PKG_FAIL, // 键盘事件封装失败 62 SPRINTF_S_SEC_FUN_FAIL, // sprintf_s安全函数错误 63 MULTIDEVICE_SAME_EVENT_MARK, // 多设备相同事件返回标志 64 GESTURE_EVENT_PKG_FAIL, // GESTURE_SWIPE事件封装失败 65 GESTURE_EVENT_DISP_FAIL, // gesture swipe事件派发失败 66 SASERVICE_INIT_FAIL, // SA_Service初始化错误 67 SASERVICE_PERMISSION_FAIL, // SA_Service权限不足 68 ADD_SESSION_FAIL, // 增加session错误 69 MAKE_SHARED_FAIL, // make_shared错误 70 FCNTL_FAIL, // fcntl 函数调用错误 71 PACKET_WRITE_FAIL, // 写入数据错误 72 PACKET_READ_FAIL, // 读取数据错误 73 POINTER_DRAW_INIT_FAIL, // 初始化画鼠标失败 74 MMISERVICE_NOT_RUNNING, // 多模服务未启动 75 ETASKS_INIT_FAIL, // 代理任务启动失败 76 ETASKS_QUEUE_FULL, // 委托任务队列已满 77 ETASKS_WAIT_TIMEOUT, // 委托任务wait超时 78 ETASKS_WAIT_DEFERRED, // 委托任务wait延期 79 ETASKS_POST_SYNCTASK_FAIL, // 生成同步任务失败 80 ETASKS_POST_ASYNCTASK_FAIL, // 生成异步任务失败 81 DUMP_PARAM_ERR // DUMP参数错误 82 }; 83 // Error code for util 84 constexpr ErrCode UTIL_ERR_OFFSET = ErrCodeOffset(SUBSYS_MULTIMODAINPUT, MODULE_UTIL); 85 86 enum { 87 NON_STD_EVENT = UTIL_ERR_OFFSET, // 非标准化事件 88 UNPROC_MSG, // 未处理的消息 89 UNKNOWN_MSG_ID, // 未知消息ID 90 UNKNOWN_DEV, // 未知设备 91 FILE_READ_FAIL, // 文件读取失败 92 FILE_WRITE_FAIL, // 文件写入失败 93 API_PARAM_TYPE_FAIL, // api参数类型错误 94 API_OUT_OF_RANGE, // api返回值超出定义范围 95 FOCUS_ID_OBTAIN_FAIL, // 获取focus_id失败 96 EPOLL_CREATE_FAIL, // EPOLL创建失败 97 EPOLL_MODIFY_FAIL, // 修改EPOLL失败 98 STREAM_BUF_WRITE_FAIL, // 流缓冲写入失败 99 VAL_NOT_EXP, // 值不符合预期 100 MEM_NOT_ENOUGH, // 没有足够的内存 101 MEM_OUT_OF_BOUNDS, // 内存越界 102 SESSION_NOT_FOUND, // 没有找到session 103 INVALID_MONITOR_MON // 监听增加失败 104 }; 105 106 enum REGISTER { 107 MMI_STANDARD_EVENT_SUCCESS = 1, 108 MMI_STANDARD_EVENT_INVALID_PARAM = -1, 109 }; 110 111 enum MMI_SERVICE_STATUS { 112 MMI_SERVICE_INVALID = -1, // 多模服务不存在,多模输入服务异常 113 }; 114 } // namespace MMI 115 } // namespace OHOS 116 #endif // ERROR_MULTIMODAL_H