1 Star 0 Fork 619

Far / multimodalinput_input

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 4.76 KB
一键复制 编辑 原始数据 按行查看 历史
hiweil 提交于 2022-06-08 16:45 . 修改注入接口md文件

multimodalinput_input

Introduction

The 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.

Directory Structure

/foundation/multimodalinput/input
├── interfaces                   # External APIs
│   └── native                   # Native APIs
│       └── innerkits            # Native APIs provided for internal subsystems
├── service                      # Service framework code
├── sa_profile                   # Service startup configuration file
├── uinput                       # Input event injection module

Usage

Available APIs

Available APIs of Multimodal Input are event injection ones, which are open only to system apps currently.

  • The inputEventClient class provides methods for processing injection events.

    Table 1 Major APIs in inputEventClient

    Category

    API

    Description

    Event injection

    function injectEvent({KeyEvent: KeyEvent}): void;

    Injects events.

Usage Guidelines

Currently, only the BACK key event can be injected.

When 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:

// Import the required JavaScript API library.
import input from '@ohos.multimodalInput.inputEventClient'

// Call the API for injecting events.
var keyEvent = {
    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.
    code:2,                   // Keycode for the key, for example, 2 for the BACK key.
    keyDownDuration:10,       // Duration in which the current key is pressed down before it is released, in milliseconds.
};

var res = input.injectEvent({
    KeyEvent: keyEvent
});

NOTE: The new APIs must be compatible with the original capabilities.

Equipment Capability Support

device touch touchpad mouse keyboard
rk3568 Y Y Y Y
hi3516dv300 Y N N N

Repositories Involved

Multimodal input subsystem

multimodalinput_input

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yesiyuanjim/multimodalinput_input.git
git@gitee.com:yesiyuanjim/multimodalinput_input.git
yesiyuanjim
multimodalinput_input
multimodalinput_input
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891