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