• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 #ifndef STRUCT_MULTIMODAL_H
16 #define STRUCT_MULTIMODAL_H
17 
18 #include "proto.h"
19 
20 namespace OHOS {
21 namespace MMI {
22 inline constexpr int32_t MAX_DEVICENAME = 64;
23 inline constexpr int32_t MAX_UUIDSIZE = 64;
24 inline constexpr int32_t SYSTEMUID = 1000;
25 inline constexpr int32_t MAX_SOLTED_COORDS_NUMS = 10;
26 
27 enum SENIOR_DEVICE_TYPE {
28     INPUT_DEVICE_AISENSOR = 31,
29     INPUT_DEVICE_KNUCKLE = 41
30 };
31 
32 enum DEVICE_TYPE {
33     DEVICE_TYPE_UNKNOWN = -1,
34     DEVICE_TYPE_TOUCH_PANEL = 0,
35     DEVICE_TYPE_KEYBOARD = 1,
36     DEVICE_TYPE_MOUSE = 2,
37     DEVICE_TYPE_STYLUS = 3,
38     DEVICE_TYPE_BUILTIN_KEY = 4,
39     DEVICE_TYPE_ROTATION = 5,
40     DEVICE_TYPE_AI_SPEECH = 6,
41     DEVICE_TYPE_JOYSTICK = 7,
42     DEVICE_TYPE_TOUCHPAD = 8,
43     DEVICE_TYPE_KNUCKLE = 9,
44     DEVICE_TYPE_VIRTUAL_KEYBOARD = 10,
45 };
46 
47 enum BUTTON_STATE {
48     BUTTON_STATE_RELEASED = 0,
49     BUTTON_STATE_PRESSED = 1
50 };
51 
52 enum KEY_STATE {
53     KEY_STATE_RELEASED,
54     KEY_STATE_PRESSED
55 };
56 
57 enum POINTER_AXIS {
58     POINTER_AXIS_SCROLL_VERTICAL = 0,
59     POINTER_AXIS_SCROLL_HORIZONTAL = 1,
60 };
61 
62 enum POINTER_AXIS_SOURCE {
63     POINTER_AXIS_SOURCE_WHEEL = 1,
64     POINTER_AXIS_SOURCE_FINGER,
65     POINTER_AXIS_SOURCE_CONTINUOUS,
66     POINTER_AXIS_SOURCE_WHEEL_TILT,
67 };
68 
69 enum TABLE_TOOL_TYPE {
70     TABLET_TOOL_TYPE_PEN = 1,
71     TABLET_TOOL_TYPE_ERASER,
72     TABLET_TOOL_TYPE_BRUSH,
73     TABLET_TOOL_TYPE_PENCIL,
74     TABLET_TOOL_TYPE_AIRBRUSH,
75     TABLET_TOOL_TYPE_MOUSE,
76     TABLET_TOOL_TYPE_LENS,
77     TABLET_TOOL_TYPE_TOTEM,
78 };
79 
80 enum TABLE_TOOL_PROXIMITY_STATE {
81     TABLET_TOOL_PROXIMITY_STATE_OUT = 0,
82     TABLET_TOOL_PROXIMITY_STATE_IN = 1,
83 };
84 
85 enum TABLE_TOOL_TIP_STATE {
86     TABLET_TOOL_TIP_UP = 0,
87     TABLET_TOOL_TIP_DOWN = 1,
88 };
89 
90 enum POINT_EVENT_TYPE {
91     EVENT_TYPE_INVALID = 0,
92     PRIMARY_POINT_DOWN = 1,
93     PRIMARY_POINT_UP = 2,
94     POINT_MOVE = 3,
95     OTHER_POINT_DOWN = 4,
96     OTHER_POINT_UP = 5,
97 };
98 
99 enum TABLET_PAD_RING_AXIS_SOURCE {
100     TABLET_PAD_RING_SOURCE_UNKNOWN = 1,
101     TABLET_PAD_RING_SOURCE_FINGER,
102 };
103 
104 enum TABLET_PAD_STRIP_AXIS_SOURCE {
105     TABLET_PAD_STRIP_SOURCE_UNKNOWN = 1,
106     TABLET_PAD_STRIP_SOURCE_FINGER,
107 };
108 
109 enum MOUSE_ICON {
110     DEFAULT = 0,
111     EAST = 1,
112     WEST = 2,
113     SOUTH = 3,
114     NORTH = 4,
115     WEST_EAST = 5,
116     NORTH_SOUTH = 6,
117     NORTH_EAST = 7,
118     NORTH_WEST = 8,
119     SOUTH_EAST = 9,
120     SOUTH_WEST = 10,
121     NORTH_EAST_SOUTH_WEST = 11,
122     NORTH_WEST_SOUTH_EAST = 12,
123     CROSS = 13,
124     CURSOR_COPY = 14,
125     CURSOR_FORBID = 15,
126     COLOR_SUCKER = 16,
127     HAND_GRABBING = 17,
128     HAND_OPEN = 18,
129     HAND_POINTING = 19,
130     HELP = 20,
131     CURSOR_MOVE = 21,
132     RESIZE_LEFT_RIGHT = 22,
133     RESIZE_UP_DOWN = 23,
134     SCREENSHOT_CHOOSE = 24,
135     SCREENSHOT_CURSOR = 25,
136     TEXT_CURSOR = 26,
137     ZOOM_IN = 27,
138     ZOOM_OUT = 28,
139     MIDDLE_BTN_EAST = 29,
140     MIDDLE_BTN_WEST = 30,
141     MIDDLE_BTN_SOUTH = 31,
142     MIDDLE_BTN_NORTH = 32,
143     MIDDLE_BTN_NORTH_SOUTH = 33,
144     MIDDLE_BTN_NORTH_EAST = 34,
145     MIDDLE_BTN_NORTH_WEST = 35,
146     MIDDLE_BTN_SOUTH_EAST = 36,
147     MIDDLE_BTN_SOUTH_WEST = 37,
148     MIDDLE_BTN_NORTH_SOUTH_WEST_EAST = 38,
149 };
150 
151 enum ICON_TYPE {
152     ANGLE_E = 0,
153     ANGLE_S = 1,
154     ANGLE_W = 2,
155     ANGLE_N = 3,
156     ANGLE_SE = 4,
157     ANGLE_NE = 5,
158     ANGLE_SW = 6,
159     ANGLE_NW = 7,
160     ANGLE_CENTER = 8,
161 };
162 
163 struct IconStyle {
164     int32_t alignmentWay { 0 };
165     std::string iconPath;
166 };
167 
168 #pragma pack(1)
169 struct TagPackHead {
170     MmiMessageId idMsg;
171     int32_t sizeEvent[1];
172 };
173 #pragma pack()
174 
175 struct SeniorDeviceInfo {
176     char physical[MAX_DEVICENAME];
177     enum SENIOR_DEVICE_TYPE seniorDeviceType;
178 };
179 
180 struct EventJoyStickAxisAbsInfo {
181     int32_t code;
182     int32_t value;
183     int32_t minimum;
184     int32_t maximum;
185     int32_t fuzz;
186     int32_t flat;
187     int32_t resolution;
188     float standardValue;
189     bool isChanged;
190 };
191 
192 struct EventJoyStickAxis {
193     int32_t deviceId;
194     char physical[MAX_DEVICENAME];
195     char deviceName[MAX_DEVICENAME];
196     DEVICE_TYPE deviceType;
197     int32_t eventType;
198     char uuid[MAX_UUIDSIZE];
199     int64_t time;
200     EventJoyStickAxisAbsInfo abs_throttle;
201     EventJoyStickAxisAbsInfo abs_hat0x;
202     EventJoyStickAxisAbsInfo abs_hat0y;
203     EventJoyStickAxisAbsInfo abs_x;
204     EventJoyStickAxisAbsInfo abs_y;
205     EventJoyStickAxisAbsInfo abs_z;
206     EventJoyStickAxisAbsInfo abs_rx;
207     EventJoyStickAxisAbsInfo abs_ry;
208     EventJoyStickAxisAbsInfo abs_rz;
209     EventJoyStickAxisAbsInfo abs_wheel;
210 };
211 
212 struct NormalizedCoords {
213     double x {};
214     double y {};
215 };
216 
217 struct PhysicalCoordinate {
218     double x {};
219     double y {};
220 };
221 
222 struct LogicalCoordinate {
223     int32_t x {};
224     int32_t y {};
225 };
226 
227 struct LogicalRectangle {
228     LogicalCoordinate point;
229     int32_t width;
230     int32_t height;
231 };
232 
233 struct TiltDegrees {
234     double x {};
235     double y {};
236 };
237 
238 struct PhysEllipsis {
239     double major {};
240     double minor {};
241 };
242 
243 struct Threshold {
244     int32_t upper {};
245     int32_t lower {};
246 };
247 
248 struct WinInfo {
249     int32_t windowPid {};
250     int32_t windowId {};
251 };
252 
253 struct RegisteredEvent {
254     int32_t deviceId {};
255     char uuid[MAX_UUIDSIZE] {};
256     int32_t eventType {};
257     int64_t occurredTime {};
258     DEVICE_TYPE deviceType;
259     char physical[MAX_DEVICENAME] {};
260 };
261 
262 struct StandardTouchStruct {
263     int64_t time {};
264     uint32_t msgType {};
265     int32_t buttonType {};
266     int32_t buttonCount {};
267     int32_t buttonState {};
268     int32_t reRventType {};
269     int32_t curRventType {};
270     int32_t tipState {};
271     double x {};
272     double y {};
273 };
274 
275 struct EventKeyboard {
276     int32_t deviceId {};
277     char physical[MAX_DEVICENAME] {};
278     char deviceName[MAX_DEVICENAME] {};
279     DEVICE_TYPE deviceType;
280     int32_t eventType {};
281     char uuid[MAX_UUIDSIZE] {};
282     int64_t time {};
283     int32_t key {};
284     uint32_t seat_key_count {};
285     enum KEY_STATE state;
286     int32_t unicode {};
287     bool isIntercepted { true };
288 };
289 
290 struct EventPointer {
291     int32_t deviceId {};
292     char physical[MAX_DEVICENAME] {};
293     char deviceName[MAX_DEVICENAME] {};
294     DEVICE_TYPE deviceType;
295     int32_t eventType {};
296     char uuid[MAX_UUIDSIZE] {};
297     int64_t time {};
298     NormalizedCoords delta;
299     PhysicalCoordinate deltaRaw;
300     PhysicalCoordinate absolute;
301     PhysicalCoordinate discrete;
302     int32_t button {};
303     int32_t seatButtonCount {};
304     enum BUTTON_STATE state;
305     enum POINTER_AXIS_SOURCE source;
306     enum POINTER_AXIS axis;
307 };
308 
309 struct Pointer {
310     PhysicalCoordinate absolute;
311 };
312 
313 struct TabletAxes {
314     PhysicalCoordinate point;
315     NormalizedCoords delta;
316     double distance {};
317     double pressure {};
318     TiltDegrees tilt;
319     double rotation {};
320     double slider {};
321     double wheel {};
322     int32_t wheel_discrete {};
323     PhysEllipsis size;
324 };
325 
326 struct TabletTool {
327     uint32_t serial {};
328     uint32_t tool_id {};
329     enum TABLE_TOOL_TYPE type;
330 };
331 
332 struct EventTabletTool {
333     int32_t deviceId {};
334     char physical[MAX_DEVICENAME] {};
335     char deviceName[MAX_DEVICENAME] {};
336     DEVICE_TYPE deviceType;
337     int32_t eventType {};
338     char uuid[MAX_UUIDSIZE] {};
339     uint32_t button {};
340     enum BUTTON_STATE state;
341     uint32_t seat_button_count {};
342     int64_t time {};
343     TabletAxes axes;
344     TabletTool tool;
345     enum TABLE_TOOL_PROXIMITY_STATE proximity_state;
346     enum TABLE_TOOL_TIP_STATE tip_state;
347 };
348 
349 struct EventTouch {
350     int32_t deviceId {};
351     char physical[MAX_DEVICENAME] {};
352     char deviceName[MAX_DEVICENAME] {};
353     char uuid[MAX_UUIDSIZE] {};
354     int32_t eventType {};
355     int64_t time {};
356     int32_t slot {};
357     int32_t seatSlot {};
358     LogicalCoordinate point;
359     LogicalRectangle toolRect;
360     DEVICE_TYPE deviceType;
361     double pressure {};
362     double area {};
363 };
364 
365 struct SlotedCoords {
366     bool isActive {};
367     float x {};
368     float y {};
369 };
370 
371 struct SlotedCoordsInfo {
372     SlotedCoords coords[MAX_SOLTED_COORDS_NUMS];
373     uint32_t activeCount {};
374 };
375 
376 struct EventGesture {
377     int32_t deviceId {};
378     char physical[MAX_DEVICENAME] {};
379     char deviceName[MAX_DEVICENAME] {};
380     DEVICE_TYPE deviceType;
381     int32_t eventType {};
382     char uuid[MAX_UUIDSIZE] {};
383     int64_t time {};
384     int32_t fingerCount {};
385     int32_t cancelled {};
386     NormalizedCoords delta;
387     NormalizedCoords deltaUnaccel;
388     SlotedCoordsInfo soltTouches;
389     double scale {};
390     double angle {};
391     int32_t pointerEventType {};
392 };
393 
394 struct RawInputEvent {
395     uint32_t stamp {};
396     uint32_t ev_type {};
397     uint32_t ev_code {};
398     uint32_t ev_value {};
399 };
400 
401 struct TestSurfaceData {
402     int32_t screenId {};
403     int32_t onLayerId {};
404     int32_t surfaceId {};
405     int32_t opacity {};
406     int32_t visibility {};
407     int32_t srcX {};
408     int32_t srcY {};
409     int32_t srcW {};
410     int32_t srcH {};
411 };
412 
413 struct VirtualKey {
414     bool isPressed {};
415     int32_t keyCode {};
416     int64_t keyDownDuration {};
417     bool isIntercepted { true };
418 };
419 
420 struct DeviceManage {
421     uint32_t deviceId {};
422     char physical[MAX_DEVICENAME] {};
423     char deviceName[MAX_DEVICENAME] {};
424     DEVICE_TYPE deviceType;
425     int32_t eventType {};
426     char uuid[MAX_UUIDSIZE] {};
427 };
428 
429 struct EventTabletPad {
430     uint32_t deviceId {};
431     char physical[MAX_DEVICENAME] {};
432     char deviceName[MAX_DEVICENAME] {};
433     DEVICE_TYPE deviceType;
434     int32_t eventType {};
435     char uuid[MAX_UUIDSIZE] {};
436     int64_t time {};
437     uint32_t mode {};
438     struct {
439         uint32_t number {};
440         enum BUTTON_STATE state;
441     } button;
442     struct {
443         uint32_t code {};
444         enum KEY_STATE state;
445     } key;
446     struct {
447         enum TABLET_PAD_RING_AXIS_SOURCE source;
448         double position {};
449         int32_t number {};
450     } ring;
451     struct {
452         enum TABLET_PAD_STRIP_AXIS_SOURCE source;
453         double position {};
454         int32_t number {};
455     } strip;
456 };
457 } // namespace MMI
458 } // namespace OHOS
459 #endif // STRUCT_MULTIMODAL_H