提交 10a94c3d 编写于 作者: M mayunteng_1

示例修改

Signed-off-by: Nmayunteng_1 <mayunteng@huawei.com>
Change-Id: Ifeaedf9eb5e5c2fb30b480873bd11650c06b7f3c
上级 fdc763f6
......@@ -38,10 +38,10 @@ inputDevice.on("change", (data) => {
console.log("type: " + data.type + ", deviceId: " + data.deviceId);
inputDevice.getKeyboardType(data.deviceId, (ret) => {
console.log("The keyboard type of the device is: " + ret);
if (ret == 2 && data.type == 'add') {
if (ret == KeyboardType.ALPHABETIC_KEYBOARD && data.type == 'add') {
// 监听物理键盘已连接。
isPhysicalKeyboardExist = true;
} else if (ret == 2 && data.type == 'remove') {
} else if (ret == KeyboardType.ALPHABETIC_KEYBOARD && data.type == 'remove') {
// 监听物理键盘已断开。
isPhysicalKeyboardExist = false;
}
......@@ -382,4 +382,4 @@ inputDevice.getKeyboardType().then((ret)=>{
| ALPHABETIC_KEYBOARD | number | 2 | 表示全键盘设备。 |
| DIGITAL_KEYBOARD | number | 3 | 表示小键盘设备。 |
| HANDWRITING_PEN | number | 4 | 表示手写笔设备。 |
| REMOTE_CONTROL | number | 5 | 表示遥控器设备。 |
\ No newline at end of file
| REMOTE_CONTROL | number | 5 | 表示遥控器设备。 |
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册