Available on crate feature
api-12 only.Expand description
Provides functions such as event injection and status query.
System capability: SystemCapability.MultimodalInput.Input.Core
Structs§
- Input
Error Code - Enumerates error codes.
- Input
Event_ Mouse Axis - Mouse axis types.
- Input
Event_ Source Type - Enumerates event source types.
- Input_
Device Info api-13 - Represents information about the input device.
- Input_
Device Listener api-13 - Defines a listener for device insertion and removal events.
- Input_
Injection Status api-20 - Enumerates the injection authorization status.
- Input_
Interceptor Event Callback - Defines the structure for the interceptor of event callbacks, including mouseCallback, touchCallback, and axisCallback.
- Input_
Interceptor Options - Defines event interceptor options.
- Input_
KeyEvent Action - Enumerates key event types.
- Input_
KeyState Action - Enumerated values of key event action.
- Input_
Keyboard Type api-13 - Enumerates keyboard types.
- Input_
Mouse Event Action - Enumerated values of mouse event action.
- Input_
Mouse Event Button - Enumerated values of mouse event button.
- Input_
Touch Event Action - Enumerated values of touch event action.
Functions§
- OH_
Input_ ⚠AddAxis Event Monitor - Adds a listener for the specified type of axis events.
- OH_
Input_ ⚠AddAxis Event Monitor ForAll - Adds a listener for all types of axis events.
The axis event types are defined in
InputEvent_AxisEventType. - OH_
Input_ ⚠AddHotkey Monitor api-14 - Subscribes to shortcut key events.
- OH_
Input_ ⚠AddInput Event Interceptor - Adds an interceptor for input events, including mouse, touch, and axis events. If multiple interceptors are added, only the first one takes effect.
- OH_
Input_ ⚠AddKey Event Hook api-21 - Add a keyEvent interception hook function. Before using this interface, the user needs to authorize it in the settings.
- OH_
Input_ ⚠AddKey Event Interceptor - Adds a key event interceptor. If multiple interceptors are added, only the first one takes effect.
- OH_
Input_ ⚠AddKey Event Monitor - Adds a listener of key events.
- OH_
Input_ ⚠AddMouse Event Monitor - Adds a listener for mouse events, including mouse click and movement events, but not scroll wheel events. Scroll wheel events are axis events.
- OH_
Input_ ⚠AddTouch Event Monitor - Add a listener for touch events.
- OH_
Input_ ⚠Cancel Injection - Cancels event injection and revokes authorization.
- OH_
Input_ ⚠Create AllSystem Hotkeys api-14 - Creates an array of
Input_Hotkeyinstances. - OH_
Input_ ⚠Create Axis Event - Creates an axis event object.
- OH_
Input_ ⚠Create Device Info api-13 - Creates a deviceInfo object.
- OH_
Input_ ⚠Create Hotkey api-14 - Creates a hot key object.
- OH_
Input_ ⚠Create KeyEvent - Creates a key event object.
- OH_
Input_ ⚠Create KeyState - Creates a key status enumeration object.
- OH_
Input_ ⚠Create Mouse Event - Creates a mouse event object.
- OH_
Input_ ⚠Create Touch Event - Creates a touch event object.
- OH_
Input_ ⚠Destroy AllSystem Hotkeys api-14 - Destroys an array of
Input_Hotkeyinstances and reclaims memory. - OH_
Input_ ⚠Destroy Axis Event - Destroys an axis event object.
- OH_
Input_ ⚠Destroy Device Info api-13 - Destroys a deviceInfo object.
- OH_
Input_ ⚠Destroy Hotkey api-14 - Destroys a hot key object.
- OH_
Input_ ⚠Destroy KeyEvent - Destroys a key event object.
- OH_
Input_ ⚠Destroy KeyState - Destroys a key status enumeration object.
- OH_
Input_ ⚠Destroy Mouse Event - Destroys a mouse event object.
- OH_
Input_ ⚠Destroy Touch Event - Destroys a touch event object.
- OH_
Input_ ⚠Dispatch ToNext Handler api-21 - Redispatches keyEvent. Only keyEvent intercepted by hook functions can be redispatched, and the event order must be maintained during redispatching. The hook function intercepts the input event and then redistributes it for 3 seconds. If this time is exceeded, calling this function will return INPUT_PARAMETER_ERROR. Re-dispatching requires event pairing, usually starting with one or more KEY_ACTION_DOWN and ending with KEY_ACTION_UP or KEY_ACTION_CANCEL. Only KEY_ACTION_UP or KEY_ACTION_CANCEL is redispatched, the function call succeeds, but no actual dispatch is made. If an event is dispatched that is not intercepted by the hook function, the function call succeeds, but no actual dispatch action is taken.
- OH_
Input_ ⚠GetAll System Hotkeys api-14 - Obtains all hot keys supported by the system.
- OH_
Input_ ⚠GetAxis Event Action - Obtains the axis event action.
- OH_
Input_ ⚠GetAxis Event Action Time - Obtains the time when an axis event occurs.
- OH_
Input_ ⚠GetAxis Event Axis Value - Obtains the axis value for the specified axis type of the axis event.
- OH_
Input_ ⚠GetAxis Event Display Id api-15 - Obtains the displayId of an axis event.
- OH_
Input_ ⚠GetAxis Event DisplayX - Obtains the X coordinate of an axis event.
- OH_
Input_ ⚠GetAxis Event DisplayY - Obtains the Y coordinate of an axis event.
- OH_
Input_ ⚠GetAxis Event GlobalX api-20 - Queries the global X coordinate of the axis event.
- OH_
Input_ ⚠GetAxis Event GlobalY api-20 - Queries the global Y coordinate of the axis event.
- OH_
Input_ ⚠GetAxis Event Source Type - Obtains the axis event source type.
- OH_
Input_ ⚠GetAxis Event Type - Obtains the axis event type.
- OH_
Input_ ⚠GetAxis Event Window Id api-15 - Obtains the windowId of an axis event.
- OH_
Input_ ⚠GetCapabilities api-13 - Obtains the capabilities of an input device, for example, a touchscreen, touchpad, or keyboard.
- OH_
Input_ ⚠GetDevice api-13 - Obtains the information about an input device.
- OH_
Input_ ⚠GetDevice Address api-13 - Obtains the physical address of an input device.
- OH_
Input_ ⚠GetDevice Id api-13 - Obtains the ID of an input device.
- OH_
Input_ ⚠GetDevice Ids api-13 - Obtains the IDs of all input devices.
- OH_
Input_ ⚠GetDevice Name api-13 - Obtains the name of an input device.
- OH_
Input_ ⚠GetDevice Product api-13 - Obtains the product information of an input device.
- OH_
Input_ ⚠GetDevice Vendor api-13 - Obtains the vendor information of an input device.
- OH_
Input_ ⚠GetDevice Version api-13 - Obtains the version information of an input device.
- OH_
Input_ ⚠GetFinal Key api-14 - Obtains a modified key.
- OH_
Input_ ⚠GetFunction KeyState api-15 - Obtains the function key status.
- OH_
Input_ ⚠GetInterval Since Last Input api-14 - Obtains the interval since the last system input event.
- OH_
Input_ ⚠GetKey Code - Obtains the key value of a key status enumeration object.
- OH_
Input_ ⚠GetKey Event Action - Obtains the key event type.
- OH_
Input_ ⚠GetKey Event Action Time - Obtains the time when a key event occurs.
- OH_
Input_ ⚠GetKey Event Display Id api-15 - Obtains the displayId of a key event.
- OH_
Input_ ⚠GetKey Event Id api-21 - Get the eventId of the keyEvent.
- OH_
Input_ ⚠GetKey Event KeyCode - Obtains the key value of a key event.
- OH_
Input_ ⚠GetKey Event Window Id api-15 - Obtains the windowId of a key event.
- OH_
Input_ ⚠GetKey Pressed - Checks whether the key specific to a key status enumeration object is pressed.
- OH_
Input_ ⚠GetKey State - Queries the key state.
- OH_
Input_ ⚠GetKey Switch - Obtains the key switch of the key status enumeration object.
- OH_
Input_ ⚠GetKeyboard Type api-13 - Obtains the keyboard type of an input device.
- OH_
Input_ ⚠GetMouse Event Action - Obtains the action of a mouse event.
- OH_
Input_ ⚠GetMouse Event Action Time - Obtains the time when a mouse event occurs.
- OH_
Input_ ⚠GetMouse Event Axis Type - Obtains the axis type of a mouse event.
- OH_
Input_ ⚠GetMouse Event Axis Value - Obtains the axis value of a mouse event.
- OH_
Input_ ⚠GetMouse Event Button - Obtains the button of a mouse event.
- OH_
Input_ ⚠GetMouse Event Display Id api-15 - Obtains the displayId of a mouse event.
- OH_
Input_ ⚠GetMouse Event DisplayX - Obtains the X coordinate of a mouse event.
- OH_
Input_ ⚠GetMouse Event DisplayY - Obtains the Y coordinate of a mouse event.
- OH_
Input_ ⚠GetMouse Event GlobalX api-20 - Queries the global X coordinate of the mouse event.
- OH_
Input_ ⚠GetMouse Event GlobalY api-20 - Queries the global Y coordinate of the mouse event.
- OH_
Input_ ⚠GetMouse Event Window Id api-15 - Obtains the windowId of a mouse event.
- OH_
Input_ ⚠GetPointer Location api-20 - Get pointer location.
- OH_
Input_ ⚠GetPre Keys api-14 - Obtains a modifier key.
- OH_
Input_ ⚠GetRepeat api-14 - Checks whether to report repeated key events.
- OH_
Input_ ⚠GetTouch Event Action - Obtains the action of a touch event.
- OH_
Input_ ⚠GetTouch Event Action Time - Obtains the time when a touch event occurs.
- OH_
Input_ ⚠GetTouch Event Display Id api-15 - Obtains the displayId of a touch event.
- OH_
Input_ ⚠GetTouch Event DisplayX - Obtains the X coordinate of a touch event.
- OH_
Input_ ⚠GetTouch Event DisplayY - Obtains the Y coordinate of a touch event.
- OH_
Input_ ⚠GetTouch Event Finger Id - Obtains the finger ID of a touch event.
- OH_
Input_ ⚠GetTouch Event GlobalX api-20 - Queries the global X coordinate of the touch event.
- OH_
Input_ ⚠GetTouch Event GlobalY api-20 - Queries the global Y coordinate of the touch event.
- OH_
Input_ ⚠GetTouch Event Window Id api-15 - Obtains the windowId of a touch event.
- OH_
Input_ ⚠Inject KeyEvent - Inject system keys. since API 20, it is recommended to use OH_Input_RequestInjection to request authorization before using the interface, and then use OH_Input_QueryAuthorizedStatus to query the authorization status. When the authorization status is AUTHORIZED, use the interface.
- OH_
Input_ ⚠Inject Mouse Event - Inject mouse event. since API 20, it is recommended to use OH_Input_RequestInjection to request authorization before using the interface, and then use OH_Input_QueryAuthorizedStatus to query the authorization status. When the authorization status is AUTHORIZED, use the interface.
- OH_
Input_ ⚠Inject Mouse Event Global api-20 - Inject mouse event using global coordinate. since API 20, it is recommended to use OH_Input_RequestInjection to request authorization before using the interface, and then use OH_Input_QueryAuthorizedStatus to query the authorization status. When the authorization status is AUTHORIZED, use the interface.
- OH_
Input_ ⚠Inject Touch Event - Inject touch event. since API 20, it is recommended to use OH_Input_RequestInjection to request authorization before using the interface, and then use OH_Input_QueryAuthorizedStatus to query the authorization status. When the authorization status is AUTHORIZED, use the interface.
- OH_
Input_ ⚠Inject Touch Event Global api-20 - Inject touch event using global coordinate. since API 20, it is recommended to use OH_Input_RequestInjection to request authorization before using the interface, and then use OH_Input_QueryAuthorizedStatus to query the authorization status. When the authorization status is AUTHORIZED, use the interface.
- OH_
Input_ ⚠Query Authorized Status api-20 - Queries the injection authorization status.
- OH_
Input_ ⚠Query MaxTouch Points api-20 - Queries the maximum number of touch points supported by the current device. If -1 is returned, the number is unknown.
- OH_
Input_ ⚠Register Device Listener api-13 - Registers a listener for device hot swap events.
- OH_
Input_ ⚠Remove Axis Event Monitor - Removes the listener for the specified type of axis events.
- OH_
Input_ ⚠Remove Axis Event Monitor ForAll - Removes the listener for all types of axis events.
- OH_
Input_ ⚠Remove Hotkey Monitor api-14 - Unsubscribes from shortcut key events.
- OH_
Input_ ⚠Remove Input Event Interceptor - Removes an interceptor for input events, including mouse, touch, and axis events.
- OH_
Input_ ⚠Remove KeyEvent Hook api-21 - Remove keyEvent interception hook function.
- OH_
Input_ ⚠Remove KeyEvent Interceptor - Removes a key event interceptor.
- OH_
Input_ ⚠Remove KeyEvent Monitor - Removes a key event listener.
- OH_
Input_ ⚠Remove Mouse Event Monitor - Removes a mouse event listener.
- OH_
Input_ ⚠Remove Touch Event Monitor - Removes a touch event listener.
- OH_
Input_ ⚠Request Injection api-20 - Requests for injection authorization.
- OH_
Input_ ⚠SetAxis Event Action - Sets the axis event action.
- OH_
Input_ ⚠SetAxis Event Action Time - Sets the time when an axis event occurs.
- OH_
Input_ ⚠SetAxis Event Axis Value - Sets the axis value of the axis type specified by the axis event.
- OH_
Input_ ⚠SetAxis Event Display Id api-15 - Sets the displayId of an axis event.
- OH_
Input_ ⚠SetAxis Event DisplayX - Sets the X coordinate of an axis event.
- OH_
Input_ ⚠SetAxis Event DisplayY - Sets the Y coordinate of an axis event.
- OH_
Input_ ⚠SetAxis Event GlobalX api-20 - Set the global X coordinate of the axis event.
- OH_
Input_ ⚠SetAxis Event GlobalY api-20 - Set the global Y coordinate of the axis event.
- OH_
Input_ ⚠SetAxis Event Source Type - Sets the axis event source type.
- OH_
Input_ ⚠SetAxis Event Type - Sets the axis event type.
- OH_
Input_ ⚠SetAxis Event Window Id api-15 - Sets the windowId of an axis event.
- OH_
Input_ ⚠SetFinal Key api-14 - Sets a modified key.
- OH_
Input_ ⚠SetKey Code - Sets the key value of a key status enumeration object.
- OH_
Input_ ⚠SetKey Event Action - Sets the key event type.
- OH_
Input_ ⚠SetKey Event Action Time - Sets the time when a key event occurs.
- OH_
Input_ ⚠SetKey Event Display Id api-15 - Sets the displayId for a key event.
- OH_
Input_ ⚠SetKey Event KeyCode - Sets the key value for a key event.
- OH_
Input_ ⚠SetKey Event Window Id api-15 - Sets the windowId for a key event.
- OH_
Input_ ⚠SetKey Pressed - Sets whether the key specific to a key status enumeration object is pressed.
- OH_
Input_ ⚠SetKey Switch - Sets the key switch of the key status enumeration object.
- OH_
Input_ ⚠SetMouse Event Action - Sets the action for a mouse event.
- OH_
Input_ ⚠SetMouse Event Action Time - Sets the time when a mouse event occurs.
- OH_
Input_ ⚠SetMouse Event Axis Type - Sets the axis type for mouse event.
- OH_
Input_ ⚠SetMouse Event Axis Value - Sets the axis value for a mouse axis event.
- OH_
Input_ ⚠SetMouse Event Button - Sets the button for a mouse event.
- OH_
Input_ ⚠SetMouse Event Display Id api-15 - Sets the displayId for a mouse event.
- OH_
Input_ ⚠SetMouse Event DisplayX - Sets the X coordinate for a mouse event.
- OH_
Input_ ⚠SetMouse Event DisplayY - Sets the Y coordinate for a mouse event.
- OH_
Input_ ⚠SetMouse Event GlobalX api-20 - Set the global X coordinate of the mouse event.
- OH_
Input_ ⚠SetMouse Event GlobalY api-20 - Set the global Y coordinate of the mouse event.
- OH_
Input_ ⚠SetMouse Event Window Id api-15 - Sets the windowId for a mouse event.
- OH_
Input_ ⚠SetPre Keys api-14 - Sets a modifier key.
- OH_
Input_ ⚠SetRepeat api-14 - Specifies whether to report repeated key events.
- OH_
Input_ ⚠SetTouch Event Action - Sets the action for a touch event.
- OH_
Input_ ⚠SetTouch Event Action Time - Sets the time when a touch event occurs.
- OH_
Input_ ⚠SetTouch Event Display Id api-15 - Sets the displayId for a touch event.
- OH_
Input_ ⚠SetTouch Event DisplayX - Sets the X coordinate for a touch event.
- OH_
Input_ ⚠SetTouch Event DisplayY - Sets the Y coordinate for a touch event.
- OH_
Input_ ⚠SetTouch Event Finger Id - Sets the finger ID for the touch event.
- OH_
Input_ ⚠SetTouch Event GlobalX api-20 - Set the global X coordinate of the touch event.
- OH_
Input_ ⚠SetTouch Event GlobalY api-20 - Set the global Y coordinate of the touch event.
- OH_
Input_ ⚠SetTouch Event Window Id api-15 - Sets the windowId for a touch event.
- OH_
Input_ ⚠Unregister Device Listener api-13 - Unregisters the listener for device hot swap events.
- OH_
Input_ ⚠Unregister Device Listeners api-13 - Unregisters the listener for all device hot swap events.
Type Aliases§
- Input_
Axis Event Callback - Defines a lifecycle callback for axisEvent. If the callback is triggered, axisEvent will be destroyed.
- Input_
Device Added Callback api-13 - Defines the callback for device addition events.
- Input_
Device Removed Callback api-13 - Defines the callback for device removal events.
- Input_
Hotkey Callback api-14 - Callback used to return shortcut key events.
- Input_
Inject Authorize Callback api-20 - Defines the event injection callback.
- Input_
KeyEvent Callback - Defines a lifecycle callback for keyEvent. If the callback is triggered, keyEvent will be destroyed.
- Input_
Mouse Event Callback - Defines a lifecycle callback for mouseEvent. If the callback is triggered, mouseEvent will be destroyed.
- Input_
Result - Input_
Touch Event Callback - Defines a lifecycle callback for touchEvent. If the callback is triggered, touchEvent will be destroyed.