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