harmony 鸿蒙@ohos.multimodalInput.inputDevice (输入设备)

  • 2022-08-09
  • 浏览 (511)

@ohos.multimodalInput.inputDevice (输入设备)

输入设备管理模块,用于监听输入设备连接和断开状态,查询输入设备相关信息。

说明

本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。

导入模块

import inputDevice from '@ohos.multimodalInput.inputDevice';

inputDevice.getDeviceList9+

getDeviceList(callback: AsyncCallback<Array<number>>): void

获取所有输入设备的id列表,使用AsyncCallback异步方式返回结果。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

参数

参数名 类型 必填 说明
callback AsyncCallback<Array<number>> 回调函数,异步返回所有输入设备的id列表。

示例

try {
  inputDevice.getDeviceList((error: Error, ids: Array<Number>) => {
    if (error) {
      console.log(`Failed to get device id list, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
    console.log(`Device id list: ${JSON.stringify(ids)}`);
  });
} catch (error) {
  console.log(`Failed to get device id list, error: ${JSON.stringify(error, [`code`, `message`])}`);
}

inputDevice.getDeviceList9+

getDeviceList(): Promise&lt;Array&lt;number&gt;&gt;

获取所有输入设备的id列表,使用Promise异步方式返回结果。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

返回值

参数 说明
Promise&lt;Array&lt;number&gt;&gt; Promise对象,异步返回所有输入设备的id列表。

示例

try {
  inputDevice.getDeviceList().then((ids: Array<Number>) => {
    console.log(`Device id list: ${JSON.stringify(ids)}`);
  });
} catch (error) {
  console.log(`Failed to get device id list, error: ${JSON.stringify(error, [`code`, `message`])}`);
}

inputDevice.getDeviceInfo9+

getDeviceInfo(deviceId: number, callback: AsyncCallback&lt;InputDeviceData&gt;): void

获取指定输入设备的信息,使用AsyncCallback异步方式返回结果。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

参数

参数名 类型 必填 说明
deviceId number 输入设备id。
callback AsyncCallback&lt;InputDeviceData&gt; 回调函数,异步返回输入设备信息。

示例

// 获取输入设备id为1的设备信息。
try {
  inputDevice.getDeviceInfo(1, (error: Error, deviceData: inputDevice.InputDeviceData) => {
    if (error) {
      console.log(`Failed to get device info, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
    console.log(`Device info: ${JSON.stringify(deviceData)}`);
  });
} catch (error) {
  console.log(`Failed to get device info, error: ${JSON.stringify(error, [`code`, `message`])}`);
}

inputDevice.getDeviceInfo9+

getDeviceInfo(deviceId: number): Promise&lt;InputDeviceData&gt;

获取指定输入设备的信息,使用Promise异步方式返回结果。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

参数

参数名 类型 必填 说明
deviceId number 输入设备id。

返回值

参数 说明
Promise&lt;InputDeviceData&gt; Promise对象,异步返回输入设备信息。

示例

// 获取输入设备id为1的设备信息。
try {
  inputDevice.getDeviceInfo(1).then((deviceData: inputDevice.InputDeviceData) => {
    console.log(`Device info: ${JSON.stringify(deviceData)}`);
  });
} catch (error) {
  console.log(`Failed to get device info, error: ${JSON.stringify(error, [`code`, `message`])}`);
}

inputDevice.getDeviceInfoSync10+

getDeviceInfoSync(deviceId: number): InputDeviceData

获取指定输入设备的信息。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

参数

参数名 类型 必填 说明
deviceId number 输入设备id。

返回值

参数 说明
InputDeviceData 返回输入设备信息。

示例

// 获取输入设备id为1的设备信息。
try {
  let deviceData: inputDevice.InputDeviceData = inputDevice.getDeviceInfoSync(1)
  console.log(`Device info: ${JSON.stringify(deviceData)}`)
} catch (error) {
  console.log(`Failed to get device info, error: ${JSON.stringify(error, [`code`, `message`])}`)
}

inputDevice.on9+

on(type: “change”, listener: Callback&lt;DeviceListener&gt;): void

监听输入设备的热插拔事件。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

参数

参数名 类型 必填 说明
type string 输入设备的事件类型。
listener Callback&lt;DeviceListener&gt; 回调函数,异步上报输入设备热插拔事件。

示例

let isPhysicalKeyboardExist = true;
try {
  inputDevice.on("change", (data: inputDevice.DeviceListener) => {
    console.log(`Device event info: ${JSON.stringify(data)}`);
    inputDevice.getKeyboardType(data.deviceId, (err: Error, type: inputDevice.KeyboardType) => {
      console.log("The keyboard type is: " + type);
      if (type == inputDevice.KeyboardType.ALPHABETIC_KEYBOARD && data.type == 'add') {
        // 监听物理键盘已连接。
        isPhysicalKeyboardExist = true;
      } else if (type == inputDevice.KeyboardType.ALPHABETIC_KEYBOARD && data.type == 'remove') {
        // 监听物理键盘已断开。
        isPhysicalKeyboardExist = false;
      }
    });
  });
  // 根据isPhysicalKeyboardExist的值决定软键盘是否弹出。
} catch (error) {
  console.log(`Get device info failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}

inputDevice.off9+

off(type: “change”, listener?: Callback&lt;DeviceListener&gt;): void

取消监听输入设备的热插拔事件。在应用退出前调用,取消监听。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

参数

参数名 类型 必填 说明
type string 输入设备的事件类型。
listener Callback&lt;DeviceListener&gt; 取消监听的回调函数。

示例

function callback(data: inputDevice.DeviceListener) {
  console.log(`Report device event info: ${JSON.stringify(data, [`type`, `deviceId`])}`);
};

try {
  inputDevice.on("change", callback);
} catch (error) {
  console.log(`Listen device event failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}

// 取消指定的监听。
try {
  inputDevice.off("change", callback);
} catch (error) {
  console.log(`Cancel listening device event failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}

// 取消所有监听。
try {
  inputDevice.off("change");
} catch (error) {
  console.log(`Cancel all listening device event failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}

inputDevice.getDeviceIds(deprecated)

getDeviceIds(callback: AsyncCallback&lt;Array&lt;number&gt;&gt;): void

获取所有输入设备的id列表,使用AsyncCallback异步方式返回结果。

从API version 9 开始不再维护,建议使用inputDevice.getDeviceList代替。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

参数

参数名 类型 必填 说明
callback AsyncCallback&lt;Array&lt;number&gt;&gt; 回调函数,异步返回所有输入设备的id列表。

示例

inputDevice.getDeviceIds((error: Error, ids: Array<Number>) => {
  if (error) {
    console.log(`Failed to get device id list, error: ${JSON.stringify(error, [`code`, `message`])}`);
    return;
  }
  console.log(`Device id list: ${JSON.stringify(ids)}`);
});

inputDevice.getDeviceIds(deprecated)

getDeviceIds(): Promise&lt;Array&lt;number&gt;&gt;

获取所有输入设备的id列表,使用Promise异步方式返回结果。

从API version 9 开始不再维护,建议使用inputDevice.getDeviceList代替。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

返回值

参数 说明
Promise&lt;Array&lt;number&gt;&gt; Promise对象,异步返回所有输入设备的id列表。

示例

inputDevice.getDeviceIds().then((ids: Array<Number>) => {
  console.log(`Device id list: ${JSON.stringify(ids)}`);
});

inputDevice.getDevice(deprecated)

getDevice(deviceId: number, callback: AsyncCallback&lt;InputDeviceData&gt;): void

获取指定输入设备的信息,使用AsyncCallback异步方式返回结果。

从API version 9 开始不再维护,建议使用inputDevice.getDeviceInfo代替。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

参数

参数名 类型 必填 说明
deviceId number 输入设备id。
callback AsyncCallback&lt;InputDeviceData&gt; 回调函数,异步返回输入设备信息。

示例

// 获取输入设备id为1的设备信息。
inputDevice.getDevice(1, (error: Error, deviceData: inputDevice.InputDeviceData) => {
  if (error) {
    console.log(`Failed to get device info, error: ${JSON.stringify(error, [`code`, `message`])}`);
    return;
  }
  console.log(`Device info: ${JSON.stringify(deviceData)}`);
});

inputDevice.getDevice(deprecated)

getDevice(deviceId: number): Promise&lt;InputDeviceData&gt;

获取指定输入设备的信息,使用Promise异步方式返回结果。

从API version 9 开始不再维护,建议使用inputDevice.getDeviceInfo代替。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

参数

参数名 类型 必填 说明
deviceId number 输入设备id。

返回值

参数 说明
Promise&lt;InputDeviceData&gt; Promise对象,异步返回输入设备信息。

示例

// 获取输入设备id为1的设备信息。
inputDevice.getDevice(1).then((deviceData: inputDevice.InputDeviceData) => {
  console.log(`Device info: ${JSON.stringify(deviceData)}`);
});

inputDevice.supportKeys9+

supportKeys(deviceId: number, keys: Array&lt;KeyCode&gt;, callback: AsyncCallback &lt;Array&lt;boolean&gt;&gt;): void

获取输入设备是否支持指定的键码值,使用AsyncCallback异步方式返回结果。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

参数

参数名 类型 必填 说明
deviceId number 输入设备id,同一个物理设备反复插拔,设备id会发生变化。
keys Array&lt;KeyCode&gt; 需要查询的键码值,最多支持5个按键查询。
callback AsyncCallback&lt;Array&lt;boolean&gt;&gt; 回调函数,异步返回查询结果。

示例

// 查询id为1的输入设备对于17、22和2055按键的支持情况。
try {
  inputDevice.supportKeys(1, [17, 22, 2055], (error: Error, supportResult: Array<Boolean>) => {
    console.log(`Query result: ${JSON.stringify(supportResult)}`);
  });
} catch (error) {
  console.log(`Query failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}

inputDevice.supportKeys9+

supportKeys(deviceId: number, keys: Array&lt;KeyCode&gt;): Promise&lt;Array&lt;boolean&gt;&gt;

获取输入设备是否支持指定的键码值,使用Promise异步方式返回结果。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

参数

参数名 类型 必填 说明
deviceId number 输入设备id,同一个物理设备反复插拔,设备id会发生变化。
keys Array&lt;KeyCode&gt; 需要查询的键码值,最多支持5个按键查询。

返回值

参数 说明
Promise&lt;Array&lt;boolean&gt;&gt; Promise对象,异步返回查询结果。

示例

// 查询id为1的输入设备对于17、22和2055按键的支持情况。
try {
  inputDevice.supportKeys(1, [17, 22, 2055]).then((supportResult: Array<Boolean>) => {
    console.log(`Query result: ${JSON.stringify(supportResult)}`);
  });
} catch (error) {
  console.log(`Query failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}

inputDevice.supportKeysSync10+

supportKeysSync(deviceId: number, keys: Array&lt;KeyCode&gt;): Array&lt;boolean&gt;

获取输入设备是否支持指定的键码值。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

参数

参数名 类型 必填 说明
deviceId number 输入设备id,同一个物理设备反复插拔,设备id会发生变化。
keys Array&lt;KeyCode&gt; 需要查询的键码值,最多支持5个按键查询。

返回值

参数 说明
Array&lt;boolean&gt; 返回查询结果。true表示支持,false表示不支持。

示例

// 查询id为1的输入设备对于17、22和2055按键的支持情况。
try {
  let supportResult: Array<Boolean> = inputDevice.supportKeysSync(1, [17, 22, 2055])
  console.log(`Query result: ${JSON.stringify(supportResult)}`)
} catch (error) {
  console.log(`Query failed, error: ${JSON.stringify(error, [`code`, `message`])}`)
}

inputDevice.getKeyboardType9+

getKeyboardType(deviceId: number, callback: AsyncCallback&lt;KeyboardType&gt;): void

获取输入设备的键盘类型,使用AsyncCallback异步方式返回结果。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

参数

参数名 类型 必填 说明
deviceId number 输入设备的唯一标识,同一个物理设备反复插拔,设备id会发生变化。
callback AsyncCallback&lt;KeyboardType&gt; 回调函数,异步返回查询结果。

示例

// 查询id为1的输入设备的键盘类型。
try {
  inputDevice.getKeyboardType(1, (error: Error, type: Number) => {
    if (error) {
      console.log(`Failed to get keyboard type, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
    console.log(`Keyboard type: ${JSON.stringify(type)}`);
  });
} catch (error) {
  console.log(`Failed to get keyboard type, error: ${JSON.stringify(error, [`code`, `message`])}`);
}

inputDevice.getKeyboardType9+

getKeyboardType(deviceId: number): Promise&lt;KeyboardType&gt;

获取输入设备的键盘类型,使用Promise异步方式返回结果。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

参数

参数名 类型 必填 说明
deviceId number 输入设备的唯一标识,同一个物理设备反复插拔,设备id会发生变化。

返回值

参数 说明
Promise&lt;KeyboardType&gt; Promise对象,异步返回查询结果。

示例

// 示例查询设备id为1的设备键盘类型。
try {
  inputDevice.getKeyboardType(1).then((type: Number) => {
    console.log(`Keyboard type: ${JSON.stringify(type)}`);
  });
} catch (error) {
  console.log(`Failed to get keyboard type, error: ${JSON.stringify(error, [`code`, `message`])}`);
}

inputDevice.getKeyboardTypeSync10+

getKeyboardTypeSync(deviceId: number): KeyboardType

获取输入设备的键盘类型。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

参数

参数名 类型 必填 说明
deviceId number 输入设备的唯一标识,同一个物理设备反复插拔,设备id会发生变化。

返回值

参数 说明
KeyboardType 返回查询结果。

示例

// 示例查询设备id为1的设备键盘类型。
try {
  let type: number = inputDevice.getKeyboardTypeSync(1)
  console.log(`Keyboard type: ${JSON.stringify(type)}`)
} catch (error) {
  console.log(`Failed to get keyboard type, error: ${JSON.stringify(error, [`code`, `message`])}`)
}

inputDevice.setKeyboardRepeatDelay10+

setKeyboardRepeatDelay(delay: number, callback: AsyncCallback&lt;void&gt;): void

设置键盘按键的重复时延,使用AsyncCallback异步方式返回结果。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

系统API:此接口为系统接口。

参数

参数名 类型 必填 说明
delay number 键盘按键重复延迟时间,默认值500ms,调节范围[300ms,1000ms]。
callback AsyncCallback&lt;void&gt; 回调函数。

示例

try {
  inputDevice.setKeyboardRepeatDelay(350, (error: Error) => {
    if (error) {
      console.log(`Set keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
    console.log(`Set keyboard repeat delay success`);
  });
} catch (error) {
  console.log(`Set keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}

inputDevice.setKeyboardRepeatDelay10+

setKeyboardRepeatDelay(delay: number): Promise&lt;void&gt;

设置键盘按键的重复时延,使用Promise异步方式返回结果。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

系统API:此接口为系统接口。

参数

参数名 类型 必填 说明
delay number 键盘按键重复延迟时间,默认值500ms,调节范围[300ms,1000ms]。

返回值

参数 说明
Promise&lt;void&gt; Promise对象。

示例

try {
  inputDevice.setKeyboardRepeatDelay(350).then(() => {
    console.log(`Set keyboard repeat delay success`);
  });
} catch (error) {
  console.log(`Set keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}

inputDevice.getKeyboardRepeatDelay10+

getKeyboardRepeatDelay(callback: AsyncCallback&lt;number&gt;): void

获取键盘按键的重复时延,使用AsyncCallback异步方式返回结果。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

系统API:此接口为系统接口。

参数

参数名 类型 必填 说明
callback AsyncCallback&lt;number&gt; 回调函数,异步返回键盘按键重复延迟时间。

示例

try {
  inputDevice.getKeyboardRepeatDelay((error: Error, delay: Number) => {
    if (error) {
      console.log(`Get keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
    console.log(`Get keyboard repeat delay success`);
  });
} catch (error) {
  console.log(`Get keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}

inputDevice.getKeyboardRepeatDelay10+

getKeyboardRepeatDelay(): Promise&lt;number&gt;

获取键盘按键的重复时延,使用Promise异步方式返回结果。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

系统API:此接口为系统接口。

返回值

参数 说明
Promise&lt;number&gt; Promise实例,异步返回键盘按键的重复时延。

示例

try {
  inputDevice.getKeyboardRepeatDelay().then((delay: Number) => {
    console.log(`Get keyboard repeat delay success`);
  });
} catch (error) {
  console.log(`Get keyboard repeat delay failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}

inputDevice.setKeyboardRepeatRate10+

setKeyboardRepeatRate(rate: number, callback: AsyncCallback&lt;void&gt;): void

设置键盘按键的重复速率,使用AsyncCallback异步方式返回结果。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

系统API:此接口为系统接口。

参数

参数名 类型 必填 说明
rate number 键盘按键重复速率,默认值50ms/次,调节范围[36ms/次,100ms/次]。
callback AsyncCallback&lt;void&gt; 回调函数。

示例

try {
  inputDevice.setKeyboardRepeatRate(60, (error: Error) => {
    if (error) {
      console.log(`Set keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
    console.log(`Set keyboard repeat rate success`);
  });
} catch (error) {
  console.log(`Set keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}

inputDevice.setKeyboardRepeatRate10+

setKeyboardRepeatRate(rate: number): Promise&lt;void&gt;

设置键盘按键的重复速率,使用Promise异步方式返回结果。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

系统API:此接口为系统接口。

参数

参数名 类型 必填 说明
rate number 键盘按键重复速率,默认值50ms/次,调节范围[36ms/次,100ms/次]。

返回值

参数 说明
Promise&lt;void&gt; Promise对象。

示例

try {
  inputDevice.setKeyboardRepeatRate(60).then(() => {
    console.log(`Set keyboard repeat rate success`);
  });
} catch (error) {
  console.log(`Set keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}

inputDevice.getKeyboardRepeatRate10+

getKeyboardRepeatRate(callback: AsyncCallback&lt;number&gt;): void

获取键盘按键的重复速率,使用AsyncCallback异步方式返回结果。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

系统API:此接口为系统接口。

参数

参数名 类型 必填 说明
callback AsyncCallback&lt;number&gt; 回调函数,异步返回键盘按键的重复速率。

示例

try {
  inputDevice.getKeyboardRepeatRate((error: Error, rate: Number) => {
    if (error) {
      console.log(`Get keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
    console.log(`Get keyboard repeat rate success`);
  });
} catch (error) {
  console.log(`Get keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}

inputDevice.getKeyboardRepeatRate10+

getKeyboardRepeatRate(): Promise&lt;number&gt;

获取键盘按键的重复速率,使用Promise异步方式返回结果。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

系统API:此接口为系统接口。

返回值

参数 说明
Promise&lt;number&gt; Promise实例,异步返回键盘按键的重复速率。

示例

try {
  inputDevice.getKeyboardRepeatRate().then((rate: Number) => {
    console.log(`Get keyboard repeat rate success`);
  });
} catch (error) {
  console.log(`Get keyboard repeat rate failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}

DeviceListener9+

输入设备热插拔的描述信息。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

名称 类型 可读 可写 说明
type ChangedType 输入设备插入或者移除。
deviceId number 输入设备的唯一标识,同一个物理设备反复插拔,设备id会发生变化。

InputDeviceData

输入设备的描述信息。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

名称 类型 可读 可写 说明
id number 输入设备的唯一标识,同一个物理设备反复插拔,设备id会发生变化。
name string 输入设备的名字。
sources Array&lt;SourceType&gt; 输入设备支持的源类型。比如有的键盘上附带触摸板,则此设备有keyboard和touchpad两种输入源。
axisRanges Array&lt;AxisRange&gt; 输入设备的轴信息。
bus9+ number 输入设备的总线类型。
product9+ number 输入设备的产品信息。
vendor9+ number 输入设备的厂商信息。
version9+ number 输入设备的版本信息。
phys9+ string 输入设备的物理地址。
uniq9+ string 输入设备的唯一标识。

AxisType9+

输入设备的轴类型。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

名称 类型 可读 可写 说明
touchmajor string 表示touchmajor轴。
touchminor string 表示touchminor轴。
toolminor string 表示toolminor轴。
toolmajor string 表示toolmajor轴。
orientation string 表示orientation轴。
pressure string 表示pressure轴。
x string 表示x轴。
y string 表示y轴。
null string 无。

AxisRange

输入设备的轴信息。

系统能力: SystemCapability.MultimodalInput.Input.InputDevice

名称 类型 可读 可写 说明
source SourceType 轴的输入源类型。
axis AxisType 轴的类型。
max number 轴的最大值。
min number 轴的最小值。
fuzz9+ number 轴的模糊值。
flat9+ number 轴的基准值。
resolution9+ number 轴的分辨率。

SourceType9+

轴的输入源类型。比如鼠标设备可上报x轴事件,则x轴的输入源就是鼠标。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

名称 类型 可读 可写 说明
keyboard string 表示输入设备是键盘。
touchscreen string 表示输入设备是触摸屏。
mouse string 表示输入设备是鼠标。
trackball string 表示输入设备是轨迹球。
touchpad string 表示输入设备是触摸板。
joystick string 表示输入设备是操纵杆。

ChangedType9+

定义监听设备热插拔事件。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

名称 类型 可读 可写 说明
add string 表示输入设备插入。
remove string 表示输入设备移除。

KeyboardType9+

定义键盘输入设备的类型。

系统能力:SystemCapability.MultimodalInput.Input.InputDevice

名称 说明
NONE 0 表示无按键设备。
UNKNOWN 1 表示未知按键设备。
ALPHABETIC_KEYBOARD 2 表示全键盘设备。
DIGITAL_KEYBOARD 3 表示小键盘设备。
HANDWRITING_PEN 4 表示手写笔设备。
REMOTE_CONTROL 5 表示遥控器设备。

你可能感兴趣的鸿蒙文章

harmony 鸿蒙接口

harmony 鸿蒙系统公共事件定义(待停用)

harmony 鸿蒙系统公共事件定义

harmony 鸿蒙开发说明

harmony 鸿蒙企业设备管理概述(仅对系统应用开放)

harmony 鸿蒙BundleStatusCallback

harmony 鸿蒙@ohos.bundle.innerBundleManager (innerBundleManager模块)

harmony 鸿蒙@ohos.distributedBundle (分布式包管理)

harmony 鸿蒙@ohos.bundle (Bundle模块)

harmony 鸿蒙@ohos.enterprise.EnterpriseAdminExtensionAbility (企业设备管理扩展能力)

0  赞