mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-11-24 07:40:25 +00:00
e1591d20d4
Signed-off-by:hungry_feiwei<huxiao31@huawei.com>
89 lines
3.3 KiB
TypeScript
Executable File
89 lines
3.3 KiB
TypeScript
Executable File
/*
|
|
* 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<SourceType>;
|
|
axisRanges : Array<AxisRange>;
|
|
}
|
|
|
|
/**
|
|
* 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<Array<number>>): 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<InputDeviceData>): void;
|
|
}
|
|
|
|
export default inputDevice; |