From 7414cd1b5be7a41f4628bb542ec92f135798d006 Mon Sep 17 00:00:00 2001 From: lifenghui Date: Tue, 19 Mar 2024 09:43:38 +0000 Subject: [PATCH 1/5] add multimodalinput interface Signed-off-by: lifenghui --- .../kits/c/input/oh_input_manager.h | 503 +++++++++++++++++- multimodalinput/kits/c/ohinput.ndk.json | 140 +++++ 2 files changed, 642 insertions(+), 1 deletion(-) diff --git a/multimodalinput/kits/c/input/oh_input_manager.h b/multimodalinput/kits/c/input/oh_input_manager.h index 7d02e48a13a..e6de1d98604 100644 --- a/multimodalinput/kits/c/input/oh_input_manager.h +++ b/multimodalinput/kits/c/input/oh_input_manager.h @@ -61,12 +61,158 @@ enum Input_KeyStateAction { KEY_SWITCH_OFF = 3 }; +/** + * @brief 鼠标动作。 + * + * @since 12 + */ +typedef enum { + MOUSE_ACTION_CANCEL = 0, + MOUSE_ACTION_MOVE = 1, + MOUSE_ACTION_BUTTON_DOWN = 2, + MOUSE_ACTION_BUTTON_UP = 3, + MOUSE_ACTION_AXIS_BEGIN = 4, + MOUSE_ACTION_AXIS_UPDATE = 5, + MOUSE_ACTION_AXIS_END = 6, + MOUSE_ACTION_ACTION_DOWN = 7, + MOUSE_ACTION_ACTION_UP = 8, +} InputEvent_MouseAction; + +/** + * @brief 鼠标按键。 + * + * @since 12 + */ +typedef enum { + MOUSE_BUTTON_LEFT = 0, + MOUSE_BUTTON_MIDDLE = 1, + MOUSE_BUTTON_RIGHT = 2, + MOUSE_BUTTON_SIDE = 3, + MOUSE_BUTTON_EXTRA = 4, + MOUSE_BUTTON_FORWARD = 5, + MOUSE_BUTTON_BACK = 6, + MOUSE_BUTTON_TASK = 7, +} InputEvent_MouseButton; + +/** + * @brief 鼠标轴类型。 + * + * @since 12 + */ +typedef enum { + MOUSE_AXIS_SCROLL_VERTICAL = 0, + MOUSE_AXIS_SCROLL_HORIZONTAL = 1, + MOUSE_AXIS_PINCH = 2, +} InputEvent_MouseAxis; + +/** + * @brief 鼠标工具类型。 + * + * @since 12 + */ +typedef enum { + /** 鼠标 */ + MOUSE_TOOL_TYPE_MOUSE = 0, + /** 摇杆 */ + MOUSE_TOOL_TYPE_JOYSTICK = 1, +} InputEvent_MouseToolType; + +/** + * @brief 触屏行为,包括按下、移动、抬起等。 + * + * @since 12 + */ +typedef enum { + TOUCH_ACTION_CANCEL = 0, + TOUCH_ACTION_DOWN = 1, + TOUCH_ACTION_MOVE = 2, + TOUCH_ACTION_UP = 3, +} InputEvent_TouchAction; + +/** + * @brief 触屏源类型。 + * + * @since 12 + */ +typedef enum { + /** 触屏 */ + TOUCH_SOURCE_TYPE_TOUCH_SCREEN = 0, + /** 手写笔 */ + TOUCH_SOURCE_TYPE_PEN = 1, + /** 触摸板 */ + TOUCH_SOURCE_TYPE_TOUCH_PAD = 2, + /** 手指 */ + TOUCH_SOURCE_TYPE_FINGER = 3, + /** 手写笔 */ + TOUCH_SOURCE_TYPE_PEN = 4, + /** 橡皮 */ + TOUCH_SOURCE_TYPE_RUBBER = 5, + /** 刷子 */ + TOUCH_SOURCE_TYPE_BRUSH = 6, + /** 铅笔 */ + TOUCH_SOURCE_TYPE_PENCIL = 7, + /** 喷枪 */ + TOUCH_SOURCE_TYPE_AIRBRUSH = 8, +} InputEvent_TouchSourceType; + +/** + * @brief 触屏工具类型。 + * + * @since 12 + */ +typedef enum { + TOUCH_TOOLTYPE_FINGER = 0, + TOUCH_TOOLTYPE_PEN = 1, + TOUCH_TOOLTYPE_RUBBER = 2, + TOUCH_TOOLTYPE_BRUSH = 3, + TOUCH_TOOLTYPE_PENCIL = 4, + TOUCH_TOOLTYPE_AIRBRUSH = 5, + TOUCH_TOOLTYPE_MOUSE = 6, + TOUCH_TOOLTYPE_LENS = 7, +} InputEvent_TouchToolType; + +/** + * @brief 设置工具类型。 + * + * @since 12 + */ +typedef enum { + KEY_ACTION_UNPRESSED = 0, + KEY_ACTION_PRESSED = 1 +} InputEvent_KeyAction; + /** * @brief Defines key information, which identifies a key pressing behavior. For example, the Ctrl key information contains the key value and key type. * * @since 12 */ -struct Input_KeyState; +struct Input_KeyState { + /** 按键键值 */ + int32_t keyCode; + /** 按键状态 */ + int32_t keyState; +} Input_KeyState; + +/** + * @brief + * + * @since 12 + */ +struct Input_KeyEvent; + +/** + * @brief + * + * @since 12 + */ +struct Input_MouseEvent; + +/** + * @brief + * + * @since 12 + */ +struct Input_TouchEvent; /** * @brief Enumerates the error codes. @@ -134,6 +280,46 @@ void OH_Input_SetKeyCode(struct Input_KeyState* keyState, int32_t keyCode); */ int32_t OH_Input_GetKeyCode(struct Input_KeyState* keyState); +/** + * @brief 设置按键动作。 + * + * @param keyEvent 按键事件。 + * @param keyAction 按键动作。 + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +void OH_Input_SetKeyAction(struct Input_KeyEvent* keyEvent, int32_t keyAction); + +/** + * @brief 获取按键动作。 + * + * @param keyEvent 按键事件。 + * @return + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +int32_t OH_Input_GetKeyAction(struct Input_KeyEvent* keyEvent); + +/** + * @brief 设置是否重复输入。 + * + * @param keyEvent 按键事件。 + * @param repeat 是否重复输入。 + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +void OH_Input_SetKeyRepeat(struct Input_KeyEvent* keyEvent, bool repeat); + +/** + * @brief 获取是否重复输入。 + * + * @param keyEvent 按键事件。 + * @return + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +bool OH_Input_GetKeyRepeat(struct Input_KeyEvent* keyEvent); + /** * @brief Sets whether the key specific to a key status enumeration object is pressed. * @@ -174,6 +360,321 @@ void OH_Input_SetKeySwitch(struct Input_KeyState* keyState, int32_t keySwitch); */ int32_t OH_Input_GetKeySwitch(struct Input_KeyState* keyState); +/** + * @brief 注入按键事件。 + * + * @param keyEvent 按键事件。 + * @return + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +int32_t OH_Input_InjectKeyEvent(struct Input_KeyEvent* keyEvent); + +/** + * @brief 创建按键事件。 + * + * @param keyCode 按键键值。 + * @param action + * @return + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +Input_KeyEvent *OH_Input_CreateKeyEvent(int32_t keyCode, int32_t action); + +/** + * @brief 销毁按键事件。 + * + * @param keyEvent + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +void OH_Input_DestroyKeyEvent(struct Input_KeyEvent** keyEvent); + +/** + * @brief 注入鼠标事件。 + * + * @param mouseEvent + * @return + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +int32_t OH_Input_InjectMouseEvent(struct Input_MouseEvent* mouseEvent); + +/** + * @brief 创建鼠标事件。 + * + * @param displayX + * @param displayY + * @param action + * @param sourceType + * @return + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +Input_MouseEvent *OH_Input_CreateMouseEvent(int32_t displayX, int32_t displayY, int32_t action, int32_t sourceType); + +/** + * @brief 销毁鼠标事件。 + * + * @param mouseEvent + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +void OH_Input_DestroyMouseEvent(struct Input_MouseEvent** mouseEvent); + +/** + * @brief 注入触摸事件。 + * + * @param touchEvent + * @return + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +int32_t OH_Input_InjectTouchEvent(struct Input_TouchEvent* touchEvent); + +/** + * @brief 创建触摸事件。 + * + * @param displayX + * @param displayY + * @param action + * @param sourceType + * @param toolType + * @return + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +Input_TouchEvent *OH_Input_CreateTouchEvent(int32_t displayX, int32_t displayY, int32_t action, int32_t sourceType, int32_t toolType); + +/** + * @brief 销毁触摸事件。 + * + * @param touchEvent + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +void OH_Input_DestroyTouchEvent(struct Input_TouchEvent** touchEvent); + +/** + * @brief 设置相对屏幕X坐标。 + * + * @param mouseEvent 鼠标事件。 + * @param displayX X坐标。 + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +void OH_Input_SetMouseDisplayX(struct Input_MouseEvent* mouseEvent, int32_t displayX); + +/** + * @brief 获取相对屏幕X坐标。 + * + * @param mouseEvent 鼠标事件。 + * @return + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +int32_t OH_Input_GetMouseDisplayX(struct Input_MouseEvent* mouseEvent); + +/** + * @brief 设置相对屏幕Y坐标。 + * + * @param mouseEvent 鼠标事件。 + * @param displayY Y坐标。 + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +void OH_Input_SetMouseDisplayY(struct Input_MouseEvent* mouseEvent, int32_t displayY); + +/** + * @brief 获取相对屏幕Y坐标。 + * + * @param mouseEvent 鼠标事件。 + * @return + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +int32_t OH_Input_GetMouseDisplayY(struct Input_MouseEvent* mouseEvent); + +/** + * @brief 设置动作,按下、移动、抬起。 + * + * @param mouseEvent 鼠标事件。 + * @param mouseAction 鼠标动作。 + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +void OH_Input_SetMouseAction(struct Input_MouseEvent* mouseEvent, int32_t mouseAction); + +/** + * @brief 获取动作,按下、移动、抬起。 + * + * @param mouseEvent 鼠标事件。 + * @return + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +int32_t OH_Input_GetMouseAction(struct Input_MouseEvent* mouseEvent); + +/** + * @brief 设置资源类型。 + * + * @param mouseEvent 鼠标事件。 + * @param sourceType 资源类型。 + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +void OH_Input_SetMouseSourceType(struct Input_MouseEvent* mouseEvent, int32_t sourceType); + +/** + * @brief 获取资源类型。 + * + * @param mouseEvent 鼠标事件。 + * @return + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +int32_t OH_Input_GetMouseSourceType(struct Input_MouseEvent* mouseEvent); + +/** + * @brief 设置鼠标按键。 + * + * @param mouseEvent 鼠标事件。 + * @param buttonId 鼠标按键。 + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +void OH_Input_SetButtonId(struct Input_MouseEvent* mouseEvent, int32_t buttonId); + +/** + * @brief 获取鼠标按键。 + * + * @param mouseEvent 鼠标事件。 + * @return + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +int32_t OH_Input_GetButtonId(struct Input_MouseEvent* mouseEvent); + +/** + * @brief 设置滚轮滚动偏移值。 + * + * @param mouseEvent 鼠标事件。 + * @param scrollValue 鼠标按键。 + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +void OH_Input_SetScrollValue(struct Input_MouseEvent* mouseEvent, int32_t scrollValue); + +/** + * @brief 获取滚轮偏移值。 + * + * @param mouseEvent 鼠标事件。 + * @return + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +int32_t OH_Input_GetScrollValue(struct Input_MouseEvent* mouseEvent); + +/** + * @brief 设置X坐标。 + * + * @param touchEvent 触摸事件。 + * @param displayX X坐标。 + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +void OH_Input_SetTouchDisplayX(struct Input_TouchEvent* touchEvent, int32_t displayX); + +/** + * @brief 获取X坐标。 + * + * @param touchEvent 触摸事件。 + * @return + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +int32_t OH_Input_GetTouchDisplayX(struct Input_TouchEvent* touchEvent); + +/** + * @brief 设置Y坐标。 + * + * @param touchEvent 触摸事件。 + * @param displayY Y坐标。 + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +void OH_Input_SetTouchDisplayY(struct Input_TouchEvent* touchEvent, int32_t displayY); + +/** + * @brief 获取Y坐标。 + * + * @param touchEvent 触摸事件。 + * @return + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +int32_t OH_Input_GetTouchDisplayY(struct Input_TouchEvent* touchEvent); + +/** + * @brief 设置动作。 + * + * @param touchEvent 触摸事件。 + * @param mouseAction 触摸动作。 + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +void OH_Input_SetTouchAction(struct Input_TouchEvent* touchEvent, int32_t mouseAction); + +/** + * @brief 获取动作。 + * + * @param touchEvent 触摸事件。 + * @return + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +int32_t OH_Input_GetTouchAction(struct Input_TouchEvent* touchEvent); + +/** + * @brief 设置资源类型。 + * + * @param touchEvent 触摸事件。 + * @param sourceType 资源类型。 + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +void OH_Input_SetTouchSourceType(struct Input_TouchEvent* touchEvent, int32_t sourceType); + +/** + * @brief 获取资源类型。 + * + * @param touchEvent 触摸事件。 + * @return + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +int32_t OH_Input_GetTouchSourceType(struct Input_TouchEvent* touchEvent); + +/** + * @brief 设置工具类型。 + * + * @param touchEvent 触摸事件。 + * @param toolType 资源类型。 + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +void OH_Input_SetTouchToolType(struct Input_TouchEvent* touchEvent, int32_t toolType); + +/** + * @brief 获取工具类型。 + * + * @param touchEvent 触摸事件。 + * @return + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 12 + */ +int32_t OH_Input_GetTouchToolType(struct Input_TouchEvent* touchEvent); + #ifdef __cplusplus } #endif diff --git a/multimodalinput/kits/c/ohinput.ndk.json b/multimodalinput/kits/c/ohinput.ndk.json index 13726594051..513e14ffa60 100644 --- a/multimodalinput/kits/c/ohinput.ndk.json +++ b/multimodalinput/kits/c/ohinput.ndk.json @@ -34,5 +34,145 @@ { "first_introduced": "12", "name": "OH_Input_GetKeySwitch" + }, + { + "first_introduced": "12", + "name": "OH_Input_SetKeyAction" + }, + { + "first_introduced": "12", + "name": "OH_Input_GetKeyAction" + }, + { + "first_introduced": "12", + "name": "OH_Input_SetKeyRepeat" + }, + { + "first_introduced": "12", + "name": "OH_Input_GetKeyRepeat" + }, + { + "first_introduced": "12", + "name": "OH_Input_InjectKeyEvent" + }, + { + "first_introduced": "12", + "name": "OH_Input_CreateKeyEvent" + }, + { + "first_introduced": "12", + "name": "OH_Input_DestroyKeyEvent" + }, + { + "first_introduced": "12", + "name": "OH_Input_InjectMouseEvent" + }, + { + "first_introduced": "12", + "name": "OH_Input_CreateMouseEvent" + }, + { + "first_introduced": "12", + "name": "OH_Input_DestroyMouseEvent" + }, + { + "first_introduced": "12", + "name": "OH_Input_InjectTouchEvent" + }, + { + "first_introduced": "12", + "name": "OH_Input_CreateTouchEvent" + }, + { + "first_introduced": "12", + "name": "OH_Input_DestroyTouchEvent" + }, + { + "first_introduced": "12", + "name": "OH_Input_SetMouseDisplayX" + }, + { + "first_introduced": "12", + "name": "OH_Input_GetMouseDisplayX" + }, + { + "first_introduced": "12", + "name": "OH_Input_SetMouseDisplayY" + }, + { + "first_introduced": "12", + "name": "OH_Input_GetMouseDisplayY" + }, + { + "first_introduced": "12", + "name": "OH_Input_SetMouseAction" + }, + { + "first_introduced": "12", + "name": "OH_Input_GetMouseAction" + }, + { + "first_introduced": "12", + "name": "OH_Input_SetMouseSourceType" + }, + { + "first_introduced": "12", + "name": "OH_Input_GetMouseSourceType" + }, + { + "first_introduced": "12", + "name": "OH_Input_SetButtonId" + }, + { + "first_introduced": "12", + "name": "OH_Input_GetButtonId" + }, + { + "first_introduced": "12", + "name": "OH_Input_SetScrollValue" + }, + { + "first_introduced": "12", + "name": "OH_Input_GetScrollValue" + }, + { + "first_introduced": "12", + "name": "OH_Input_SetTouchDisplayX" + }, + { + "first_introduced": "12", + "name": "OH_Input_GetTouchDisplayX" + }, + { + "first_introduced": "12", + "name": "OH_Input_SetTouchDisplayY" + }, + { + "first_introduced": "12", + "name": "OH_Input_GetTouchDisplayY" + }, + { + "first_introduced": "12", + "name": "OH_Input_SetTouchAction" + }, + { + "first_introduced": "12", + "name": "OH_Input_GetTouchAction" + }, + { + "first_introduced": "12", + "name": "OH_Input_SetTouchSourceType" + }, + { + "first_introduced": "12", + "name": "OH_Input_GetTouchSourceType" + }, + { + "first_introduced": "12", + "name": "OH_Input_SetTouchToolType" + }, + { + "first_introduced": "12", + "name": "OH_Input_GetTouchToolType" } ] \ No newline at end of file -- Gitee From e0149fc25cb49e4011c0687b4720db7ef21aa7b4 Mon Sep 17 00:00:00 2001 From: lifenghui Date: Wed, 20 Mar 2024 01:39:13 +0000 Subject: [PATCH 2/5] add multimodalinput interface Signed-off-by: lifenghui --- multimodalinput/kits/c/input/oh_input_manager.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/multimodalinput/kits/c/input/oh_input_manager.h b/multimodalinput/kits/c/input/oh_input_manager.h index e6de1d98604..4875fa32d1e 100644 --- a/multimodalinput/kits/c/input/oh_input_manager.h +++ b/multimodalinput/kits/c/input/oh_input_manager.h @@ -186,12 +186,7 @@ typedef enum { * * @since 12 */ -struct Input_KeyState { - /** 按键键值 */ - int32_t keyCode; - /** 按键状态 */ - int32_t keyState; -} Input_KeyState; +struct Input_KeyState; /** * @brief @@ -659,7 +654,7 @@ int32_t OH_Input_GetTouchSourceType(struct Input_TouchEvent* touchEvent); * @brief 设置工具类型。 * * @param touchEvent 触摸事件。 - * @param toolType 资源类型。 + * @param toolType 工具类型。 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ -- Gitee From 2218bb765bc86518f50c493b59a249e4364ea32c Mon Sep 17 00:00:00 2001 From: lifenghui Date: Wed, 20 Mar 2024 02:18:50 +0000 Subject: [PATCH 3/5] add multimodalinput interface Signed-off-by: lifenghui --- .../kits/c/input/oh_input_manager.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/multimodalinput/kits/c/input/oh_input_manager.h b/multimodalinput/kits/c/input/oh_input_manager.h index 4875fa32d1e..ba177ec2d34 100644 --- a/multimodalinput/kits/c/input/oh_input_manager.h +++ b/multimodalinput/kits/c/input/oh_input_manager.h @@ -379,7 +379,7 @@ Input_KeyEvent *OH_Input_CreateKeyEvent(int32_t keyCode, int32_t action); /** * @brief 销毁按键事件。 * - * @param keyEvent + * @param keyEvent 按键事件。 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ @@ -388,7 +388,7 @@ void OH_Input_DestroyKeyEvent(struct Input_KeyEvent** keyEvent); /** * @brief 注入鼠标事件。 * - * @param mouseEvent + * @param mouseEvent 鼠标事件。 * @return * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 @@ -411,7 +411,7 @@ Input_MouseEvent *OH_Input_CreateMouseEvent(int32_t displayX, int32_t displayY, /** * @brief 销毁鼠标事件。 * - * @param mouseEvent + * @param mouseEvent 鼠标事件。 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ @@ -420,7 +420,7 @@ void OH_Input_DestroyMouseEvent(struct Input_MouseEvent** mouseEvent); /** * @brief 注入触摸事件。 * - * @param touchEvent + * @param touchEvent 触摸事件。 * @return * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 @@ -430,11 +430,11 @@ int32_t OH_Input_InjectTouchEvent(struct Input_TouchEvent* touchEvent); /** * @brief 创建触摸事件。 * - * @param displayX - * @param displayY - * @param action - * @param sourceType - * @param toolType + * @param displayX X坐标。 + * @param displayY Y坐标。 + * @param action 触屏动作。 + * @param sourceType 资源类型。 + * @param toolType 工具类型。 * @return * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 -- Gitee From 61c9b7c375406906ad0049903fc11ea8b04ef005 Mon Sep 17 00:00:00 2001 From: lifenghui Date: Thu, 21 Mar 2024 03:38:46 +0000 Subject: [PATCH 4/5] add multimodalinput interface Signed-off-by: lifenghui --- .../kits/c/input/oh_input_manager.h | 176 +++++++++--------- 1 file changed, 89 insertions(+), 87 deletions(-) diff --git a/multimodalinput/kits/c/input/oh_input_manager.h b/multimodalinput/kits/c/input/oh_input_manager.h index ba177ec2d34..13227bcd921 100644 --- a/multimodalinput/kits/c/input/oh_input_manager.h +++ b/multimodalinput/kits/c/input/oh_input_manager.h @@ -66,120 +66,116 @@ enum Input_KeyStateAction { * * @since 12 */ -typedef enum { +enum InputEvent_MouseAction { + /** 取消鼠标操作 */ MOUSE_ACTION_CANCEL = 0, + /** 鼠标移动操作 */ MOUSE_ACTION_MOVE = 1, + /** 鼠标按键按下操作 */ MOUSE_ACTION_BUTTON_DOWN = 2, + /** 鼠标按键抬起操作 */ MOUSE_ACTION_BUTTON_UP = 3, + /** 鼠标轴事件开始动作 */ MOUSE_ACTION_AXIS_BEGIN = 4, + /** 鼠标轴事件更新动作 */ MOUSE_ACTION_AXIS_UPDATE = 5, + /** 鼠标轴事件结束动作 */ MOUSE_ACTION_AXIS_END = 6, + /** 鼠标触摸板按下动作 */ MOUSE_ACTION_ACTION_DOWN = 7, + /** 鼠标触摸板抬起动作 */ MOUSE_ACTION_ACTION_UP = 8, -} InputEvent_MouseAction; - -/** - * @brief 鼠标按键。 - * - * @since 12 - */ -typedef enum { - MOUSE_BUTTON_LEFT = 0, - MOUSE_BUTTON_MIDDLE = 1, - MOUSE_BUTTON_RIGHT = 2, - MOUSE_BUTTON_SIDE = 3, - MOUSE_BUTTON_EXTRA = 4, - MOUSE_BUTTON_FORWARD = 5, - MOUSE_BUTTON_BACK = 6, - MOUSE_BUTTON_TASK = 7, -} InputEvent_MouseButton; +}; /** * @brief 鼠标轴类型。 * * @since 12 */ -typedef enum { +enum InputEvent_MouseAxis { + /** 垂直滚动轴 */ MOUSE_AXIS_SCROLL_VERTICAL = 0, + /** 水平滚动轴 */ MOUSE_AXIS_SCROLL_HORIZONTAL = 1, - MOUSE_AXIS_PINCH = 2, -} InputEvent_MouseAxis; +}; /** * @brief 鼠标工具类型。 * * @since 12 */ -typedef enum { +enum InputEvent_MouseToolType { /** 鼠标 */ MOUSE_TOOL_TYPE_MOUSE = 0, /** 摇杆 */ MOUSE_TOOL_TYPE_JOYSTICK = 1, -} InputEvent_MouseToolType; +}; /** * @brief 触屏行为,包括按下、移动、抬起等。 * * @since 12 */ -typedef enum { +enum InputEvent_TouchAction { + /** 取消触摸操作 */ TOUCH_ACTION_CANCEL = 0, + /** 触摸按下操作 */ TOUCH_ACTION_DOWN = 1, + /** 触摸移动操作 */ TOUCH_ACTION_MOVE = 2, + /** 触摸抬起操作 */ TOUCH_ACTION_UP = 3, -} InputEvent_TouchAction; +}; /** * @brief 触屏源类型。 * * @since 12 */ -typedef enum { +enum InputEvent_TouchSourceType { /** 触屏 */ TOUCH_SOURCE_TYPE_TOUCH_SCREEN = 0, /** 手写笔 */ TOUCH_SOURCE_TYPE_PEN = 1, /** 触摸板 */ TOUCH_SOURCE_TYPE_TOUCH_PAD = 2, - /** 手指 */ - TOUCH_SOURCE_TYPE_FINGER = 3, - /** 手写笔 */ - TOUCH_SOURCE_TYPE_PEN = 4, - /** 橡皮 */ - TOUCH_SOURCE_TYPE_RUBBER = 5, - /** 刷子 */ - TOUCH_SOURCE_TYPE_BRUSH = 6, - /** 铅笔 */ - TOUCH_SOURCE_TYPE_PENCIL = 7, - /** 喷枪 */ - TOUCH_SOURCE_TYPE_AIRBRUSH = 8, -} InputEvent_TouchSourceType; +}; /** * @brief 触屏工具类型。 * * @since 12 */ -typedef enum { +enum InputEvent_TouchToolType { + /** 手指 */ TOUCH_TOOLTYPE_FINGER = 0, + /** 手写笔 */ TOUCH_TOOLTYPE_PEN = 1, + /** 橡皮 */ TOUCH_TOOLTYPE_RUBBER = 2, + /** 刷子 */ TOUCH_TOOLTYPE_BRUSH = 3, + /** 铅笔 */ TOUCH_TOOLTYPE_PENCIL = 4, + /** 喷枪 */ TOUCH_TOOLTYPE_AIRBRUSH = 5, + /** 鼠标 */ TOUCH_TOOLTYPE_MOUSE = 6, + /** 透镜 */ TOUCH_TOOLTYPE_LENS = 7, -} InputEvent_TouchToolType; +}; /** * @brief 设置工具类型。 * * @since 12 */ -typedef enum { +enum InputEvent_KeyAction { + /** 按键释放操作 */ KEY_ACTION_UNPRESSED = 0, - KEY_ACTION_PRESSED = 1 -} InputEvent_KeyAction; + /** 按键按下操作 */ + KEY_ACTION_PRESSED = 1, +}; /** * @brief Defines key information, which identifies a key pressing behavior. For example, the Ctrl key information contains the key value and key type. @@ -189,21 +185,21 @@ typedef enum { struct Input_KeyState; /** - * @brief + * @brief 按键事件。 * * @since 12 */ struct Input_KeyEvent; /** - * @brief + * @brief 鼠标事件。 * * @since 12 */ struct Input_MouseEvent; /** - * @brief + * @brief 触摸事件。 * * @since 12 */ @@ -289,7 +285,7 @@ void OH_Input_SetKeyAction(struct Input_KeyEvent* keyEvent, int32_t keyAction); * @brief 获取按键动作。 * * @param keyEvent 按键事件。 - * @return + * @return 返回按键枚举对象的动作。 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ @@ -299,17 +295,17 @@ int32_t OH_Input_GetKeyAction(struct Input_KeyEvent* keyEvent); * @brief 设置是否重复输入。 * * @param keyEvent 按键事件。 - * @param repeat 是否重复输入。 + * @param repeat 按键是否重复输入。 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ void OH_Input_SetKeyRepeat(struct Input_KeyEvent* keyEvent, bool repeat); /** - * @brief 获取是否重复输入。 + * @brief 获取按键是否重复输入。 * * @param keyEvent 按键事件。 - * @return + * @return 返回按键枚举对象是否重复输入。 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ @@ -359,25 +355,27 @@ int32_t OH_Input_GetKeySwitch(struct Input_KeyState* keyState); * @brief 注入按键事件。 * * @param keyEvent 按键事件。 - * @return + * @return 0 - 成功 + * 201 - 权限拒绝 + * 401 - 参数错误 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ int32_t OH_Input_InjectKeyEvent(struct Input_KeyEvent* keyEvent); /** - * @brief 创建按键事件。 + * @brief 创建按键事件对象。 * * @param keyCode 按键键值。 - * @param action - * @return + * @param action 按键动作。 + * @return 如果成功,返回一个Input_KeyEvent的指针对象 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ Input_KeyEvent *OH_Input_CreateKeyEvent(int32_t keyCode, int32_t action); /** - * @brief 销毁按键事件。 + * @brief 销毁按键事件对象。 * * @param keyEvent 按键事件。 * @syscap SystemCapability.MultimodalInput.Input.Core @@ -389,27 +387,29 @@ void OH_Input_DestroyKeyEvent(struct Input_KeyEvent** keyEvent); * @brief 注入鼠标事件。 * * @param mouseEvent 鼠标事件。 - * @return + * @return 0 - 成功 + * 201 - 权限拒绝 + * 401 - 参数错误 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ int32_t OH_Input_InjectMouseEvent(struct Input_MouseEvent* mouseEvent); /** - * @brief 创建鼠标事件。 + * @brief 创建鼠标事件对象。 * - * @param displayX - * @param displayY - * @param action - * @param sourceType - * @return + * @param displayX 鼠标事件的相对屏幕X坐标。 + * @param displayY 鼠标事件的相对屏幕Y坐标。 + * @param action 鼠标事件的动作。 + * @param sourceType 鼠标事件的资源类型。 + * @return 如果成功,返回一个 Input_TouchEvent 的指针对象 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ Input_MouseEvent *OH_Input_CreateMouseEvent(int32_t displayX, int32_t displayY, int32_t action, int32_t sourceType); /** - * @brief 销毁鼠标事件。 + * @brief 销毁鼠标事件对象。 * * @param mouseEvent 鼠标事件。 * @syscap SystemCapability.MultimodalInput.Input.Core @@ -421,30 +421,32 @@ void OH_Input_DestroyMouseEvent(struct Input_MouseEvent** mouseEvent); * @brief 注入触摸事件。 * * @param touchEvent 触摸事件。 - * @return + * @return 0 - 成功 + * 201 - 权限拒绝 + * 401 - 参数错误 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ int32_t OH_Input_InjectTouchEvent(struct Input_TouchEvent* touchEvent); /** - * @brief 创建触摸事件。 + * @brief 创建触摸事件对象。 * - * @param displayX X坐标。 - * @param displayY Y坐标。 - * @param action 触屏动作。 - * @param sourceType 资源类型。 - * @param toolType 工具类型。 - * @return + * @param displayX 触摸事件的相对屏幕X坐标。 + * @param displayY 触摸事件的相对屏幕Y坐标。 + * @param action 触摸事件的触屏动作。 + * @param sourceType 触摸事件的资源类型。 + * @param toolType 触摸事件的工具类型。 + * @return 如果成功,返回一个 Input_TouchEvent 的指针对象 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ Input_TouchEvent *OH_Input_CreateTouchEvent(int32_t displayX, int32_t displayY, int32_t action, int32_t sourceType, int32_t toolType); /** - * @brief 销毁触摸事件。 + * @brief 销毁触摸事件对象。 * - * @param touchEvent + * @param touchEvent 触摸事件。 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ @@ -464,7 +466,7 @@ void OH_Input_SetMouseDisplayX(struct Input_MouseEvent* mouseEvent, int32_t disp * @brief 获取相对屏幕X坐标。 * * @param mouseEvent 鼠标事件。 - * @return + * @return 返回鼠标事件的相对屏幕X坐标。 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ @@ -484,7 +486,7 @@ void OH_Input_SetMouseDisplayY(struct Input_MouseEvent* mouseEvent, int32_t disp * @brief 获取相对屏幕Y坐标。 * * @param mouseEvent 鼠标事件。 - * @return + * @return 返回鼠标事件的相对屏幕Y坐标。 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ @@ -504,7 +506,7 @@ void OH_Input_SetMouseAction(struct Input_MouseEvent* mouseEvent, int32_t mouseA * @brief 获取动作,按下、移动、抬起。 * * @param mouseEvent 鼠标事件。 - * @return + * @return 返回鼠标事件的动作。 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ @@ -524,7 +526,7 @@ void OH_Input_SetMouseSourceType(struct Input_MouseEvent* mouseEvent, int32_t so * @brief 获取资源类型。 * * @param mouseEvent 鼠标事件。 - * @return + * @return 返回鼠标事件的资源类型。 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ @@ -544,7 +546,7 @@ void OH_Input_SetButtonId(struct Input_MouseEvent* mouseEvent, int32_t buttonId) * @brief 获取鼠标按键。 * * @param mouseEvent 鼠标事件。 - * @return + * @return 返回鼠标事件的按键ID。 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ @@ -564,7 +566,7 @@ void OH_Input_SetScrollValue(struct Input_MouseEvent* mouseEvent, int32_t scroll * @brief 获取滚轮偏移值。 * * @param mouseEvent 鼠标事件。 - * @return + * @return 返回鼠标事件的滚轮偏移值。 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ @@ -574,7 +576,7 @@ int32_t OH_Input_GetScrollValue(struct Input_MouseEvent* mouseEvent); * @brief 设置X坐标。 * * @param touchEvent 触摸事件。 - * @param displayX X坐标。 + * @param displayX 触摸事件相对屏幕的X坐标。 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ @@ -584,7 +586,7 @@ void OH_Input_SetTouchDisplayX(struct Input_TouchEvent* touchEvent, int32_t disp * @brief 获取X坐标。 * * @param touchEvent 触摸事件。 - * @return + * @return 返回触摸事件的相对屏幕X坐标。 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ @@ -594,7 +596,7 @@ int32_t OH_Input_GetTouchDisplayX(struct Input_TouchEvent* touchEvent); * @brief 设置Y坐标。 * * @param touchEvent 触摸事件。 - * @param displayY Y坐标。 + * @param displayY 触摸事件相对屏幕的Y坐标。 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ @@ -604,7 +606,7 @@ void OH_Input_SetTouchDisplayY(struct Input_TouchEvent* touchEvent, int32_t disp * @brief 获取Y坐标。 * * @param touchEvent 触摸事件。 - * @return + * @return 返回触摸事件的相对屏幕Y坐标。 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ @@ -624,7 +626,7 @@ void OH_Input_SetTouchAction(struct Input_TouchEvent* touchEvent, int32_t mouseA * @brief 获取动作。 * * @param touchEvent 触摸事件。 - * @return + * @return 返回触摸事件的动作。 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ @@ -644,7 +646,7 @@ void OH_Input_SetTouchSourceType(struct Input_TouchEvent* touchEvent, int32_t so * @brief 获取资源类型。 * * @param touchEvent 触摸事件。 - * @return + * @return 返回触摸事件资源类型。 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ @@ -664,7 +666,7 @@ void OH_Input_SetTouchToolType(struct Input_TouchEvent* touchEvent, int32_t tool * @brief 获取工具类型。 * * @param touchEvent 触摸事件。 - * @return + * @return 返回触摸事件工具类型。 * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ -- Gitee From 968645158b3bc82dddafa03e3bc03b1e70ae25f2 Mon Sep 17 00:00:00 2001 From: lifenghui Date: Fri, 22 Mar 2024 08:25:20 +0000 Subject: [PATCH 5/5] add multimodalinput interface Signed-off-by: lifenghui --- .../kits/c/input/oh_input_manager.h | 328 +++++++++--------- 1 file changed, 164 insertions(+), 164 deletions(-) diff --git a/multimodalinput/kits/c/input/oh_input_manager.h b/multimodalinput/kits/c/input/oh_input_manager.h index 13227bcd921..541dcf0657a 100644 --- a/multimodalinput/kits/c/input/oh_input_manager.h +++ b/multimodalinput/kits/c/input/oh_input_manager.h @@ -20,7 +20,7 @@ * @addtogroup input * @{ * - * @brief Provides the C interface in the multi-modal input domain. + * @brief Provides C APIs of the multimodal input module. * * @since 12 */ @@ -51,9 +51,9 @@ extern "C" { enum Input_KeyStateAction { /** Default */ KEY_DEFAULT = -1, - /** Pressing of a key */ + /** Key pressed */ KEY_PRESSED = 0, - /** Release of a key */ + /** Key released */ KEY_RELEASED = 1, /** Key switch enabled */ KEY_SWITCH_ON = 2, @@ -62,144 +62,144 @@ enum Input_KeyStateAction { }; /** - * @brief 鼠标动作。 + * @brief Mouse actions. * * @since 12 */ enum InputEvent_MouseAction { - /** 取消鼠标操作 */ + /** Cancelling of the mouse action */ MOUSE_ACTION_CANCEL = 0, - /** 鼠标移动操作 */ + /** Moving of the mouse */ MOUSE_ACTION_MOVE = 1, - /** 鼠标按键按下操作 */ + /** Pressing of the mouse button */ MOUSE_ACTION_BUTTON_DOWN = 2, - /** 鼠标按键抬起操作 */ + /** Releasing of the mouse button */ MOUSE_ACTION_BUTTON_UP = 3, - /** 鼠标轴事件开始动作 */ + /** Beginning of the mouse axis event */ MOUSE_ACTION_AXIS_BEGIN = 4, - /** 鼠标轴事件更新动作 */ + /** Updating of the mouse axis event */ MOUSE_ACTION_AXIS_UPDATE = 5, - /** 鼠标轴事件结束动作 */ + /** End of the mouse axis event */ MOUSE_ACTION_AXIS_END = 6, - /** 鼠标触摸板按下动作 */ + /** Finger pressing on the touchpad */ MOUSE_ACTION_ACTION_DOWN = 7, - /** 鼠标触摸板抬起动作 */ + /** Finger lifting from the touchpad */ MOUSE_ACTION_ACTION_UP = 8, }; /** - * @brief 鼠标轴类型。 + * @brief Mouse axis types. * * @since 12 */ enum InputEvent_MouseAxis { - /** 垂直滚动轴 */ + /** Vertical scroll axis */ MOUSE_AXIS_SCROLL_VERTICAL = 0, - /** 水平滚动轴 */ + /** Horizontal scroll axis */ MOUSE_AXIS_SCROLL_HORIZONTAL = 1, }; /** - * @brief 鼠标工具类型。 + * @brief Mouse tool types. * * @since 12 */ enum InputEvent_MouseToolType { - /** 鼠标 */ + /** Mouse */ MOUSE_TOOL_TYPE_MOUSE = 0, - /** 摇杆 */ + /** Joystick */ MOUSE_TOOL_TYPE_JOYSTICK = 1, }; /** - * @brief 触屏行为,包括按下、移动、抬起等。 + * @brief Touch actions, including pressing, moving, and lifting. * * @since 12 */ enum InputEvent_TouchAction { - /** 取消触摸操作 */ + /** Cancelling of the touch operation */ TOUCH_ACTION_CANCEL = 0, - /** 触摸按下操作 */ + /** Pressing */ TOUCH_ACTION_DOWN = 1, - /** 触摸移动操作 */ + /** Moving */ TOUCH_ACTION_MOVE = 2, - /** 触摸抬起操作 */ + /** Lifting */ TOUCH_ACTION_UP = 3, }; /** - * @brief 触屏源类型。 + * @brief Touchscreen source types. * * @since 12 */ enum InputEvent_TouchSourceType { - /** 触屏 */ + /** Touchscreen */ TOUCH_SOURCE_TYPE_TOUCH_SCREEN = 0, - /** 手写笔 */ + /** Stylus */ TOUCH_SOURCE_TYPE_PEN = 1, - /** 触摸板 */ + /** Touchpad */ TOUCH_SOURCE_TYPE_TOUCH_PAD = 2, }; /** - * @brief 触屏工具类型。 + * @brief Touchscreen tool types. * * @since 12 */ enum InputEvent_TouchToolType { - /** 手指 */ + /** Finger */ TOUCH_TOOLTYPE_FINGER = 0, - /** 手写笔 */ + /** Stylus */ TOUCH_TOOLTYPE_PEN = 1, - /** 橡皮 */ + /** Rubber */ TOUCH_TOOLTYPE_RUBBER = 2, - /** 刷子 */ + /** Brush */ TOUCH_TOOLTYPE_BRUSH = 3, - /** 铅笔 */ + /** Pencil */ TOUCH_TOOLTYPE_PENCIL = 4, - /** 喷枪 */ + /** Air brush */ TOUCH_TOOLTYPE_AIRBRUSH = 5, - /** 鼠标 */ + /** Mouse */ TOUCH_TOOLTYPE_MOUSE = 6, - /** 透镜 */ + /** Lens */ TOUCH_TOOLTYPE_LENS = 7, }; /** - * @brief 设置工具类型。 + * @brief Sets the tool type. * * @since 12 */ enum InputEvent_KeyAction { - /** 按键释放操作 */ + /** Key releasing */ KEY_ACTION_UNPRESSED = 0, - /** 按键按下操作 */ + /** Key pressing */ KEY_ACTION_PRESSED = 1, }; /** - * @brief Defines key information, which identifies a key pressing behavior. For example, the Ctrl key information contains the key value and key type. + * @brief Defines key information, which identifies a key pressing behavior. For example, the Ctrl key information contains the key code and key type. * * @since 12 */ struct Input_KeyState; /** - * @brief 按键事件。 + * @brief Key events. * * @since 12 */ struct Input_KeyEvent; /** - * @brief 鼠标事件。 + * @brief Mouse events. * * @since 12 */ struct Input_MouseEvent; /** - * @brief 触摸事件。 + * @brief Touch events. * * @since 12 */ @@ -252,60 +252,60 @@ struct Input_KeyState* OH_Input_CreateKeyState(); void OH_Input_DestroyKeyState(struct Input_KeyState* keyState); /** - * @brief Sets the key value of a key status enumeration object. + * @brief Sets the key code of a key status enumeration object. * * @param keyState Key status enumeration object. - * @param keyCode Key value of the key status enumeration object. + * @param keyCode Key code of the key status enumeration object. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ void OH_Input_SetKeyCode(struct Input_KeyState* keyState, int32_t keyCode); /** - * @brief Obtains the key value of a key status enumeration object. + * @brief Obtains the key code of a key status enumeration object. * * @param keyState Key status enumeration object. - * @return Key value of the key status enumeration object. + * @return Key code of the key status enumeration object. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ int32_t OH_Input_GetKeyCode(struct Input_KeyState* keyState); /** - * @brief 设置按键动作。 + * @brief Sets the key action. * - * @param keyEvent 按键事件。 - * @param keyAction 按键动作。 + * @param keyEvent Key event. + * @param keyAction Key action. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ void OH_Input_SetKeyAction(struct Input_KeyEvent* keyEvent, int32_t keyAction); /** - * @brief 获取按键动作。 + * @brief Obtains the key action. * - * @param keyEvent 按键事件。 - * @return 返回按键枚举对象的动作。 + * @param keyEvent Key event. + * @return Action of the key enumeration object. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ int32_t OH_Input_GetKeyAction(struct Input_KeyEvent* keyEvent); /** - * @brief 设置是否重复输入。 + * @brief Sets whether to enable repeated input of keys. * - * @param keyEvent 按键事件。 - * @param repeat 按键是否重复输入。 + * @param keyEvent Key event. + * @param repeat Whether to enable repeated input of keys. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ void OH_Input_SetKeyRepeat(struct Input_KeyEvent* keyEvent, bool repeat); /** - * @brief 获取按键是否重复输入。 + * @brief Obtains whether repeated input of keys is enabled. * - * @param keyEvent 按键事件。 - * @return 返回按键枚举对象是否重复输入。 + * @param keyEvent Key event. + * @return Result indicating whether repeated input of keys is enabled. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ @@ -352,321 +352,321 @@ void OH_Input_SetKeySwitch(struct Input_KeyState* keyState, int32_t keySwitch); int32_t OH_Input_GetKeySwitch(struct Input_KeyState* keyState); /** - * @brief 注入按键事件。 + * @brief Injects a key event. * - * @param keyEvent 按键事件。 - * @return 0 - 成功 - * 201 - 权限拒绝 - * 401 - 参数错误 + * @param keyEvent Key event. + * @return 0 - success + * 201 - permission denied + * 401 - parameter error * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ int32_t OH_Input_InjectKeyEvent(struct Input_KeyEvent* keyEvent); /** - * @brief 创建按键事件对象。 + * @brief Creates a key event object. * - * @param keyCode 按键键值。 - * @param action 按键动作。 - * @return 如果成功,返回一个Input_KeyEvent的指针对象 + * @param keyCode Key code. + * @param action Key action. + * @return an Input_KeyEvent pointer object if the operation is successful. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ Input_KeyEvent *OH_Input_CreateKeyEvent(int32_t keyCode, int32_t action); /** - * @brief 销毁按键事件对象。 + * @brief Destroys a key event object. * - * @param keyEvent 按键事件。 + * @param keyEvent Key event. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ void OH_Input_DestroyKeyEvent(struct Input_KeyEvent** keyEvent); /** - * @brief 注入鼠标事件。 + * @brief Injects a mouse event. * - * @param mouseEvent 鼠标事件。 - * @return 0 - 成功 - * 201 - 权限拒绝 - * 401 - 参数错误 + * @param mouseEvent Mouse event. + * @return 0 - success + * 201 - permission denied + * 401 - parameter error * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ int32_t OH_Input_InjectMouseEvent(struct Input_MouseEvent* mouseEvent); /** - * @brief 创建鼠标事件对象。 + * @brief Creates a mouse event object. * - * @param displayX 鼠标事件的相对屏幕X坐标。 - * @param displayY 鼠标事件的相对屏幕Y坐标。 - * @param action 鼠标事件的动作。 - * @param sourceType 鼠标事件的资源类型。 - * @return 如果成功,返回一个 Input_TouchEvent 的指针对象 + * @param displayX X coordinate relative to the screen. + * @param displayY Y coordinate relative to the screen. + * @param action Action of the mouse event. + * @param sourceType Resource type of the mouse event. + * @return an Input_TouchEvent pointer object if the operation is successful. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ Input_MouseEvent *OH_Input_CreateMouseEvent(int32_t displayX, int32_t displayY, int32_t action, int32_t sourceType); /** - * @brief 销毁鼠标事件对象。 + * @brief Destroys a mouse event object. * - * @param mouseEvent 鼠标事件。 + * @param mouseEvent Mouse event. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ void OH_Input_DestroyMouseEvent(struct Input_MouseEvent** mouseEvent); /** - * @brief 注入触摸事件。 + * @brief Injects a touch event. * - * @param touchEvent 触摸事件。 - * @return 0 - 成功 - * 201 - 权限拒绝 - * 401 - 参数错误 + * @param touchEvent Touch event. + * @return 0 - success + * 201 - permission denied + * 401 - parameter error * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ int32_t OH_Input_InjectTouchEvent(struct Input_TouchEvent* touchEvent); /** - * @brief 创建触摸事件对象。 + * @brief Creates a touch event object. * - * @param displayX 触摸事件的相对屏幕X坐标。 - * @param displayY 触摸事件的相对屏幕Y坐标。 - * @param action 触摸事件的触屏动作。 - * @param sourceType 触摸事件的资源类型。 - * @param toolType 触摸事件的工具类型。 - * @return 如果成功,返回一个 Input_TouchEvent 的指针对象 + * @param displayX X coordinate relative to the screen. + * @param displayY Y coordinate relative to the screen. + * @param action Touch action of the touch event. + * @param sourceType Resource type of the touch event. + * @param toolType Tool type of the touch event. + * @return an Input_TouchEvent pointer object if the operation is successful. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ Input_TouchEvent *OH_Input_CreateTouchEvent(int32_t displayX, int32_t displayY, int32_t action, int32_t sourceType, int32_t toolType); /** - * @brief 销毁触摸事件对象。 + * @brief Destroys a touch event object. * - * @param touchEvent 触摸事件。 + * @param touchEvent Touch event. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ void OH_Input_DestroyTouchEvent(struct Input_TouchEvent** touchEvent); /** - * @brief 设置相对屏幕X坐标。 + * @brief Sets the X coordinate relative to the screen. * - * @param mouseEvent 鼠标事件。 - * @param displayX X坐标。 + * @param mouseEvent Mouse event. + * @param displayX X coordinate. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ void OH_Input_SetMouseDisplayX(struct Input_MouseEvent* mouseEvent, int32_t displayX); /** - * @brief 获取相对屏幕X坐标。 + * @brief Obtains the X coordinate relative to the screen. * - * @param mouseEvent 鼠标事件。 - * @return 返回鼠标事件的相对屏幕X坐标。 + * @param mouseEvent Mouse event. + * @return X coordinate relative to the screen. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ int32_t OH_Input_GetMouseDisplayX(struct Input_MouseEvent* mouseEvent); /** - * @brief 设置相对屏幕Y坐标。 + * @brief Sets the Y coordinate relative to the screen. * - * @param mouseEvent 鼠标事件。 - * @param displayY Y坐标。 + * @param mouseEvent Mouse event. + * @param displayY Y coordinate. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ void OH_Input_SetMouseDisplayY(struct Input_MouseEvent* mouseEvent, int32_t displayY); /** - * @brief 获取相对屏幕Y坐标。 + * @brief Obtains the Y coordinate relative to the screen. * - * @param mouseEvent 鼠标事件。 - * @return 返回鼠标事件的相对屏幕Y坐标。 + * @param mouseEvent Mouse event. + * @return Y coordinate relative to the screen. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ int32_t OH_Input_GetMouseDisplayY(struct Input_MouseEvent* mouseEvent); /** - * @brief 设置动作,按下、移动、抬起。 + * @brief Sets the action, which can be pressing, moving, and lifting. * - * @param mouseEvent 鼠标事件。 - * @param mouseAction 鼠标动作。 + * @param mouseEvent Mouse event. + * @param mouseAction Mouse action. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ void OH_Input_SetMouseAction(struct Input_MouseEvent* mouseEvent, int32_t mouseAction); /** - * @brief 获取动作,按下、移动、抬起。 + * @brief Obtains actions, such as pressing, moving, and lifting. * - * @param mouseEvent 鼠标事件。 - * @return 返回鼠标事件的动作。 + * @param mouseEvent Mouse event. + * @return Mouse action. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ int32_t OH_Input_GetMouseAction(struct Input_MouseEvent* mouseEvent); /** - * @brief 设置资源类型。 + * @brief Sets the resource type. * - * @param mouseEvent 鼠标事件。 - * @param sourceType 资源类型。 + * @param mouseEvent Mouse event. + * @param sourceType Resource type. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ void OH_Input_SetMouseSourceType(struct Input_MouseEvent* mouseEvent, int32_t sourceType); /** - * @brief 获取资源类型。 + * @brief Obtains the resource type. * - * @param mouseEvent 鼠标事件。 - * @return 返回鼠标事件的资源类型。 + * @param mouseEvent Mouse event. + * @return Resource type of the mouse event. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ int32_t OH_Input_GetMouseSourceType(struct Input_MouseEvent* mouseEvent); /** - * @brief 设置鼠标按键。 + * @brief Sets the mouse button. * - * @param mouseEvent 鼠标事件。 - * @param buttonId 鼠标按键。 + * @param mouseEvent Mouse event. + * @param buttonId Mouse button. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ void OH_Input_SetButtonId(struct Input_MouseEvent* mouseEvent, int32_t buttonId); /** - * @brief 获取鼠标按键。 + * @brief Obtains the mouse button. * - * @param mouseEvent 鼠标事件。 - * @return 返回鼠标事件的按键ID。 + * @param mouseEvent Mouse event. + * @return ID of the mouse button. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ int32_t OH_Input_GetButtonId(struct Input_MouseEvent* mouseEvent); /** - * @brief 设置滚轮滚动偏移值。 + * @brief Sets the offset of the scroll wheel. * - * @param mouseEvent 鼠标事件。 - * @param scrollValue 鼠标按键。 + * @param mouseEvent Mouse event. + * @param scrollValue Offset of the scroll wheel. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ void OH_Input_SetScrollValue(struct Input_MouseEvent* mouseEvent, int32_t scrollValue); /** - * @brief 获取滚轮偏移值。 + * @brief Obtains the offset of the scroll wheel. * - * @param mouseEvent 鼠标事件。 - * @return 返回鼠标事件的滚轮偏移值。 + * @param mouseEvent Mouse event. + * @return Offset of the scroll wheel. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ int32_t OH_Input_GetScrollValue(struct Input_MouseEvent* mouseEvent); /** - * @brief 设置X坐标。 + * @brief Sets the X coordinate. * - * @param touchEvent 触摸事件。 - * @param displayX 触摸事件相对屏幕的X坐标。 + * @param touchEvent Touch event. + * @param displayX X coordinate relative to the screen. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ void OH_Input_SetTouchDisplayX(struct Input_TouchEvent* touchEvent, int32_t displayX); /** - * @brief 获取X坐标。 + * @brief Obtains the X coordinate. * - * @param touchEvent 触摸事件。 - * @return 返回触摸事件的相对屏幕X坐标。 + * @param touchEvent Touch event. + * @return X coordinate relative to the screen. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ int32_t OH_Input_GetTouchDisplayX(struct Input_TouchEvent* touchEvent); /** - * @brief 设置Y坐标。 + * @brief Sets the Y coordinate. * - * @param touchEvent 触摸事件。 - * @param displayY 触摸事件相对屏幕的Y坐标。 + * @param touchEvent Touch event. + * @param displayY Y coordinate relative to the screen. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ void OH_Input_SetTouchDisplayY(struct Input_TouchEvent* touchEvent, int32_t displayY); /** - * @brief 获取Y坐标。 + * @brief Obtains the Y coordinate. * - * @param touchEvent 触摸事件。 - * @return 返回触摸事件的相对屏幕Y坐标。 + * @param touchEvent Touch event. + * @return Y coordinate relative to the screen. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ int32_t OH_Input_GetTouchDisplayY(struct Input_TouchEvent* touchEvent); /** - * @brief 设置动作。 + * @brief Sets the touch action. * - * @param touchEvent 触摸事件。 - * @param mouseAction 触摸动作。 + * @param touchEvent Touch event. + * @param mouseAction Touch action. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ void OH_Input_SetTouchAction(struct Input_TouchEvent* touchEvent, int32_t mouseAction); /** - * @brief 获取动作。 + * @brief Obtains the touch action. * - * @param touchEvent 触摸事件。 - * @return 返回触摸事件的动作。 + * @param touchEvent Touch event. + * @return Touch action. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ int32_t OH_Input_GetTouchAction(struct Input_TouchEvent* touchEvent); /** - * @brief 设置资源类型。 + * @brief Sets the resource type. * - * @param touchEvent 触摸事件。 - * @param sourceType 资源类型。 + * @param touchEvent Touch event. + * @param sourceType Resource type. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ void OH_Input_SetTouchSourceType(struct Input_TouchEvent* touchEvent, int32_t sourceType); /** - * @brief 获取资源类型。 + * @brief Obtains the resource type. * - * @param touchEvent 触摸事件。 - * @return 返回触摸事件资源类型。 + * @param touchEvent Touch event. + * @return Resource type. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ int32_t OH_Input_GetTouchSourceType(struct Input_TouchEvent* touchEvent); /** - * @brief 设置工具类型。 + * @brief Sets the tool type. * - * @param touchEvent 触摸事件。 - * @param toolType 工具类型。 + * @param touchEvent Touch event. + * @param toolType Tool type. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ void OH_Input_SetTouchToolType(struct Input_TouchEvent* touchEvent, int32_t toolType); /** - * @brief 获取工具类型。 + * @brief Obtains the tool type. * - * @param touchEvent 触摸事件。 - * @return 返回触摸事件工具类型。 + * @param touchEvent Touch event. + * @return Tool type. * @syscap SystemCapability.MultimodalInput.Input.Core * @since 12 */ -- Gitee