From 8cc0ce9066c3a8f45fe319f0b3be6eef67a4ebf5 Mon Sep 17 00:00:00 2001 From: shaoziyun Date: Sat, 7 Oct 2023 07:54:51 +0000 Subject: [PATCH] Multimodalinput Add injection interface Signed-off-by: shaoziyun --- ...ohos.multimodalInput.inputEventClient.d.ts | 73 +++++++++++++++++- api/@ohos.multimodalInput.mouseEvent.d.ts | 76 ++++++++++++++++++- 2 files changed, 147 insertions(+), 2 deletions(-) diff --git a/api/@ohos.multimodalInput.inputEventClient.d.ts b/api/@ohos.multimodalInput.inputEventClient.d.ts index 155c194767..32db9bfd78 100644 --- a/api/@ohos.multimodalInput.inputEventClient.d.ts +++ b/api/@ohos.multimodalInput.inputEventClient.d.ts @@ -13,6 +13,8 @@ * limitations under the License. */ +import { MouseEvent } from './@ohos.multimodalInput.mouseEvent'; +import { TouchEvent } from './@ohos.multimodalInput.touchEvent'; /** * Global Key Event Injection * @@ -47,7 +49,14 @@ declare namespace inputEventClient { * @systemapi hide for inner use * @since 8 */ - keyCode: number; + /** + * A set of keyCode values for key. + * + * @syscap SystemCapability.MultimodalInput.Input.InputSimulator + * @systemapi hide for inner use + * @since 11 + */ + keyCode: Array; /** * Key hold duration. @@ -68,6 +77,44 @@ declare namespace inputEventClient { isIntercepted: boolean; } + /** + * Defines event of mouse that user want to inject. + * + * @interface KeyEvent + * @syscap SystemCapability.MultimodalInput.Input.InputSimulator + * @systemapi hide for inner use + * @since 11 + */ + interface MouseEventData { + /** + * Inject mouse event. + * + * @syscap SystemCapability.MultimodalInput.Input.InputSimulator + * @systemapi hide for inner use + * @since 11 + */ + mouseEvent: MouseEvent; + } + + /** + * Defines event of touch that user want to inject. + * + * @interface KeyEvent + * @syscap SystemCapability.MultimodalInput.Input.InputSimulator + * @systemapi hide for inner use + * @since 11 + */ + interface TouchEventData { + /** + * Inject touch event. + * + * @syscap SystemCapability.MultimodalInput.Input.InputSimulator + * @systemapi hide for inner use + * @since 11 + */ + touchEvent: TouchEvent; + } + /** * Inject system keys. * @@ -78,6 +125,30 @@ declare namespace inputEventClient { * @since 8 */ function injectEvent({ KeyEvent: KeyEvent }): void; + + /** + * Inject mouse event. + * + * @param { { MouseEvent } } MouseEvent - the mouse event to be injected. + * @throws { BusinessError } 202 - SystemAPI permission error. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.MultimodalInput.Input.InputSimulator + * @systemapi hide for inner use + * @since 11 + */ + function injectMouseEvent({ mouseEvent: MouseEventData }): void; + + /** + * Inject touch event. + * + * @param { { TouchEvent } } TouchEvent - the touch event to be injected. + * @throws { BusinessError } 202 - SystemAPI permission error. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.MultimodalInput.Input.InputSimulator + * @systemapi hide for inner use + * @since 11 + */ + function injectTouchEvent({ touchEvent: TouchEventData }): void; } export default inputEventClient; diff --git a/api/@ohos.multimodalInput.mouseEvent.d.ts b/api/@ohos.multimodalInput.mouseEvent.d.ts index 069bdea0d8..1b48157c23 100644 --- a/api/@ohos.multimodalInput.mouseEvent.d.ts +++ b/api/@ohos.multimodalInput.mouseEvent.d.ts @@ -78,7 +78,23 @@ export declare enum Action { * @syscap SystemCapability.MultimodalInput.Input.Core * @since 9 */ - AXIS_END = 6 + AXIS_END = 6, + + /** + * Indicates a pointer action representing that a finger is pressed on touchpad. + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ + ACTION_DOWN = 7, + + /** + * Indicates a pointer action representing that a finger leaves touchpad. + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ + ACTION_UP = 8, } /** @@ -212,6 +228,55 @@ export declare interface AxisValue { value: number; } +/** + * ToolType + * + * @enum { number } + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ +export declare enum ToolType { + /** + * Unknown type + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ + UNKNOWN = 0, + + /** + * Mouse + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ + MOUSE = 1, + + /** + * Touch screen + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ + TOUCHSCREEN = 2, + + /** + * Touch pad + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ + TOUCHPAD = 3, + + /** + * Joystick + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ + JOYSTICK = 4 +} + /** * MouseEvent * @@ -372,4 +437,13 @@ export declare interface MouseEvent extends InputEvent { * @since 9 */ scrollLock: boolean; + + /** + * Tool type + * + * @type { ToolType } + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ + toolType?: ToolType; } \ No newline at end of file -- Gitee