• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * Global Key Event Injection
18 *
19 * @namespace inputEventClient
20 * @syscap SystemCapability.MultimodalInput.Input.InputSimulator
21 * @systemapi hide for inner use
22 * @since 8
23 */
24declare namespace inputEventClient {
25  /**
26   * Defines event of key that user want to inject.
27   *
28   * @interface KeyEvent
29   * @syscap SystemCapability.MultimodalInput.Input.InputSimulator
30   * @systemapi hide for inner use
31   * @since 8
32   */
33  interface KeyEvent {
34    /**
35     * The status of key.
36     *
37     * @syscap SystemCapability.MultimodalInput.Input.InputSimulator
38     * @systemapi hide for inner use
39     * @since 8
40     */
41    isPressed: boolean;
42
43    /**
44     * The keyCode value of key.
45     *
46     * @syscap SystemCapability.MultimodalInput.Input.InputSimulator
47     * @systemapi hide for inner use
48     * @since 8
49     */
50    keyCode: number;
51
52    /**
53     * Key hold duration.
54     *
55     * @syscap SystemCapability.MultimodalInput.Input.InputSimulator
56     * @systemapi hide for inner use
57     * @since 8
58     */
59    keyDownDuration: number;
60
61    /**
62     * Whether the key is blocked.
63     *
64     * @syscap SystemCapability.MultimodalInput.Input.InputSimulator
65     * @systemapi hide for inner use
66     * @since 8
67     */
68    isIntercepted: boolean;
69  }
70
71  /**
72   * Inject system keys.
73   *
74   * @param { { KeyEvent } } KeyEvent - the key event to be injected.
75   * @throws { BusinessError } 401 - Parameter error.
76   * @syscap SystemCapability.MultimodalInput.Input.InputSimulator
77   * @systemapi hide for inner use
78   * @since 8
79   */
80  function injectEvent({ KeyEvent: KeyEvent }): void;
81}
82
83export default inputEventClient;
84