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 #include <errors.h> 19 20 namespace OHOS { 21 enum MmiModuleType { 22 MODULE_CLIENT = 0x00, 23 MODULE_EVENT_SIMULATE = 0x01, 24 MODULE_SERVER = 0x02, 25 MODULE_UTIL = 0x03, 26 MODULE_VIRTUAL_DEVICE = 0x04, 27 MODULE_NAPI = 0x05 28 }; 29 // Error code for client 30 constexpr ErrCode CLIENT_ERR_OFFSET = ErrCodeOffset(SUBSYS_MULTIMODAINPUT, MODULE_CLIENT); 31 32 enum { 33 MSG_HANDLER_INIT_FAIL = CLIENT_ERR_OFFSET, // 消息处理初始化失败 34 START_CLI_FAIL, // 客户端启动失败 35 EVENT_CONSUM_FAIL, // 事件消费失败 36 UNKNOW_TOUCH_TYPE, // 客户端处理Touch时间时,收到了客户端发来的位置类型 37 STRCPY_S_CALLBACK_FAIL, // strcpy_s返回错误 38 }; 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 EVENT_DATA_LEN_INPUT_FAIL, // 注入事件的数据长度错误 49 TOUCH_CMD_INPUT_FAIL, // 注入的touch命令无效 50 STRSET_SEC_FUN_FAIL, // strset安全函数错误 51 DRIVE_PATH_INVALID, // 无效的驱动列表文件路径 52 CMD_PATH_INVALID, // 无效的指令集文件路径 53 CMD_STR_INVALID, // 无效指令字符串 54 }; 55 // Error code for server 56 constexpr ErrCode SERVER_ERR_OFFSET = ErrCodeOffset(SUBSYS_MULTIMODAINPUT, MODULE_SERVER); 57 58 enum { 59 MSG_SEND_FAIL = SERVER_ERR_OFFSET, // 发送消息失败 60 UNKNOWN_EVENT, // 未知的事件 61 ERROR_NULL_POINTER, // 空指针 62 WINDOWS_MSG_INIT_FAIL, // 窗口管理器初始化失败 63 SVR_MSG_HANDLER_INIT_FAIL, // 服务消息处理初始化失败 64 INPUT_EVENT_HANDLER_INIT_FAIL, // 输入事件处理初始化失败 65 LIBINPUT_INIT_FAIL, // libinput初始化失败 66 LIBINPUT_START_FAIL, // libinput启动失败 67 LIBMMI_SVR_START_FAIL, // 多模服务启动失败 68 LOG_CONFIG_FAIL, // log4z配置失败 69 LOG_START_FAIL, // log4z启动失败 70 PARAM_INPUT_INVALID, // 无效的输入参数 71 INVALID_PARAM, // 无效的参数 72 SENIOR_INPUT_DEV_INIT_FAIL, // 高级输入设备初始化失败 73 LIBINPUT_DEV_EMPTY, // libinput设备为空 74 REG_EVENT_DISP_FAIL, // 注册事件派发失败 75 KEY_EVENT_DISP_FAIL, // 键盘事件派发失败 76 INVAILD_COORDINATE, // 无效的坐标(坐标落点未找到窗口) 77 ILLEGAL_DEV_ID, // 非法的设备fd 78 DEV_REG_FAIL, // 设备注册失败 79 FD_FIND_FAIL, // 查找fd失败 80 CONN_BREAK, // 连接断开 81 SOCKET_BUF_FULL, // socket 缓冲区满 82 WAITING_QUEUE_FULL, // 等待队列满 83 APP_NOT_RESP, // ANR 84 MEMCPY_SEC_FUN_FAIL, // memcpy安全函数错误 85 LIBINPUT_DEV_NULLPTR, // libinput Device为空 86 TOUCH_ID_NO_FIND, // 未找到touchid 87 JOYSTICK_EVENT_DISP_FAIL, // 摇杆或手柄事件派发失败 88 TOUCH_EVENT_DISP_FAIL, // 触摸屏事件派发失败 89 POINT_REG_EVENT_DISP_FAIL, // 鼠标注册事件派发失败 90 POINT_EVENT_DISP_FAIL, // 鼠标事件派发失败 91 XKB_ALLOC_CONTEXT_FAIL, // XKB分配上下文失败 92 XKB_INCL_PATH_FAIL, // XKB包含路径失败 93 XKB_COMPILE_KEYMAP_FAIL, // XKB编译keymap失败 94 XKB_ALLOC_STATE_FAIL, // XKB分配state失败 95 KEY_EVENT_PKG_FAIL, // 键盘事件封装失败 96 POINT_EVENT_PKG_FAIL, // 鼠标事件封装失败 97 JOYSTICK_AXIS_EVENT_PKG_FAIL, // 摇杆手柄轴事件封装失败 98 JOYSTICK_KEY_EVENT_PKG_FAIL, // 摇杆手柄键事件封装失败 99 SPRINTF_S_SEC_FUN_FAIL, // sprintf_s安全函数错误 100 SPCL_REG_EVENT_DISP_FAIL, // 特殊注册事件派发失败. 101 TABLETPAD_KEY_EVENT_PKG_FAIL, // 触控板键事件封装失败 102 TABLETPAD_KEY_EVENT_DISP_FAIL, // 触控板键事件派发失败 103 TABLETPAD_EVENT_PKG_FAIL, // 触控板轴事件封装失败 104 TABLETPAD_EVENT_DISP_FAIL, // 触控板轴事件派发失败 105 TABLETTOOL_EVENT_PKG_FAIL, // 触控笔事件封装失败 106 TABLETTOOL_EVENT_DISP_FAIL, // 触控笔事件派发失败 107 MULTIDEVICE_SAME_EVENT_MARK, // 多设备相同事件返回标志 108 GESTURE_EVENT_PKG_FAIL, // GESTURE_SWIPE事件封装失败 109 STAT_CALL_FAIL, // stat函数调用失败 110 REG_EVENT_PKG_FAIL, // 注册事件封装失败 111 GESTURE_EVENT_DISP_FAIL, // gesture swipe事件派发失败 112 DEV_PARAM_PKG_FAIL, // 设备号参数封装失败 113 DEV_ADD_EVENT_PKG_FAIL, // 新增设备事件封装失败 114 DEV_REMOVE_EVENT_PKG_FAIL, // 删除设备事件封装失败 115 ADD_DEVICE_INFO_CALL_FAIL, // 调用AddDeviceInfo函数失败 116 TOUCH_EVENT_PKG_FAIL, // 触摸屏事件封装失败 117 UNKNOWN_EVENT_PKG_FAIL, // 未识别事件封装失败 118 MEMSET_SEC_FUN_FAIL, // memset安全函数错误 119 DEVICEID_PARAM_PKG_FAIL, // 设备号参数封装失败 120 MALLOC_FAIL, // malloc失败 121 SEC_STRCPY_FAIL, // 安全函数strcpy错误 122 SASERVICE_INIT_FAIL, // SA_Service初始化错误 123 SASERVICE_START_FAIL, // SA_Service启动错误 124 SASERVICE_STOP_FAIL, // SA_Service停止错误 125 INVALID_RETURN_VALUE, // 无效的返回值 126 EPOLL_CTL_FAIL, // epoll_ctl错误 127 EXP_SO_LIBY_INIT_FAIL, // 可扩展模块初始化错误 128 SASERVICE_PERMISSION_FAIL, // SA_Service权限不足 129 SASERVICE_IPC_CALL_FAIL, // SA_Service调用失败 130 STREAMBUFF_OVER_FLOW, // 缓冲区写入错误 131 ADD_SESSION_FAIL, // 增加session错误 132 MAKE_SHARED_FAIL, // make_shared错误 133 CLEAR_DEAD_SESSION_FAIL, // 清理无效的session错误 134 INIT_SIGNAL_HANDLER_FAIL, // 初始化全局信号处理器失败 135 FCNTL_FAIL, // fcntl 函数调用错误 136 PACKET_WRITE_FAIL, // 写入数据错误 137 PACKET_READ_FAIL, // 读取数据错误 138 POINTER_DRAW_INIT_FAIL, // 初始化画鼠标失败 139 }; 140 // Error code for util 141 constexpr ErrCode UTIL_ERR_OFFSET = ErrCodeOffset(SUBSYS_MULTIMODAINPUT, MODULE_UTIL); 142 143 enum { 144 NON_STD_EVENT = UTIL_ERR_OFFSET, // 非标准化事件 145 UNPROC_MSG, // 未处理的消息 146 UNKNOWN_MSG_ID, // 未知消息ID 147 UNKNOWN_DEV, // 未知设备 148 FILE_READ_FAIL, // 文件读取失败 149 FILE_WRITE_FAIL, // 文件写入失败 150 API_PARAM_TYPE_FAIL, // api参数类型错误 151 API_OUT_OF_RANGE, // api返回值超出定义范围 152 FOCUS_ID_OBTAIN_FAIL, // 获取focus_id失败 153 SOCKET_PATH_INVALID, // 无效的Socket文件路径 154 SOCKET_CREATE_FAIL, // Socket创建失败 155 SOCKET_BIND_FAIL, // 监听Socket失败 156 SOCKET_LISTEN_FAIL, // 监听Socket失败 157 EPOLL_CREATE_FAIL, // EPOLL创建失败 158 EPOLL_MODIFY_FAIL, // 修改EPOLL失败 159 STREAM_BUF_WRITE_FAIL, // 流缓冲写入失败 160 SESSION_ADD_FAIL, // 增加Session失败 161 VAL_NOT_EXP, // 值不符合预期 162 MEM_NOT_ENOUGH, // 没有足够的内存 163 MEM_OUT_OF_BOUNDS, // 内存越界 164 CONN_FAIL, // 建立连接失败 165 SESSION_NOT_FOUND, // 没有找到session 166 FD_ACCEPT_FAIL, // 接受连接时fd无效 167 PID_OBTAIN_FAIL, // 获取PID失败 168 FD_OBTAIN_FAIL, // 获取FD失败 169 INVALID_MONITOR_MON // 监听增加失败 170 }; 171 // Error code for virtual deviceparam 172 constexpr ErrCode VIRTUAL_DEVICE_ERR_OFFSET = ErrCodeOffset(SUBSYS_MULTIMODAINPUT, MODULE_VIRTUAL_DEVICE); 173 174 // Error code for napi 175 constexpr ErrCode NAPI_ERR_OFFSET = ErrCodeOffset(SUBSYS_MULTIMODAINPUT, MODULE_NAPI); 176 177 enum { 178 CALL_NAPI_API_ERR = NAPI_ERR_OFFSET 179 }; 180 181 enum REGISTER { 182 MMI_STANDARD_EVENT_SUCCESS = 1, 183 MMI_STANDARD_EVENT_EXIST = 2, 184 MMI_STANDARD_EVENT_INVALID_PARAM = -1, 185 MMI_STANDARD_EVENT_NOT_EXIST = 3, 186 }; 187 enum EXCEPTIONTEST { 188 SERVICESELFCHECK = 1001, 189 MULTIMODALINPUT_EXCEPTION_INJECTION = 1002, 190 }; 191 192 enum MMI_SERVICE_STATUS { 193 MMI_SERVICE_INVALID = 0, // 多模服务不存在,多模输入服务异常 194 MMI_SERVICE_RUNNING, // 多模服务运行正常 195 }; 196 } // namespace OHOS 197 #endif // ERROR_MULTIMODAL_H