From f6093666334f6560d6e91d249af4e52a0a9bdbb5 Mon Sep 17 00:00:00 2001 From: hungry_feiwei Date: Tue, 19 Apr 2022 15:36:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0hmos=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hungry_feiwei --- api/@system.multimodalInput.inputDevice.d.ts | 142 +++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100755 api/@system.multimodalInput.inputDevice.d.ts diff --git a/api/@system.multimodalInput.inputDevice.d.ts b/api/@system.multimodalInput.inputDevice.d.ts new file mode 100755 index 0000000000..41ae290480 --- /dev/null +++ b/api/@system.multimodalInput.inputDevice.d.ts @@ -0,0 +1,142 @@ +/* +* Copyright (C) 2022 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.Input.InputDevice + * @import import inputDevice from '@system.multimodalInput.inputDevice'; + */ + +declare namespace inputDevice { + type EventType = 'add' | 'remove' | 'update'; + + type SourceType = 'keyboard' | 'dpad' | 'gamepad' | 'touchscreen' | 'mouse' | 'stylus' | 'bluetoothStylus' | 'trackball' | + 'pointerCaptureMouse' | 'touchpad' | 'rotaryEncoder' | 'joystick'; + + type AxisType = 'orientation' | 'pressure' | 'size' | 'toolMajor' | 'toolMinor' | 'touchMajor' | 'touchMinor' | 'x' | 'y'; + + /** + * Defines the monitor for input device events. + * + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @param type Type of the input device event. The options are add, remove, and update. + * @param deviceId ID of the input device for the reported input device event. + */ + interface DeviceMonitor{ + (type: EventType, deviceId: number): void; + } + + /** + * Starts monitoring for an input device event. + * + * @since 8 + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @device phone, tablet, tv, wearable, car + * @param type Type of the input device event. The options are add, remove, and update. + * @param monitor Callback for the input device event. + */ + function on(type: EventType, monitor: DeviceMonitor): void; + + /** + * Stops monitoring for an input device event. + * + * @since 8 + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @device phone, tablet, tv, wearable, car + * @param type Type of the input device event. The options are add, remove, and update. + * @param monitor Callback for the input device event. + */ + function off(type: EventType, monitor?: DeviceMonitor): void; + + /** + * 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.Input.InputDevice + * @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.Input.InputDevice + * @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.Input.InputDevice + * @device phone, tablet, tv, wearable, car + * @param callback callback function, receive reported data + */ + function getDeviceIds(callback: AsyncCallback>): void; + function getDeviceIds(): Promise>; + + /** + * Obtain the information about an input device. + * + * @since 8 + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @device phone, tablet, tv, wearable, car + * @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; + function getDevice(deviceId: number): Promise; + + /** + * Obtain the information about an input device. + * + * @since 8 + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @device phone, tablet, tv, wearable, car + * @param deviceId ID of the input device whose information is to be obtained. + */ + function getDeviceSync(deviceId: number): InputDeviceData; + + /** + * Obtains the IDs of all input devices. + * + * @since 8 + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @device phone, tablet, tv, wearable, car + */ + function getDeviceIdsSync(): Array; +} + +export default inputDevice; \ No newline at end of file -- Gitee From 28258db0546673d5b181be562ce2fde647d0d5f8 Mon Sep 17 00:00:00 2001 From: hungry_feiwei Date: Tue, 19 Apr 2022 15:37:08 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0hmos=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hungry_feiwei --- api/@system.multimodalInput.inputDevice.d.ts | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 api/@system.multimodalInput.inputDevice.d.ts diff --git a/api/@system.multimodalInput.inputDevice.d.ts b/api/@system.multimodalInput.inputDevice.d.ts old mode 100755 new mode 100644 -- Gitee