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