161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit InputKit 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport type { Callback, AsyncCallback } from './@ohos.base'; 2261847f8eSopenharmony_ciimport type { KeyCode } from './@ohos.multimodalInput.keyCode'; 2361847f8eSopenharmony_ci 2461847f8eSopenharmony_ci/** 2561847f8eSopenharmony_ci * The input device management module is configured to obtain an ID and device information of an input device. 2661847f8eSopenharmony_ci * 2761847f8eSopenharmony_ci * @namespace inputDevice 2861847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 2961847f8eSopenharmony_ci * @since 8 3061847f8eSopenharmony_ci */ 3161847f8eSopenharmony_cideclare namespace inputDevice { 3261847f8eSopenharmony_ci /** 3361847f8eSopenharmony_ci * Add or remove device 3461847f8eSopenharmony_ci * @typedef { 'add' | 'remove' } 3561847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 3661847f8eSopenharmony_ci * @since 9 3761847f8eSopenharmony_ci */ 3861847f8eSopenharmony_ci type ChangedType = 'add' | 'remove'; 3961847f8eSopenharmony_ci 4061847f8eSopenharmony_ci /** 4161847f8eSopenharmony_ci * The type of input device 4261847f8eSopenharmony_ci * @typedef { 'keyboard' | 'mouse' | 'touchpad' | 'touchscreen' | 'joystick' | 'trackball' } 4361847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 4461847f8eSopenharmony_ci * @since 9 4561847f8eSopenharmony_ci */ 4661847f8eSopenharmony_ci type SourceType = 'keyboard' | 'mouse' | 'touchpad' | 'touchscreen' | 'joystick' | 'trackball'; 4761847f8eSopenharmony_ci 4861847f8eSopenharmony_ci /** 4961847f8eSopenharmony_ci * Axis Type of the input event 5061847f8eSopenharmony_ci * @typedef { 'touchmajor'| 'touchminor' | 'orientation' | 'x' | 'y' | 'pressure' | 'toolminor' | 'toolmajor' | 'null' } 5161847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 5261847f8eSopenharmony_ci * @since 9 5361847f8eSopenharmony_ci */ 5461847f8eSopenharmony_ci type AxisType = 5561847f8eSopenharmony_ci 'touchmajor' 5661847f8eSopenharmony_ci | 'touchminor' 5761847f8eSopenharmony_ci | 'orientation' 5861847f8eSopenharmony_ci | 'x' 5961847f8eSopenharmony_ci | 'y' 6061847f8eSopenharmony_ci | 'pressure' 6161847f8eSopenharmony_ci | 'toolminor' 6261847f8eSopenharmony_ci | 'toolmajor' 6361847f8eSopenharmony_ci | 'null'; 6461847f8eSopenharmony_ci 6561847f8eSopenharmony_ci /** 6661847f8eSopenharmony_ci * @enum { number } 6761847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 6861847f8eSopenharmony_ci * @since 9 6961847f8eSopenharmony_ci */ 7061847f8eSopenharmony_ci enum KeyboardType { 7161847f8eSopenharmony_ci /** 7261847f8eSopenharmony_ci * None 7361847f8eSopenharmony_ci * 7461847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 7561847f8eSopenharmony_ci * @since 9 7661847f8eSopenharmony_ci */ 7761847f8eSopenharmony_ci NONE = 0, 7861847f8eSopenharmony_ci 7961847f8eSopenharmony_ci /** 8061847f8eSopenharmony_ci * Unknown key 8161847f8eSopenharmony_ci * 8261847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 8361847f8eSopenharmony_ci * @since 9 8461847f8eSopenharmony_ci */ 8561847f8eSopenharmony_ci UNKNOWN = 1, 8661847f8eSopenharmony_ci 8761847f8eSopenharmony_ci /** 8861847f8eSopenharmony_ci * Alphabetical keyboard 8961847f8eSopenharmony_ci * 9061847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 9161847f8eSopenharmony_ci * @since 9 9261847f8eSopenharmony_ci */ 9361847f8eSopenharmony_ci ALPHABETIC_KEYBOARD = 2, 9461847f8eSopenharmony_ci 9561847f8eSopenharmony_ci /** 9661847f8eSopenharmony_ci * Digital keyboard 9761847f8eSopenharmony_ci * 9861847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 9961847f8eSopenharmony_ci * @since 9 10061847f8eSopenharmony_ci */ 10161847f8eSopenharmony_ci DIGITAL_KEYBOARD = 3, 10261847f8eSopenharmony_ci 10361847f8eSopenharmony_ci /** 10461847f8eSopenharmony_ci * Stylus 10561847f8eSopenharmony_ci * 10661847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 10761847f8eSopenharmony_ci * @since 9 10861847f8eSopenharmony_ci */ 10961847f8eSopenharmony_ci HANDWRITING_PEN = 4, 11061847f8eSopenharmony_ci 11161847f8eSopenharmony_ci /** 11261847f8eSopenharmony_ci * Remote control 11361847f8eSopenharmony_ci * 11461847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 11561847f8eSopenharmony_ci * @since 9 11661847f8eSopenharmony_ci */ 11761847f8eSopenharmony_ci REMOTE_CONTROL = 5 11861847f8eSopenharmony_ci } 11961847f8eSopenharmony_ci 12061847f8eSopenharmony_ci /** 12161847f8eSopenharmony_ci * Defines the listener for input device events. 12261847f8eSopenharmony_ci * 12361847f8eSopenharmony_ci * @interface DeviceListener 12461847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 12561847f8eSopenharmony_ci * @since 9 12661847f8eSopenharmony_ci */ 12761847f8eSopenharmony_ci interface DeviceListener { 12861847f8eSopenharmony_ci /** 12961847f8eSopenharmony_ci * Type of the input device event. The options are add and remove. 13061847f8eSopenharmony_ci * 13161847f8eSopenharmony_ci * @type { ChangedType } 13261847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 13361847f8eSopenharmony_ci * @since 9 13461847f8eSopenharmony_ci */ 13561847f8eSopenharmony_ci type: ChangedType; 13661847f8eSopenharmony_ci 13761847f8eSopenharmony_ci /** 13861847f8eSopenharmony_ci * ID of the input device for the reported input device event. 13961847f8eSopenharmony_ci * 14061847f8eSopenharmony_ci * @type { number } 14161847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 14261847f8eSopenharmony_ci * @since 9 14361847f8eSopenharmony_ci */ 14461847f8eSopenharmony_ci deviceId: number; 14561847f8eSopenharmony_ci } 14661847f8eSopenharmony_ci 14761847f8eSopenharmony_ci /** 14861847f8eSopenharmony_ci * Starts listening for an input device event. 14961847f8eSopenharmony_ci * 15061847f8eSopenharmony_ci * @param { 'change' } type - Type of the input device event, which is **change**. 15161847f8eSopenharmony_ci * @param { Callback<DeviceListener> } listener - Callback for the input device event. 15261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 15361847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 15461847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 15561847f8eSopenharmony_ci * @since 9 15661847f8eSopenharmony_ci */ 15761847f8eSopenharmony_ci function on(type: 'change', listener: Callback<DeviceListener>): void; 15861847f8eSopenharmony_ci 15961847f8eSopenharmony_ci /** 16061847f8eSopenharmony_ci * Stops listening for an input device event. 16161847f8eSopenharmony_ci * 16261847f8eSopenharmony_ci * @param { 'change' } type - Type of the input device event, which is **change**. 16361847f8eSopenharmony_ci * @param { Callback<DeviceListener> } listener - Callback for the input device event. 16461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 16561847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 16661847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 16761847f8eSopenharmony_ci * @since 9 16861847f8eSopenharmony_ci */ 16961847f8eSopenharmony_ci function off(type: 'change', listener?: Callback<DeviceListener>): void; 17061847f8eSopenharmony_ci 17161847f8eSopenharmony_ci /** 17261847f8eSopenharmony_ci * Defines axis information about events that can be reported by an input device. 17361847f8eSopenharmony_ci * For example, a touchscreen may report information such as x, y, and pressure, 17461847f8eSopenharmony_ci * which indicate the x-axis coordinate, y-axis coordinate, and pressure, respectively. 17561847f8eSopenharmony_ci * 17661847f8eSopenharmony_ci * @interface AxisRange 17761847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 17861847f8eSopenharmony_ci * @since 8 17961847f8eSopenharmony_ci */ 18061847f8eSopenharmony_ci interface AxisRange { 18161847f8eSopenharmony_ci /** 18261847f8eSopenharmony_ci * Input source type of the axis. For example, if a mouse reports an x-axis event, 18361847f8eSopenharmony_ci * the source of the x-axis is the mouse. 18461847f8eSopenharmony_ci * 18561847f8eSopenharmony_ci * @type { SourceType } 18661847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 18761847f8eSopenharmony_ci * @since 8 18861847f8eSopenharmony_ci */ 18961847f8eSopenharmony_ci source: SourceType; 19061847f8eSopenharmony_ci 19161847f8eSopenharmony_ci /** 19261847f8eSopenharmony_ci * Type of the axis. for example, the x-axis, y-axis, and pressure axis. 19361847f8eSopenharmony_ci * 19461847f8eSopenharmony_ci * @type { AxisType } 19561847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 19661847f8eSopenharmony_ci * @since 8 19761847f8eSopenharmony_ci */ 19861847f8eSopenharmony_ci axis: AxisType; 19961847f8eSopenharmony_ci 20061847f8eSopenharmony_ci /** 20161847f8eSopenharmony_ci * Maximum value of the data reported on this axis. 20261847f8eSopenharmony_ci * 20361847f8eSopenharmony_ci * @type { number } 20461847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 20561847f8eSopenharmony_ci * @since 8 20661847f8eSopenharmony_ci */ 20761847f8eSopenharmony_ci max: number; 20861847f8eSopenharmony_ci 20961847f8eSopenharmony_ci /** 21061847f8eSopenharmony_ci * Minimum value of the data reported on this axis. 21161847f8eSopenharmony_ci * 21261847f8eSopenharmony_ci * @type { number } 21361847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 21461847f8eSopenharmony_ci * @since 8 21561847f8eSopenharmony_ci */ 21661847f8eSopenharmony_ci min: number; 21761847f8eSopenharmony_ci 21861847f8eSopenharmony_ci /** 21961847f8eSopenharmony_ci * Fuzz value of the data reported on this axis. 22061847f8eSopenharmony_ci * 22161847f8eSopenharmony_ci * @type { number } 22261847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 22361847f8eSopenharmony_ci * @since 9 22461847f8eSopenharmony_ci */ 22561847f8eSopenharmony_ci fuzz: number; 22661847f8eSopenharmony_ci 22761847f8eSopenharmony_ci /** 22861847f8eSopenharmony_ci * Flat value of the data reported on this axis. 22961847f8eSopenharmony_ci * 23061847f8eSopenharmony_ci * @type { number } 23161847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 23261847f8eSopenharmony_ci * @since 9 23361847f8eSopenharmony_ci */ 23461847f8eSopenharmony_ci flat: number; 23561847f8eSopenharmony_ci 23661847f8eSopenharmony_ci /** 23761847f8eSopenharmony_ci * Resolution value of the data reported on this axis. 23861847f8eSopenharmony_ci * 23961847f8eSopenharmony_ci * @type { number } 24061847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 24161847f8eSopenharmony_ci * @since 9 24261847f8eSopenharmony_ci */ 24361847f8eSopenharmony_ci resolution: number; 24461847f8eSopenharmony_ci } 24561847f8eSopenharmony_ci 24661847f8eSopenharmony_ci /** 24761847f8eSopenharmony_ci * Defines the information about an input device. 24861847f8eSopenharmony_ci * 24961847f8eSopenharmony_ci * @interface InputDeviceData 25061847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 25161847f8eSopenharmony_ci * @since 8 25261847f8eSopenharmony_ci */ 25361847f8eSopenharmony_ci interface InputDeviceData { 25461847f8eSopenharmony_ci /** 25561847f8eSopenharmony_ci * Id of the input device. 25661847f8eSopenharmony_ci * 25761847f8eSopenharmony_ci * @type { number } 25861847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 25961847f8eSopenharmony_ci * @since 8 26061847f8eSopenharmony_ci */ 26161847f8eSopenharmony_ci id: number; 26261847f8eSopenharmony_ci 26361847f8eSopenharmony_ci /** 26461847f8eSopenharmony_ci * Name of the input device. 26561847f8eSopenharmony_ci * 26661847f8eSopenharmony_ci * @type { string } 26761847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 26861847f8eSopenharmony_ci * @since 8 26961847f8eSopenharmony_ci */ 27061847f8eSopenharmony_ci name: string; 27161847f8eSopenharmony_ci 27261847f8eSopenharmony_ci /** 27361847f8eSopenharmony_ci * Source type supported by the input device. For example, if a keyboard is attached with a touchpad, 27461847f8eSopenharmony_ci * the device has two input sources: keyboard and touchpad. 27561847f8eSopenharmony_ci * 27661847f8eSopenharmony_ci * @type { Array<SourceType> } 27761847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 27861847f8eSopenharmony_ci * @since 8 27961847f8eSopenharmony_ci */ 28061847f8eSopenharmony_ci sources: Array<SourceType>; 28161847f8eSopenharmony_ci 28261847f8eSopenharmony_ci /** 28361847f8eSopenharmony_ci * Axis range of the input device. 28461847f8eSopenharmony_ci * 28561847f8eSopenharmony_ci * @type { Array<AxisRange> } 28661847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 28761847f8eSopenharmony_ci * @since 8 28861847f8eSopenharmony_ci */ 28961847f8eSopenharmony_ci axisRanges: Array<AxisRange>; 29061847f8eSopenharmony_ci 29161847f8eSopenharmony_ci /** 29261847f8eSopenharmony_ci * Bus of the input device. 29361847f8eSopenharmony_ci * 29461847f8eSopenharmony_ci * @type { number } 29561847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 29661847f8eSopenharmony_ci * @since 9 29761847f8eSopenharmony_ci */ 29861847f8eSopenharmony_ci bus: number; 29961847f8eSopenharmony_ci 30061847f8eSopenharmony_ci /** 30161847f8eSopenharmony_ci * Product of the input device. 30261847f8eSopenharmony_ci * 30361847f8eSopenharmony_ci * @type { number } 30461847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 30561847f8eSopenharmony_ci * @since 9 30661847f8eSopenharmony_ci */ 30761847f8eSopenharmony_ci product: number; 30861847f8eSopenharmony_ci 30961847f8eSopenharmony_ci /** 31061847f8eSopenharmony_ci * Vendor of the input device. 31161847f8eSopenharmony_ci * 31261847f8eSopenharmony_ci * @type { number } 31361847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 31461847f8eSopenharmony_ci * @since 9 31561847f8eSopenharmony_ci */ 31661847f8eSopenharmony_ci vendor: number; 31761847f8eSopenharmony_ci 31861847f8eSopenharmony_ci /** 31961847f8eSopenharmony_ci * Version of the input device. 32061847f8eSopenharmony_ci * 32161847f8eSopenharmony_ci * @type { number } 32261847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 32361847f8eSopenharmony_ci * @since 9 32461847f8eSopenharmony_ci */ 32561847f8eSopenharmony_ci version: number; 32661847f8eSopenharmony_ci 32761847f8eSopenharmony_ci /** 32861847f8eSopenharmony_ci * Physical path of the input device. 32961847f8eSopenharmony_ci * 33061847f8eSopenharmony_ci * @type { string } 33161847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 33261847f8eSopenharmony_ci * @since 9 33361847f8eSopenharmony_ci */ 33461847f8eSopenharmony_ci phys: string; 33561847f8eSopenharmony_ci 33661847f8eSopenharmony_ci /** 33761847f8eSopenharmony_ci * Unique identifier of the input device. 33861847f8eSopenharmony_ci * 33961847f8eSopenharmony_ci * @type { string } 34061847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 34161847f8eSopenharmony_ci * @since 9 34261847f8eSopenharmony_ci */ 34361847f8eSopenharmony_ci uniq: string; 34461847f8eSopenharmony_ci } 34561847f8eSopenharmony_ci 34661847f8eSopenharmony_ci /** 34761847f8eSopenharmony_ci * Obtains the IDs of all input devices. 34861847f8eSopenharmony_ci * 34961847f8eSopenharmony_ci * @param { AsyncCallback<Array<number>> } callback - Callback function, receive reported data 35061847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 35161847f8eSopenharmony_ci * @since 8 35261847f8eSopenharmony_ci * @deprecated since 9 35361847f8eSopenharmony_ci * @useinstead ohos.multimodalInput.inputDevice#getDeviceList 35461847f8eSopenharmony_ci */ 35561847f8eSopenharmony_ci function getDeviceIds(callback: AsyncCallback<Array<number>>): void; 35661847f8eSopenharmony_ci 35761847f8eSopenharmony_ci /** 35861847f8eSopenharmony_ci * Obtains the IDs of all input devices. 35961847f8eSopenharmony_ci * 36061847f8eSopenharmony_ci * @returns { Promise<Array<number>> } 36161847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 36261847f8eSopenharmony_ci * @since 8 36361847f8eSopenharmony_ci * @deprecated since 9 36461847f8eSopenharmony_ci * @useinstead ohos.multimodalInput.inputDevice#getDeviceList 36561847f8eSopenharmony_ci */ 36661847f8eSopenharmony_ci function getDeviceIds(): Promise<Array<number>>; 36761847f8eSopenharmony_ci 36861847f8eSopenharmony_ci /** 36961847f8eSopenharmony_ci * Obtain the information about an input device. 37061847f8eSopenharmony_ci * 37161847f8eSopenharmony_ci * @param { number } deviceId - ID of the input device whose information is to be obtained. 37261847f8eSopenharmony_ci * @param { AsyncCallback<InputDeviceData> } callback - Callback function, receive reported data 37361847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 37461847f8eSopenharmony_ci * @since 8 37561847f8eSopenharmony_ci * @deprecated since 9 37661847f8eSopenharmony_ci * @useinstead ohos.multimodalInput.inputDevice#getDeviceInfo 37761847f8eSopenharmony_ci */ 37861847f8eSopenharmony_ci function getDevice(deviceId: number, callback: AsyncCallback<InputDeviceData>): void; 37961847f8eSopenharmony_ci 38061847f8eSopenharmony_ci /** 38161847f8eSopenharmony_ci * Obtain the information about an input device. 38261847f8eSopenharmony_ci * 38361847f8eSopenharmony_ci * @param { number } deviceId - ID of the input device whose information is to be obtained. 38461847f8eSopenharmony_ci * @returns { Promise<InputDeviceData> } 38561847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 38661847f8eSopenharmony_ci * @since 8 38761847f8eSopenharmony_ci * @deprecated since 9 38861847f8eSopenharmony_ci * @useinstead ohos.multimodalInput.inputDevice#getDeviceInfo 38961847f8eSopenharmony_ci */ 39061847f8eSopenharmony_ci function getDevice(deviceId: number): Promise<InputDeviceData>; 39161847f8eSopenharmony_ci 39261847f8eSopenharmony_ci /** 39361847f8eSopenharmony_ci * Obtains the IDs of all input devices. 39461847f8eSopenharmony_ci * 39561847f8eSopenharmony_ci * @param { AsyncCallback<Array<number>> } callback - Callback function, receive reported data 39661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 39761847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 39861847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 39961847f8eSopenharmony_ci * @since 9 40061847f8eSopenharmony_ci */ 40161847f8eSopenharmony_ci function getDeviceList(callback: AsyncCallback<Array<number>>): void; 40261847f8eSopenharmony_ci 40361847f8eSopenharmony_ci /** 40461847f8eSopenharmony_ci * Obtains the IDs of all input devices. 40561847f8eSopenharmony_ci * 40661847f8eSopenharmony_ci * @returns { Promise<Array<number>> } 40761847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 40861847f8eSopenharmony_ci * @since 9 40961847f8eSopenharmony_ci */ 41061847f8eSopenharmony_ci function getDeviceList(): Promise<Array<number>>; 41161847f8eSopenharmony_ci 41261847f8eSopenharmony_ci /** 41361847f8eSopenharmony_ci * Obtain the information about an input device. 41461847f8eSopenharmony_ci * 41561847f8eSopenharmony_ci * @param { number } deviceId - ID of the input device whose information is to be obtained. 41661847f8eSopenharmony_ci * @param { AsyncCallback<InputDeviceData> } callback - Callback function, receive reported data 41761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 41861847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 41961847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 42061847f8eSopenharmony_ci * @since 9 42161847f8eSopenharmony_ci */ 42261847f8eSopenharmony_ci function getDeviceInfo(deviceId: number, callback: AsyncCallback<InputDeviceData>): void; 42361847f8eSopenharmony_ci 42461847f8eSopenharmony_ci /** 42561847f8eSopenharmony_ci * Obtain the information about an input device. 42661847f8eSopenharmony_ci * 42761847f8eSopenharmony_ci * @param { number } deviceId - ID of the input device whose information is to be obtained. 42861847f8eSopenharmony_ci * @returns { Promise<InputDeviceData> } 42961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 43061847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 43161847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 43261847f8eSopenharmony_ci * @since 9 43361847f8eSopenharmony_ci */ 43461847f8eSopenharmony_ci function getDeviceInfo(deviceId: number): Promise<InputDeviceData>; 43561847f8eSopenharmony_ci 43661847f8eSopenharmony_ci /** 43761847f8eSopenharmony_ci * Obtain the information about an input device. 43861847f8eSopenharmony_ci * 43961847f8eSopenharmony_ci * @param { number } deviceId - ID of the input device whose information is to be obtained. 44061847f8eSopenharmony_ci * @returns { InputDeviceData } 44161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 44261847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 44361847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 44461847f8eSopenharmony_ci * @since 10 44561847f8eSopenharmony_ci */ 44661847f8eSopenharmony_ci function getDeviceInfoSync(deviceId: number): InputDeviceData; 44761847f8eSopenharmony_ci 44861847f8eSopenharmony_ci /** 44961847f8eSopenharmony_ci * Checks whether the specified key codes of an input device are supported. 45061847f8eSopenharmony_ci * 45161847f8eSopenharmony_ci * @param { number } deviceId - ID of the input device. 45261847f8eSopenharmony_ci * @param { Array<KeyCode> } keys - Key codes of the input device, You can query maximum of five key codes at a time. 45361847f8eSopenharmony_ci * @param { AsyncCallback<Array<boolean>> } callback -Indicates whether the specified key codes are supported. 45461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 45561847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 45661847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 45761847f8eSopenharmony_ci * @since 9 45861847f8eSopenharmony_ci */ 45961847f8eSopenharmony_ci function supportKeys(deviceId: number, keys: Array<KeyCode>, callback: AsyncCallback<Array<boolean>>): void; 46061847f8eSopenharmony_ci 46161847f8eSopenharmony_ci /** 46261847f8eSopenharmony_ci * Checks whether the specified key codes of an input device are supported. 46361847f8eSopenharmony_ci * 46461847f8eSopenharmony_ci * @param { number } deviceId - ID of the input device. 46561847f8eSopenharmony_ci * @param { Array<KeyCode> } keys - Key codes of the input device, You can query maximum of five key codes at a time. 46661847f8eSopenharmony_ci * @returns { Promise<Array<boolean>> } Returns a result indicating whether the specified key codes are supported. 46761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 46861847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 46961847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 47061847f8eSopenharmony_ci * @since 9 47161847f8eSopenharmony_ci */ 47261847f8eSopenharmony_ci function supportKeys(deviceId: number, keys: Array<KeyCode>): Promise<Array<boolean>>; 47361847f8eSopenharmony_ci 47461847f8eSopenharmony_ci /** 47561847f8eSopenharmony_ci * Checks whether the specified key codes of an input device are supported. 47661847f8eSopenharmony_ci * 47761847f8eSopenharmony_ci * @param { number } deviceId - ID of the input device. 47861847f8eSopenharmony_ci * @param { Array<KeyCode> } keys - Key codes of the input device, You can query maximum of five key codes at a time. 47961847f8eSopenharmony_ci * @returns { Array<boolean> } Returns a result indicating whether the specified key codes are supported. 48061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 48161847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 48261847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 48361847f8eSopenharmony_ci * @since 10 48461847f8eSopenharmony_ci */ 48561847f8eSopenharmony_ci function supportKeysSync(deviceId: number, keys: Array<KeyCode>): Array<boolean>; 48661847f8eSopenharmony_ci 48761847f8eSopenharmony_ci /** 48861847f8eSopenharmony_ci * Query the keyboard type of the input device. 48961847f8eSopenharmony_ci * 49061847f8eSopenharmony_ci * @param { number } deviceId - ID of the specified input device. 49161847f8eSopenharmony_ci * @param { AsyncCallback<KeyboardType> } callback - Returns the keyboard type. 49261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 49361847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 49461847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 49561847f8eSopenharmony_ci * @since 9 49661847f8eSopenharmony_ci */ 49761847f8eSopenharmony_ci function getKeyboardType(deviceId: number, callback: AsyncCallback<KeyboardType>): void; 49861847f8eSopenharmony_ci 49961847f8eSopenharmony_ci /** 50061847f8eSopenharmony_ci * Query the keyboard type of the input device. 50161847f8eSopenharmony_ci * 50261847f8eSopenharmony_ci * @param { number } deviceId - ID of the specified input device. 50361847f8eSopenharmony_ci * @returns { Promise<KeyboardType> } Returns the keyboard type. 50461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 50561847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 50661847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 50761847f8eSopenharmony_ci * @since 9 50861847f8eSopenharmony_ci */ 50961847f8eSopenharmony_ci function getKeyboardType(deviceId: number): Promise<KeyboardType>; 51061847f8eSopenharmony_ci 51161847f8eSopenharmony_ci /** 51261847f8eSopenharmony_ci * Query the keyboard type of the input device. 51361847f8eSopenharmony_ci * 51461847f8eSopenharmony_ci * @param { number } deviceId - ID of the specified input device. 51561847f8eSopenharmony_ci * @returns { KeyboardType } Returns the keyboard type. 51661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 51761847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 51861847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 51961847f8eSopenharmony_ci * @since 10 52061847f8eSopenharmony_ci */ 52161847f8eSopenharmony_ci function getKeyboardTypeSync(deviceId: number): KeyboardType; 52261847f8eSopenharmony_ci 52361847f8eSopenharmony_ci /** 52461847f8eSopenharmony_ci * Setting the Keyboard Repetition Delay. 52561847f8eSopenharmony_ci * 52661847f8eSopenharmony_ci * @param { number } delay - Repeat delay time, the unit is ms. 52761847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Callback used to return the result. 52861847f8eSopenharmony_ci * @throws { BusinessError } 202 - SystemAPI permission error. 52961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 53061847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 53161847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 53261847f8eSopenharmony_ci * @systemapi hide for inner use. 53361847f8eSopenharmony_ci * @since 10 53461847f8eSopenharmony_ci */ 53561847f8eSopenharmony_ci function setKeyboardRepeatDelay(delay: number, callback: AsyncCallback<void>): void; 53661847f8eSopenharmony_ci 53761847f8eSopenharmony_ci /** 53861847f8eSopenharmony_ci * Setting the Keyboard Repetition Delay. 53961847f8eSopenharmony_ci * 54061847f8eSopenharmony_ci * @param { number } delay - Repeat delay time, the unit is ms. 54161847f8eSopenharmony_ci * @returns { Promise<void> } Returns the result through a promise. 54261847f8eSopenharmony_ci * @throws { BusinessError } 202 - SystemAPI permission error. 54361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 54461847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 54561847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 54661847f8eSopenharmony_ci * @systemapi hide for inner use. 54761847f8eSopenharmony_ci * @since 10 54861847f8eSopenharmony_ci */ 54961847f8eSopenharmony_ci function setKeyboardRepeatDelay(delay: number): Promise<void>; 55061847f8eSopenharmony_ci 55161847f8eSopenharmony_ci /** 55261847f8eSopenharmony_ci * Get the Keyboard Repetition Delay. 55361847f8eSopenharmony_ci * 55461847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - Callback used to return the result. 55561847f8eSopenharmony_ci * @throws { BusinessError } 202 - SystemAPI permission error. 55661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 55761847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 55861847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 55961847f8eSopenharmony_ci * @systemapi hide for inner use. 56061847f8eSopenharmony_ci * @since 10 56161847f8eSopenharmony_ci */ 56261847f8eSopenharmony_ci function getKeyboardRepeatDelay(callback: AsyncCallback<number>): void; 56361847f8eSopenharmony_ci 56461847f8eSopenharmony_ci /** 56561847f8eSopenharmony_ci * Get the Keyboard Repetition Delay. 56661847f8eSopenharmony_ci * 56761847f8eSopenharmony_ci * @returns { Promise<number> } Returns the result through a promise. 56861847f8eSopenharmony_ci * @throws { BusinessError } 202 - SystemAPI permission error. 56961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 57061847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 57161847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 57261847f8eSopenharmony_ci * @systemapi hide for inner use. 57361847f8eSopenharmony_ci * @since 10 57461847f8eSopenharmony_ci */ 57561847f8eSopenharmony_ci function getKeyboardRepeatDelay(): Promise<number>; 57661847f8eSopenharmony_ci 57761847f8eSopenharmony_ci /** 57861847f8eSopenharmony_ci * Setting the Keyboard Key Repetition Rate. 57961847f8eSopenharmony_ci * 58061847f8eSopenharmony_ci * @param { number } rate - Repetition rate, the unit is ms. 58161847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Callback used to return the result. 58261847f8eSopenharmony_ci * @throws { BusinessError } 202 - SystemAPI permission error. 58361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 58461847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 58561847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 58661847f8eSopenharmony_ci * @systemapi hide for inner use. 58761847f8eSopenharmony_ci * @since 10 58861847f8eSopenharmony_ci */ 58961847f8eSopenharmony_ci function setKeyboardRepeatRate(rate: number, callback: AsyncCallback<void>): void; 59061847f8eSopenharmony_ci 59161847f8eSopenharmony_ci /** 59261847f8eSopenharmony_ci * Setting the Keyboard Key Repetition Rate. 59361847f8eSopenharmony_ci * 59461847f8eSopenharmony_ci * @param { number } rate - Repetition rate, the unit is ms. 59561847f8eSopenharmony_ci * @returns { Promise<void> } Returns the result through a promise. 59661847f8eSopenharmony_ci * @throws { BusinessError } 202 - SystemAPI permission error. 59761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 59861847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 59961847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 60061847f8eSopenharmony_ci * @systemapi hide for inner use. 60161847f8eSopenharmony_ci * @since 10 60261847f8eSopenharmony_ci */ 60361847f8eSopenharmony_ci function setKeyboardRepeatRate(rate: number): Promise<void>; 60461847f8eSopenharmony_ci 60561847f8eSopenharmony_ci /** 60661847f8eSopenharmony_ci * Get Keyboard Key Repetition Rate. 60761847f8eSopenharmony_ci * 60861847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - Callback used to return the result. 60961847f8eSopenharmony_ci * @throws { BusinessError } 202 - SystemAPI permission error. 61061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 61161847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 61261847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 61361847f8eSopenharmony_ci * @systemapi hide for inner use. 61461847f8eSopenharmony_ci * @since 10 61561847f8eSopenharmony_ci */ 61661847f8eSopenharmony_ci function getKeyboardRepeatRate(callback: AsyncCallback<number>): void; 61761847f8eSopenharmony_ci 61861847f8eSopenharmony_ci /** 61961847f8eSopenharmony_ci * Get Keyboard Key Repetition Rate. 62061847f8eSopenharmony_ci * 62161847f8eSopenharmony_ci * @returns { Promise<number> } Returns the result through a promise. 62261847f8eSopenharmony_ci * @throws { BusinessError } 202 - SystemAPI permission error. 62361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 62461847f8eSopenharmony_ci * <br>2. Incorrect parameter types; 3. Parameter verification failed. 62561847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 62661847f8eSopenharmony_ci * @systemapi hide for inner use. 62761847f8eSopenharmony_ci * @since 10 62861847f8eSopenharmony_ci */ 62961847f8eSopenharmony_ci function getKeyboardRepeatRate(): Promise<number>; 63061847f8eSopenharmony_ci 63161847f8eSopenharmony_ci /** 63261847f8eSopenharmony_ci * Obtains the interval since the last input. 63361847f8eSopenharmony_ci * 63461847f8eSopenharmony_ci * @returns { Promise<number> } Promise used to return the interval since the last input. 63561847f8eSopenharmony_ci * @syscap SystemCapability.MultimodalInput.Input.InputDevice 63661847f8eSopenharmony_ci * @since 13 63761847f8eSopenharmony_ci */ 63861847f8eSopenharmony_ci function getIntervalSinceLastInput(): Promise<number>; 63961847f8eSopenharmony_ci} 64061847f8eSopenharmony_ci 64161847f8eSopenharmony_ciexport default inputDevice;