1# Multimodal Input Subsystem Changelog 2 3## cl.multimodalinput.1 Error Information Return Method Change 4 5The internal APIs of the following modules used service logic return values to indicate error information, which does not comply with the error code specifications of OpenHarmony. Therefore, they are modified in API version 9 and later. 6 - Input device management module (**@ohos.multimodalInput.inputDevice.d.ts**): third-party APIs 7 8 - Input consumer module (**@ohos.multimodalInput.inputConsumer.d.ts**): system APIs 9 10 - Screen hopping module (**@ohos.multimodalInput.inputDeviceCooperate.d.ts**): system APIs 11 12 - Key injection module (**@ohos.multimodalInput.inputEventClient.d.ts**): system APIs 13 14 - Input listening module (**@ohos.multimodalInput.inputMonitor.d.ts**): system APIs 15 16 - Mouse pointer module (**@ohos.multimodalInput.pointer.d.ts**): system APIs and third-party APIs 17 18Asynchronous APIs in the preceding modules have the following changes: A parameter check error is returned synchronously; a service logic error is returned via **AsyncCallback** or the **error** object of **Promise**. No change is made to synchronous APIs. 19 20**Change Impact** 21 22The application developed based on earlier versions needs to adapt the method for returning API error information. Otherwise, the original service logic will be affected. 23 24**Key API/Component Changes** 25 26 - supportKeys(deviceId: number, keys: Array<KeyCode>, callback: AsyncCallback<Array<boolean>>): void; 27 - supportKeys(deviceId: number, keys: Array<KeyCode>): Promise<Array<boolean>>; 28 - getKeyboardType(deviceId: number, callback: AsyncCallback<KeyboardType>): void; > 29 - getKeyboardType(deviceId: number): Promise<KeyboardType>; 30 - setPointerSpeed(speed: number, callback: AsyncCallback<void>): void; 31 - setPointerSpeed(speed: number): Promise<void>; 32 - getPointerSpeed(callback: AsyncCallback<number>): void; 33 - getPointerSpeed(): Promise<number>; 34 - setPointerStyle(windowId: number, pointerStyle: PointerStyle, callback: AsyncCallback<void>): void; 35 - setPointerStyle(windowId: number, pointerStyle: PointerStyle): Promise<void>; 36 - getPointerStyle(windowId: number, callback: AsyncCallback<PointerStyle>): void; 37 - getPointerStyle(windowId: number): Promise<PointerStyle>; 38 - setPointerVisible(visible: boolean, callback: AsyncCallback<void>): void; 39 - setPointerVisible(visible: boolean): Promise<void>; 40 - isPointerVisible(callback: AsyncCallback<boolean>): void; 41 - isPointerVisible(): Promise<boolean>; 42 - on(type:"touch", receiver:TouchEventReceiver):void; 43 - on(type:"mouse", receiver:Callback<MouseEvent>):void; 44 - off(type:"touch", receiver?:TouchEventReceiver):void; 45 - off(type:"mouse", receiver?:Callback<MouseEvent>):void; 46 - injectEvent({KeyEvent: KeyEvent}): void; 47 - enable(enable: boolean, callback: AsyncCallback<void>): void; 48 - enable(enable: boolean): Promise<void>; 49 - start(sinkDeviceDescriptor: string, srcInputDeviceId: number, callback: AsyncCallback<void>): void; 50 - start(sinkDeviceDescriptor: string, srcInputDeviceId: number): Promise<void>; 51 - stop(callback: AsyncCallback<void>): void; 52 - stop(): Promise<void>; 53 - getState(deviceDescriptor: string, callback: AsyncCallback<{ state: boolean }>): void; 54 - getState(deviceDescriptor: string): Promise<{ state: boolean }>; 55 - on(type: 'cooperation', callback: AsyncCallback<{ deviceDescriptor: string, eventMsg: EventMsg }>): void; 56 - off(type: 'cooperation', callback?: AsyncCallback<void>): void; 57 - on(type: "key", keyOptions: KeyOptions, callback: Callback<KeyOptions>): void; 58 - off(type: "key", keyOptions: KeyOptions, callback?: Callback<KeyOptions>): void; 59 60Deprecated APIs: 61 - getDeviceIds(callback: AsyncCallback<Array<number>>): void; 62 - getDeviceIds(): Promise<Array<number>>; 63 - getDevice(deviceId: number, callback: AsyncCallback<InputDeviceData>): void; 64 - getDevice(deviceId: number): Promise<InputDeviceData>; 65 66Substitute APIs: 67 - getDeviceList(callback: AsyncCallback<Array<number>>): void; 68 - getDeviceList(): Promise<Array<number>>; 69 - getDeviceInfo(deviceId: number, callback: AsyncCallback<InputDeviceData>): void; 70 - getDeviceInfo(deviceId: number): Promise<InputDeviceData>; 71 72Changed APIs: 73 74Before change: 75 - supportKeys(deviceId: number, keys: Array<KeyCode>, callback: Callback<Array<boolean>>): void; 76 - getKeyboardType(deviceId: number, callback: Callback<KeyboardType>): void; 77 78After change: 79 - supportKeys(deviceId: number, keys: Array<KeyCode>, callback: AsyncCallback<Array<boolean>>): void; 80 - getKeyboardType(deviceId: number, callback: AsyncCallback<KeyboardType>): void; 81 82**Adaptation Guide** 83 84The following uses **setPointerVisible** as an example: 85 86```ts 87import pointer from '@ohos.multimodalInput.pointer'; 88pointer.setPointerVisible(true, (error) => { 89 console.log(`Set pointer visible success`); 90 }); 91 92try { 93 pointer.setPointerVisible(true, (error) => { 94 if (error) { 95 console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 96 return; 97 } 98 console.log(`Set pointer visible success`); 99 }); 100} catch (error) { 101 console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 102} 103``` 104