• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 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 * @addtogroup HdiInput
18 * @{
19 *
20 * @brief Provides APIs for the upper-layer input service.
21 *
22 * Using the APIs provided by the Input module, input service developers can implement the following functions:
23 * enabling or disabling input devices, obtaining input events, querying device information, registering callback
24 * functions, and managing the feature status.
25 *
26 * @since 3.2
27 * @version 1.0
28 */
29
30/**
31 * @file InputTypes.idl
32 *
33 * @brief Defines input device-specific data types.
34 *
35 * This module defines the structures used by the driver APIs for the input service, including the device information,
36 * device attributes, and device capabilities.
37 *
38 * @since 3.2
39 * @version 1.0
40 */
41
42/**
43 * @brief Defines the package path of the Input module APIs.
44 *
45 * @since 3.2
46 * @version 1.0
47 */
48package ohos.hdi.input.v1_0;
49
50/**
51 * @brief Describes the input device.
52 */
53struct DevDesc {
54    unsigned int devIndex;        /**< Device index */
55    unsigned int devType;         /**< Device type */
56};
57
58/**
59 * @brief Describes identification information of the input device.
60 */
61struct DevIdentify {
62    unsigned short busType;       /**< Bus type */
63    unsigned short vendor;        /**< Vendor ID */
64    unsigned short product;       /**< Product ID */
65    unsigned short version;       /**< Version */
66};
67
68/**
69 * @brief Describes dimension information of the input device.
70 */
71struct DimensionInfo {
72    int axis;             /**< Axis */
73    int min;              /**< Minimum value of each coordinate */
74    int max;              /**< Maximum value of each coordinate */
75    int fuzz;             /**< Resolution of each coordinate */
76    int flat;             /**< Reference value of each coordinate */
77    int range;            /**< Range */
78};
79
80/**
81 * @brief Describes input device attributes.
82 */
83struct DevAttr {
84    String devName;                      /**< Device name */
85    struct DevIdentify id;               /**< Device identification information */
86    struct DimensionInfo[] axisInfo;     /**< Device dimension information */
87};
88
89/**
90 * @brief Describes the input device ability for storing bitmaps that record supported event types.
91 *
92 * A bit is used to indicate the type of events that can be reported by the input device.
93 *
94 */
95struct DevAbility {
96    unsigned long[] devProp;         /**< Device properties */
97    unsigned long[] eventType;       /**< Bitmap for recording the supported event types */
98    unsigned long[] absCode;         /**< Bitmap for recording the supported absolute coordinates */
99    unsigned long[] relCode;         /**< Bitmap for recording the supported relative coordinates */
100    unsigned long[] keyCode;         /**< Bitmap for recording the supported keycodes */
101    unsigned long[] ledCode;         /**< Bitmap for recording the supported indicators */
102    unsigned long[] miscCode;        /**< Bitmap for recording other supported functions */
103    unsigned long[] soundCode;       /**< Bitmap for recording supported sounds or alerts */
104    unsigned long[] forceCode;       /**< Bitmap for recording the supported force functions */
105    unsigned long[] switchCode;      /**< Bitmap for recording the supported switch functions */
106    unsigned long[] keyType;         /**< Bitmap of the key type */
107    unsigned long[] ledType;         /**< Bitmap of the LED type */
108    unsigned long[] soundType;       /**< Bitmap of the sound type */
109    unsigned long[] switchType;      /**< Bitmap of the switch type */
110};
111
112/**
113 * @brief Describes basic device information of the input device.
114 */
115struct DeviceInfo {
116    unsigned int devIndex;           /**< Device index */
117    unsigned int devType;            /**< Device type */
118    String chipInfo;                 /**< Driver chip information */
119    String vendorName;               /**< Module vendor name */
120    String chipName;                 /**< Driver chip name */
121    struct DevAttr attrSet;          /**< Device attributes */
122    struct DevAbility abilitySet;    /**< Device abilities */
123};
124
125/**
126 * @brief Defines the data structure of the extra command.
127 */
128struct ExtraCmd {
129    String cmdCode;     /**< Command code */
130    String cmdValue;    /**< Data transmitted in the command */
131};
132
133/**
134 * @brief Defines the data packet structure for hot plug events.
135 */
136struct HotPlugEvent {
137    unsigned int devIndex;      /**< Device index */
138    unsigned int devType;       /**< Device type */
139    unsigned int status;        /**< Device status 1: offline 0: online */
140};
141
142/**
143 * @brief Defines the data packet structure for input events.
144 */
145struct EventPackage {
146    unsigned int type;          /**< Type of the input event */
147    unsigned int code;          /**< Specific code item of the input event */
148    int value;                  /**< Value corresponding to the input event code */
149    unsigned long timestamp;    /**< Timestamp corresponding to the input event */
150};
151/** @} */
152