README.md
1# multimodalinput\_input<a name="EN-US_TOPIC_0000001147497185"></a>
2
3- [Introduction](#section11660541593)
4- [Directory Structure](#section14408467105)
5- [Usage](#section18111235161011)
6 - [Available APIs](#section86358081116)
7 - [Usage Guidelines](#section789634518111)
8 - [Equipment Capability Support](#section789634518112)
9
10- [Repositories Involved](#section135327891219)
11
12## Introduction<a name="section11660541593"></a>
13
14The module of this repository is applied on the basis of standard systems to provide devices with single-touch input capabilities. This module reports touch events to the JS UI framework or application framework, which then encapsulates the events and provides APIs for apps.
15
16## Directory Structure<a name="section14408467105"></a>
17
18```
19/foundation/multimodalinput/input
20├── interfaces # External APIs
21│ └── native # Native APIs
22│ └── innerkits # Native APIs provided for internal subsystems
23├── service # Service framework code
24├── sa_profile # Service startup configuration file
25├── uinput # Input event injection module
26```
27
28## Usage<a name="section18111235161011"></a>
29
30### Available APIs<a name="section86358081116"></a>
31
32Available APIs of Multimodal Input are event injection ones, which are open only to system apps currently.
33
34- The **inputEventClient** class provides methods for processing injection events.
35
36 **Table 1** Major APIs in inputEventClient
37
38 <a name="t49c6a8df29a143a98ef6f66f43c7eac8"></a>
39 <table><thead align="left"><tr id="rf815506c67654ad4ac014b339ee3292d"><th class="cellrowborder" valign="top" width="15.031503150315032%" id="mcps1.2.4.1.1"><p id="a59bc0498281e498289e11d5e584eb293"><a name="a59bc0498281e498289e11d5e584eb293"></a><a name="a59bc0498281e498289e11d5e584eb293"></a>Category</p>
40 </th>
41 <th class="cellrowborder" valign="top" width="23.152315231523154%" id="mcps1.2.4.1.2"><p id="aa1226795522e4609b6b1d210255beeff"><a name="aa1226795522e4609b6b1d210255beeff"></a><a name="aa1226795522e4609b6b1d210255beeff"></a>API</p>
42 </th>
43 <th class="cellrowborder" valign="top" width="61.816181618161814%" id="mcps1.2.4.1.3"><p id="a34777ce8d3174036ba45b9fd51dc4848"><a name="a34777ce8d3174036ba45b9fd51dc4848"></a><a name="a34777ce8d3174036ba45b9fd51dc4848"></a>Description</p>
44 </th>
45 </tr>
46 </thead>
47 <tbody><tr id="ra7599f41f04548858a77e2062aad2cf5"><td class="cellrowborder" valign="top" width="15.031503150315032%" headers="mcps1.2.4.1.1 "><p id="a63ab1186072d4bcdb32d4e11b9243b57"><a name="a63ab1186072d4bcdb32d4e11b9243b57"></a><a name="a63ab1186072d4bcdb32d4e11b9243b57"></a>Event injection</p>
48 </td>
49 <td class="cellrowborder" valign="top" width="23.152315231523154%" headers="mcps1.2.4.1.2 "><p id="a3d9b89df15074475a45ed26503e22c21"><a name="a3d9b89df15074475a45ed26503e22c21"></a><a name="a3d9b89df15074475a45ed26503e22c21"></a>function injectEvent({KeyEvent: KeyEvent}): void;</p>
50 </td>
51 <td class="cellrowborder" valign="top" width="61.816181618161814%" headers="mcps1.2.4.1.3 "><p id="a33c82952289f40a09773ce2fed14f6aa"><a name="a33c82952289f40a09773ce2fed14f6aa"></a><a name="a33c82952289f40a09773ce2fed14f6aa"></a>Injects events.</p>
52 </td>
53 </tr>
54 </tbody>
55 </table>
56
57
58### Usage Guidelines<a name="section789634518111"></a>
59
60Currently, only the **BACK** key event can be injected.
61
62When a system app needs to return to the previous directory, you can call the API to inject the **BACK** key event to Multimodal Input, which then transfers this event to the system app, thereby achieving the return effect. The example code is as follows:
63
64```
65// Import the required JavaScript API library.
66import input from '@ohos.multimodalInput.inputEventClient'
67
68// Call the API for injecting events.
69var keyEvent = {
70 isPressed:true, // Action type of the key event. true indicates that the key is being pressed down, and false indicates that the key is being released.
71 code:2, // Keycode for the key, for example, 2 for the BACK key.
72 keyDownDuration:10, // Duration in which the current key is pressed down before it is released, in milliseconds.
73};
74
75var res = input.injectEvent({
76 KeyEvent: keyEvent
77});
78```
79
80> **NOTE:**
81>The new APIs must be compatible with the original capabilities.
82
83### Equipment Capability Support<a name="section789634518112"></a>
84
85| device | touch | touchpad | mouse | keyboard |
86| :---------: | :---: | :------: | :---: | :------: |
87| rk3568 | Y | Y | Y | Y |
88| hi3516dv300 | Y | N | N | N |
89
90## Repositories Involved<a name="section135327891219"></a>
91
92Multimodal input subsystem
93
94**multimodalinput\_input**
95
96