From a44bfec6e25f9f0c630f225158cfb52ad247e957 Mon Sep 17 00:00:00 2001 From: KangPeng Date: Thu, 4 Sep 2025 09:24:51 +0800 Subject: [PATCH] inputDeviceCooperate api update Signed-off-by: KangPeng --- ....multimodalInput.inputDeviceCooperate.d.ts | 118 ++++++++++++++---- 1 file changed, 95 insertions(+), 23 deletions(-) diff --git a/api/@ohos.multimodalInput.inputDeviceCooperate.d.ts b/api/@ohos.multimodalInput.inputDeviceCooperate.d.ts index c302bdac7e..4766122229 100644 --- a/api/@ohos.multimodalInput.inputDeviceCooperate.d.ts +++ b/api/@ohos.multimodalInput.inputDeviceCooperate.d.ts @@ -25,7 +25,8 @@ import { AsyncCallback } from "./@ohos.base"; * * @namespace inputDeviceCooperate * @syscap SystemCapability.MultimodalInput.Input.Cooperator - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ @@ -36,7 +37,8 @@ declare namespace inputDeviceCooperate { * @enum { number } * @syscap SystemCapability.MultimodalInput.Input.Cooperator * @systemapi hide for inner use. - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ enum EventMsg { /** @@ -44,7 +46,8 @@ declare namespace inputDeviceCooperate { * * @syscap SystemCapability.MultimodalInput.Input.Cooperator * @systemapi hide for inner use - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ MSG_COOPERATE_INFO_START = 200, @@ -53,7 +56,8 @@ declare namespace inputDeviceCooperate { * * @syscap SystemCapability.MultimodalInput.Input.Cooperator * @systemapi hide for inner use - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ MSG_COOPERATE_INFO_SUCCESS = 201, @@ -62,7 +66,8 @@ declare namespace inputDeviceCooperate { * * @syscap SystemCapability.MultimodalInput.Input.Cooperator * @systemapi hide for inner use - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ MSG_COOPERATE_INFO_FAIL = 202, @@ -71,7 +76,8 @@ declare namespace inputDeviceCooperate { * * @syscap SystemCapability.MultimodalInput.Input.Cooperator * @systemapi hide for inner use - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ MSG_COOPERATE_STATE_ON = 500, @@ -80,7 +86,8 @@ declare namespace inputDeviceCooperate { * * @syscap SystemCapability.MultimodalInput.Input.Cooperator * @systemapi hide for inner use - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ MSG_COOPERATE_STATE_OFF = 501, } @@ -95,7 +102,8 @@ declare namespace inputDeviceCooperate { *
2. Incorrect parameter types; 3. Parameter verification failed. * @syscap SystemCapability.MultimodalInput.Input.Cooperator * @systemapi hide for inner use - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ /** * Specifies whether to enable screen hopping. @@ -108,7 +116,8 @@ declare namespace inputDeviceCooperate { *
2. Incorrect parameter types; 3. Parameter verification failed. * @syscap SystemCapability.MultimodalInput.Input.Cooperator * @systemapi hide for inner use - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ function enable(enable: boolean, callback: AsyncCallback): void; @@ -135,7 +144,8 @@ declare namespace inputDeviceCooperate { *
2. Incorrect parameter types; 3. Parameter verification failed. * @syscap SystemCapability.MultimodalInput.Input.Cooperator * @systemapi hide for inner use - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ function enable(enable: boolean): Promise; @@ -159,7 +169,7 @@ declare namespace inputDeviceCooperate { * This API uses an asynchronous callback to return the result. * * @param { string } sinkDeviceDescriptor Descriptor of the target device for screen hopping. - * @param { number } srcInputDeviceId ID of the target device for screen hopping. + * @param { int } srcInputDeviceId ID of the target device for screen hopping. * @param { AsyncCallback } callback Callback used to return the result. * @throws { BusinessError } 202 - Permission denied, non-system app called system api. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; @@ -168,9 +178,10 @@ declare namespace inputDeviceCooperate { * @throws { BusinessError } 4400002 - Screen hop failed. * @syscap SystemCapability.MultimodalInput.Input.Cooperator * @systemapi hide for inner use - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ - function start(sinkDeviceDescriptor: string, srcInputDeviceId: number, callback: AsyncCallback): void; + function start(sinkDeviceDescriptor: string, srcInputDeviceId: int, callback: AsyncCallback): void; /** * Starts screen hopping. @@ -192,7 +203,7 @@ declare namespace inputDeviceCooperate { * This API uses a promise to return the result. * * @param { string } sinkDeviceDescriptor Descriptor of the target device for screen hopping. - * @param { number } srcInputDeviceId ID of the target device for screen hopping. + * @param { int } srcInputDeviceId ID of the target device for screen hopping. * @returns { Promise } Promise used to return the result. * @throws { BusinessError } 202 - Permission denied, non-system app called system api. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; @@ -201,9 +212,10 @@ declare namespace inputDeviceCooperate { * @throws { BusinessError } 4400002 - Screen hop failed. * @syscap SystemCapability.MultimodalInput.Input.Cooperator * @systemapi hide for inner use - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ - function start(sinkDeviceDescriptor: string, srcInputDeviceId: number): Promise; + function start(sinkDeviceDescriptor: string, srcInputDeviceId: int): Promise; /** * Stops screen hopping. @@ -226,7 +238,8 @@ declare namespace inputDeviceCooperate { *
2. Incorrect parameter types; 3. Parameter verification failed. * @syscap SystemCapability.MultimodalInput.Input.Cooperator * @systemapi hide for inner use - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ function stop(callback: AsyncCallback): void; @@ -237,7 +250,8 @@ declare namespace inputDeviceCooperate { * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.MultimodalInput.Input.Cooperator * @systemapi hide for inner use - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ /** * Stops screen hopping. @@ -247,7 +261,8 @@ declare namespace inputDeviceCooperate { * @throws { BusinessError } 202 - Permission denied, non-system app called system api. * @syscap SystemCapability.MultimodalInput.Input.Cooperator * @systemapi hide for inner use - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ function stop(): Promise; @@ -274,9 +289,16 @@ declare namespace inputDeviceCooperate { *
2. Incorrect parameter types; 3. Parameter verification failed. * @syscap SystemCapability.MultimodalInput.Input.Cooperator * @systemapi hide for inner use - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ + /*** if arkts 1.1 */ function getState(deviceDescriptor: string, callback: AsyncCallback<{ state: boolean }>): void; + /*** endif */ + + /*** if arkts 1.2 */ + function getState(deviceDescriptor: string, callback: AsyncCallback): void; + /*** endif */ /** * Checks whether screen hopping is enabled. @@ -303,9 +325,51 @@ declare namespace inputDeviceCooperate { *
2. Incorrect parameter types; 3. Parameter verification failed. * @syscap SystemCapability.MultimodalInput.Input.Cooperator * @systemapi hide for inner use - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ + /*** if arkts 1.1 */ function getState(deviceDescriptor: string): Promise<{ state: boolean }>; + /*** endif */ + + /*** if arkts 1.2 */ + function getState(deviceDescriptor: string): Promise; + /*** endif */ + + +/*** if arkts 1.2 */ + /** + * Enumerates screen hopping event. + * + * @enum { number } + * @syscap SystemCapability.MultimodalInput.Input.Cooperator + * @systemapi hide for inner use. + * @since 20 + * @arkts 1.2 + */ + interface Coopinfo { + /** + * Enumerates screen hopping event. + * + * @enum { number } + * @syscap SystemCapability.MultimodalInput.Input.Cooperator + * @systemapi hide for inner use. + * @since 20 + * @arkts 1.2 + */ + deviceDescriptor: String; + /** + * Enumerates screen hopping event. + * + * @enum { number } + * @syscap SystemCapability.MultimodalInput.Input.Cooperator + * @systemapi hide for inner use. + * @since 20 + * @arkts 1.2 + */ + eventMsg: EventMsg; + } +/*** endif */ /** * Enables listening for screen hopping status change events. @@ -328,9 +392,16 @@ declare namespace inputDeviceCooperate { *
2. Incorrect parameter types; 3. Parameter verification failed. * @syscap SystemCapability.MultimodalInput.Input.Cooperator * @systemapi hide for inner use - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ + /*** if arkts 1.1 */ function on(type: 'cooperation', callback: AsyncCallback<{ deviceDescriptor: string, eventMsg: EventMsg }>): void; + /*** endif */ + + /*** if arkts 1.2 */ + function on(type: 'cooperation', callback: AsyncCallback): void; + /*** endif */ /** * Disables listening for screen hopping status change events. @@ -355,7 +426,8 @@ declare namespace inputDeviceCooperate { *
2. Incorrect parameter types; 3. Parameter verification failed. * @syscap SystemCapability.MultimodalInput.Input.Cooperator * @systemapi hide for inner use - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ function off(type: 'cooperation', callback?: AsyncCallback): void; -- Gitee