• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Input
2
3## Overview
4
5Provides C APIs for the multimodal input module.
6
7**Since**: 12
8
9
10## Summary
11
12
13### File
14
15| Name| Description|
16| -------- | -------- |
17| [oh_axis_type.h](oh__axis__type_8h.md) | Defines the axis event structures and enumerations.|
18| [oh_input_manager.h](oh__input__manager_8h.md) | Provides functions such as event injection and status query. |
19| [oh_key_code.h](oh__key__code_8h.md) | Defines key codes of the key device. |
20
21### Structs
22
23| Name| Description|
24| -------- | -------- |
25| struct  [Input_InterceptorEventCallback](_input___interceptor_event_callback.md) | Defines the structure of the interceptor for callback events, including mouse events, touch events, and axis events. |
26| struct  [Input_DeviceListener](_input___device_listener.md) | Defines a listener for device hot swap events. |
27
28
29### Types
30
31| Name| Description|
32| -------- | -------- |
33| typedef enum [InputEvent_AxisType](#inputevent_axistype) [InputEvent_AxisType](#inputevent_axistype) | Provides axis types of the input device. |
34| typedef enum [InputEvent_AxisEventType](#inputevent_axiseventtype) [InputEvent_AxisEventType](#inputevent_axiseventtype) | Provides event types of the input device. |
35| typedef enum [InputEvent_AxisAction](#inputevent_axisaction) [InputEvent_AxisAction](#inputevent_axisaction) | Provides actions of the input device. |
36| typedef enum [Input_KeyStateAction](#input_keystateaction) [Input_KeyStateAction](#input_keystateaction) | Provides the enum values of the key status. |
37| typedef enum [Input_KeyEventAction](#input_keyeventaction) [Input_KeyEventAction](#input_keyeventaction) | Provides the enum values of the key event type. |
38| typedef enum [Input_MouseEventAction](#input_mouseeventaction) [Input_MouseEventAction](#input_mouseeventaction) | Provides the enum values of mouse actions. |
39| typedef enum [InputEvent_MouseAxis](#inputevent_mouseaxis) [InputEvent_MouseAxis](#inputevent_mouseaxis) | Provides the enum values of mouse axis event types. |
40| typedef enum [Input_MouseEventButton](#input_mouseeventbutton) [Input_MouseEventButton](#input_mouseeventbutton) | Provides the enum values of mouse buttons. |
41| typedef enum [Input_TouchEventAction](#input_toucheventaction) [Input_TouchEventAction](#input_toucheventaction) | Provides the enum values of touch actions. |
42| typedef enum [InputEvent_SourceType](#inputevent_sourcetype) [InputEvent_SourceType](#inputevent_sourcetype) | Provides the enum values of event source types. |
43| typedef enum [Input_KeyboardType](#input_keyboardtype) [Input_KeyboardType](#input_keyboardtype) | Provides the enum values of keyboard types of the input device. |
44| typedef struct [Input_KeyState](#input_keystate) [Input_KeyState](#input_keystate) | Defines key information, which identifies a key pressing behavior. For example, the Ctrl key information contains the key value and key type. |
45| typedef struct [Input_KeyEvent](#input_keyevent) [Input_KeyEvent](#input_keyevent) | Defines the key event to be injected. |
46| typedef struct [Input_MouseEvent](#input_mouseevent) [Input_MouseEvent](#input_mouseevent) | Defines the mouse event to be injected. |
47| typedef struct [Input_TouchEvent](#input_touchevent) [Input_TouchEvent](#input_touchevent) | Defines the touch event to be injected. |
48| typedef struct [Input_AxisEvent](#input_axisevent) [Input_AxisEvent](#input_axisevent) | Defines an axis event. |
49| typedef enum [Input_Result](#input_result) [Input_Result](#input_result) | Provides the enum values of error codes. |
50| typedef void(\* [Input_KeyEventCallback](#input_keyeventcallback)) (const [Input_KeyEvent](#input_keyevent) \*keyEvent) | Defines a lifecycle callback for **keyEvent**. If the callback is triggered, **keyEvent** will be destroyed. |
51| typedef void(\* [Input_MouseEventCallback](#input_mouseeventcallback)) (const [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Defines a lifecycle callback for **mouseEvent**. If the callback is triggered, **mouseEvent** will be destroyed. |
52| typedef void(\* [Input_TouchEventCallback](#input_toucheventcallback)) (const [Input_TouchEvent](#input_touchevent) \*touchEvent) | Defines a lifecycle callback for **touchEvent**. If the callback is triggered, **touchEvent** will be destroyed. |
53| typedef void(\* [Input_AxisEventCallback](#input_axiseventcallback)) (const [Input_AxisEvent](#input_axisevent) \*axisEvent) | Defines a lifecycle callback for **axisEvent**. If the callback is triggered, **axisEvent** will be destroyed. |
54| typedef void(\* [Input_HotkeyCallback](#input_hotkeycallback)) ([Input_Hotkey](#input_hotkey) \*hotkey) | Defines the callback used to return shortcut key events. |
55| typedef void(\* [Input_DeviceAddedCallback](#input_deviceaddedcallback)) (int32_t deviceId) | Defines a callback used to receive device insertion events. |
56| typedef void(\* [Input_DeviceRemovedCallback](#input_deviceremovedcallback)) (int32_t deviceId) | Defines a callback used to receive device removal events. |
57| typedef struct [Input_InterceptorEventCallback](_input___interceptor_event_callback.md) [Input_InterceptorEventCallback](#input_interceptoreventcallback) | Defines the structure of the interceptor for callback events, including mouse events, touch events, and axis events. |
58| typedef struct [Input_DeviceListener](_input___device_listener.md) [Input_DeviceListener](#input_devicelistener) |Defines a listener for device hot swap events. |
59| typedef struct [Input_InterceptorOptions](#input_interceptoroptions) [Input_InterceptorOptions](#input_interceptoroptions) | Defines event interception options. |
60| typedef struct [Input_Hotkey](#input_hotkey) [Input_Hotkey](#input_hotkey) | Defines the shortcut key structure. |
61| typedef struct [Input_DeviceInfo](#input_deviceinfo) [Input_DeviceInfo](#input_deviceinfo) | Defines the input device information. |
62
63
64### Enums
65
66| Name| Description|
67| -------- | -------- |
68| [InputEvent_AxisType](#inputevent_axistype) {<br>AXIS_TYPE_UNKNOWN, AXIS_TYPE_SCROLL_VERTICAL, AXIS_TYPE_SCROLL_HORIZONTAL, AXIS_TYPE_PINCH,<br>AXIS_TYPE_ROTATE<br>} | Axis type of the input device. |
69| [InputEvent_AxisEventType](#inputevent_axiseventtype) { AXIS_EVENT_TYPE_PINCH = 1, AXIS_EVENT_TYPE_SCROLL = 2 } | Event type of the input device. |
70| [InputEvent_AxisAction](#inputevent_axisaction) { AXIS_ACTION_CANCEL = 0, AXIS_ACTION_BEGIN, AXIS_ACTION_UPDATE, AXIS_ACTION_END } | Action of the input device. |
71| [Input_KeyStateAction](#input_keystateaction) {<br>KEY_DEFAULT = -1, KEY_PRESSED = 0, KEY_RELEASED = 1, KEY_SWITCH_ON = 2,<br>KEY_SWITCH_OFF = 3<br>} | Key status. |
72| [Input_KeyEventAction](#input_keyeventaction) { KEY_ACTION_CANCEL = 0, KEY_ACTION_DOWN = 1, KEY_ACTION_UP = 2 } | Key event type. |
73| [Input_MouseEventAction](#input_mouseeventaction) {<br>MOUSE_ACTION_CANCEL = 0, MOUSE_ACTION_MOVE = 1, MOUSE_ACTION_BUTTON_DOWN = 2, MOUSE_ACTION_BUTTON_UP = 3,<br>MOUSE_ACTION_AXIS_BEGIN = 4, MOUSE_ACTION_AXIS_UPDATE = 5, MOUSE_ACTION_AXIS_END = 6<br>} | Mouse action. |
74| [InputEvent_MouseAxis](#inputevent_mouseaxis) { MOUSE_AXIS_SCROLL_VERTICAL = 0, MOUSE_AXIS_SCROLL_HORIZONTAL = 1 } | Mouse axis event type. |
75| [Input_MouseEventButton](#input_mouseeventbutton) {<br>MOUSE_BUTTON_NONE = -1, MOUSE_BUTTON_LEFT = 0, MOUSE_BUTTON_MIDDLE = 1, MOUSE_BUTTON_RIGHT = 2,<br>MOUSE_BUTTON_FORWARD = 3, MOUSE_BUTTON_BACK = 4<br>} | Mouse button. |
76| [Input_TouchEventAction](#input_toucheventaction) { TOUCH_ACTION_CANCEL = 0, TOUCH_ACTION_DOWN = 1, TOUCH_ACTION_MOVE = 2, TOUCH_ACTION_UP = 3 } | Touch action. |
77| [InputEvent_SourceType](#inputevent_sourcetype) { SOURCE_TYPE_MOUSE = 1, SOURCE_TYPE_TOUCHSCREEN = 2, SOURCE_TYPE_TOUCHPAD = 3 } | Event source type. |
78| [Input_KeyboardType](#input_keyboardtype) {<br>KEYBOARD_TYPE_NONE = 0, KEYBOARD_TYPE_UNKNOWN = 1, KEYBOARD_TYPE_ALPHABETIC = 2, KEYBOARD_TYPE_DIGITAL = 3,<br>KEYBOARD_TYPE_STYLUS = 4, KEYBOARD_TYPE_REMOTE_CONTROL = 5<br>} | Keyboard type of the input device. |
79| [Input_Result](#input_result) {<br>INPUT_SUCCESS = 0, INPUT_PERMISSION_DENIED = 201, INPUT_NOT_SYSTEM_APPLICATION = 202, INPUT_PARAMETER_ERROR = 401, INPUT_DEVICE_NOT_SUPPORTED = 801,<br>INPUT_SERVICE_EXCEPTION = 3800001, INPUT_KEYBOARD_DEVICE_NOT_EXIST = 3900002, INPUT_REPEAT_INTERCEPTOR = 4200001, INPUT_OCCUPIED_BY_SYSTEM = 4200002, <br>INPUT_OCCUPIED_BY_OTHER = 4200003<br>} | Error code. |
80| [Input_KeyCode](#input_keycode) {<br>KEYCODE_UNKNOWN = -1, KEYCODE_FN = 0, KEYCODE_VOLUME_UP = 16, KEYCODE_VOLUME_DOWN = 17,<br>KEYCODE_POWER = 18, KEYCODE_CAMERA = 19, KEYCODE_VOLUME_MUTE = 22, KEYCODE_MUTE = 23,<br>KEYCODE_BRIGHTNESS_UP = 40, KEYCODE_BRIGHTNESS_DOWN = 41, KEYCODE_0 = 2000, KEYCODE_1 = 2001,<br>KEYCODE_2 = 2002, KEYCODE_3 = 2003, KEYCODE_4 = 2004, KEYCODE_5 = 2005,<br>KEYCODE_6 = 2006, KEYCODE_7 = 2007, KEYCODE_8 = 2008, KEYCODE_9 = 2009,<br>KEYCODE_STAR = 2010, KEYCODE_POUND = 2011, KEYCODE_DPAD_UP = 2012, KEYCODE_DPAD_DOWN = 2013,<br>KEYCODE_DPAD_LEFT = 2014, KEYCODE_DPAD_RIGHT = 2015, KEYCODE_DPAD_CENTER = 2016, KEYCODE_A = 2017,<br>KEYCODE_B = 2018, KEYCODE_C = 2019, KEYCODE_D = 2020, KEYCODE_E = 2021,<br>KEYCODE_F = 2022, KEYCODE_G = 2023, KEYCODE_H = 2024, KEYCODE_I = 2025,<br>KEYCODE_J = 2026, KEYCODE_K = 2027, KEYCODE_L = 2028, KEYCODE_M = 2029,<br>KEYCODE_N = 2030, KEYCODE_O = 2031, KEYCODE_P = 2032, KEYCODE_Q = 2033,<br>KEYCODE_R = 2034, KEYCODE_S = 2035, KEYCODE_T = 2036, KEYCODE_U = 2037,<br>KEYCODE_V = 2038, KEYCODE_W = 2039, KEYCODE_X = 2040, KEYCODE_Y = 2041,<br>KEYCODE_Z = 2042, KEYCODE_COMMA = 2043, KEYCODE_PERIOD = 2044, KEYCODE_ALT_LEFT = 2045,<br>KEYCODE_ALT_RIGHT = 2046, KEYCODE_SHIFT_LEFT = 2047, KEYCODE_SHIFT_RIGHT = 2048, KEYCODE_TAB = 2049,<br>KEYCODE_SPACE = 2050, KEYCODE_SYM = 2051, KEYCODE_EXPLORER = 2052, KEYCODE_ENVELOPE = 2053,<br>KEYCODE_ENTER = 2054, KEYCODE_DEL = 2055, KEYCODE_GRAVE = 2056, KEYCODE_MINUS = 2057,<br>KEYCODE_EQUALS = 2058, KEYCODE_LEFT_BRACKET = 2059, KEYCODE_RIGHT_BRACKET = 2060, KEYCODE_BACKSLASH = 2061,<br>KEYCODE_SEMICOLON = 2062, KEYCODE_APOSTROPHE = 2063, KEYCODE_SLASH = 2064, KEYCODE_AT = 2065,<br>KEYCODE_PLUS = 2066, KEYCODE_MENU = 2067, KEYCODE_PAGE_UP = 2068, KEYCODE_PAGE_DOWN = 2069,<br>KEYCODE_ESCAPE = 2070, KEYCODE_FORWARD_DEL = 2071, KEYCODE_CTRL_LEFT = 2072, KEYCODE_CTRL_RIGHT = 2073,<br>KEYCODE_CAPS_LOCK = 2074, KEYCODE_SCROLL_LOCK = 2075, KEYCODE_META_LEFT = 2076, KEYCODE_META_RIGHT = 2077,<br>KEYCODE_FUNCTION = 2078, KEYCODE_SYSRQ = 2079, KEYCODE_BREAK = 2080, KEYCODE_MOVE_HOME = 2081,<br>KEYCODE_MOVE_END = 2082, KEYCODE_INSERT = 2083, KEYCODE_FORWARD = 2084, KEYCODE_MEDIA_PLAY = 2085,<br>KEYCODE_MEDIA_PAUSE = 2086, KEYCODE_MEDIA_CLOSE = 2087, KEYCODE_MEDIA_EJECT = 2088, KEYCODE_MEDIA_RECORD = 2089,<br>KEYCODE_F1 = 2090, KEYCODE_F2 = 2091, KEYCODE_F3 = 2092, KEYCODE_F4 = 2093,<br>KEYCODE_F5 = 2094, KEYCODE_F6 = 2095, KEYCODE_F7 = 2096, KEYCODE_F8 = 2097,<br>KEYCODE_F9 = 2098, KEYCODE_F10 = 2099, KEYCODE_F11 = 2100, KEYCODE_F12 = 2101,<br>KEYCODE_NUM_LOCK = 2102, KEYCODE_NUMPAD_0 = 2103, KEYCODE_NUMPAD_1 = 2104, KEYCODE_NUMPAD_2 = 2105,<br>KEYCODE_NUMPAD_3 = 2106, KEYCODE_NUMPAD_4 = 2107, KEYCODE_NUMPAD_5 = 2108, KEYCODE_NUMPAD_6 = 2109,<br>KEYCODE_NUMPAD_7 = 2110, KEYCODE_NUMPAD_8 = 2111, KEYCODE_NUMPAD_9 = 2112, KEYCODE_NUMPAD_DIVIDE = 2113,<br>KEYCODE_NUMPAD_MULTIPLY = 2114, KEYCODE_NUMPAD_SUBTRACT = 2115, KEYCODE_NUMPAD_ADD = 2116, KEYCODE_NUMPAD_DOT = 2117,<br>KEYCODE_NUMPAD_COMMA = 2118, KEYCODE_NUMPAD_ENTER = 2119, KEYCODE_NUMPAD_EQUALS = 2120, KEYCODE_NUMPAD_LEFT_PAREN = 2121,<br>KEYCODE_NUMPAD_RIGHT_PAREN = 2122, KEYCODE_DAGGER_CLICK = 3211, KEYCODE_DAGGER_DOUBLE_CLICK = 3212, KEYCODE_DAGGER_LONG_PRESS = 3213<br>} | Key code value. |
81
82
83### Functions
84
85| Name| Description|
86| -------- | -------- |
87| [Input_Result](#input_result) [OH_Input_GetKeyState](#oh_input_getkeystate) (struct [Input_KeyState](#input_keystate) \*keyState) | Queries a key status enum object. |
88| struct [Input_KeyState](#input_keystate) \* [OH_Input_CreateKeyState](#oh_input_createkeystate) () | Creates a key status enum object. |
89| void [OH_Input_DestroyKeyState](#oh_input_destroykeystate) (struct [Input_KeyState](#input_keystate) \*\*keyState) | Destroys a key status enum object. |
90| void [OH_Input_SetKeyCode](#oh_input_setkeycode) (struct [Input_KeyState](#input_keystate) \*keyState, int32_t keyCode) | Sets the key value of a key status enum object. |
91| int32_t [OH_Input_GetKeyCode](#oh_input_getkeycode) (const struct [Input_KeyState](#input_keystate) \*keyState) | Obtains the key value of a key status enum object. |
92| void [OH_Input_SetKeyPressed](#oh_input_setkeypressed) (struct [Input_KeyState](#input_keystate) \*keyState, int32_t keyAction) | Sets whether the key specific to a key status enum object is pressed. |
93| int32_t [OH_Input_GetKeyPressed](#oh_input_getkeypressed) (const struct [Input_KeyState](#input_keystate) \*keyState) | Checks whether the key specific to a key status enum object is pressed. |
94| void [OH_Input_SetKeySwitch](#oh_input_setkeyswitch) (struct [Input_KeyState](#input_keystate) \*keyState, int32_t keySwitch) | Sets the key switch of the key status enum object. |
95| int32_t [OH_Input_GetKeySwitch](#oh_input_getkeyswitch) (const struct [Input_KeyState](#input_keystate) \*keyState) | Obtains the key switch of the key status enum object. |
96| int32_t [OH_Input_InjectKeyEvent](#oh_input_injectkeyevent) (const struct [Input_KeyEvent](#input_keyevent) \*keyEvent) | Injects a key event. |
97| struct [Input_KeyEvent](#input_keyevent) \* [OH_Input_CreateKeyEvent](#oh_input_createkeyevent) () | Creates a key event object. |
98| void [OH_Input_DestroyKeyEvent](#oh_input_destroykeyevent) (struct [Input_KeyEvent](#input_keyevent) \*\*keyEvent) | Destroys a key event object.|
99| void [OH_Input_SetKeyEventAction](#oh_input_setkeyeventaction) (struct [Input_KeyEvent](#input_keyevent) \*keyEvent, int32_t action) | Sets the key event type. |
100| int32_t [OH_Input_GetKeyEventAction](#oh_input_getkeyeventaction) (const struct [Input_KeyEvent](#input_keyevent) \*keyEvent) | Obtains the key event type. |
101| void [OH_Input_SetKeyEventKeyCode](#oh_input_setkeyeventkeycode) (struct [Input_KeyEvent](#input_keyevent) \*keyEvent, int32_t keyCode) | Sets the key code value for a key event. |
102| int32_t [OH_Input_GetKeyEventKeyCode](#oh_input_getkeyeventkeycode) (const struct [Input_KeyEvent](#input_keyevent) \*keyEvent) | Obtains the key code value of a key event. |
103| void [OH_Input_SetKeyEventActionTime](#oh_input_setkeyeventactiontime) (struct [Input_KeyEvent](#input_keyevent) \*keyEvent, int64_t actionTime) | Sets the time when a key event occurs. |
104| int64_t [OH_Input_GetKeyEventActionTime](#oh_input_getkeyeventactiontime) (const struct [Input_KeyEvent](#input_keyevent) \*keyEvent) | Obtains the time when a key event occurs. |
105| void [OH_Input_SetKeyEventWindowId](#oh_input_setkeyeventwindowid) (struct [Input_KeyEvent](#input_keyevent) \*keyEvent, int32_t windowId) | Sets the window ID of a key event. |
106| int32_t [OH_Input_GetKeyEventWindowId](#oh_input_getkeyeventwindowid) (const struct [Input_KeyEvent](#input_keyevent) \*keyEvent) | Obtains the window ID of a key event. |
107| void [OH_Input_SetKeyEventDisplayId](#oh_input_setkeyeventdisplayid) (struct [Input_KeyEvent](#input_keyevent) \*keyEvent, int32_t displayId) | Sets the screen ID of a key event. |
108| int32_t [OH_Input_GetKeyEventDisplayId](#oh_input_getkeyeventdisplayid) (const struct [Input_KeyEvent](#input_keyevent) \*keyEvent) | Obtains the screen ID of a key event. |
109| int32_t [OH_Input_InjectMouseEvent](#oh_input_injectmouseevent) (const struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Injects a mouse event. |
110| struct [Input_MouseEvent](#input_mouseevent) \* [OH_Input_CreateMouseEvent](#oh_input_createmouseevent) () | Creates a mouse event object. |
111| void [OH_Input_DestroyMouseEvent](#oh_input_destroymouseevent) (struct [Input_MouseEvent](#input_mouseevent) \*\*mouseEvent) | Destroys a mouse event object.|
112| void [OH_Input_SetMouseEventAction](#oh_input_setmouseeventaction) (struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent, int32_t action) | Sets the action for a mouse event. |
113| int32_t [OH_Input_GetMouseEventAction](#oh_input_getmouseeventaction) (const struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Obtains the action of a mouse event. |
114| void [OH_Input_SetMouseEventDisplayX](#oh_input_setmouseeventdisplayx) (struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent, int32_t displayX) | Sets the X coordinate for a mouse event. |
115| int32_t [OH_Input_GetMouseEventDisplayX](#oh_input_getmouseeventdisplayx) (const struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Obtains the X coordinate of a mouse event. |
116| void [OH_Input_SetMouseEventDisplayY](#oh_input_setmouseeventdisplayy) (struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent, int32_t displayY) | Sets the Y coordinate for a mouse event. |
117| int32_t [OH_Input_GetMouseEventDisplayY](#oh_input_getmouseeventdisplayy) (const struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Obtains the Y coordinate of a mouse event. |
118| void [OH_Input_SetMouseEventButton](#oh_input_setmouseeventbutton) (struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent, int32_t button) | Sets the button for a mouse event. |
119| int32_t [OH_Input_GetMouseEventButton](#oh_input_getmouseeventbutton) (const struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Obtains the button of a mouse event. |
120| void [OH_Input_SetMouseEventAxisType](#oh_input_setmouseeventaxistype) (struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent, int32_t axisType) | Sets the axis type for a mouse event. |
121| int32_t [OH_Input_GetMouseEventAxisType](#oh_input_getmouseeventaxistype) (const struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Obtains the axis type of a mouse event. |
122| void [OH_Input_SetMouseEventAxisValue](#oh_input_setmouseeventaxisvalue) (struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent, float axisValue) | Sets the axis value for a mouse axis event. |
123| float [OH_Input_GetMouseEventAxisValue](#oh_input_getmouseeventaxisvalue) (const struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Obtains the axis value of a mouse axis event. |
124| void [OH_Input_SetMouseEventActionTime](#oh_input_setmouseeventactiontime) (struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent, int64_t actionTime) | Sets the time when a mouse event occurs. |
125| int64_t [OH_Input_GetMouseEventActionTime](#oh_input_getmouseeventactiontime) (const struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Obtains the time when a mouse event occurs. |
126| void [OH_Input_SetMouseEventWindowId](#oh_input_setmouseeventwindowid) (struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent, int32_t windowId) | Sets the window ID of a mouse event. |
127| int32_t [OH_Input_GetMouseEventWindowId](#oh_input_getmouseeventwindowid) (const struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Obtains the window ID of a mouse event. |
128| void [OH_Input_SetMouseEventDisplayId](#oh_input_setmouseeventdisplayid) (struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent, int32_t displayId) | Sets the screen ID of a mouse event. |
129| int32_t [OH_Input_GetMouseEventDisplayId](#oh_input_getmouseeventdisplayid) (const struct [Input_MouseEvent](#input_mouseevent) \*mouseEvent) | Obtains the screen ID of a mouse event. |
130| int32_t [OH_Input_InjectTouchEvent](#oh_input_injecttouchevent) (const struct [Input_TouchEvent](#input_touchevent) \*touchEvent) | Injects a touch event. |
131| struct [Input_TouchEvent](#input_touchevent) \* [OH_Input_CreateTouchEvent](#oh_input_createtouchevent) () | Creates a touch event object. |
132| void [OH_Input_DestroyTouchEvent](#oh_input_destroytouchevent) (struct [Input_TouchEvent](#input_touchevent) \*\*touchEvent) | Destroys a touch event object. |
133| void [OH_Input_SetTouchEventAction](#oh_input_settoucheventaction) (struct [Input_TouchEvent](#input_touchevent) \*touchEvent, int32_t action) | Sets the action for a touch event. |
134| int32_t [OH_Input_GetTouchEventAction](#oh_input_gettoucheventaction) (const struct [Input_TouchEvent](#input_touchevent) \*touchEvent) | Obtains the action of a touch event. |
135| void [OH_Input_SetTouchEventFingerId](#oh_input_settoucheventfingerid) (struct [Input_TouchEvent](#input_touchevent) \*touchEvent, int32_t id) | Sets the finger ID for a touch event. |
136| int32_t [OH_Input_GetTouchEventFingerId](#oh_input_gettoucheventfingerid) (const struct [Input_TouchEvent](#input_touchevent) \*touchEvent) | Obtains the finger ID of a touch event. |
137| void [OH_Input_SetTouchEventDisplayX](#oh_input_settoucheventdisplayx) (struct [Input_TouchEvent](#input_touchevent) \*touchEvent, int32_t displayX) | Sets the X coordinate for a touch event.|
138| int32_t [OH_Input_GetTouchEventDisplayX](#oh_input_gettoucheventdisplayx) (const struct [Input_TouchEvent](#input_touchevent) \*touchEvent) | Obtains the X coordinate of a touch event. |
139| void [OH_Input_SetTouchEventDisplayY](#oh_input_settoucheventdisplayy) (struct [Input_TouchEvent](#input_touchevent) \*touchEvent, int32_t displayY) | Sets the Y coordinate for a touch event. |
140| int32_t [OH_Input_GetTouchEventDisplayY](#oh_input_gettoucheventdisplayy) (const struct [Input_TouchEvent](#input_touchevent) \*touchEvent) | Obtains the Y coordinate of a touch event. |
141| void [OH_Input_SetTouchEventActionTime](#oh_input_settoucheventactiontime) (struct [Input_TouchEvent](#input_touchevent) \*touchEvent, int64_t actionTime) | Sets the time when a touch event occurs. |
142| int64_t [OH_Input_GetTouchEventActionTime](#oh_input_gettoucheventactiontime) (const struct [Input_TouchEvent](#input_touchevent) \*touchEvent) | Obtains the time when a touch event occurs. |
143| void [OH_Input_SetTouchEventWindowId](#oh_input_settoucheventwindowid) (struct [Input_TouchEvent](#input_touchevent) \*touchEvent, int32_t windowId) | Sets the window ID of a touchscreen event. |
144| int32_t [OH_Input_GetTouchEventWindowId](#oh_input_gettoucheventwindowid) (const struct [Input_TouchEvent](#input_touchevent) \*touchEvent) | Obtains the window ID of a touchscreen event. |
145| void [OH_Input_SetTouchEventDisplayId](#oh_input_settoucheventdisplayid) (struct [Input_TouchEvent](#input_touchevent) \*touchEvent, int32_t displayId) | Sets the screen ID of a touchscreen event. |
146| int32_t [OH_Input_GetTouchEventDisplayId](#oh_input_gettoucheventdisplayid) (const struct [Input_TouchEvent](#input_touchevent) \*touchEvent) | Obtains the screen ID of a touchscreen event. |
147| void [OH_Input_CancelInjection](#oh_input_cancelinjection) () | Stops event injection and revokes authorization. |
148| [Input_AxisEvent](#input_axisevent) \* [OH_Input_CreateAxisEvent](#oh_input_createaxisevent) (void) | Creates an axis event object. |
149| [Input_Result](#input_result) [OH_Input_DestroyAxisEvent](#oh_input_destroyaxisevent) ([Input_AxisEvent](#input_axisevent) \*\*axisEvent) | Destroys an axis event object. |
150| [Input_Result](#input_result) [OH_Input_SetAxisEventAction](#oh_input_setaxiseventaction) ([Input_AxisEvent](#input_axisevent) \*axisEvent, [InputEvent_AxisAction](#inputevent_axisaction) action) | Sets the action for an axis event. |
151| [Input_Result](#input_result) [OH_Input_GetAxisEventAction](#oh_input_getaxiseventaction) (const [Input_AxisEvent](#input_axisevent) \*axisEvent, [InputEvent_AxisAction](#inputevent_axisaction) \*action) | Obtains the action of an axis event. |
152| [Input_Result](#input_result) [OH_Input_SetAxisEventDisplayX](#oh_input_setaxiseventdisplayx) ([Input_AxisEvent](#input_axisevent) \*axisEvent, float displayX) | Sets the X coordinate for an axis event. |
153| [Input_Result](#input_result) [OH_Input_GetAxisEventDisplayX](#oh_input_getaxiseventdisplayx) (const [Input_AxisEvent](#input_axisevent) \*axisEvent, float \*displayX) | Obtains the X coordinate of an axis event. |
154| [Input_Result](#input_result) [OH_Input_SetAxisEventDisplayY](#oh_input_setaxiseventdisplayy) ([Input_AxisEvent](#input_axisevent) \*axisEvent, float displayY) | Sets the Y coordinate for an axis event. |
155| [Input_Result](#input_result) [OH_Input_GetAxisEventDisplayY](#oh_input_getaxiseventdisplayy) (const [Input_AxisEvent](#input_axisevent) \*axisEvent, float \*displayY) | Obtains the Y coordinate of an axis event. |
156| [Input_Result](#input_result) [OH_Input_SetAxisEventAxisValue](#oh_input_setaxiseventaxisvalue) ([Input_AxisEvent](#input_axisevent) \*axisEvent, [InputEvent_AxisType](#inputevent_axistype) axisType, double axisValue) | Sets the axis value of the axis type specified by the axis event. |
157| [Input_Result](#input_result) [OH_Input_GetAxisEventAxisValue](#oh_input_getaxiseventaxisvalue) (const [Input_AxisEvent](#input_axisevent) \*axisEvent, [InputEvent_AxisType](#inputevent_axistype) axisType, double \*axisValue) | Obtains the axis value for the specified axis type of the axis event. |
158| [Input_Result](#input_result) [OH_Input_SetAxisEventActionTime](#oh_input_setaxiseventactiontime) ([Input_AxisEvent](#input_axisevent) \*axisEvent, int64_t actionTime) | Sets the time when an axis event occurs. |
159| [Input_Result](#input_result) [OH_Input_GetAxisEventActionTime](#oh_input_getaxiseventactiontime) (const [Input_AxisEvent](#input_axisevent) \*axisEvent, int64_t \*actionTime) | Obtains the time when an axis event occurs. |
160| [Input_Result](#input_result) [OH_Input_SetAxisEventType](#oh_input_setaxiseventtype) ([Input_AxisEvent](#input_axisevent) \*axisEvent, [InputEvent_AxisEventType](#inputevent_axiseventtype) axisEventType) | Sets the axis event type. |
161| [Input_Result](#input_result) [OH_Input_GetAxisEventType](#oh_input_getaxiseventtype) (const [Input_AxisEvent](#input_axisevent) \*axisEvent, [InputEvent_AxisEventType](#inputevent_axiseventtype) \*axisEventType) | Obtains the axis event type. |
162| [Input_Result](#input_result) [OH_Input_SetAxisEventSourceType](#oh_input_setaxiseventsourcetype) ([Input_AxisEvent](#input_axisevent) \*axisEvent, [InputEvent_SourceType](#inputevent_sourcetype) sourceType) | Sets the axis event source type. |
163| [Input_Result](#input_result) [OH_Input_GetAxisEventSourceType](#oh_input_getaxiseventsourcetype) (const [Input_AxisEvent](#input_axisevent) \*axisEvent, [InputEvent_SourceType](#inputevent_sourcetype) \*sourceType) | Obtains the axis event source type. |
164| [Input_Result](#input_result) [OH_Input_SetAxisEventWindowId](#oh_input_setaxiseventwindowid) ([Input_AxisEvent](#input_axisevent) \*axisEvent, int32_t windowId) | Sets the window ID of an axis event. |
165| [Input_Result](#input_result) [OH_Input_GetAxisEventWindowId](#oh_input_getaxiseventwindowid) (const [Input_AxisEvent](#input_axisevent) \*axisEvent, int32_t \*windowId) | Obtains the window ID of an axis event. |
166| [Input_Result](#input_result) [OH_Input_SetAxisEventDisplayId](#oh_input_setaxiseventdisplayid) ([Input_AxisEvent](#input_axisevent) \*axisEvent, int32_t displayId) | Sets the screen ID of an axis event. |
167| [Input_Result](#input_result) [OH_Input_GetAxisEventDisplayId](#oh_input_getaxiseventdisplayid) (const [Input_AxisEvent](#input_axisevent) \*axisEvent, int32_t \*displayId) | Obtains the screen ID of an axis event. |
168| [Input_Result](#input_result) [OH_Input_AddKeyEventMonitor](#oh_input_addkeyeventmonitor) ([Input_KeyEventCallback](#input_keyeventcallback) callback) | Adds a listener for key events. |
169| [Input_Result](#input_result) [OH_Input_AddMouseEventMonitor](#oh_input_addmouseeventmonitor) ([Input_MouseEventCallback](#input_mouseeventcallback) callback) | Adds a listener for mouse events, including mouse click and movement events, but not scroll wheel events. Scroll wheel events are axis events. |
170| [Input_Result](#input_result) [OH_Input_AddTouchEventMonitor](#oh_input_addtoucheventmonitor) ([Input_TouchEventCallback](#input_toucheventcallback) callback) | Adds a listener for touch events. |
171| [Input_Result](#input_result) [OH_Input_AddAxisEventMonitorForAll](#oh_input_addaxiseventmonitorforall) ([Input_AxisEventCallback](#input_axiseventcallback) callback) | Adds a listener for all types of axis events, which are defined in [InputEvent_AxisEventType](#inputevent_axiseventtype). |
172| [Input_Result](#input_result) [OH_Input_AddAxisEventMonitor](#oh_input_addaxiseventmonitor) ([InputEvent_AxisEventType](#inputevent_axiseventtype) axisEventType, [Input_AxisEventCallback](#input_axiseventcallback) callback) | Adds a listener for the specified type of axis events, which are defined in [InputEvent_AxisEventType](#inputevent_axiseventtype). |
173| [Input_Result](#input_result) [OH_Input_RemoveKeyEventMonitor](#oh_input_removekeyeventmonitor) ([Input_KeyEventCallback](#input_keyeventcallback) callback) | Removes the listener for key events. |
174| [Input_Result](#input_result) [OH_Input_RemoveMouseEventMonitor](#oh_input_removemouseeventmonitor) ([Input_MouseEventCallback](#input_mouseeventcallback) callback) | Removes the listener for mouse events. |
175| [Input_Result](#input_result) [OH_Input_RemoveTouchEventMonitor](#oh_input_removetoucheventmonitor) ([Input_TouchEventCallback](#input_toucheventcallback) callback) | Removes the listener for touch events. |
176| [Input_Result](#input_result) [OH_Input_RemoveAxisEventMonitorForAll](#oh_input_removeaxiseventmonitorforall) ([Input_AxisEventCallback](#input_axiseventcallback) callback) | Removes the listener for all types of axis events. |
177| [Input_Result](#input_result) [OH_Input_RemoveAxisEventMonitor](#oh_input_removeaxiseventmonitor) ([InputEvent_AxisEventType](#inputevent_axiseventtype) axisEventType, [Input_AxisEventCallback](#input_axiseventcallback) callback) | Removes the listener for the specified type of axis events, which are defined in [InputEvent_AxisEventType](#inputevent_axiseventtype). |
178| [Input_Result](#input_result) [OH_Input_AddKeyEventInterceptor](#oh_input_addkeyeventinterceptor) ([Input_KeyEventCallback](#input_keyeventcallback) callback, [Input_InterceptorOptions](#input_interceptoroptions) \*option) | Adds an interceptor for key events. If multiple interceptors are added, only the first one takes effect. |
179| [Input_Result](#input_result) [OH_Input_AddInputEventInterceptor](#oh_input_addinputeventinterceptor) ([Input_InterceptorEventCallback](_input___interceptor_event_callback.md) \*callback [Input_InterceptorOptions](#input_interceptoroptions) \*option) | Adds an interceptor for input events, including mouse, touch, and axis events. If multiple interceptors are added, only the first one takes effect. |
180| [Input_Result](#input_result) [OH_Input_RemoveKeyEventInterceptor](#oh_input_removekeyeventinterceptor) (void) | Removes the interceptor for key events. |
181| [Input_Result](#input_result) [OH_Input_RemoveInputEventInterceptor](#oh_input_removeinputeventinterceptor) (void) | Removes the interceptor for input events, including mouse, touch, and axis events. |
182| [Input_Result](#input_result) [OH_Input_GetIntervalSinceLastInput](#oh_input_getintervalsincelastinput) (int64_t \*timeInterval) | Obtains the interval since the last system input event. |
183| [Input_Hotkey](#input_hotkey) \* [OH_Input_CreateHotkey](#oh_input_createhotkey) (void) | Creates a shortcut key object. |
184| void [OH_Input_DestroyHotkey](#oh_input_destroyhotkey) ([Input_Hotkey](#input_hotkey) \*\*hotkey) | Destroys a shortcut key object. |
185| void [OH_Input_SetPreKeys](#oh_input_setprekeys) ([Input_Hotkey](#input_hotkey) \*hotkey, int32_t \*preKeys, int32_t size) | Sets the modifier key. |
186| [Input_Result](#input_result) [OH_Input_GetPreKeys](#oh_input_getprekeys) (const [Input_Hotkey](#input_hotkey) \*hotkey, int32_t \*\*preKeys, int32_t \*preKeyCount) | Obtains the modifier key. |
187| void [OH_Input_SetFinalKey](#oh_input_setfinalkey) ([Input_Hotkey](#input_hotkey) \*hotkey, int32_t finalKey) | Sets the modified key. |
188| [Input_Result](#input_result) [OH_Input_GetFinalKey](#oh_input_getfinalkey) (const [Input_Hotkey](#input_hotkey) \*hotkey, int32_t \*finalKeyCode) | Obtains the modified key. |
189| [Input_Hotkey](#input_hotkey) \*\* [OH_Input_CreateAllSystemHotkeys](#oh_input_createallsystemhotkeys) (int32_t count) | Creates an array of [Input_Hotkey](#input_hotkey) instances. |
190| void [OH_Input_DestroyAllSystemHotkeys](#oh_input_destroyallsystemhotkeys) ([Input_Hotkey](#input_hotkey) \*\*hotkeys, int32_t count) | Destroys the array of [Input_Hotkey](#input_hotkey) instances and reclaims the memory. |
191| [Input_Result](#input_result) [OH_Input_GetAllSystemHotkeys](#oh_input_getallsystemhotkeys) ([Input_Hotkey](#input_hotkey) \*\*hotkey, int32_t \*count) | Obtains all configured shortcut keys. |
192| void [OH_Input_SetRepeat](#oh_input_setrepeat) ([Input_Hotkey](#input_hotkey) \*hotkey, bool isRepeat) | Specifies whether to report repeated key events. |
193| [Input_Result](#input_result) [OH_Input_GetRepeat](#oh_input_getrepeat) (const [Input_Hotkey](#input_hotkey) \*hotkey, bool \*isRepeat) | Checks whether to report repeated key events. |
194| [Input_Result](#input_result) [OH_Input_AddHotkeyMonitor](#oh_input_addhotkeymonitor) (const [Input_Hotkey](#input_hotkey) \*hotkey, [Input_HotkeyCallback](#input_hotkeycallback) callback) | Subscribes to shortcut key events. This API is not applicable to wearables and lite wearables. |
195| [Input_Result](#input_result) [OH_Input_RemoveHotkeyMonitor](#oh_input_removehotkeymonitor) (const [Input_Hotkey](#input_hotkey) \*hotkey, [Input_HotkeyCallback](#input_hotkeycallback) callback) | Unsubscribes from shortcut key events. |
196| [Input_Result](#input_result) [OH_Input_GetDeviceIds](#oh_input_getdeviceids) (int32_t \*deviceIds, int32_t inSize, int32_t \*outSize) | Obtains the IDs of all input devices. |
197| [Input_Result](#input_result) [OH_Input_GetDevice](#oh_input_getdevice) (int32_t deviceId, [Input_DeviceInfo](#input_deviceinfo) \*\*deviceInfo) | Obtains information about the input device. |
198| [Input_DeviceInfo](#input_deviceinfo) \* [OH_Input_CreateDeviceInfo](#oh_input_createdeviceinfo) (void) | Creates a **deviceInfo** object. |
199| void [OH_Input_DestroyDeviceInfo](#oh_input_destroydeviceinfo) ([Input_DeviceInfo](#input_deviceinfo) \*\*deviceInfo) | Destroys a **deviceInfo** object. |
200| [Input_Result](#input_result) [OH_Input_GetKeyboardType](#oh_input_getkeyboardtype) (int32_t deviceId, int32_t \*keyboardType) | Obtains the keyboard type of the input device. |
201| [Input_Result](#input_result) [OH_Input_GetDeviceId](#oh_input_getdeviceid) ([Input_DeviceInfo](#input_deviceinfo) \*deviceInfo, int32_t \*id) | Obtains the ID of an input device. |
202| [Input_Result](#input_result) [OH_Input_GetDeviceName](#oh_input_getdevicename) ([Input_DeviceInfo](#input_deviceinfo) \*deviceInfo, char \*\*name) | Obtains the name of an input device. |
203| [Input_Result](#input_result) [OH_Input_GetCapabilities](#oh_input_getcapabilities) ([Input_DeviceInfo](#input_deviceinfo) \*deviceInfo, int32_t \*capabilities) | Obtains the capabilities of an input device, for example, a touchscreen, touchpad, or keyboard. |
204| [Input_Result](#input_result) [OH_Input_GetDeviceVersion](#oh_input_getdeviceversion) ([Input_DeviceInfo](#input_deviceinfo) \*deviceInfo, int32_t \*version) | Obtains the version information of an input device. |
205| [Input_Result](#input_result) [OH_Input_GetDeviceProduct](#oh_input_getdeviceproduct) ([Input_DeviceInfo](#input_deviceinfo) \*deviceInfo, int32_t \*product) | Obtains the product information of an input device. |
206| [Input_Result](#input_result) [OH_Input_GetDeviceVendor](#oh_input_getdevicevendor) ([Input_DeviceInfo](#input_deviceinfo) \*deviceInfo, int32_t \*vendor) | Obtains the vendor information of an input device. |
207| [Input_Result](#input_result) [OH_Input_GetDeviceAddress](#oh_input_getdeviceaddress) ([Input_DeviceInfo](#input_deviceinfo) \*deviceInfo, char \*\*address) | Obtains the physical address of an input device. |
208| [Input_Result](#input_result) [OH_Input_RegisterDeviceListener](#oh_input_registerdevicelistener) ([Input_DeviceListener](_input___device_listener.md) \*listener) | Registers a listener for device hot swap events. |
209| [Input_Result](#input_result) [OH_Input_UnregisterDeviceListener](#oh_input_unregisterdevicelistener) ([Input_DeviceListener](_input___device_listener.md) \*listener) | Unregisters the listener for device hot swap events. |
210| [Input_Result](#input_result) [OH_Input_UnregisterDeviceListeners](#oh_input_unregisterdevicelisteners) () | Unregisters the listener for all device hot swap events. |
211| [Input_Result](#input_result) [OH_Input_GetFunctionKeyState](#oh_input_getfunctionkeystate) (int32_t keyCode, int32_t \*state) | Obtains the function key status. |
212
213
214## Type Description
215
216
217### Input_AxisEvent
218
219```
220typedef struct Input_AxisEventInput_AxisEvent
221```
222**Description**
223
224Defines an axis event.
225
226**Since**: 12
227
228
229### Input_AxisEventCallback
230
231```
232typedef void(* Input_AxisEventCallback) (const Input_AxisEvent *axisEvent)
233```
234**Description**
235
236Defines a lifecycle callback for **axisEvent**. If the callback is triggered, **axisEvent** will be destroyed.
237
238**Since**: 12
239
240**Parameters**
241
242| Name| Description   |
243| ------ | ------ |
244| axisEvent | Axis event object.|
245
246### Input_DeviceAddedCallback
247
248```
249typedef void(* Input_DeviceAddedCallback) (int32_t deviceId)
250```
251**Description**
252
253Defines a callback used to receive device insertion events.
254
255**Since**: 13
256
257**Parameters**
258
259| Name| Description|
260| -------- | -------- |
261| deviceId | Device ID. |
262
263### Input_DeviceInfo
264
265```
266typedef struct Input_DeviceInfoInput_DeviceInfo
267```
268**Description**
269
270Defines the input device information.
271
272**Since**: 13
273
274### Input_DeviceListener
275
276```
277typedef struct Input_DeviceListenerInput_DeviceListener
278```
279**Description**
280
281Defines a listener for device hot swap events.
282
283**Since**: 13
284
285### Input_DeviceRemovedCallback
286
287```
288typedef void(* Input_DeviceRemovedCallback) (int32_t deviceId)
289```
290**Description**
291
292Defines a callback used to receive device removal events.
293
294**Since**: 13
295
296**Parameters**
297
298| Name| Description|
299| -------- | -------- |
300| deviceId | Device ID. |
301
302
303### Input_Hotkey
304
305```
306typedef struct Input_Hotkey Input_Hotkey
307```
308**Description**
309
310Defines the shortcut key structure.
311
312**Since**: 14
313
314
315### Input_HotkeyCallback
316
317```
318typedef void(* Input_HotkeyCallback) (Input_Hotkey *hotkey)
319```
320**Description**
321
322Defines the callback used to return shortcut key events.
323
324**Since**: 14
325
326
327### Input_InterceptorEventCallback
328
329```
330typedef struct Input_InterceptorEventCallbackInput_InterceptorEventCallback
331```
332**Description**
333
334Defines the structure of the interceptor for callback events, including mouse events, touch events, and axis events.
335
336**Since**: 12
337
338
339### Input_InterceptorOptions
340
341```
342typedef struct Input_InterceptorOptionsInput_InterceptorOptions
343```
344**Description**
345
346Defines event interception options.
347
348**Since**: 12
349
350
351### Input_KeyboardType
352
353```
354typedef enum Input_KeyboardTypeInput_KeyboardType
355```
356**Description**
357
358Enumerates keyboard types of the input device.
359
360**Since**: 13
361
362
363### Input_KeyEvent
364
365```
366typedef struct Input_KeyEventInput_KeyEvent
367```
368**Description**
369
370Defines the key event to be injected.
371
372**Since**: 12
373
374
375### Input_KeyEventAction
376
377```
378typedef enum Input_KeyEventActionInput_KeyEventAction
379```
380**Description**
381
382Provides the enum values of the key event type.
383
384**Since**: 12
385
386
387### Input_KeyEventCallback
388
389```
390typedef void(* Input_KeyEventCallback) (const Input_KeyEvent *keyEvent)
391```
392**Description**
393
394Defines a lifecycle callback for **keyEvent**. If the callback is triggered, **keyEvent** will be destroyed.
395
396**Since**: 12
397
398**Parameters**
399
400| Name|Description   |
401| ------ | ------ |
402| keyEvent | Key event object.|
403
404### Input_KeyState
405
406```
407typedef struct Input_KeyStateInput_KeyState
408```
409**Description**
410
411Defines key information, which identifies a key pressing behavior. For example, the Ctrl key information contains the key value and key type.
412
413**Since**: 12
414
415
416### Input_KeyStateAction
417
418```
419typedef enum Input_KeyStateActionInput_KeyStateAction
420```
421**Description**
422
423Provides the enum values of the key status.
424
425**Since**: 12
426
427
428### Input_MouseEvent
429
430```
431typedef struct Input_MouseEventInput_MouseEvent
432```
433**Description**
434
435Defines the mouse event to be injected.
436
437**Since**: 12
438
439### Input_MouseEventAction
440
441```
442typedef enum Input_MouseEventActionInput_MouseEventAction
443```
444**Description**
445
446Provides the enum values of mouse actions.
447
448**Since**: 12
449
450
451### Input_MouseEventButton
452
453```
454typedef enum Input_MouseEventButtonInput_MouseEventButton
455```
456**Description**
457
458Provides the enum values of mouse buttons.
459
460**Since**: 12
461
462
463### Input_MouseEventCallback
464
465```
466typedef void(* Input_MouseEventCallback) (const Input_MouseEvent *mouseEvent)
467```
468**Description**
469
470Defines a lifecycle callback for **mouseEvent**. If the callback is triggered, **mouseEvent** will be destroyed.
471
472**Since**: 12
473
474**Parameters**
475
476| Name| Description   |
477| ------ | ------ |
478| mouseEvent | Mouse event object.|
479
480### Input_Result
481
482```
483typedef enum Input_ResultInput_Result
484```
485**Description**
486
487Provides the enum values of error codes.
488
489**Since**: 12
490
491
492### Input_TouchEvent
493
494```
495typedef struct Input_TouchEventInput_TouchEvent
496```
497**Description**
498
499Defines the touch event to be injected.
500
501**Since**: 12
502
503
504### Input_TouchEventAction
505
506```
507typedef enum Input_TouchEventActionInput_TouchEventAction
508```
509**Description**
510
511Provides the enum values of touch actions.
512
513**Since**: 12
514
515
516### Input_TouchEventCallback
517
518```
519typedef void(* Input_TouchEventCallback) (const Input_TouchEvent *touchEvent)
520```
521**Description**
522
523Defines a lifecycle callback for **touchEvent**. If the callback is triggered, **touchEvent** will be destroyed.
524
525**Since**: 12
526
527**Parameters**
528
529| Name| Description   |
530| ------ | ------ |
531| touchEvent | Touch event object.|
532
533### InputEvent_AxisAction
534
535```
536typedef enum InputEvent_AxisActionInputEvent_AxisAction
537```
538**Description**
539
540Action of the input device.
541
542**Since**: 12
543
544
545### InputEvent_AxisEventType
546
547```
548typedef enum InputEvent_AxisEventTypeInputEvent_AxisEventType
549```
550**Description**
551
552Event type of the input device.
553
554**Since**: 12
555
556
557### InputEvent_AxisType
558
559```
560typedef enum InputEvent_AxisTypeInputEvent_AxisType
561```
562**Description**
563
564Defines the axis type of an input device.
565
566**Since**: 12
567
568
569### InputEvent_MouseAxis
570
571```
572typedef enum InputEvent_MouseAxisInputEvent_MouseAxis
573```
574**Description**
575
576Provides the enum values of mouse axis event types.
577
578**Since**: 12
579
580
581### InputEvent_SourceType
582
583```
584typedef enum InputEvent_SourceTypeInputEvent_SourceType
585```
586**Description**
587
588Enter the event source type.
589
590**Since**: 12
591
592
593## Enum Description
594
595
596### Input_KeyboardType
597
598```
599enum Input_KeyboardType
600```
601**Description**
602
603Enumerates keyboard types of the input device.
604
605**Since**: 13
606
607| Value| Description|
608| -------- | -------- |
609| KEYBOARD_TYPE_NONE  | Keyboard without keys.|
610| KEYBOARD_TYPE_UNKNOWN  | Keyboard with unknown keys.|
611| KEYBOARD_TYPE_ALPHABETIC  | Full keyboard.|
612| KEYBOARD_TYPE_DIGITAL  | Numeric keypad.|
613| KEYBOARD_TYPE_STYLUS  | Stylus.|
614| KEYBOARD_TYPE_REMOTE_CONTROL  | Remote control.|
615
616
617### Input_KeyCode
618
619```
620enum Input_KeyCode
621```
622**Description**
623
624Enumerates key code values.
625
626**Since**: 12
627
628| Value| Description|
629| -------- | -------- |
630| KEYCODE_UNKNOWN  | Unknown key|
631| KEYCODE_FN  | Function (Fn) key|
632| KEYCODE_VOLUME_UP  | Volume Up key|
633| KEYCODE_VOLUME_DOWN  | Volume Down key|
634| KEYCODE_POWER  | Power key|
635| KEYCODE_CAMERA  | Camera key|
636| KEYCODE_VOLUME_MUTE  | Speaker Mute key|
637| KEYCODE_MUTE  | Mute key|
638| KEYCODE_BRIGHTNESS_UP  | Brightness Up key|
639| KEYCODE_BRIGHTNESS_DOWN  | Brightness Down key|
640| KEYCODE_0  | Key 0|
641| KEYCODE_1  | Key 1|
642| KEYCODE_2  | Key 2|
643| KEYCODE_3  | Key 3|
644| KEYCODE_4  | Key 4|
645| KEYCODE_5  | Key 5|
646| KEYCODE_6  | Key 6|
647| KEYCODE_7  | Key 7|
648| KEYCODE_8  | Key 8|
649| KEYCODE_9  | Key 9|
650| KEYCODE_STAR  | Key \*|
651| KEYCODE_POUND  | Key \#|
652| KEYCODE_DPAD_UP  | Up key on D-pad|
653| KEYCODE_DPAD_DOWN  | Down key on D-pad|
654| KEYCODE_DPAD_LEFT  | Left key on D-pad|
655| KEYCODE_DPAD_RIGHT  | Right key on D-pad|
656| KEYCODE_DPAD_CENTER  | Center key on D-pad|
657| KEYCODE_A  | Key A|
658| KEYCODE_B  | Key B|
659| KEYCODE_C  | Key C|
660| KEYCODE_D  | Key D|
661| KEYCODE_E  | Key E|
662| KEYCODE_F  | Key F|
663| KEYCODE_G  | Key G|
664| KEYCODE_H  | Key H|
665| KEYCODE_I  | Key I|
666| KEYCODE_J  | Key J|
667| KEYCODE_K  | Key K|
668| KEYCODE_L  | Key L|
669| KEYCODE_M  | Key M|
670| KEYCODE_N  | Key N|
671| KEYCODE_O  | Key O|
672| KEYCODE_P  | Key P|
673| KEYCODE_Q  | Key Q|
674| KEYCODE_R  | Key R|
675| KEYCODE_S  | Key S|
676| KEYCODE_T  | Key T|
677| KEYCODE_U  | Key U|
678| KEYCODE_V  | Key V|
679| KEYCODE_W  | Key W|
680| KEYCODE_X  | Key X|
681| KEYCODE_Y  | Key Y|
682| KEYCODE_Z  | Key Z|
683| KEYCODE_COMMA  | Key ,|
684| KEYCODE_PERIOD  | Key .|
685| KEYCODE_ALT_LEFT  | Left Alt key|
686| KEYCODE_ALT_RIGHT  | Right Alt key|
687| KEYCODE_SHIFT_LEFT  | Left Shift key|
688| KEYCODE_SHIFT_RIGHT  | Right Shift key|
689| KEYCODE_TAB  | Tab key|
690| KEYCODE_SPACE  | Space key|
691| KEYCODE_SYM  | Symbol key|
692| KEYCODE_EXPLORER  | Explorer key, which is used to start the explorer application|
693| KEYCODE_ENVELOPE  | Email key, which is used to start the email application|
694| KEYCODE_ENTER  | Enter key|
695| KEYCODE_DEL  | Delete key|
696| KEYCODE_GRAVE  | Key `|
697| KEYCODE_MINUS  | Key -|
698| KEYCODE_EQUALS  | Key =|
699| KEYCODE_LEFT_BRACKET  | Key [|
700| KEYCODE_RIGHT_BRACKET  | Key ]|
701| KEYCODE_BACKSLASH  | Key \|
702| KEYCODE_SEMICOLON  | Key ;|
703| KEYCODE_APOSTROPHE  | Key '|
704| KEYCODE_SLASH  | Key /|
705| KEYCODE_AT  | Key \@|
706| KEYCODE_PLUS  | Key +|
707| KEYCODE_MENU  | Menu key|
708| KEYCODE_PAGE_UP  | Page Up key|
709| KEYCODE_PAGE_DOWN  | Page Down key|
710| KEYCODE_ESCAPE  | ESC key|
711| KEYCODE_FORWARD_DEL  | Forward Delete key|
712| KEYCODE_CTRL_LEFT  | Left Ctrl key|
713| KEYCODE_CTRL_RIGHT  | Right Ctrl key.|
714| KEYCODE_CAPS_LOCK  | Caps Lock key|
715| KEYCODE_SCROLL_LOCK  | Scroll Lock key|
716| KEYCODE_META_LEFT  | Left Meta key|
717| KEYCODE_META_RIGHT  | Right Meta key|
718| KEYCODE_FUNCTION  | Function key|
719| KEYCODE_SYSRQ  | System Request/Print Screen key|
720| KEYCODE_BREAK  | Break/Pause key|
721| KEYCODE_MOVE_HOME  | Move to Home key|
722| KEYCODE_MOVE_END  | Move to End key|
723| KEYCODE_INSERT  | Insert key|
724| KEYCODE_FORWARD  | Forward key|
725| KEYCODE_MEDIA_PLAY  | Play key|
726| KEYCODE_MEDIA_PAUSE  | Pause key|
727| KEYCODE_MEDIA_CLOSE  | Close key|
728| KEYCODE_MEDIA_EJECT  | Eject key|
729| KEYCODE_MEDIA_RECORD  | Record key|
730| KEYCODE_F1  | F1 key|
731| KEYCODE_F2  | F2 key|
732| KEYCODE_F3  | F3 key|
733| KEYCODE_F4  | F4 key|
734| KEYCODE_F5  | F5 key|
735| KEYCODE_F6  | F6 key|
736| KEYCODE_F7  | F7 key|
737| KEYCODE_F8  | F8 key|
738| KEYCODE_F9  | F9 key|
739| KEYCODE_F10  | F10 key|
740| KEYCODE_F11  | F11 key|
741| KEYCODE_F12  | F12 key|
742| KEYCODE_NUM_LOCK  | Number Lock key on numeric keypad|
743| KEYCODE_NUMPAD_0  | Key 0 on numeric keypad|
744| KEYCODE_NUMPAD_1  | Key 1 on numeric keypad|
745| KEYCODE_NUMPAD_2  | Key 2 on numeric keypad|
746| KEYCODE_NUMPAD_3  | Key 3 on numeric keypad|
747| KEYCODE_NUMPAD_4  | Key 4 on numeric keypad|
748| KEYCODE_NUMPAD_5  | Key 5 on numeric keypad|
749| KEYCODE_NUMPAD_6  | Key 6 on numeric keypad|
750| KEYCODE_NUMPAD_7  | Key 7 on numeric keypad|
751| KEYCODE_NUMPAD_8  | Key 8 on numeric keypad|
752| KEYCODE_NUMPAD_9  | Key 9 on numeric keypad|
753| KEYCODE_NUMPAD_DIVIDE  | Key / on numeric keypad|
754| KEYCODE_NUMPAD_MULTIPLY  | Key \* on numeric keypad|
755| KEYCODE_NUMPAD_SUBTRACT  | Key - on numeric keypad|
756| KEYCODE_NUMPAD_ADD  | Key + on numeric keypad|
757| KEYCODE_NUMPAD_DOT  | Key . on numeric keypad|
758| KEYCODE_NUMPAD_COMMA  | Key , on numeric keypad|
759| KEYCODE_NUMPAD_ENTER  | Enter key on numeric keypad|
760| KEYCODE_NUMPAD_EQUALS  | Key = on numeric keypad|
761| KEYCODE_NUMPAD_LEFT_PAREN  | Key ( on numeric keypad|
762| KEYCODE_NUMPAD_RIGHT_PAREN  | Key ) on numeric keypad|
763| KEYCODE_DAGGER_CLICK  | Dagger click key on the smart watch<br>**Since**: 18|
764| KEYCODE_DAGGER_DOUBLE_CLICK  | Dagger double-click key on the smart watch<br>**Since**: 18|
765| KEYCODE_DAGGER_LONG_PRESS  | Dagger long-press key on the smart watch<br>**Since**: 18|
766
767
768### Input_KeyEventAction
769
770```
771enum Input_KeyEventAction
772```
773**Description**
774
775Provides the enum values of the key event type.
776
777**Since**: 12
778
779| Value| Description|
780| -------- | -------- |
781| KEY_ACTION_CANCEL  | Button action canceled.|
782| KEY_ACTION_DOWN  | Key pressed.|
783| KEY_ACTION_UP  | Key released.|
784
785
786### Input_KeyStateAction
787
788```
789enum Input_KeyStateAction
790```
791**Description**
792
793Provides the enum values of the key status.
794
795**Since**: 12
796
797| Value| Description|
798| -------- | -------- |
799| KEY_DEFAULT  | Default state.|
800| KEY_PRESSED  | Key pressed.|
801| KEY_RELEASED  | Key released.|
802| KEY_SWITCH_ON  | Key switch enabled.|
803| KEY_SWITCH_OFF  | Key switch disabled.|
804
805
806### Input_MouseEventAction
807
808```
809enum Input_MouseEventAction
810```
811**Description**
812
813Provides the enum values of mouse actions.
814
815**Since**: 12
816
817| Value| Description|
818| -------- | -------- |
819| MOUSE_ACTION_CANCEL  | Mouse action canceled.|
820| MOUSE_ACTION_MOVE  | Mouse pointer moved.|
821| MOUSE_ACTION_BUTTON_DOWN  | Mouse button pressed.|
822| MOUSE_ACTION_BUTTON_UP  | Mouse button released.|
823| MOUSE_ACTION_AXIS_BEGIN  | Mouse axis begun.|
824| MOUSE_ACTION_AXIS_UPDATE  | Mouse axis updated.|
825| MOUSE_ACTION_AXIS_END  | Mouse axis ended.|
826
827
828### Input_MouseEventButton
829
830```
831enum Input_MouseEventButton
832```
833**Description**
834
835Provides the enum values of mouse buttons.
836
837**Since**: 12
838
839| Value| Description|
840| -------- | -------- |
841| MOUSE_BUTTON_NONE  | Invalid key|
842| MOUSE_BUTTON_LEFT  | Left mouse button|
843| MOUSE_BUTTON_MIDDLE  | Middle mouse button|
844| MOUSE_BUTTON_RIGHT  | Right mouse button|
845| MOUSE_BUTTON_FORWARD  | Mouse forward button|
846| MOUSE_BUTTON_BACK  | Mouse back button|
847
848
849### Input_Result
850
851```
852enum Input_Result
853```
854**Description**
855
856Provides the enum values of error codes.
857
858**Since**: 12
859
860| Value| Description|
861| -------- | -------- |
862| INPUT_SUCCESS  | Operation succeeded.|
863| INPUT_PERMISSION_DENIED  | Permission verification failed.|
864| INPUT_NOT_SYSTEM_APPLICATION  | Not a system application.|
865| INPUT_PARAMETER_ERROR  | Parameter check failed.|
866| INPUT_DEVICE_NOT_SUPPORTED | Input device not supported.<br>**Since**: API version 14|
867| INPUT_SERVICE_EXCEPTION  | Service error.|
868| INPUT_REPEAT_INTERCEPTOR  | Interceptor repeatedly created.|
869| INPUT_OCCUPIED_BY_SYSTEM  | Occupied by a system application.<br>**Since**: API version 14|
870| INPUT_OCCUPIED_BY_OTHER  | Occupied by other applications.<br>**Since**: API version 14|
871| INPUT_KEYBOARD_DEVICE_NOT_EXIST | No keyboard connected.<br>**Since**: API version 15|
872
873
874### Input_TouchEventAction
875
876```
877enum Input_TouchEventAction
878```
879**Description**
880
881Provides the enum values of touch actions.
882
883**Since**: 12
884
885| Value| Description|
886| -------- | -------- |
887| TOUCH_ACTION_CANCEL  | Cancellation of touch.|
888| TOUCH_ACTION_DOWN  | Pressing of touch.|
889| TOUCH_ACTION_MOVE  | Moving of touch.|
890| TOUCH_ACTION_UP  | Lifting of touch.|
891
892
893### InputEvent_AxisAction
894
895```
896enum InputEvent_AxisAction
897```
898**Description**
899
900Action of the input device.
901
902**Since**: 12
903
904| Value| Description|
905| -------- | -------- |
906| AXIS_ACTION_CANCEL  | Cancellation of an axis input event.|
907| AXIS_ACTION_BEGIN  | Start of an axis input event.|
908| AXIS_ACTION_UPDATE  | Update of an axis input event.|
909| AXIS_ACTION_END  | End of an axis input event.|
910
911
912### InputEvent_AxisEventType
913
914```
915enum InputEvent_AxisEventType
916```
917**Description**
918
919Event type of the input device.
920
921**Since**: 12
922
923| Value| Description|
924| -------- | -------- |
925| AXIS_EVENT_TYPE_PINCH  | Two-finger pinch event. The value can be **AXIS_TYPE_PINCH** or **AXIS_TYPE_ROTATE**.|
926| AXIS_EVENT_TYPE_SCROLL  | Scroll axis event. The value can be **AXIS_TYPE_SCROLL_VERTICAL** and **AXIS_TYPE_SCROLL_HORIZONTAL**. For mouse wheel events, the value can only be **AXIS_TYPE_SCROLL_VERTICAL**.|
927
928
929### InputEvent_AxisType
930
931```
932enum InputEvent_AxisType
933```
934**Description**
935
936Defines the axis type of an input device.
937
938**Since**: 12
939
940| Value| Description|
941| -------- | -------- |
942| AXIS_TYPE_UNKNOWN  | Unknown axis type, which is usually used as the initial value.|
943| AXIS_TYPE_SCROLL_VERTICAL  | Vertical scroll axis. When you scroll the mouse wheel or slide with one or two fingers on the touchpad, the status of the vertical scroll axis changes.|
944| AXIS_TYPE_SCROLL_HORIZONTAL  | Horizontal scroll axis. When you scroll the mouse wheel or slide with two fingers on the touchpad, the status of the horizontal scroll axis changes.|
945| AXIS_TYPE_PINCH  | Pinch axis, which is used to describe a two-finger pinch gesture on the touchpad.|
946| AXIS_TYPE_ROTATE  | Rotation axis, which is used to describe a two-finger rotation gesture on the touchpad.|
947
948
949### InputEvent_MouseAxis
950
951```
952enum InputEvent_MouseAxis
953```
954**Description**
955
956Provides the enum values of mouse axis event types.
957
958**Since**: 12
959
960| Value| Description|
961| -------- | -------- |
962| MOUSE_AXIS_SCROLL_VERTICAL  | Vertical scroll axis.|
963| MOUSE_AXIS_SCROLL_HORIZONTAL  | Horizontal scroll axis.|
964
965
966### InputEvent_SourceType
967
968```
969enum InputEvent_SourceType
970```
971**Description**
972
973Enter the event source type.
974
975**Since**: 12
976
977| Value| Description|
978| -------- | -------- |
979| SOURCE_TYPE_MOUSE  | Source that generates events similar to mouse cursor movement, button press and release, and wheel scrolling.|
980| SOURCE_TYPE_TOUCHSCREEN  | Source that generates a touchscreen multi-touch event.|
981| SOURCE_TYPE_TOUCHPAD  | Source that generates a touchpad multi-touch event.|
982
983
984## Function Description
985
986
987### OH_Input_AddAxisEventMonitor()
988
989```
990Input_Result OH_Input_AddAxisEventMonitor (InputEvent_AxisEventType axisEventType, Input_AxisEventCallback callback )
991```
992**Description**
993
994Adds a listener for the specified type of axis events, which are defined in [InputEvent_AxisEventType](#inputevent_axiseventtype).
995
996**System capability**: SystemCapability.MultimodalInput.Input.Core
997
998**Since**: 12
999
1000**Parameters**
1001
1002| Name| Description|
1003| -------- | -------- |
1004| axisEventType | Type of the axis event. The event type is defined in [InputEvent_AxisEventType](#inputevent_axiseventtype). |
1005| callback | Callback used to receive the specified type of axis events. |
1006
1007**Required Permissions**
1008
1009ohos.permission.INPUT_MONITORING
1010
1011**Returns**
1012
1013**INTO_SUCCESS** if the operation is successful; **INPUT_PERMISSION_DENIED** if the permission verification fails; **INPUT_PARAMETER_ERROR** if the callback is empty; **INPUT_SERVICE_EXCEPTION** if the service is abnormal.
1014
1015
1016### OH_Input_AddAxisEventMonitorForAll()
1017
1018```
1019Input_Result OH_Input_AddAxisEventMonitorForAll (Input_AxisEventCallback callback)
1020```
1021**Description**
1022
1023Adds a listener for all types of axis events, which are defined in [InputEvent_AxisEventType](#inputevent_axiseventtype).
1024
1025**System capability**: SystemCapability.MultimodalInput.Input.Core
1026
1027**Since**: 12
1028
1029**Parameters**
1030
1031| Name| Description|
1032| -------- | -------- |
1033| callback | Callback used to receive axis events. |
1034
1035**Required Permissions**
1036
1037ohos.permission.INPUT_MONITORING
1038
1039**Returns**
1040
1041**INTO_SUCCESS** if the operation is successful; **INPUT_PERMISSION_DENIED** if the permission verification fails; **INPUT_PARAMETER_ERROR** if the callback is empty; **INPUT_SERVICE_EXCEPTION** if the service is abnormal.
1042
1043
1044### OH_Input_AddHotkeyMonitor()
1045
1046```
1047Input_Result OH_Input_AddHotkeyMonitor (const Input_Hotkey * hotkey, Input_HotkeyCallback callback )
1048```
1049**Description**
1050
1051Subscribes to shortcut key events. This API is not applicable to wearables and lite wearables.
1052
1053**System capability**: SystemCapability.MultimodalInput.Input.Core
1054
1055**Since**: 14
1056
1057**Parameters**
1058
1059| Name| Description|
1060| -------- | -------- |
1061| hotkey | Shortcut key object. |
1062| callback | Defines the callback used to return shortcut key events. |
1063
1064**Returns**
1065
1066OH_Input_AddHotkeyMonitor status code, specifically,
1067
1068**INPUT_SUCCESS** if the operation is successful;
1069
1070INPUT_PARAMETER_ERROR if parameter check fails;
1071
1072INPUT_OCCUPIED_BY_SYSTEM if the shortcut key has been occupied by the system (you can use [OH_Input_GetAllSystemHotkeys](#oh_input_getallsystemhotkeys) to query allsystem shortcut keys);
1073
1074INPUT_OCCUPIED_BY_OTHER if the shortcut key has been occupied by another application.
1075
1076**INPUT_DEVICE_NOT_SUPPORTED** if the input device is not supported.
1077
1078### OH_Input_AddInputEventInterceptor()
1079
1080```
1081Input_Result OH_Input_AddInputEventInterceptor (Input_InterceptorEventCallback *callback Input_InterceptorOptions * option)
1082```
1083**Description**
1084
1085Adds an interceptor for input events, including mouse, touch, and axis events. If multiple interceptors are added, only the first one takes effect.
1086
1087**System capability**: SystemCapability.MultimodalInput.Input.Core
1088
1089**Since**: 12
1090
1091**Parameters**
1092
1093| Name| Description|
1094| -------- | -------- |
1095| callback | Pointer to the input event callback. For details, see [Input_InterceptorEventCallback](_input___interceptor_event_callback.md). |
1096| option | Options for event interception. If **null** is passed, the default value is used. |
1097
1098**Required Permissions**
1099
1100ohos.permission.INTERCEPT_INPUT_EVENT
1101
1102**Returns**
1103
1104**INTO_SUCCESS** if the operation is successful;
1105
1106**INPUT_PERMISSION_DENIED** if the permission verification fails;
1107
1108**INPUT_PARAMETER_ERROR** if the callback is empty;
1109
1110**INPUT_REPEAT_INTERCEPTOR** if an interceptor is repeatedly added;
1111
1112or **INPUT_SERVICE_EXCEPTION** if the service is abnormal.
1113
1114
1115### OH_Input_AddKeyEventInterceptor()
1116
1117```
1118Input_Result OH_Input_AddKeyEventInterceptor (Input_KeyEventCallback callback, Input_InterceptorOptions * option )
1119```
1120**Description**
1121
1122Adds an interceptor for key events. If multiple interceptors are added, only the first one takes effect.
1123
1124**System capability**: SystemCapability.MultimodalInput.Input.Core
1125
1126**Since**: 12
1127
1128**Parameters**
1129
1130| Name| Description|
1131| -------- | -------- |
1132| callback | Callback used to receive key events. |
1133| option | Options for event interception. If **null** is passed, the default value is used. |
1134
1135**Required Permissions**
1136
1137ohos.permission.INTERCEPT_INPUT_EVENT
1138
1139**Returns**
1140
1141**INTO_SUCCESS** if the operation is successful;
1142
1143**INPUT_PERMISSION_DENIED** if the permission verification fails;
1144
1145**INPUT_PARAMETER_ERROR** if the callback is empty;
1146
1147**INPUT_REPEAT_INTERCEPTOR** if an interceptor is repeatedly added;
1148
1149or **INPUT_SERVICE_EXCEPTION** if the service is abnormal.
1150
1151
1152### OH_Input_AddKeyEventMonitor()
1153
1154```
1155Input_Result OH_Input_AddKeyEventMonitor (Input_KeyEventCallback callback)
1156```
1157**Description**
1158
1159Adds a listener for key events.
1160
1161**System capability**: SystemCapability.MultimodalInput.Input.Core
1162
1163**Since**: 12
1164
1165**Parameters**
1166
1167| Name| Description|
1168| -------- | -------- |
1169| callback | Callback used to receive key events. |
1170
1171**Required Permissions**
1172
1173ohos.permission.INPUT_MONITORING
1174
1175**Returns**
1176
1177**INTO_SUCCESS** if the operation is successful;
1178
1179**INPUT_PERMISSION_DENIED** if the permission verification fails;
1180
1181**INPUT_PARAMETER_ERROR** if the callback is empty;
1182
1183or **INPUT_SERVICE_EXCEPTION** if the service is abnormal.
1184
1185
1186### OH_Input_AddMouseEventMonitor()
1187
1188```
1189Input_Result OH_Input_AddMouseEventMonitor (Input_MouseEventCallback callback)
1190```
1191**Description**
1192
1193Adds a listener for mouse events, including mouse click and movement events, but not scroll wheel events. Scroll wheel events are axis events.
1194
1195**System capability**: SystemCapability.MultimodalInput.Input.Core
1196
1197**Since**: 12
1198
1199**Parameters**
1200
1201| Name| Description|
1202| -------- | -------- |
1203| callback | Callback used to receive mouse events. |
1204
1205**Required Permissions**
1206
1207ohos.permission.INPUT_MONITORING
1208
1209**Returns**
1210
1211**INTO_SUCCESS** if the operation is successful;
1212
1213**INPUT_PERMISSION_DENIED** if the permission verification fails;
1214
1215**INPUT_PARAMETER_ERROR** if the callback is empty;
1216
1217or **INPUT_SERVICE_EXCEPTION** if the service is abnormal.
1218
1219
1220### OH_Input_AddTouchEventMonitor()
1221
1222```
1223Input_Result OH_Input_AddTouchEventMonitor (Input_TouchEventCallback callback)
1224```
1225**Description**
1226
1227Adds a listener for touch events.
1228
1229**System capability**: SystemCapability.MultimodalInput.Input.Core
1230
1231**Since**: 12
1232
1233**Parameters**
1234
1235| Name| Description|
1236| -------- | -------- |
1237| callback | Callback used to receive touch events. |
1238
1239**Required Permissions**
1240
1241ohos.permission.INPUT_MONITORING
1242
1243**Returns**
1244
1245**INTO_SUCCESS** if the operation is successful; **INPUT_PERMISSION_DENIED** if the permission verification fails; **INPUT_PARAMETER_ERROR** if the callback is empty; **INPUT_SERVICE_EXCEPTION** if the service is abnormal.
1246
1247
1248### OH_Input_CancelInjection()
1249
1250```
1251void OH_Input_CancelInjection ()
1252```
1253**Description**
1254
1255Stops event injection and revokes authorization.
1256
1257**System capability**: SystemCapability.MultimodalInput.Input.Core
1258
1259**Since**: 12
1260
1261
1262### OH_Input_CreateAllSystemHotkeys()
1263
1264```
1265Input_Hotkey** OH_Input_CreateAllSystemHotkeys (int32_t count)
1266```
1267**Description**
1268
1269Creates an array of [Input_Hotkey](#input_hotkey) instances.
1270
1271**System capability**: SystemCapability.MultimodalInput.Input.Core
1272
1273**Since**: 14
1274
1275**Parameters**
1276
1277| Name| Description|
1278| -------- | -------- |
1279| count | Number of [Input_Hotkey](#input_hotkey) instances to be created. |
1280
1281**Returns**
1282
1283OH_Input_CreateAllSystemHotkey status code, which is **INPUT_SUCCESS** if a double pointer to the instance array is successfully created or an error code otherwise.
1284
1285
1286### OH_Input_CreateAxisEvent()
1287
1288```
1289Input_AxisEvent* OH_Input_CreateAxisEvent ( void )
1290```
1291**Description**
1292
1293Creates an axis event object.
1294
1295**System capability**: SystemCapability.MultimodalInput.Input.Core
1296
1297**Since**: 12
1298
1299**Returns**
1300
1301An [Input_AxisEvent](#input_axisevent) object if the operation is successful; **null** otherwise.
1302
1303
1304### OH_Input_CreateDeviceInfo()
1305
1306```
1307Input_DeviceInfo* OH_Input_CreateDeviceInfo (void )
1308```
1309**Description**
1310
1311Creates a **deviceInfo** object.
1312
1313**System capability**: SystemCapability.MultimodalInput.Input.Core
1314
1315**Since**: 13
1316
1317**Returns**
1318
1319Pointer to an [Input_DeviceInfo](#input_deviceinfo) object if the operation is successful; a null pointer otherwise (possibly because of a memory allocation failure).
1320
1321
1322### OH_Input_CreateHotkey()
1323
1324```
1325Input_Hotkey* OH_Input_CreateHotkey (void)
1326```
1327**Description**
1328
1329Creates a shortcut key object.
1330
1331**System capability**: SystemCapability.MultimodalInput.Input.Core
1332
1333**Since**: 14
1334
1335**Returns**
1336
1337An [Input_Hotkey](#input_hotkey) pointer object if the operation is successful; a null pointer otherwise (possibly because of a memory allocation failure).
1338
1339
1340### OH_Input_CreateKeyEvent()
1341
1342```
1343struct Input_KeyEvent* OH_Input_CreateKeyEvent ()
1344```
1345**Description**
1346
1347Creates a key event object.
1348
1349**System capability**: SystemCapability.MultimodalInput.Input.Core
1350
1351**Since**: 12
1352
1353**Returns**
1354
1355An [Input_KeyEvent](#input_keyevent) pointer object if the operation is successful; a null pointer otherwise.
1356
1357
1358### OH_Input_CreateKeyState()
1359
1360```
1361struct Input_KeyState* OH_Input_CreateKeyState ()
1362```
1363**Description**
1364
1365Creates a key status enum object.
1366
1367**System capability**: SystemCapability.MultimodalInput.Input.Core
1368
1369**Since**: 12
1370
1371**Returns**
1372
1373An [Input_KeyState](#input_keystate) pointer object if the operation is successful; a null pointer otherwise.
1374
1375
1376### OH_Input_CreateMouseEvent()
1377
1378```
1379struct Input_MouseEvent* OH_Input_CreateMouseEvent ()
1380```
1381**Description**
1382
1383Creates a mouse event object.
1384
1385**System capability**: SystemCapability.MultimodalInput.Input.Core
1386
1387**Since**: 12
1388
1389**Returns**
1390
1391An [Input_MouseEvent](#input_mouseevent) pointer object if the operation is successful; a null pointer otherwise.
1392
1393
1394### OH_Input_CreateTouchEvent()
1395
1396```
1397struct Input_TouchEvent* OH_Input_CreateTouchEvent ()
1398```
1399**Description**
1400
1401Creates a touch event object.
1402
1403**System capability**: SystemCapability.MultimodalInput.Input.Core
1404
1405**Since**: 12
1406
1407**Returns**
1408
1409An [Input_TouchEvent](#input_touchevent) pointer object if the operation is successful; a null pointer otherwise.
1410
1411
1412### OH_Input_DestroyAllSystemHotkeys()
1413
1414```
1415void OH_Input_DestroyAllSystemHotkeys (Input_Hotkey ** hotkeys, int32_t count )
1416```
1417**Description**
1418
1419Destroys the array of [Input_Hotkey](#input_hotkey) instances and reclaims the memory.
1420
1421**System capability**: SystemCapability.MultimodalInput.Input.Core
1422
1423**Since**: 14
1424
1425**Parameters**
1426
1427| Name| Description|
1428| -------- | -------- |
1429| hotkeys | Double pointer to the array of [Input_Hotkey](#input_hotkey) instances. |
1430| count | Number of [Input_Hotkey](#input_hotkey) instances to be destroyed. |
1431
1432
1433### OH_Input_DestroyAxisEvent()
1434
1435```
1436Input_Result OH_Input_DestroyAxisEvent (Input_AxisEvent ** axisEvent)
1437```
1438**Description**
1439
1440Destroys an axis event object.
1441
1442**System capability**: SystemCapability.MultimodalInput.Input.Core
1443
1444**Since**: 12
1445
1446**Parameters**
1447
1448| Name| Description|
1449| -------- | -------- |
1450| axisEvent | Pointer to the axis event object. |
1451
1452**Returns**
1453
1454**INTO_SUCCESS** if operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** or **\*axisEvent** is **NULL**.
1455
1456
1457### OH_Input_DestroyDeviceInfo()
1458
1459```
1460void OH_Input_DestroyDeviceInfo (Input_DeviceInfo ** deviceInfo)
1461```
1462**Description**
1463
1464Destroys a **deviceInfo** object.
1465
1466**System capability**: SystemCapability.MultimodalInput.Input.Core
1467
1468**Since**: 13
1469
1470**Parameters**
1471
1472| Name| Description|
1473| -------- | -------- |
1474| deviceInfo | **deviceInfo** object. |
1475
1476
1477### OH_Input_DestroyHotkey()
1478
1479```
1480void OH_Input_DestroyHotkey (Input_Hotkey ** hotkey)
1481```
1482**Description**
1483
1484Destroys a shortcut key object.
1485
1486**System capability**: SystemCapability.MultimodalInput.Input.Core
1487
1488**Since**: 14
1489
1490**Parameters**
1491
1492| Name| Description|
1493| -------- | -------- |
1494| hotkey | Shortcut key object. |
1495
1496
1497### OH_Input_DestroyKeyEvent()
1498
1499```
1500void OH_Input_DestroyKeyEvent (struct Input_KeyEvent ** keyEvent)
1501```
1502**Description**
1503
1504Destroys a key event object.
1505
1506**System capability**: SystemCapability.MultimodalInput.Input.Core
1507
1508**Since**: 12
1509
1510**Parameters**
1511
1512| Name| Description|
1513| -------- | -------- |
1514| keyEvent | Key event object. |
1515
1516
1517### OH_Input_DestroyKeyState()
1518
1519```
1520void OH_Input_DestroyKeyState (struct Input_KeyState ** keyState)
1521```
1522**Description**
1523
1524Destroys a key status enum object.
1525
1526**System capability**: SystemCapability.MultimodalInput.Input.Core
1527
1528**Since**: 12
1529
1530**Parameters**
1531
1532| Name| Description|
1533| -------- | -------- |
1534| keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).|
1535
1536
1537### OH_Input_DestroyMouseEvent()
1538
1539```
1540void OH_Input_DestroyMouseEvent (struct Input_MouseEvent ** mouseEvent)
1541```
1542**Description**
1543
1544Destroys a mouse event object.
1545
1546**System capability**: SystemCapability.MultimodalInput.Input.Core
1547
1548**Since**: 12
1549
1550**Parameters**
1551
1552| Name| Description|
1553| -------- | -------- |
1554| mouseEvent | Mouse event object. |
1555
1556
1557### OH_Input_DestroyTouchEvent()
1558
1559```
1560void OH_Input_DestroyTouchEvent (struct Input_TouchEvent ** touchEvent)
1561```
1562**Description**
1563
1564Destroys a touch event object.
1565
1566**System capability**: SystemCapability.MultimodalInput.Input.Core
1567
1568**Since**: 12
1569
1570**Parameters**
1571
1572| Name| Description|
1573| -------- | -------- |
1574| touchEvent | Touch event object. |
1575
1576
1577### OH_Input_GetAllSystemHotkeys()
1578
1579```
1580Input_Result OH_Input_GetAllSystemHotkeys (Input_Hotkey ** hotkey, int32_t * count )
1581```
1582**Description**
1583
1584Obtains all configured shortcut keys.
1585
1586**System capability**: SystemCapability.MultimodalInput.Input.Core
1587
1588**Since**: 14
1589
1590**Parameters**
1591
1592| Name| Description|
1593| -------- | -------- |
1594| hotkey | An array of [Input_Hotkey](#input_hotkey) instances. When calling this API for the first time, you can pass **NULL** to obtain the array length. |
1595| count | Number of supported shortcut keys. |
1596
1597**Returns**
1598
1599Status code of the **OH_Input_GetAllSystemHotkeys** function, which is
1600
1601**INTO_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** otherwise.
1602
1603
1604### OH_Input_GetAxisEventAction()
1605
1606```
1607Input_Result OH_Input_GetAxisEventAction (const Input_AxisEvent * axisEvent, InputEvent_AxisAction * action )
1608```
1609**Description**
1610
1611Obtains the action of an axis event.
1612
1613**System capability**: SystemCapability.MultimodalInput.Input.Core
1614
1615**Since**: 12
1616
1617**Parameters**
1618
1619| Name| Description|
1620| -------- | -------- |
1621| axisEvent | Axis event object. |
1622| action | Action of the axis event. For details, see [InputEvent_AxisAction](#inputevent_axisaction). |
1623
1624**Returns**
1625
1626**INTO_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** or **action** is **NULL**.
1627
1628### OH_Input_GetAxisEventActionTime()
1629
1630```
1631Input_Result OH_Input_GetAxisEventActionTime (const Input_AxisEvent * axisEvent, int64_t * actionTime )
1632```
1633**Description**
1634
1635Obtains the time when an axis event occurs.
1636
1637**System capability**: SystemCapability.MultimodalInput.Input.Core
1638
1639**Since**: 12
1640
1641**Parameters**
1642
1643| Name| Description|
1644| -------- | -------- |
1645| axisEvent | Axis event object. For details, see [Input_AxisEvent](#input_axisevent). |
1646| actionTime | Time when an axis event occurs. |
1647
1648**Returns**
1649
1650**INTO_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** or **actionTime** is **NULL**.
1651
1652
1653### OH_Input_GetAxisEventAxisValue()
1654
1655```
1656Input_Result OH_Input_GetAxisEventAxisValue (const Input_AxisEvent * axisEvent, InputEvent_AxisType axisType, double * axisValue )
1657```
1658**Description**
1659
1660Obtains the axis value for the specified axis type of the axis event.
1661
1662**System capability**: SystemCapability.MultimodalInput.Input.Core
1663
1664**Since**: 12
1665
1666**Parameters**
1667
1668| Name| Description|
1669| -------- | -------- |
1670| axisEvent | Axis event object. For details, see [Input_AxisEvent](#input_axisevent). |
1671| axisType | Axis type. For details, see [InputEvent_AxisType](#inputevent_axistype). |
1672| axisValue | Axis value of the axis event. |
1673
1674**Returns**
1675
1676**INTO_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** or **axisValue** is **NULL**.
1677
1678
1679### OH_Input_GetAxisEventDisplayId()
1680
1681```
1682Input_Result OH_Input_GetAxisEventDisplayId (const Input_AxisEvent * axisEvent, int32_t * displayId )
1683```
1684**Description**
1685
1686Obtains the screen ID of an axis event.
1687
1688**System capability**: SystemCapability.MultimodalInput.Input.Core
1689
1690**Since**: 15
1691
1692**Parameters**
1693
1694| Name| Description|
1695| -------- | -------- |
1696| axisEvent | Axis event object. |
1697| displayId | Screen ID of the axis event. |
1698
1699**Returns**
1700
1701**INTO_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** or **displayId** is **NULL**.
1702
1703
1704### OH_Input_GetAxisEventDisplayX()
1705
1706```
1707Input_Result OH_Input_GetAxisEventDisplayX (const Input_AxisEvent * axisEvent, float * displayX )
1708```
1709**Description**
1710
1711Obtains the X coordinate of an axis event.
1712
1713**System capability**: SystemCapability.MultimodalInput.Input.Core
1714
1715**Since**: 12
1716
1717**Parameters**
1718
1719| Name| Description|
1720| -------- | -------- |
1721| axisEvent | Axis event object. |
1722| displayX | X coordinate of the axis event. |
1723
1724**Returns**
1725
1726**INTO_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** or **displayX** is **NULL**.
1727
1728
1729### OH_Input_GetAxisEventDisplayY()
1730
1731```
1732Input_Result OH_Input_GetAxisEventDisplayY (const Input_AxisEvent * axisEvent, float * displayY )
1733```
1734**Description**
1735
1736Obtains the Y coordinate of an axis event.
1737
1738**System capability**: SystemCapability.MultimodalInput.Input.Core
1739
1740**Since**: 12
1741
1742**Parameters**
1743
1744| Name| Description|
1745| -------- | -------- |
1746| axisEvent | Axis event object. For details, see [Input_AxisEvent](#input_axisevent). |
1747| displayY | Y coordinate of the axis event. |
1748
1749**Returns**
1750
1751**INTO_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** or **displayY** is **NULL**.
1752
1753
1754### OH_Input_GetAxisEventSourceType()
1755
1756```
1757Input_Result OH_Input_GetAxisEventSourceType (const Input_AxisEvent * axisEvent, InputEvent_SourceType * sourceType )
1758```
1759**Description**
1760
1761Obtains the axis event source type.
1762
1763**System capability**: SystemCapability.MultimodalInput.Input.Core
1764
1765**Since**: 12
1766
1767**Parameters**
1768
1769| Name| Description|
1770| -------- | -------- |
1771| axisEvent | Axis event object. |
1772| sourceType | Axis event source type. For details, see [InputEvent_SourceType](#inputevent_sourcetype). |
1773
1774**Returns**
1775
1776**INTO_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** or **sourceType** is **NULL**.
1777
1778
1779### OH_Input_GetAxisEventType()
1780
1781```
1782Input_Result OH_Input_GetAxisEventType (const Input_AxisEvent * axisEvent, InputEvent_AxisEventType * axisEventType )
1783```
1784**Description**
1785
1786Obtains the axis event type.
1787
1788**System capability**: SystemCapability.MultimodalInput.Input.Core
1789
1790**Since**: 12
1791
1792**Parameters**
1793
1794| Name| Description|
1795| -------- | -------- |
1796| axisEvent | Axis event object. |
1797| axisEventType | Axis event type. For details, see [InputEvent_AxisEventType](#inputevent_axiseventtype). |
1798
1799**Returns**
1800
1801**INTO_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** or **axisEventType** is **NULL**.
1802
1803
1804### OH_Input_GetAxisEventWindowId()
1805
1806```
1807Input_Result OH_Input_GetAxisEventWindowId (const Input_AxisEvent * axisEvent, int32_t * windowId )
1808```
1809**Description**
1810
1811Obtains the window ID of an axis event.
1812
1813**System capability**: SystemCapability.MultimodalInput.Input.Core
1814
1815**Since**: 15
1816
1817**Parameters**
1818
1819| Name| Description|
1820| -------- | -------- |
1821| axisEvent | Axis event object. |
1822| windowId | Window ID of the axis event. |
1823
1824**Returns**
1825
1826**INTO_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** or **windowId** is **NULL**.
1827
1828
1829### OH_Input_GetCapabilities()
1830
1831```
1832Input_Result OH_Input_GetCapabilities (Input_DeviceInfo * deviceInfo, int32_t * capabilities )
1833```
1834**Description**
1835
1836Obtains the capabilities of an input device, for example, a touchscreen, touchpad, or keyboard.
1837
1838**System capability**: SystemCapability.MultimodalInput.Input.Core
1839
1840**Since**: 13
1841
1842**Parameters**
1843
1844| Name| Description|
1845| -------- | -------- |
1846| deviceInfo | [Input_DeviceInfo](#input_deviceinfo) object. |
1847| capabilities | Pointer to the capability information of the input device. |
1848
1849**Returns**
1850
1851**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **deviceInfo** or **capabilities** is a null pointer.
1852
1853
1854### OH_Input_GetDevice()
1855
1856```
1857Input_Result OH_Input_GetDevice (int32_t deviceId, Input_DeviceInfo ** deviceInfo )
1858```
1859**Description**
1860
1861Obtains information about the input device.
1862
1863**System capability**: SystemCapability.MultimodalInput.Input.Core
1864
1865**Since**: 13
1866
1867**Parameters**
1868
1869| Name| Description|
1870| -------- | -------- |
1871| deviceId | Device ID. |
1872| deviceInfo | Pointer to the [Input_DeviceInfo](#input_deviceinfo) object. |
1873
1874**Returns**
1875
1876**INPUT_SUCCESS** if the operation is successful;
1877
1878**INPUT_PARAMETER_ERROR** if **deviceInfo** is a null pointer or **deviceId** is invalid. You can use [OH_Input_GetDeviceIds](#oh_input_getdeviceids) to query the device IDs supported by the system.
1879
1880
1881### OH_Input_GetDeviceAddress()
1882
1883```
1884Input_Result OH_Input_GetDeviceAddress (Input_DeviceInfo * deviceInfo, char ** address )
1885```
1886**Description**
1887
1888Obtains the physical address of an input device.
1889
1890**System capability**: SystemCapability.MultimodalInput.Input.Core
1891
1892**Since**: 13
1893
1894**Parameters**
1895
1896| Name| Description|
1897| -------- | -------- |
1898| deviceInfo | [Input_DeviceInfo](#input_deviceinfo) object. |
1899| address | Pointer to the physical address of the input device. |
1900
1901**Returns**
1902
1903**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **deviceInfo** or **address** is a null pointer.
1904
1905
1906### OH_Input_GetDeviceId()
1907
1908```
1909Input_Result OH_Input_GetDeviceId (Input_DeviceInfo * deviceInfo, int32_t * id )
1910```
1911**Description**
1912
1913Obtains the ID of an input device.
1914
1915**System capability**: SystemCapability.MultimodalInput.Input.Core
1916
1917**Since**: 13
1918
1919**Parameters**
1920
1921| Name| Description|
1922| -------- | -------- |
1923| deviceInfo | Input device information. For details, see [Input_DeviceInfo](#input_deviceinfo). |
1924| id | Pointer to the input device ID. |
1925
1926**Returns**
1927
1928**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **deviceInfo** or **id** is a null pointer.
1929
1930
1931### OH_Input_GetDeviceIds()
1932
1933```
1934Input_Result OH_Input_GetDeviceIds (int32_t * deviceIds, int32_t inSize, int32_t * outSize )
1935```
1936**Description**
1937
1938Obtains the IDs of all input devices.
1939
1940**System capability**: SystemCapability.MultimodalInput.Input.Core
1941
1942**Since**: 13
1943
1944**Parameters**
1945
1946| Name| Description|
1947| -------- | -------- |
1948| deviceIds | List of input device IDs. |
1949| inSize | Size of the input device ID list. |
1950| outSize | Length of the input device ID list. The value must be less than or equal to the value of **inSize**. |
1951
1952**Returns**
1953
1954**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **deviceIds** or **outSize** is a null pointer or **inSize** is less than **0**.
1955
1956
1957### OH_Input_GetDeviceName()
1958
1959```
1960Input_Result OH_Input_GetDeviceName (Input_DeviceInfo * deviceInfo, char ** name )
1961```
1962**Description**
1963
1964Obtains the name of an input device.
1965
1966**System capability**: SystemCapability.MultimodalInput.Input.Core
1967
1968**Since**: 13
1969
1970**Parameters**
1971
1972| Name| Description|
1973| -------- | -------- |
1974| deviceInfo | Input device information. For details, see [Input_DeviceInfo](#input_deviceinfo). |
1975| name | Pointer to the input device name. |
1976
1977**Returns**
1978
1979**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **deviceInfo** or **name** is a null pointer.
1980
1981
1982### OH_Input_GetDeviceProduct()
1983
1984```
1985Input_Result OH_Input_GetDeviceProduct (Input_DeviceInfo * deviceInfo, int32_t * product )
1986```
1987**Description**
1988
1989Obtains the product information of an input device.
1990
1991**System capability**: SystemCapability.MultimodalInput.Input.Core
1992
1993**Since**: 13
1994
1995**Parameters**
1996
1997| Name| Description|
1998| -------- | -------- |
1999| deviceInfo | Input device information. For details, see [Input_DeviceInfo](#input_deviceinfo). |
2000| product | Pointer to the product information of the input device. |
2001
2002**Returns**
2003
2004**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **deviceInfo** or **product** is a null pointer.
2005
2006
2007### OH_Input_GetDeviceVendor()
2008
2009```
2010Input_Result OH_Input_GetDeviceVendor (Input_DeviceInfo * deviceInfo, int32_t * vendor )
2011```
2012**Description**
2013
2014Obtains the vendor information of an input device.
2015
2016**System capability**: SystemCapability.MultimodalInput.Input.Core
2017
2018**Since**: 13
2019
2020**Parameters**
2021
2022| Name| Description|
2023| -------- | -------- |
2024| deviceInfo | Input device information. For details, see [Input_DeviceInfo](#input_deviceinfo). |
2025| vendor | Pointer to the vendor information of the input device. |
2026
2027**Returns**
2028
2029**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **deviceInfo** or **vendor** is a null pointer.
2030
2031
2032### OH_Input_GetDeviceVersion()
2033
2034```
2035Input_Result OH_Input_GetDeviceVersion (Input_DeviceInfo * deviceInfo, int32_t * version )
2036```
2037**Description**
2038
2039Obtains the version information of an input device.
2040
2041**System capability**: SystemCapability.MultimodalInput.Input.Core
2042
2043**Since**: 13
2044
2045**Parameters**
2046
2047| Name| Description|
2048| -------- | -------- |
2049| deviceInfo | Input device information. For details, see [Input_DeviceInfo](#input_deviceinfo). |
2050| version | Pointer to the version information of the input device. |
2051
2052**Returns**
2053
2054**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **deviceInfo** or **version** is a null pointer.
2055
2056
2057### OH_Input_GetFinalKey()
2058
2059```
2060Input_Result OH_Input_GetFinalKey (const Input_Hotkey * hotkey, int32_t * finalKeyCode )
2061```
2062**Description**
2063
2064Obtains the modified key.
2065
2066**System capability**: SystemCapability.MultimodalInput.Input.Core
2067
2068**Since**: 14
2069
2070**Parameters**
2071
2072| Name| Description|
2073| -------- | -------- |
2074| hotkey | Shortcut key object. |
2075| finalKeyCode | Modified key. |
2076
2077**Returns**
2078
2079Status code of the **OH_Input_GetfinalKey** function, which is **INPUT_SUCCESS** if the operation is successful or
2080
2081**INPUT_PARAMETER_ERROR** otherwise.
2082
2083
2084### OH_Input_GetFunctionKeyState()
2085
2086```
2087Input_Result OH_Input_GetFunctionKeyState (int32_t keyCode, int32_t * state )
2088```
2089**Description**
2090
2091Obtains the function key status.
2092
2093**Since**: 15
2094
2095**Parameters**
2096
2097| Name| Description|
2098| -------- | -------- |
2099| keyCode | Function key. Only the **CapsLock** key is supported. |
2100| state | Function key status. The value **0** indicates that the function key is disabled, and the value **1** indicates that the function key is enabled. |
2101
2102**Returns**
2103
2104**OH_Input_GetFunctionKeyState** status code, specifically:
2105**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if the parameter is incorrect; **INPUT_DEVICE_NOT_EXIST** if the keyboard does not exist.
2106
2107
2108### OH_Input_GetIntervalSinceLastInput()
2109
2110```
2111Input_Result OH_Input_GetIntervalSinceLastInput (int64_t * timeInterval)
2112```
2113**Description**
2114
2115Obtains the interval since the last system input event.
2116
2117**System capability**: SystemCapability.MultimodalInput.Input.Core
2118
2119**Since**: 14
2120
2121**Parameters**
2122
2123| Name| Description|
2124| -------- | -------- |
2125| timeInterval | Interval, in microseconds. |
2126
2127**Returns**
2128
2129Status code of the **OH_Input_GetIntervalSinceLastInput** function,
2130
2131which is **INPUT_SUCCESS** if the operation is successful; **INPUT_SERVICE_EXCEPTION** otherwise.
2132
2133
2134### OH_Input_GetKeyboardType()
2135
2136```
2137Input_Result OH_Input_GetKeyboardType (int32_t deviceId, int32_t * keyboardType )
2138```
2139**Description**
2140
2141Obtains the keyboard type of an input device.
2142
2143**System capability**: SystemCapability.MultimodalInput.Input.Core
2144
2145**Since**: 13
2146
2147**Parameters**
2148
2149| Name| Description|
2150| -------- | -------- |
2151| deviceId | Device ID. |
2152| keyboardType | Pointer to the keyboard type of the input device. |
2153
2154**Returns**
2155
2156**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if the device ID is invalid or **keyboardType** is a null pointer.
2157
2158
2159### OH_Input_GetKeyCode()
2160
2161```
2162int32_t OH_Input_GetKeyCode (const struct Input_KeyState * keyState)
2163```
2164**Description**
2165
2166Obtains the key value of a key status enum object.
2167
2168**System capability**: SystemCapability.MultimodalInput.Input.Core
2169
2170**Since**: 12
2171
2172**Parameters**
2173
2174| Name| Description|
2175| -------- | -------- |
2176| keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).|
2177
2178**Returns**
2179
2180Key value of the key status enum object.
2181
2182
2183### OH_Input_GetKeyEventAction()
2184
2185```
2186int32_t OH_Input_GetKeyEventAction (const struct Input_KeyEvent * keyEvent)
2187```
2188**Description**
2189
2190Obtains the key event type.
2191
2192**System capability**: SystemCapability.MultimodalInput.Input.Core
2193
2194**Since**: 12
2195
2196**Parameters**
2197
2198| Name| Description|
2199| -------- | -------- |
2200| keyEvent | Key event object.|
2201
2202**Returns**
2203
2204Key event type.
2205
2206
2207### OH_Input_GetKeyEventActionTime()
2208
2209```
2210int64_t OH_Input_GetKeyEventActionTime (const struct Input_KeyEvent * keyEvent)
2211```
2212**Description**
2213
2214Obtains the time when a key event occurs.
2215
2216**System capability**: SystemCapability.MultimodalInput.Input.Core
2217
2218**Since**: 12
2219
2220**Parameters**
2221
2222| Name| Description|
2223| -------- | -------- |
2224| keyEvent | Key event object. |
2225
2226**Returns**
2227
2228Time when a key event occurs.
2229
2230
2231### OH_Input_GetKeyEventDisplayId()
2232
2233```
2234int32_t OH_Input_GetKeyEventDisplayId (const struct Input_KeyEvent * keyEvent)
2235```
2236**Description**
2237
2238Obtains the screen ID of a key event.
2239
2240**System capability**: SystemCapability.MultimodalInput.Input.Core
2241
2242**Since**: 15
2243
2244**Parameters**
2245
2246| Name| Description|
2247| -------- | -------- |
2248| keyEvent | Key event object. |
2249
2250**Returns**
2251
2252Screen ID of the key event.
2253
2254
2255### OH_Input_GetKeyEventKeyCode()
2256
2257```
2258int32_t OH_Input_GetKeyEventKeyCode (const struct Input_KeyEvent * keyEvent)
2259```
2260**Description**
2261
2262Obtains the key code value of a key event.
2263
2264**System capability**: SystemCapability.MultimodalInput.Input.Core
2265
2266**Since**: 12
2267
2268**Parameters**
2269
2270| Name| Description|
2271| -------- | -------- |
2272| keyEvent | Key event object. |
2273
2274**Returns**
2275
2276Key code.
2277
2278
2279### OH_Input_GetKeyEventWindowId()
2280
2281```
2282int32_t OH_Input_GetKeyEventWindowId (const struct Input_KeyEvent * keyEvent)
2283```
2284**Description**
2285
2286Obtains the window ID of a key event.
2287
2288**System capability**: SystemCapability.MultimodalInput.Input.Core
2289
2290**Since**: 15
2291
2292**Parameters**
2293
2294| Name| Description|
2295| -------- | -------- |
2296| keyEvent | Key event object. |
2297
2298**Returns**
2299
2300Window ID of the key event.
2301
2302
2303### OH_Input_GetKeyPressed()
2304
2305```
2306int32_t OH_Input_GetKeyPressed (const struct Input_KeyState * keyState)
2307```
2308**Description**
2309
2310Checks whether the key specific to a key status enum object is pressed.
2311
2312**System capability**: SystemCapability.MultimodalInput.Input.Core
2313
2314**Since**: 12
2315
2316**Parameters**
2317
2318| Name| Description|
2319| -------- | -------- |
2320| keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).|
2321
2322**Returns**
2323
2324Key pressing status of the key status enum object.
2325
2326
2327### OH_Input_GetKeyState()
2328
2329```
2330Input_Result OH_Input_GetKeyState (struct Input_KeyState * keyState)
2331```
2332**Description**
2333
2334Queries a key status enum object.
2335
2336**System capability**: SystemCapability.MultimodalInput.Input.Core
2337
2338**Since**: 12
2339
2340**Parameters**
2341
2342| Name| Description|
2343| -------- | -------- |
2344| keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).|
2345
2346**Returns**
2347
2348**Input_Result#INPUT_SUCCESS** if the operation is successful; an error code defined in [Input_Result](#input_result) otherwise.
2349
2350
2351### OH_Input_GetKeySwitch()
2352
2353```
2354int32_t OH_Input_GetKeySwitch (const struct Input_KeyState * keyState)
2355```
2356**Description**
2357
2358Obtains the key switch of the key status enum object.
2359
2360**System capability**: SystemCapability.MultimodalInput.Input.Core
2361
2362**Since**: 12
2363
2364**Parameters**
2365
2366| Name| Description|
2367| -------- | -------- |
2368| keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).|
2369
2370**Returns**
2371
2372Key switch of the key status enum object.
2373
2374
2375### OH_Input_GetMouseEventAction()
2376
2377```
2378int32_t OH_Input_GetMouseEventAction (const struct Input_MouseEvent * mouseEvent)
2379```
2380**Description**
2381
2382Obtains the action of a mouse event.
2383
2384**System capability**: SystemCapability.MultimodalInput.Input.Core
2385
2386**Since**: 12
2387
2388**Parameters**
2389
2390| Name| Description|
2391| -------- | -------- |
2392| mouseEvent | Mouse event object. |
2393
2394**Returns**
2395
2396Mouse action.
2397
2398
2399### OH_Input_GetMouseEventActionTime()
2400
2401```
2402int64_t OH_Input_GetMouseEventActionTime (const struct Input_MouseEvent * mouseEvent)
2403```
2404**Description**
2405
2406Obtains the time when a mouse event occurs.
2407
2408**System capability**: SystemCapability.MultimodalInput.Input.Core
2409
2410**Since**: 12
2411
2412**Parameters**
2413
2414| Name| Description|
2415| -------- | -------- |
2416| keyEvent | Mouse event object. |
2417
2418**Returns**
2419
2420Time when the mouse event occurs.
2421
2422
2423### OH_Input_GetMouseEventAxisType()
2424
2425```
2426int32_t OH_Input_GetMouseEventAxisType (const struct Input_MouseEvent * mouseEvent)
2427```
2428**Description**
2429
2430Obtains the axis type of a mouse event.
2431
2432**System capability**: SystemCapability.MultimodalInput.Input.Core
2433
2434**Since**: 12
2435
2436**Parameters**
2437
2438| Name| Description|
2439| -------- | -------- |
2440| mouseEvent | Mouse event object. |
2441
2442**Returns**
2443
2444Axis type.
2445
2446
2447### OH_Input_GetMouseEventAxisValue()
2448
2449```
2450float OH_Input_GetMouseEventAxisValue (const struct Input_MouseEvent * mouseEvent)
2451```
2452**Description**
2453
2454Obtains the axis value of a mouse axis event.
2455
2456**System capability**: SystemCapability.MultimodalInput.Input.Core
2457
2458**Since**: 12
2459
2460**Parameters**
2461
2462| Name| Description|
2463| -------- | -------- |
2464| mouseEvent | Mouse event object. |
2465
2466**Returns**
2467
2468Axis value of the mouse axis event.
2469
2470
2471### OH_Input_GetMouseEventButton()
2472
2473```
2474int32_t OH_Input_GetMouseEventButton (const struct Input_MouseEvent * mouseEvent)
2475```
2476**Description**
2477
2478Obtains the button of a mouse event.
2479
2480**System capability**: SystemCapability.MultimodalInput.Input.Core
2481
2482**Since**: 12
2483
2484**Parameters**
2485
2486| Name| Description|
2487| -------- | -------- |
2488| mouseEvent | Mouse event object. |
2489
2490**Returns**
2491
2492Enumerates mouse buttons.
2493
2494
2495### OH_Input_GetMouseEventDisplayId()
2496
2497```
2498int32_t OH_Input_GetMouseEventDisplayId (const struct Input_MouseEvent * mouseEvent)
2499```
2500**Description**
2501
2502Obtains the screen ID of a mouse event.
2503
2504**System capability**: SystemCapability.MultimodalInput.Input.Core
2505
2506**Since**: 15
2507
2508**Parameters**
2509
2510| Name| Description|
2511| -------- | -------- |
2512| mouseEvent | Mouse event object. |
2513
2514**Returns**
2515
2516Screen ID of the mouse event.
2517
2518
2519### OH_Input_GetMouseEventDisplayX()
2520
2521```
2522int32_t OH_Input_GetMouseEventDisplayX (const struct Input_MouseEvent * mouseEvent)
2523```
2524**Description**
2525
2526Obtains the X coordinate of a mouse event.
2527
2528**System capability**: SystemCapability.MultimodalInput.Input.Core
2529
2530**Since**: 12
2531
2532**Parameters**
2533
2534| Name| Description|
2535| -------- | -------- |
2536| mouseEvent | Mouse event object. |
2537
2538**Returns**
2539
2540X coordinate on the screen.
2541
2542
2543### OH_Input_GetMouseEventDisplayY()
2544
2545```
2546int32_t OH_Input_GetMouseEventDisplayY (const struct Input_MouseEvent * mouseEvent)
2547```
2548**Description**
2549
2550Obtains the Y coordinate of a mouse event.
2551
2552**System capability**: SystemCapability.MultimodalInput.Input.Core
2553
2554**Since**: 12
2555
2556**Parameters**
2557
2558| Name| Description|
2559| -------- | -------- |
2560| mouseEvent | Mouse event object. |
2561
2562**Returns**
2563
2564Y coordinate on the screen.
2565
2566
2567### OH_Input_GetMouseEventWindowId()
2568
2569```
2570int32_t OH_Input_GetMouseEventWindowId (const struct Input_MouseEvent * mouseEvent)
2571```
2572**Description**
2573
2574Obtains the window ID of a mouse event.
2575
2576**System capability**: SystemCapability.MultimodalInput.Input.Core
2577
2578**Since**: 15
2579
2580**Parameters**
2581
2582| Name| Description|
2583| -------- | -------- |
2584| mouseEvent | Mouse event object. |
2585
2586**Returns**
2587
2588Window ID of the mouse event.
2589
2590
2591### OH_Input_GetPreKeys()
2592
2593```
2594Input_Result OH_Input_GetPreKeys (const Input_Hotkey * hotkey, int32_t ** preKeys, int32_t * preKeyCount )
2595```
2596**Description**
2597
2598Obtains the modifier key.
2599
2600**System capability**: SystemCapability.MultimodalInput.Input.Core
2601
2602**Since**: 14
2603
2604**Parameters**
2605
2606| Name| Description|
2607| -------- | -------- |
2608| hotkey | Shortcut key object. |
2609| preKeys | List of modifier keys. |
2610| preKeyCount | Number of modifier keys. |
2611
2612**Returns**
2613
2614Status code of the **OH_Input_GetpressedKeys** function, which is **INPUT_SUCCESS** if the operation is successful or
2615
2616**INPUT_PARAMETER_ERROR** otherwise.
2617
2618### OH_Input_GetRepeat()
2619
2620```
2621Input_Result OH_Input_GetRepeat (const Input_Hotkey * hotkey, bool * isRepeat )
2622```
2623**Description**
2624
2625Checks whether to report repeated key events.
2626
2627**System capability**: SystemCapability.MultimodalInput.Input.Core
2628
2629**Since**: 14
2630
2631**Parameters**
2632
2633| Name| Description|
2634| -------- | -------- |
2635| hotkey | Shortcut key object. |
2636| isRepeat | Whether the reported key events is repeated. |
2637
2638**Returns**
2639
2640OH_Input_GetIsRepeat status code, specifically, **INPUT_SUCCESS** if the operation is successful or
2641
2642**INPUT_PARAMETER_ERROR** otherwise.
2643
2644### OH_Input_GetTouchEventAction()
2645
2646```
2647int32_t OH_Input_GetTouchEventAction (const struct Input_TouchEvent * touchEvent)
2648```
2649**Description**
2650
2651Obtains the action of a touch event.
2652
2653**System capability**: SystemCapability.MultimodalInput.Input.Core
2654
2655**Since**: 12
2656
2657**Parameters**
2658
2659| Name| Description|
2660| -------- | -------- |
2661| touchEvent | Touch event object. |
2662
2663**Returns**
2664
2665Action of the touch event.
2666
2667
2668### OH_Input_GetTouchEventActionTime()
2669
2670```
2671int64_t OH_Input_GetTouchEventActionTime (const struct Input_TouchEvent * touchEvent)
2672```
2673**Description**
2674
2675Obtains the time when a touch event occurs.
2676
2677**System capability**: SystemCapability.MultimodalInput.Input.Core
2678
2679**Since**: 12
2680
2681**Parameters**
2682
2683| Name| Description|
2684| -------- | -------- |
2685| keyEvent | Touch event object. |
2686
2687**Returns**
2688
2689Time when the touch event occurs.
2690
2691
2692### OH_Input_GetTouchEventDisplayId()
2693
2694```
2695int32_t OH_Input_GetTouchEventDisplayId (const struct Input_TouchEvent * touchEvent)
2696```
2697**Description**
2698
2699Obtains the screen ID of a touchscreen event.
2700
2701**System capability**: SystemCapability.MultimodalInput.Input.Core
2702
2703**Since**: 15
2704
2705**Parameters**
2706
2707| Name| Description|
2708| -------- | -------- |
2709| touchEvent | Touch event object. |
2710
2711**Returns**
2712
2713Screen ID of the touchscreen event.
2714
2715
2716### OH_Input_GetTouchEventDisplayX()
2717
2718```
2719int32_t OH_Input_GetTouchEventDisplayX (const struct Input_TouchEvent * touchEvent)
2720```
2721**Description**
2722
2723Obtains the X coordinate of a touch event.
2724
2725**System capability**: SystemCapability.MultimodalInput.Input.Core
2726
2727**Since**: 12
2728
2729**Parameters**
2730
2731| Name| Description|
2732| -------- | -------- |
2733| touchEvent | Touch event object. |
2734
2735**Returns**
2736
2737X coordinate on the touchscreen.
2738
2739
2740### OH_Input_GetTouchEventDisplayY()
2741
2742```
2743int32_t OH_Input_GetTouchEventDisplayY (const struct Input_TouchEvent * touchEvent)
2744```
2745**Description**
2746
2747Obtains the Y coordinate of a touch event.
2748
2749**System capability**: SystemCapability.MultimodalInput.Input.Core
2750
2751**Since**: 12
2752
2753**Parameters**
2754
2755| Name| Description|
2756| -------- | -------- |
2757| touchEvent | Touch event object. |
2758
2759**Returns**
2760
2761Y coordinate on the touchscreen.
2762
2763
2764### OH_Input_GetTouchEventFingerId()
2765
2766```
2767int32_t OH_Input_GetTouchEventFingerId (const struct Input_TouchEvent * touchEvent)
2768```
2769**Description**
2770
2771Obtains the finger ID of a touch event.
2772
2773**System capability**: SystemCapability.MultimodalInput.Input.Core
2774
2775**Since**: 12
2776
2777**Parameters**
2778
2779| Name| Description|
2780| -------- | -------- |
2781| touchEvent | Touch event object. |
2782
2783**Returns**
2784
2785Finger ID of a touch event.
2786
2787
2788### OH_Input_GetTouchEventWindowId()
2789
2790```
2791int32_t OH_Input_GetTouchEventWindowId (const struct Input_TouchEvent * touchEvent)
2792```
2793**Description**
2794
2795Obtains the window ID of a touchscreen event.
2796
2797**System capability**: SystemCapability.MultimodalInput.Input.Core
2798
2799**Since**: 15
2800
2801**Parameters**
2802
2803| Name| Description|
2804| -------- | -------- |
2805| touchEvent | Touch event object. |
2806
2807**Returns**
2808
2809Window ID of the touchscreen event.
2810
2811
2812### OH_Input_InjectKeyEvent()
2813
2814```
2815int32_t OH_Input_InjectKeyEvent (const struct Input_KeyEvent * keyEvent)
2816```
2817**Description**
2818
2819Injects a key event.
2820
2821**System capability**: SystemCapability.MultimodalInput.Input.Core
2822
2823**Since**: 12
2824
2825**Parameters**
2826
2827| Name| Description|
2828| -------- | -------- |
2829| keyEvent | Defines the key event to be injected. |
2830
2831**Returns**
2832
2833**0** if the operation is successful; **201** if the required permission is missing; **401** if the parameter is invalid.
2834
2835
2836### OH_Input_InjectMouseEvent()
2837
2838```
2839int32_t OH_Input_InjectMouseEvent (const struct Input_MouseEvent * mouseEvent)
2840```
2841**Description**
2842
2843Injects a mouse event.
2844
2845**System capability**: SystemCapability.MultimodalInput.Input.Core
2846
2847**Since**: 12
2848
2849**Parameters**
2850
2851| Name| Description|
2852| -------- | -------- |
2853| mouseEvent |  Defines the mouse event to be injected. |
2854
2855**Returns**
2856
2857**0** if the operation is successful; **201** if the required permission is missing; **401** if the parameter is invalid.
2858
2859
2860### OH_Input_InjectTouchEvent()
2861
2862```
2863int32_t OH_Input_InjectTouchEvent (const struct Input_TouchEvent * touchEvent)
2864```
2865**Description**
2866
2867Injects a touch event.
2868
2869**System capability**: SystemCapability.MultimodalInput.Input.Core
2870
2871**Since**: 12
2872
2873**Parameters**
2874
2875| Name| Description|
2876| -------- | -------- |
2877| touchEvent | Defines the touch event to be injected. |
2878
2879**Returns**
2880
2881**0** if the operation is successful; **201** if the required permission is missing; **401** if the parameter is invalid.
2882
2883### OH_Input_RegisterDeviceListener()
2884
2885```
2886Input_Result OH_Input_RegisterDeviceListener (Input_DeviceListener * listener)
2887```
2888**Description**
2889
2890Registers a listener for device hot swap events.
2891
2892**System capability**: SystemCapability.MultimodalInput.Input.Core
2893
2894**Since**: 13
2895
2896**Parameters**
2897
2898| Name| Description|
2899| -------- | -------- |
2900| listener | Pointer to the [Input_DeviceListener](_input___device_listener.md) object. |
2901
2902**Returns**
2903
2904**OH_Input_RegisterDeviceListener** status code, specifically:
2905
2906**INPUT_SUCCESS** if the operation is successful; **INPUT_PARAMETER_ERROR** if **listener** is **NULL**.
2907
2908### OH_Input_RemoveAxisEventMonitor()
2909
2910```
2911Input_Result OH_Input_RemoveAxisEventMonitor (InputEvent_AxisEventType axisEventType, Input_AxisEventCallback callback )
2912```
2913**Description**
2914
2915Removes the listener for the specified type of axis events, which are defined in [InputEvent_AxisEventType](#inputevent_axiseventtype).
2916
2917**System capability**: SystemCapability.MultimodalInput.Input.Core
2918
2919**Since**: 12
2920
2921**Parameters**
2922
2923| Name| Description|
2924| -------- | -------- |
2925| axisEventType | Axis event type, which is defined in [InputEvent_AxisEventType](#inputevent_axiseventtype). |
2926| callback | Callback for the specified type of axis events. |
2927
2928**Required Permissions**
2929
2930ohos.permission.INPUT_MONITORING
2931
2932**Returns**
2933
2934**INTO_SUCCESS** if the operation is successful; **INPUT_PERMISSION_DENIED** if the permission verification fails; **INPUT_PARAMETER_ERROR** if the callback is empty or no listener is added; **INPUT_SERVICE_EXCEPTION** if the service is abnormal.
2935
2936
2937### OH_Input_RemoveAxisEventMonitorForAll()
2938
2939```
2940Input_Result OH_Input_RemoveAxisEventMonitorForAll (Input_AxisEventCallback callback)
2941```
2942**Description**
2943
2944Removes the listener for all types of axis events.
2945
2946**System capability**: SystemCapability.MultimodalInput.Input.Core
2947
2948**Since**: 12
2949
2950**Parameters**
2951
2952| Name| Description|
2953| -------- | -------- |
2954| callback | Callback for the all types of axis events. |
2955
2956**Required Permissions**
2957
2958ohos.permission.INPUT_MONITORING
2959
2960**Returns**
2961
2962**INTO_SUCCESS** if the operation is successful; **INPUT_PERMISSION_DENIED** if the permission verification fails; **INPUT_PARAMETER_ERROR** if the callback is empty or no listener is added; **INPUT_SERVICE_EXCEPTION** if the service is abnormal.
2963
2964
2965### OH_Input_RemoveHotkeyMonitor()
2966
2967```
2968Input_Result OH_Input_RemoveHotkeyMonitor (const Input_Hotkey * hotkey, Input_HotkeyCallback callback )
2969```
2970**Description**
2971
2972Unsubscribes from shortcut key events.
2973
2974**System capability**: SystemCapability.MultimodalInput.Input.Core
2975
2976**Since**: 14
2977
2978**Parameters**
2979
2980| Name| Description|
2981| -------- | -------- |
2982| hotkey | Shortcut key object. |
2983| callback | Defines the callback used to return shortcut key events. |
2984
2985**Returns**
2986
2987OH_Input_RemoveHotkeyMonitor status code, specifically, **INPUT_SUCCESS** if the operation is successful or
2988
2989**INPUT_PARAMETER_ERROR** if parameter check fails.
2990
2991
2992### OH_Input_RemoveInputEventInterceptor()
2993
2994```
2995Input_Result OH_Input_RemoveInputEventInterceptor (void)
2996```
2997**Description**
2998
2999Removes the interceptor for input events, including mouse, touch, and axis events.
3000
3001**System capability**: SystemCapability.MultimodalInput.Input.Core
3002
3003**Since**: 12
3004
3005**Required Permissions**
3006
3007ohos.permission.INTERCEPT_INPUT_EVENT
3008
3009**Returns**
3010
3011**INTO_SUCCESS** if operation is successful; **INPUT_PERMISSION_DENIED** if permission verification fails; **INPUT_SERVICE_EXCEPTION** if the service is abnormal.
3012
3013
3014### OH_Input_RemoveKeyEventInterceptor()
3015
3016```
3017Input_Result OH_Input_RemoveKeyEventInterceptor (void)
3018```
3019**Description**
3020
3021Removes the interceptor for key events.
3022
3023**System capability**: SystemCapability.MultimodalInput.Input.Core
3024
3025**Since**: 12
3026
3027**Required Permissions**
3028
3029ohos.permission.INTERCEPT_INPUT_EVENT
3030
3031**Returns**
3032
3033**INTO_SUCCESS** if operation is successful; **INPUT_PERMISSION_DENIED** if permission verification fails; **INPUT_SERVICE_EXCEPTION** if the service is abnormal.
3034
3035
3036### OH_Input_RemoveKeyEventMonitor()
3037
3038```
3039Input_Result OH_Input_RemoveKeyEventMonitor (Input_KeyEventCallback callback)
3040```
3041**Description**
3042
3043Removes the listener for key events.
3044
3045**System capability**: SystemCapability.MultimodalInput.Input.Core
3046
3047**Since**: 12
3048
3049**Parameters**
3050
3051| Name| Description|
3052| -------- | -------- |
3053| callback | Callback for key events. |
3054
3055**Required Permissions**
3056
3057ohos.permission.INPUT_MONITORING
3058
3059**Returns**
3060
3061**INTO_SUCCESS** if the operation is successful; **INPUT_PERMISSION_DENIED** if the permission verification fails; **INPUT_PARAMETER_ERROR** if the callback is empty or no listener is added; **INPUT_SERVICE_EXCEPTION** if the service is abnormal.
3062
3063
3064### OH_Input_RemoveMouseEventMonitor()
3065
3066```
3067Input_Result OH_Input_RemoveMouseEventMonitor (Input_MouseEventCallback callback)
3068```
3069**Description**
3070
3071Removes the listener for mouse events.
3072
3073**System capability**: SystemCapability.MultimodalInput.Input.Core
3074
3075**Since**: 12
3076
3077**Parameters**
3078
3079| Name| Description|
3080| -------- | -------- |
3081| callback | Callback for mouse events. |
3082
3083**Required Permissions**
3084
3085ohos.permission.INPUT_MONITORING
3086
3087**Returns**
3088
3089**INTO_SUCCESS** if the operation is successful; **INPUT_PERMISSION_DENIED** if the permission verification fails; **INPUT_PARAMETER_ERROR** if the callback is empty or no listener is added; **INPUT_SERVICE_EXCEPTION** if the service is abnormal.
3090
3091
3092### OH_Input_RemoveTouchEventMonitor()
3093
3094```
3095Input_Result OH_Input_RemoveTouchEventMonitor (Input_TouchEventCallback callback)
3096```
3097**Description**
3098
3099Removes the listener for touch events.
3100
3101**System capability**: SystemCapability.MultimodalInput.Input.Core
3102
3103**Since**: 12
3104
3105**Parameters**
3106
3107| Name| Description|
3108| -------- | -------- |
3109| callback | Callback for touch events. |
3110
3111**Required Permissions**
3112
3113ohos.permission.INPUT_MONITORING
3114
3115**Returns**
3116
3117**INTO_SUCCESS** if the operation is successful; **INPUT_PERMISSION_DENIED** if the permission verification fails; **INPUT_PARAMETER_ERROR** if the callback is empty or no listener is added; **INPUT_SERVICE_EXCEPTION** if the service is abnormal.
3118
3119
3120### OH_Input_SetAxisEventAction()
3121
3122```
3123Input_Result OH_Input_SetAxisEventAction (Input_AxisEvent * axisEvent, InputEvent_AxisAction action )
3124```
3125**Description**
3126
3127Sets the action for an axis event.
3128
3129**System capability**: SystemCapability.MultimodalInput.Input.Core
3130
3131**Since**: 12
3132
3133**Parameters**
3134
3135| Name| Description|
3136| -------- | -------- |
3137| axisEvent | Axis event object. |
3138| action | Action of the axis event. For details, see [InputEvent_AxisAction](#inputevent_axisaction). |
3139
3140**Returns**
3141
3142**INTO_SUCCESS** if operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** is NULL.
3143
3144### OH_Input_SetAxisEventActionTime()
3145
3146```
3147Input_Result OH_Input_SetAxisEventActionTime (Input_AxisEvent * axisEvent, int64_t actionTime )
3148```
3149**Description**
3150
3151Sets the time when an axis event occurs.
3152
3153**System capability**: SystemCapability.MultimodalInput.Input.Core
3154
3155**Since**: 12
3156
3157**Parameters**
3158
3159| Name| Description|
3160| -------- | -------- |
3161| axisEvent | Axis event object. For details, see [Input_AxisEvent](#input_axisevent). |
3162| actionTime | Time when an event occurs. |
3163
3164**Returns**
3165
3166**INTO_SUCCESS** if operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** is NULL.
3167
3168
3169### OH_Input_SetAxisEventAxisValue()
3170
3171```
3172Input_Result OH_Input_SetAxisEventAxisValue (Input_AxisEvent * axisEvent, InputEvent_AxisType axisType, double axisValue )
3173```
3174**Description**
3175
3176Sets the axis value of the axis type specified by the axis event.
3177
3178**System capability**: SystemCapability.MultimodalInput.Input.Core
3179
3180**Since**: 12
3181
3182**Parameters**
3183
3184| Name| Description|
3185| -------- | -------- |
3186| axisEvent | Axis event object. For details, see [Input_AxisEvent](#input_axisevent). |
3187| axisType | Axis type. For details, see [InputEvent_AxisType](#inputevent_axistype). |
3188| axisValue | Axis event axis value. |
3189
3190**Returns**
3191
3192**INTO_SUCCESS** if operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** is NULL.
3193
3194
3195### OH_Input_SetAxisEventDisplayId()
3196
3197```
3198Input_Result OH_Input_SetAxisEventDisplayId (Input_AxisEvent * axisEvent, int32_t displayId )
3199```
3200**Description**
3201
3202Sets the screen ID of an axis event.
3203
3204**System capability**: SystemCapability.MultimodalInput.Input.Core
3205
3206**Since**: 15
3207
3208**Parameters**
3209
3210| Name| Description|
3211| -------- | -------- |
3212| axisEvent | Axis event object. |
3213| displayId | Screen ID of the axis event. |
3214
3215**Returns**
3216
3217**INTO_SUCCESS** if operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** is NULL.
3218
3219
3220### OH_Input_SetAxisEventDisplayX()
3221
3222```
3223Input_Result OH_Input_SetAxisEventDisplayX (Input_AxisEvent * axisEvent, float displayX )
3224```
3225**Description**
3226
3227Sets the X coordinate for an axis event.
3228
3229**System capability**: SystemCapability.MultimodalInput.Input.Core
3230
3231**Since**: 12
3232
3233**Parameters**
3234
3235| Name| Description|
3236| -------- | -------- |
3237| axisEvent | Axis event object. |
3238| displayX | X coordinate of the axis event. |
3239
3240**Returns**
3241
3242**INTO_SUCCESS** if operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** is NULL.
3243
3244
3245### OH_Input_SetAxisEventDisplayY()
3246
3247```
3248Input_Result OH_Input_SetAxisEventDisplayY (Input_AxisEvent * axisEvent, float displayY )
3249```
3250**Description**
3251
3252Sets the Y coordinate for an axis event.
3253
3254**System capability**: SystemCapability.MultimodalInput.Input.Core
3255
3256**Since**: 12
3257
3258**Parameters**
3259
3260| Name| Description|
3261| -------- | -------- |
3262| axisEvent | Axis event object. For details, see [Input_AxisEvent](#input_axisevent). |
3263| displayY | Y coordinate of the axis event. |
3264
3265**Returns**
3266
3267**INTO_SUCCESS** if operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** is NULL.
3268
3269
3270### OH_Input_SetAxisEventSourceType()
3271
3272```
3273Input_Result OH_Input_SetAxisEventSourceType (Input_AxisEvent * axisEvent, InputEvent_SourceType sourceType )
3274```
3275**Description**
3276
3277Sets the axis event source type.
3278
3279**System capability**: SystemCapability.MultimodalInput.Input.Core
3280
3281**Since**: 12
3282
3283**Parameters**
3284
3285| Name| Description|
3286| -------- | -------- |
3287| axisEvent | Axis event object. |
3288| sourceType | Axis event source type. For details, see [InputEvent_SourceType](#inputevent_sourcetype). |
3289
3290**Returns**
3291
3292**INTO_SUCCESS** if operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** is NULL.
3293
3294
3295### OH_Input_SetAxisEventType()
3296
3297```
3298Input_Result OH_Input_SetAxisEventType (Input_AxisEvent * axisEvent, InputEvent_AxisEventType axisEventType )
3299```
3300**Description**
3301
3302Sets the axis event type.
3303
3304**System capability**: SystemCapability.MultimodalInput.Input.Core
3305
3306**Since**: 12
3307
3308**Parameters**
3309
3310| Name| Description|
3311| -------- | -------- |
3312| axisEvent | Axis event object. For details, see [Input_AxisEvent](#input_axisevent). |
3313| axisEventType | Axis event type. For details, see [InputEvent_AxisEventType](#inputevent_axiseventtype). |
3314
3315**Returns**
3316
3317**INTO_SUCCESS** if operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** is NULL.
3318
3319
3320### OH_Input_SetAxisEventWindowId()
3321
3322```
3323Input_Result OH_Input_SetAxisEventWindowId (Input_AxisEvent * axisEvent, int32_t windowId )
3324```
3325**Description**
3326
3327Sets the window ID of an axis event.
3328
3329**System capability**: SystemCapability.MultimodalInput.Input.Core
3330
3331**Since**: 15
3332
3333**Parameters**
3334
3335| Name| Description|
3336| -------- | -------- |
3337| axisEvent | Axis event object. |
3338| windowId | Window ID of the axis event. |
3339
3340**Returns**
3341
3342**INTO_SUCCESS** if operation is successful; **INPUT_PARAMETER_ERROR** if **axisEvent** is NULL.
3343
3344
3345### OH_Input_SetFinalKey()
3346
3347```
3348void OH_Input_SetFinalKey (Input_Hotkey * hotkey, int32_t finalKey )
3349```
3350**Description**
3351
3352Sets the modified key.
3353
3354**System capability**: SystemCapability.MultimodalInput.Input.Core
3355
3356**Since**: 14
3357
3358**Parameters**
3359
3360| Name| Description|
3361| -------- | -------- |
3362| hotkey | Shortcut key object. |
3363| finalKey | Modifier key value. Only one modifier key value is allowed. |
3364
3365
3366### OH_Input_SetKeyCode()
3367
3368```
3369void OH_Input_SetKeyCode (struct Input_KeyState * keyState, int32_t keyCode )
3370```
3371**Description**
3372
3373Sets the key value of a key status enum object.
3374
3375**System capability**: SystemCapability.MultimodalInput.Input.Core
3376
3377**Since**: 12
3378
3379**Parameters**
3380
3381| Name| Description|
3382| -------- | -------- |
3383| keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).|
3384| keyCode | Key code. |
3385
3386
3387### OH_Input_SetKeyEventAction()
3388
3389```
3390void OH_Input_SetKeyEventAction (struct Input_KeyEvent * keyEvent, int32_t action )
3391```
3392**Description**
3393
3394Sets the key event type.
3395
3396**System capability**: SystemCapability.MultimodalInput.Input.Core
3397
3398**Since**: 12
3399
3400**Parameters**
3401
3402| Name| Description|
3403| -------- | -------- |
3404| keyEvent | Key event object. |
3405| action | Key event type.|
3406
3407
3408### OH_Input_SetKeyEventActionTime()
3409
3410```
3411void OH_Input_SetKeyEventActionTime (struct Input_KeyEvent * keyEvent, int64_t actionTime )
3412```
3413**Description**
3414
3415Sets the time when a key event occurs.
3416
3417**System capability**: SystemCapability.MultimodalInput.Input.Core
3418
3419**Since**: 12
3420
3421**Parameters**
3422
3423| Name| Description|
3424| -------- | -------- |
3425| keyEvent | Key event object.|
3426| actionTime | Time when a key event occurs. |
3427
3428
3429### OH_Input_SetKeyEventDisplayId()
3430
3431```
3432void OH_Input_SetKeyEventDisplayId (struct Input_KeyEvent * keyEvent, int32_t displayId )
3433```
3434**Description**
3435
3436Sets the screen ID of a key event.
3437
3438**System capability**: SystemCapability.MultimodalInput.Input.Core
3439
3440**Since**: 15
3441
3442**Parameters**
3443
3444| Name| Description|
3445| -------- | -------- |
3446| keyEvent | Key event object. |
3447| displayId | Screen ID of the key event. |
3448
3449
3450### OH_Input_SetKeyEventKeyCode()
3451
3452```
3453void OH_Input_SetKeyEventKeyCode (struct Input_KeyEvent * keyEvent, int32_t keyCode )
3454```
3455**Description**
3456
3457Sets the key code value for a key event.
3458
3459**System capability**: SystemCapability.MultimodalInput.Input.Core
3460
3461**Since**: 12
3462
3463**Parameters**
3464
3465| Name| Description|
3466| -------- | -------- |
3467| keyEvent | Key event object. |
3468| keyCode | Key value. |
3469
3470
3471### OH_Input_SetKeyEventWindowId()
3472
3473```
3474void OH_Input_SetKeyEventWindowId (struct Input_KeyEvent * keyEvent, int32_t windowId )
3475```
3476**Description**
3477
3478Sets the window ID of a key event.
3479
3480**System capability**: SystemCapability.MultimodalInput.Input.Core
3481
3482**Since**: 15
3483
3484**Parameters**
3485
3486| Name| Description|
3487| -------- | -------- |
3488| keyEvent | Key event object. |
3489| windowId | Window ID of the key event. |
3490
3491
3492### OH_Input_SetKeyPressed()
3493
3494```
3495void OH_Input_SetKeyPressed (struct Input_KeyState * keyState, int32_t keyAction )
3496```
3497**Description**
3498
3499Sets whether the key specific to a key status enum object is pressed.
3500
3501**System capability**: SystemCapability.MultimodalInput.Input.Core
3502
3503**Since**: 12
3504
3505**Parameters**
3506
3507| Name| Description|
3508| -------- | -------- |
3509| keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).|
3510| keyAction | Whether a key is pressed. For details, see [Input_KeyEventAction](#input_keyeventaction).|
3511
3512
3513### OH_Input_SetKeySwitch()
3514
3515```
3516void OH_Input_SetKeySwitch (struct Input_KeyState * keyState, int32_t keySwitch )
3517```
3518**Description**
3519
3520Sets the key switch of the key status enum object.
3521
3522**System capability**: SystemCapability.MultimodalInput.Input.Core
3523
3524**Since**: 12
3525
3526**Parameters**
3527
3528| Name| Description|
3529| -------- | -------- |
3530| keyState | Key status enum object. For details, see [Input_KeyStateAction](#input_keystateaction).|
3531| keySwitch | Key switch. |
3532
3533
3534### OH_Input_SetMouseEventAction()
3535
3536```
3537void OH_Input_SetMouseEventAction (struct Input_MouseEvent * mouseEvent, int32_t action )
3538```
3539**Description**
3540
3541Sets the action for a mouse event.
3542
3543**System capability**: SystemCapability.MultimodalInput.Input.Core
3544
3545**Since**: 12
3546
3547**Parameters**
3548
3549| Name| Description|
3550| -------- | -------- |
3551| mouseEvent | Mouse event object. |
3552| action | Mouse action. |
3553
3554
3555### OH_Input_SetMouseEventActionTime()
3556
3557```
3558void OH_Input_SetMouseEventActionTime (struct Input_MouseEvent * mouseEvent, int64_t actionTime )
3559```
3560**Description**
3561
3562Sets the time when a mouse event occurs.
3563
3564**System capability**: SystemCapability.MultimodalInput.Input.Core
3565
3566**Since**: 12
3567
3568**Parameters**
3569
3570| Name| Description|
3571| -------- | -------- |
3572| mouseEvent | Mouse event object. |
3573| actionTime | Time when a mouse event occurs. |
3574
3575
3576### OH_Input_SetMouseEventAxisType()
3577
3578```
3579void OH_Input_SetMouseEventAxisType (struct Input_MouseEvent * mouseEvent, int32_t axisType )
3580```
3581**Description**
3582
3583Sets the axis type for a mouse event.
3584
3585**System capability**: SystemCapability.MultimodalInput.Input.Core
3586
3587**Since**: 12
3588
3589**Parameters**
3590
3591| Name| Description|
3592| -------- | -------- |
3593| mouseEvent | Mouse event object.|
3594| axisType | Axis type, for example, X axis or Y axis. |
3595
3596
3597### OH_Input_SetMouseEventAxisValue()
3598
3599```
3600void OH_Input_SetMouseEventAxisValue (struct Input_MouseEvent * mouseEvent, float axisValue )
3601```
3602**Description**
3603
3604Sets the axis value for a mouse axis event.
3605
3606**System capability**: SystemCapability.MultimodalInput.Input.Core
3607
3608**Since**: 12
3609
3610**Parameters**
3611
3612| Name| Description|
3613| -------- | -------- |
3614| mouseEvent | Mouse event object. |
3615| axisValue | Axis value. A positive value means scrolling forward, and a negative number means scrolling backward. |
3616
3617
3618### OH_Input_SetMouseEventButton()
3619
3620```
3621void OH_Input_SetMouseEventButton (struct Input_MouseEvent * mouseEvent, int32_t button )
3622```
3623**Description**
3624
3625Sets the button for a mouse event.
3626
3627**System capability**: SystemCapability.MultimodalInput.Input.Core
3628
3629**Since**: 12
3630
3631**Parameters**
3632
3633| Name| Description|
3634| -------- | -------- |
3635| mouseEvent | Mouse event object. |
3636| button | Enumerates mouse buttons. |
3637
3638
3639### OH_Input_SetMouseEventDisplayId()
3640
3641```
3642void OH_Input_SetMouseEventDisplayId (struct Input_MouseEvent * mouseEvent, int32_t displayId )
3643```
3644**Description**
3645
3646Sets the screen ID of a mouse event.
3647
3648**System capability**: SystemCapability.MultimodalInput.Input.Core
3649
3650**Since**: 15
3651
3652**Parameters**
3653
3654| Name| Description|
3655| -------- | -------- |
3656| mouseEvent | Mouse event object. |
3657| displayId | Screen ID of the mouse event. |
3658
3659
3660### OH_Input_SetMouseEventDisplayX()
3661
3662```
3663void OH_Input_SetMouseEventDisplayX (struct Input_MouseEvent * mouseEvent, int32_t displayX )
3664```
3665**Description**
3666
3667Sets the X coordinate for a mouse event.
3668
3669**System capability**: SystemCapability.MultimodalInput.Input.Core
3670
3671**Since**: 12
3672
3673**Parameters**
3674
3675| Name| Description|
3676| -------- | -------- |
3677| mouseEvent | Mouse event object. |
3678| displayX | X coordinate on the screen. |
3679
3680
3681### OH_Input_SetMouseEventDisplayY()
3682
3683```
3684void OH_Input_SetMouseEventDisplayY (struct Input_MouseEvent * mouseEvent, int32_t displayY )
3685```
3686**Description**
3687
3688Sets the Y coordinate for a mouse event.
3689
3690**System capability**: SystemCapability.MultimodalInput.Input.Core
3691
3692**Since**: 12
3693
3694**Parameters**
3695
3696| Name| Description|
3697| -------- | -------- |
3698| mouseEvent | Mouse event object. |
3699| displayY | Y coordinate on the screen. |
3700
3701
3702### OH_Input_SetMouseEventWindowId()
3703
3704```
3705void OH_Input_SetMouseEventWindowId (struct Input_MouseEvent * mouseEvent, int32_t windowId )
3706```
3707**Description**
3708
3709Sets the window ID of a mouse event.
3710
3711**System capability**: SystemCapability.MultimodalInput.Input.Core
3712
3713**Since**: 15
3714
3715**Parameters**
3716
3717| Name| Description|
3718| -------- | -------- |
3719| mouseEvent | Mouse event object. |
3720| windowId | Window ID of the mouse event. |
3721
3722
3723### OH_Input_SetPreKeys()
3724
3725```
3726void OH_Input_SetPreKeys (Input_Hotkey * hotkey, int32_t * preKeys, int32_t size )
3727```
3728**Description**
3729
3730Sets the modifier keys.
3731
3732**System capability**: SystemCapability.MultimodalInput.Input.Core
3733
3734**Since**: 14
3735
3736**Parameters**
3737
3738| Name| Description|
3739| -------- | -------- |
3740| hotkey | Shortcut key object. |
3741| preKeys | List of modifier keys. |
3742| size | Number of modifier keys. One or two modifier keys are supported. |
3743
3744
3745### OH_Input_SetRepeat()
3746
3747```
3748void OH_Input_SetRepeat (Input_Hotkey * hotkey, bool isRepeat )
3749```
3750**Description**
3751
3752Specifies whether to report repeated key events.
3753
3754**System capability**: SystemCapability.MultimodalInput.Input.Core
3755
3756**Since**: 14
3757
3758**Parameters**
3759
3760| Name| Description|
3761| -------- | -------- |
3762| hotkey | Shortcut key object. |
3763| isRepeat | Whether to report repeated key events. The value **true** means to report repeated key events, and the value **false** means the opposite. |
3764
3765
3766### OH_Input_SetTouchEventAction()
3767
3768```
3769void OH_Input_SetTouchEventAction (struct Input_TouchEvent * touchEvent, int32_t action )
3770```
3771**Description**
3772
3773Sets the action for a touch event.
3774
3775**System capability**: SystemCapability.MultimodalInput.Input.Core
3776
3777**Since**: 12
3778
3779**Parameters**
3780
3781| Name| Description|
3782| -------- | -------- |
3783| touchEvent | Touch event object. |
3784|  action| Action of the touch event.|
3785
3786
3787### OH_Input_SetTouchEventActionTime()
3788
3789```
3790void OH_Input_SetTouchEventActionTime (struct Input_TouchEvent * touchEvent, int64_t actionTime )
3791```
3792**Description**
3793
3794Sets the time when a touch event occurs.
3795
3796**System capability**: SystemCapability.MultimodalInput.Input.Core
3797
3798**Since**: 12
3799
3800**Parameters**
3801
3802| Name| Description|
3803| -------- | -------- |
3804| keyEvent | Touch event object.|
3805| actionTime | Time when a touch event occurs. |
3806
3807
3808### OH_Input_SetTouchEventDisplayId()
3809
3810```
3811void OH_Input_SetTouchEventDisplayId (struct Input_TouchEvent * touchEvent, int32_t displayId )
3812```
3813**Description**
3814
3815Sets the screen ID of a touchscreen event.
3816
3817**System capability**: SystemCapability.MultimodalInput.Input.Core
3818
3819**Since**: 15
3820
3821**Parameters**
3822
3823| Name| Description|
3824| -------- | -------- |
3825| touchEvent | Touch event object. |
3826| displayId | Screen ID of the touchscreen event. |
3827
3828
3829### OH_Input_SetTouchEventDisplayX()
3830
3831```
3832void OH_Input_SetTouchEventDisplayX (struct Input_TouchEvent * touchEvent, int32_t displayX )
3833```
3834**Description**
3835
3836Sets the X coordinate for a touch event.
3837
3838**System capability**: SystemCapability.MultimodalInput.Input.Core
3839
3840**Since**: 12
3841
3842**Parameters**
3843
3844| Name| Description|
3845| -------- | -------- |
3846| touchEvent | Touch event object. |
3847|   displayX| X coordinate on the touchscreen.|
3848
3849
3850### OH_Input_SetTouchEventDisplayY()
3851
3852```
3853void OH_Input_SetTouchEventDisplayY (struct Input_TouchEvent * touchEvent, int32_t displayY )
3854```
3855**Description**
3856
3857Sets the Y coordinate for a touch event.
3858
3859**System capability**: SystemCapability.MultimodalInput.Input.Core
3860
3861**Since**: 12
3862
3863**Parameters**
3864
3865| Name| Description|
3866| -------- | -------- |
3867| touchEvent | Touch event object. |
3868|  displayY | Y coordinate on the touchscreen.|
3869
3870
3871### OH_Input_SetTouchEventFingerId()
3872
3873```
3874void OH_Input_SetTouchEventFingerId (struct Input_TouchEvent * touchEvent, int32_t id )
3875```
3876**Description**
3877
3878Sets the finger ID for a touch event.
3879
3880**System capability**: SystemCapability.MultimodalInput.Input.Core
3881
3882**Since**: 12
3883
3884**Parameters**
3885
3886| Name| Description|
3887| -------- | -------- |
3888| touchEvent | Touch event object.|
3889| id | Finger ID of a touch event.|
3890
3891
3892### OH_Input_SetTouchEventWindowId()
3893
3894```
3895void OH_Input_SetTouchEventWindowId (struct Input_TouchEvent * touchEvent, int32_t windowId )
3896```
3897**Description**
3898
3899Sets the window ID of a touchscreen event.
3900
3901**System capability**: SystemCapability.MultimodalInput.Input.Core
3902
3903**Since**: 15
3904
3905**Parameters**
3906
3907| Name| Description|
3908| -------- | -------- |
3909| touchEvent | Touch event object. |
3910| windowId | Window ID of the touchscreen event. |
3911
3912
3913### OH_Input_UnregisterDeviceListener()
3914
3915```
3916Input_Result OH_Input_UnregisterDeviceListener (Input_DeviceListener * listener)
3917```
3918**Description**
3919
3920Unregisters the listener for device hot swap events.
3921
3922**System capability**: SystemCapability.MultimodalInput.Input.Core
3923
3924**Since**: 13
3925
3926**Parameters**
3927
3928| Name| Description|
3929| -------- | -------- |
3930| listener | Pointer to the [Input_DeviceListener](_input___device_listener.md) object. |
3931
3932**Returns**
3933
3934**OH_Input_UnregisterDeviceListener** status code, specifically:
3935
3936**INPUT_SUCCESS** if the operation is successful;
3937
3938**INPUT_PARAMETER_ERROR** if **listener** is **NULL** or the listener is not registered;
3939
3940**INPUT_SERVICE_EXCEPTION** if the service is abnormal.
3941
3942
3943### OH_Input_UnregisterDeviceListeners()
3944
3945```
3946Input_Result OH_Input_UnregisterDeviceListeners ()
3947```
3948**Description**
3949
3950Unregisters the listener for all device hot swap events.
3951
3952**System capability**: SystemCapability.MultimodalInput.Input.Core
3953
3954**Since**: 13
3955
3956**Returns**
3957
3958**OH_Input_UnregisterDeviceListener** status code, specifically:
3959
3960**INPUT_SUCCESS** if the operation is successful; **INPUT_SERVICE_EXCEPTION** if the service is abnormal.
3961
3962### OH_Input_GetFunctionKeyState()
3963
3964```
3965Input_Result OH_Input_GetFunctionKeyState(int32_t keyCode, int32_t *state)
3966```
3967**Description**
3968
3969Obtains the function key status.
3970
3971**System capability**: SystemCapability.MultimodalInput.Input.Core
3972
3973**Since**: 15
3974
3975**Parameters**
3976
3977| Name| Description|
3978| -------- | -------- |
3979| keyCode | Function key. Only the **CapsLock** key is supported. |
3980| state | Function key status. The value **0** indicates that the function key is disabled, and the value **1** indicates that the function key is enabled. |
3981
3982**Returns**
3983
3984**OH_Input_GetFunctionKeyState** status code, specifically:
3985
3986 **INPUT_SUCCESS** if the operation is successful;
3987
3988 **INPUT_PARAMETER_ERROR** if the parameter is incorrect;
3989
3990 **INPUT_DEVICE_NOT_EXIST** if the keyboard does not exist.
3991