diff --git a/api/@ohos.multimodalInput.inputDevice.d.ts b/api/@ohos.multimodalInput.inputDevice.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..e4503013182f03a75e035be8bc3946861653ddfa --- /dev/null +++ b/api/@ohos.multimodalInput.inputDevice.d.ts @@ -0,0 +1,89 @@ +/* +* Copyright (C) 2021 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { AsyncCallback } from './basic'; + + /** + * The input device management module is configured to obtain an ID and device information of an input device. + * + * @since 8 + * @sysCap SystemCapability.MultimodalInput.MULTIMODAL_INPUT + * @devices phone, tablet, tv, wearable + * @import import inputDevice from '@ohos.multimodalInput.inputDevice'; + * @permission N/A + */ + +declare namespace inputDevice { + type SourceType = 'keyboard' | 'mouse' | 'touchpad' | 'touchscreen' | 'joystick' | 'trackball'; + + type AxisType = 'NULL'; + + /** + * Defines axis information about events that can be reported by an input device. + * For example, a touchscreen may report information such as x, y, and pressure, + * which indicate the x-axis coordinate, y-axis coordinate, and pressure, respectively. + * + * @sysCap SystemCapability.MultimodalInput.MULTIMODAL_INPUT + * @param source Input source type of the axis. For example, if a mouse reports an x-axis event, the source of the x-axis is the mouse. + * @param axis Type of the axis. for example, the x-axis, y-axis, and pressure axis. + * @param max Maximum value of the data reported on this axis. + * @param min Minimum value of the data reported on this axis. + */ + interface AxisRange { + source: SourceType; + axis : AxisType; + max : number; + min: number; + } + + /** + * Defines the information about an input device. + * + * @sysCap SystemCapability.MultimodalInput.MULTIMODAL_INPUT + * @param name Name of the input device. + * @param sources Source type supported by the input device. For example, if a keyboard is attached with a touchpad, the device has two input sources: keyboard and touchpad. + */ + interface InputDeviceData { + id: number; + name: string; + sources : Array; + axisRanges : Array; + } + + /** + * Obtains the IDs of all input devices. + * + * @since 8 + * @sysCap SystemCapability.MultimodalInput.MULTIMODAL_INPUT + * @devices phone, tablet, tv, wearable + * @permission N/A + * @param callback callback function, receive reported data + */ + function getDeviceIds(callback: AsyncCallback>): void; + + /** + * Obtain the information about an input device. + * + * @since 8 + * @sysCap SystemCapability.MultimodalInput.MULTIMODAL_INPUT + * @devices phone, tablet, tv, wearable + * @permission N/A + * @param deviceId ID of the input device whose information is to be obtained. + * @param callback callback function, receive reported data + */ + function getDevice(deviceId: number, callback: AsyncCallback): void; +} + +export default inputDevice; \ No newline at end of file