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