# 多模输入标准系统组件
- [简介](#section11660541593)
- [目录](#section14408467105)
- [使用](#section18111235161011)
- [接口说明](#section86358081116)
- [使用说明](#section789634518111)
- [设备能力支持](#section789634518112)
- [相关仓](#section135327891219)
## 简介
本组件应用于标准系统之上,为设备提供单指触控输入能力。本组件将触屏输入产生的事件上报到JS UI框架或用户程序框架,JS UI框架根据上报的事件再次封装,对应用提供接口。
## 目录
```
/foundation/multimodalinput/input
├── interfaces # 对外接口存放目录
│ └── native # 对外native层接口存放目录
│ └── innerkits # 对系统内部子系统提供native层接口存放目录
├── service # 服务框架代码
├── sa_profile # 服务启动配置文件
├── uinput # 输入事件注入模块
```
## 使用
### 接口说明
多模输入目前提供的接口为事件注入接口,该接口目前仅对系统应用开放。
- inputEventClient是处理注入事件类。
**表 1** inputEventClient的主要接口
功能分类
|
接口名
|
描述
|
事件注入接口
|
function injectEvent({KeyEvent: KeyEvent}): void;
|
注入按键事件的接口
|
### 使用说明
当前仅提供了BACK按键的事件注入。
当系统应用需要返回上一层时,通过注入接口将BACK键注入到多模服务,多模服务再上传到应用,以实现返回到上一层级目录的效果。使用方式如下所示:
```
// 引入提供的js接口库
import input from '@ohos.multimodalInput.inputEventClient'
// 调用注入事件接口
var keyEvent = {
isPressed:true, // 按键事件的按键类型:true:down false:up
code:2, // 按键对应的keycode, 例如back键的值为2
keyDownDuration:10, // 按键按下到抬起的时长,单位ms
};
var res = input.injectEvent({
KeyEvent: keyEvent
});
```
> **说明:**
>新增的接口能力需要兼容原有的能力。
### 设备能力支持
| 设备 | 触摸屏 | 触摸板 | 鼠标 | 键盘 |
| :---------: | :----: | :----: | :--: | :--: |
| rk3568 | Y | Y | Y | Y |
| hi3516dv300 | Y | N | N | N |
## 相关仓
多模输入子系统
**multimodalinput\_input**