1 /* 2 * Copyright (c) 2021-2025 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 KEY_EVENT_H 17 #define KEY_EVENT_H 18 19 #include <optional> 20 #include "parcel.h" 21 22 #include "input_event.h" 23 24 namespace OHOS { 25 namespace MMI { 26 class KeyEvent : public InputEvent { 27 public: 28 /** 29 * Unknown function key 30 * 31 * @since 9 32 */ 33 static const int32_t UNKNOWN_FUNCTION_KEY; 34 35 /** 36 * Num Lock key 37 * 38 * @since 9 39 */ 40 static const int32_t NUM_LOCK_FUNCTION_KEY; 41 42 /** 43 * Caps Lock key 44 * 45 * @since 9 46 */ 47 static const int32_t CAPS_LOCK_FUNCTION_KEY; 48 49 /** 50 * Scroll Lock key 51 * 52 * @since 9 53 */ 54 static const int32_t SCROLL_LOCK_FUNCTION_KEY; 55 56 /** 57 * Function (Fn) key 58 * 59 * @since 9 60 */ 61 static const int32_t KEYCODE_FN; 62 63 /** 64 * Unknown keycode 65 * 66 * 67 * @since 9 68 */ 69 static const int32_t KEYCODE_UNKNOWN; 70 71 /** 72 * Home key 73 * <p>This key is processed by the framework and will never be sent to the application. 74 * 75 * @since 9 76 */ 77 static const int32_t KEYCODE_HOME; 78 79 /** 80 * Back key 81 * 82 * @since 9 83 */ 84 static const int32_t KEYCODE_BACK; 85 86 /** 87 * Call key 88 * 89 * @since 9 90 */ 91 static const int32_t KEYCODE_CALL; 92 93 /** 94 * End Call key 95 * 96 * @since 9 97 */ 98 static const int32_t KEYCODE_ENDCALL; 99 100 /** 101 * Clear key 102 * 103 * @since 9 104 */ 105 static const int32_t KEYCODE_CLEAR; 106 107 /** 108 * Headset Hook key 109 * <p>This key is used to end a call and stop media. 110 * 111 * @since 9 112 */ 113 static const int32_t KEYCODE_HEADSETHOOK; 114 115 /** 116 * Focus key 117 * <p>This key is used to enable focus for the camera. 118 * 119 * @since 9 120 */ 121 static const int32_t KEYCODE_FOCUS; 122 123 /** 124 * Notification key 125 * 126 * @since 9 127 */ 128 static const int32_t KEYCODE_NOTIFICATION; 129 130 /** 131 * Search key 132 * 133 * @since 9 134 */ 135 static const int32_t KEYCODE_SEARCH; 136 137 /** 138 * Play/Pause media key 139 * 140 * @since 9 141 */ 142 static const int32_t KEYCODE_MEDIA_PLAY_PAUSE; 143 144 /** 145 * Stop media key 146 * 147 * @since 9 148 */ 149 static const int32_t KEYCODE_MEDIA_STOP; 150 151 /** 152 * Play Next media key 153 * 154 * @since 9 155 */ 156 static const int32_t KEYCODE_MEDIA_NEXT; 157 158 /** 159 * Play Previous media key 160 * 161 * @since 9 162 */ 163 static const int32_t KEYCODE_MEDIA_PREVIOUS; 164 165 /** 166 * Rewind media key 167 * 168 * @since 9 169 */ 170 static const int32_t KEYCODE_MEDIA_REWIND; 171 172 /** 173 * Fast Forward media key 174 * 175 * @since 9 176 */ 177 static const int32_t KEYCODE_MEDIA_FAST_FORWARD; 178 179 /** 180 * Volume Up key 181 * 182 * @since 9 183 */ 184 static const int32_t KEYCODE_VOLUME_UP; 185 186 /** 187 * Volume Down key 188 * 189 * @since 9 190 */ 191 static const int32_t KEYCODE_VOLUME_DOWN; 192 193 /** 194 * Power key 195 * 196 * @since 9 197 */ 198 static const int32_t KEYCODE_POWER; 199 200 /** 201 * Remote Power KeyCode 202 * 203 * @since 9 204 */ 205 static const int32_t KEYCODE_REMOTE_POWER; 206 207 /** 208 * Camera key 209 * <p>This key is used to start the camera or take photos. 210 * 211 * @since 9 212 */ 213 static const int32_t KEYCODE_CAMERA; 214 215 /** 216 * Voice Assistant key 217 * <p>This key is used to wake up the voice assistant. 218 * 219 * @since 9 220 */ 221 static const int32_t KEYCODE_VOICE_ASSISTANT; 222 223 /** 224 * Custom key 1 225 * <p>The actions mapping to the custom keys are user-defined. 226 * Key values 521-529 are reserved for custom keys. 227 * 228 * @since 9 229 */ 230 static const int32_t KEYCODE_CUSTOM1; 231 232 /** 233 * Volume Mute key 234 * 235 * @since 9 236 */ 237 static const int32_t KEYCODE_VOLUME_MUTE; 238 239 /** 240 * Mute key 241 * 242 * @since 9 243 */ 244 static const int32_t KEYCODE_MUTE; 245 246 /** 247 * Brightness Up key 248 * 249 * @since 9 250 */ 251 static const int32_t KEYCODE_BRIGHTNESS_UP; 252 253 /** 254 * Brightness Down key 255 * 256 * @since 9 257 */ 258 static const int32_t KEYCODE_BRIGHTNESS_DOWN; 259 260 /** 261 * General-purpose key 1 on wearables 262 * 263 * @since 3 264 */ 265 static const int32_t KEYCODE_WEAR_1; 266 267 /** 268 * Number 0 key 269 * 270 * @since 9 271 */ 272 static const int32_t KEYCODE_0; 273 274 /** 275 * Number 1 key 276 * 277 * @since 9 278 */ 279 static const int32_t KEYCODE_1; 280 281 /** 282 * Number 2 key 283 * 284 * @since 9 285 */ 286 static const int32_t KEYCODE_2; 287 288 /** 289 * Number 3 key 290 * 291 * @since 9 292 */ 293 static const int32_t KEYCODE_3; 294 295 /** 296 * Number 4 key 297 * 298 * @since 9 299 */ 300 static const int32_t KEYCODE_4; 301 302 /** 303 * Number 5 key 304 * 305 * @since 9 306 */ 307 static const int32_t KEYCODE_5; 308 309 /** 310 * Number 6 key 311 * 312 * @since 9 313 */ 314 static const int32_t KEYCODE_6; 315 316 /** 317 * Number 7 key 318 * 319 * @since 9 320 */ 321 static const int32_t KEYCODE_7; 322 323 /** 324 * Number 8 key 325 * 326 * @since 9 327 */ 328 static const int32_t KEYCODE_8; 329 330 /** 331 * Number 9 key 332 * 333 * @since 9 334 */ 335 static const int32_t KEYCODE_9; 336 337 /** 338 * Star (*) key 339 * 340 * @since 9 341 */ 342 static const int32_t KEYCODE_STAR; 343 344 /** 345 * Pound (#) key 346 * 347 * @since 9 348 */ 349 static const int32_t KEYCODE_POUND; 350 351 /** 352 * Directional Pad Up key 353 * <p>This key may be synthesized from trackball motions. 354 * 355 * @since 9 356 */ 357 static const int32_t KEYCODE_DPAD_UP; 358 359 /** 360 * Directional Pad Down key 361 * <p>This key may be synthesized from trackball motions. 362 * 363 * @since 9 364 */ 365 static const int32_t KEYCODE_DPAD_DOWN; 366 367 /** 368 * Directional Pad Left key 369 * <p>This key may be synthesized from trackball motions. 370 * 371 * @since 9 372 */ 373 static const int32_t KEYCODE_DPAD_LEFT; 374 375 /** 376 * Directional Pad Right key 377 * <p>This key may be synthesized from trackball motions. 378 * 379 * @since 9 380 */ 381 static const int32_t KEYCODE_DPAD_RIGHT; 382 383 /** 384 * Directional Pad Center key 385 * <p>This key may be synthesized from trackball motions. 386 * 387 * @since 9 388 */ 389 static const int32_t KEYCODE_DPAD_CENTER; 390 391 /** 392 * Letter A key 393 * 394 * @since 9 395 */ 396 static const int32_t KEYCODE_A; 397 398 /** 399 * Letter B key 400 * 401 * @since 9 402 */ 403 static const int32_t KEYCODE_B; 404 405 /** 406 * Letter C key 407 * 408 * @since 9 409 */ 410 static const int32_t KEYCODE_C; 411 412 /** 413 * Letter D key 414 * 415 * @since 9 416 */ 417 static const int32_t KEYCODE_D; 418 419 /** 420 * Letter E key 421 * 422 * @since 9 423 */ 424 static const int32_t KEYCODE_E; 425 426 /** 427 * Letter F key 428 * 429 * @since 9 430 */ 431 static const int32_t KEYCODE_F; 432 433 /** 434 * Letter G key 435 * 436 * @since 9 437 */ 438 static const int32_t KEYCODE_G; 439 440 /** 441 * Letter H key 442 * 443 * @since 9 444 */ 445 static const int32_t KEYCODE_H; 446 447 /** 448 * Letter I key 449 * 450 * @since 9 451 */ 452 static const int32_t KEYCODE_I; 453 454 /** 455 * Letter J key 456 * 457 * @since 9 458 */ 459 static const int32_t KEYCODE_J; 460 461 /** 462 * Letter K key 463 * 464 * @since 9 465 */ 466 static const int32_t KEYCODE_K; 467 468 /** 469 * Letter L key 470 * 471 * @since 9 472 */ 473 static const int32_t KEYCODE_L; 474 475 /** 476 * Letter M key 477 * 478 * @since 9 479 */ 480 static const int32_t KEYCODE_M; 481 482 /** 483 * Letter N key 484 * 485 * @since 9 486 */ 487 static const int32_t KEYCODE_N; 488 489 /** 490 * Letter O key 491 * 492 * @since 9 493 */ 494 static const int32_t KEYCODE_O; 495 496 /** 497 * Letter P key 498 * 499 * @since 9 500 */ 501 static const int32_t KEYCODE_P; 502 503 /** 504 * Letter Q key 505 * 506 * @since 9 507 */ 508 static const int32_t KEYCODE_Q; 509 510 /** 511 * Letter R key 512 * 513 * @since 9 514 */ 515 static const int32_t KEYCODE_R; 516 517 /** 518 * Letter S key 519 * 520 * @since 9 521 */ 522 static const int32_t KEYCODE_S; 523 524 /** 525 * Letter T key 526 * 527 * @since 9 528 */ 529 static const int32_t KEYCODE_T; 530 531 /** 532 * Letter U key 533 * 534 * @since 9 535 */ 536 static const int32_t KEYCODE_U; 537 538 /** 539 * Letter V key 540 * 541 * @since 9 542 */ 543 static const int32_t KEYCODE_V; 544 545 /** 546 * Letter W key 547 * 548 * @since 9 549 */ 550 static const int32_t KEYCODE_W; 551 552 /** 553 * Letter X key 554 * 555 * @since 9 556 */ 557 static const int32_t KEYCODE_X; 558 559 /** 560 * Letter Y key 561 * 562 * @since 9 563 */ 564 static const int32_t KEYCODE_Y; 565 566 /** 567 * Letter Z key 568 * 569 * @since 9 570 */ 571 static const int32_t KEYCODE_Z; 572 573 /** 574 * Semicolon (;) key 575 * 576 * @since 9 577 */ 578 static const int32_t KEYCODE_COMMA; 579 580 /** 581 * Period (.) key 582 * 583 * @since 9 584 */ 585 static const int32_t KEYCODE_PERIOD; 586 587 /** 588 * Left Alt modifier key 589 * 590 * @since 9 591 */ 592 static const int32_t KEYCODE_ALT_LEFT; 593 594 /** 595 * Right Alt modifier key 596 * 597 * @since 9 598 */ 599 static const int32_t KEYCODE_ALT_RIGHT; 600 601 /** 602 * Left Shift modifier key 603 * 604 * @since 9 605 */ 606 static const int32_t KEYCODE_SHIFT_LEFT; 607 608 /** 609 * Right Shift modifier key 610 * 611 * @since 9 612 */ 613 static const int32_t KEYCODE_SHIFT_RIGHT; 614 615 /** 616 * Tab key 617 * 618 * @since 9 619 */ 620 static const int32_t KEYCODE_TAB; 621 622 /** 623 * Space key 624 * 625 * @since 9 626 */ 627 static const int32_t KEYCODE_SPACE; 628 629 /** 630 * Symbol modifier key 631 * <p>This key is used to input alternate symbols. 632 * 633 * @since 9 634 */ 635 static const int32_t KEYCODE_SYM; 636 637 /** 638 * Explorer function key 639 * <p>This key is used to launch a browser application. 640 * 641 * @since 9 642 */ 643 static const int32_t KEYCODE_EXPLORER; 644 645 /** 646 * Email function key 647 * <p>This key is used to launch an email application. 648 * 649 * @since 9 650 */ 651 static const int32_t KEYCODE_ENVELOPE; 652 653 /** 654 * Enter key 655 * 656 * @since 9 657 */ 658 static const int32_t KEYCODE_ENTER; 659 660 /** 661 * Backspace key 662 * <p>Unlike {@link #static const int32_t KEYCODE_FORWARD_DEL}, 663 * this key is used to delete characters before the insertion point. 664 * 665 * @since 9 666 */ 667 static const int32_t KEYCODE_DEL; 668 669 /** 670 * Backtick (') key 671 * 672 * @since 9 673 */ 674 static const int32_t KEYCODE_GRAVE; 675 676 /** 677 * Minus (-) key 678 * 679 * @since 9 680 */ 681 static const int32_t KEYCODE_MINUS; 682 683 /** 684 * Equals (=) key 685 * 686 * @since 9 687 */ 688 static const int32_t KEYCODE_EQUALS; 689 690 /** 691 * Left bracket ([) key 692 * 693 * @since 9 694 */ 695 static const int32_t KEYCODE_LEFT_BRACKET; 696 697 /** 698 * Right bracket (]) key 699 * 700 * @since 9 701 */ 702 static const int32_t KEYCODE_RIGHT_BRACKET; 703 704 /** 705 * Backslash (\) key 706 * 707 * @since 9 708 */ 709 static const int32_t KEYCODE_BACKSLASH; 710 711 /** 712 * Semicolon (;) key 713 * 714 * @since 9 715 */ 716 static const int32_t KEYCODE_SEMICOLON; 717 718 /** 719 * Apostrophe (') key 720 * 721 * @since 9 722 */ 723 static const int32_t KEYCODE_APOSTROPHE; 724 725 /** 726 * Slash (/) key 727 * 728 * @since 9 729 */ 730 static const int32_t KEYCODE_SLASH; 731 732 /** 733 * At (@) key 734 * 735 * @since 9 736 */ 737 static const int32_t KEYCODE_AT; 738 739 /** 740 * Plus (+) key 741 * 742 * @since 9 743 */ 744 static const int32_t KEYCODE_PLUS; 745 746 /** 747 * Menu key 748 * 749 * @since 9 750 */ 751 static const int32_t KEYCODE_MENU; 752 753 /** 754 * Page Up key 755 * 756 * @since 9 757 */ 758 static const int32_t KEYCODE_PAGE_UP; 759 760 /** 761 * Page Down key 762 * 763 * @since 9 764 */ 765 static const int32_t KEYCODE_PAGE_DOWN; 766 767 /** 768 * Escape key 769 * 770 * @since 9 771 */ 772 static const int32_t KEYCODE_ESCAPE; 773 774 /** 775 * Forward Delete key 776 * <p>Unlike {@link #static const int32_t KEYCODE_DEL}, 777 * this key is used to delete characters ahead of the insertion point. 778 * 779 * @since 9 780 */ 781 static const int32_t KEYCODE_FORWARD_DEL; 782 783 /** 784 * Left Control modifier key 785 * 786 * @since 9 787 */ 788 static const int32_t KEYCODE_CTRL_LEFT; 789 790 /** 791 * Right Control modifier key 792 * 793 * @since 9 794 */ 795 static const int32_t KEYCODE_CTRL_RIGHT; 796 797 /** 798 * Caps Lock key 799 * 800 * @since 9 801 */ 802 static const int32_t KEYCODE_CAPS_LOCK; 803 804 /** 805 * Scroll Lock key 806 * 807 * @since 9 808 */ 809 static const int32_t KEYCODE_SCROLL_LOCK; 810 811 /** 812 * Left Meta modifier key 813 * 814 * @since 9 815 */ 816 static const int32_t KEYCODE_META_LEFT; 817 818 /** 819 * Right Meta modifier key 820 * 821 * @since 9 822 */ 823 static const int32_t KEYCODE_META_RIGHT; 824 825 /** 826 * Function modifier key 827 * 828 * @since 9 829 */ 830 static const int32_t KEYCODE_FUNCTION; 831 832 /** 833 * System Request/Print Screen key 834 * 835 * @since 9 836 */ 837 static const int32_t KEYCODE_SYSRQ; 838 839 /** 840 * Break/Pause key 841 * 842 * @since 9 843 */ 844 static const int32_t KEYCODE_BREAK; 845 846 /** 847 * Home Movement key 848 * <p>This key is used to scroll or move the cursor around to the start of a line or to the 849 * top of a list. 850 * 851 * @since 9 852 */ 853 static const int32_t KEYCODE_MOVE_HOME; 854 855 /** 856 * End Movement key 857 * <p>This key is used to scroll or move the cursor around to the end of a line or to the 858 * bottom of a list. 859 * 860 * @since 9 861 */ 862 static const int32_t KEYCODE_MOVE_END; 863 864 /** 865 * Insert key 866 * <p>This key is used to toggle the insert or overwrite edit mode. 867 * 868 * @since 9 869 */ 870 static const int32_t KEYCODE_INSERT; 871 872 /** 873 * Forward key 874 * <p>This key is used to navigate forward in the history stack. 875 * It is a complement of {@link #static const int32_t KEYCODE_BACK}. 876 * 877 * @since 9 878 */ 879 static const int32_t KEYCODE_FORWARD; 880 881 /** 882 * Play media key 883 * 884 * @since 9 885 */ 886 static const int32_t KEYCODE_MEDIA_PLAY; 887 888 /** 889 * Pause media key 890 * 891 * @since 9 892 */ 893 static const int32_t KEYCODE_MEDIA_PAUSE; 894 895 /** 896 * Close media key 897 * <p>This key can be used to close a CD tray, for example. 898 * 899 * @since 9 900 */ 901 static const int32_t KEYCODE_MEDIA_CLOSE; 902 903 /** 904 * Eject media key 905 * <p>This key can be used to eject a CD tray, for example. 906 * 907 * @since 9 908 */ 909 static const int32_t KEYCODE_MEDIA_EJECT; 910 911 /** 912 * Record media key 913 * 914 * @since 9 915 */ 916 static const int32_t KEYCODE_MEDIA_RECORD; 917 918 /** 919 * F1 key 920 * 921 * @since 9 922 */ 923 static const int32_t KEYCODE_F1; 924 925 /** 926 * F2 key 927 * 928 * @since 9 929 */ 930 static const int32_t KEYCODE_F2; 931 932 /** 933 * F3 key 934 * 935 * @since 9 936 */ 937 static const int32_t KEYCODE_F3; 938 939 /** 940 * F4 key 941 * 942 * @since 9 943 */ 944 static const int32_t KEYCODE_F4; 945 946 /** 947 * F5 key 948 * 949 * @since 9 950 */ 951 static const int32_t KEYCODE_F5; 952 953 /** 954 * F6 key 955 * 956 * @since 9 957 */ 958 static const int32_t KEYCODE_F6; 959 960 /** 961 * F7 key 962 * 963 * @since 9 964 */ 965 static const int32_t KEYCODE_F7; 966 967 /** 968 * F8 key 969 * 970 * @since 9 971 */ 972 static const int32_t KEYCODE_F8; 973 974 /** 975 * F9 key 976 * 977 * @since 9 978 */ 979 static const int32_t KEYCODE_F9; 980 981 /** 982 * F10 key 983 * 984 * @since 9 985 */ 986 static const int32_t KEYCODE_F10; 987 988 /** 989 * F11 key 990 * 991 * @since 9 992 */ 993 static const int32_t KEYCODE_F11; 994 995 /** 996 * F12 key 997 * 998 * @since 9 999 */ 1000 static const int32_t KEYCODE_F12; 1001 1002 /** 1003 * Number Lock key 1004 * <p>This key is used to alter the behavior of other keys on the numeric keypad. 1005 * 1006 * @since 9 1007 */ 1008 static const int32_t KEYCODE_NUM_LOCK; 1009 1010 /** 1011 * Number 0 key on the numeric keypad 1012 * 1013 * @since 9 1014 */ 1015 static const int32_t KEYCODE_NUMPAD_0; 1016 1017 /** 1018 * Number 1 key on the numeric keypad 1019 * 1020 * @since 9 1021 */ 1022 static const int32_t KEYCODE_NUMPAD_1; 1023 1024 /** 1025 * Number 2 key on the numeric keypad 1026 * 1027 * @since 9 1028 */ 1029 static const int32_t KEYCODE_NUMPAD_2; 1030 1031 /** 1032 * Number 3 key on the numeric keypad 1033 * 1034 * @since 9 1035 */ 1036 static const int32_t KEYCODE_NUMPAD_3; 1037 1038 /** 1039 * Number 4 key on the numeric keypad 1040 * 1041 * @since 9 1042 */ 1043 static const int32_t KEYCODE_NUMPAD_4; 1044 1045 /** 1046 * Number 5 key on the numeric keypad 1047 * 1048 * @since 9 1049 */ 1050 static const int32_t KEYCODE_NUMPAD_5; 1051 1052 /** 1053 * Number 6 key on the numeric keypad 1054 * 1055 * @since 9 1056 */ 1057 static const int32_t KEYCODE_NUMPAD_6; 1058 1059 /** 1060 * Number 7 key on the numeric keypad 1061 * 1062 * @since 9 1063 */ 1064 static const int32_t KEYCODE_NUMPAD_7; 1065 1066 /** 1067 * Number 8 key on the numeric keypad 1068 * 1069 * @since 9 1070 */ 1071 static const int32_t KEYCODE_NUMPAD_8; 1072 1073 /** 1074 * Number 9 key on the numeric keypad 1075 * 1076 * @since 9 1077 */ 1078 static const int32_t KEYCODE_NUMPAD_9; 1079 1080 /** 1081 * Slash (/) key (for division) on the numeric keypad 1082 * 1083 * @since 9 1084 */ 1085 static const int32_t KEYCODE_NUMPAD_DIVIDE; 1086 1087 /** 1088 * Star (*) key (for multiplication) on the numeric keypad 1089 * 1090 * @since 9 1091 */ 1092 static const int32_t KEYCODE_NUMPAD_MULTIPLY; 1093 1094 /** 1095 * Minus (-) key (for subtraction) on the numeric keypad 1096 * 1097 * @since 9 1098 */ 1099 static const int32_t KEYCODE_NUMPAD_SUBTRACT; 1100 1101 /** 1102 * Plus (+) key (for addition) on the numeric keypad 1103 * 1104 * @since 9 1105 */ 1106 static const int32_t KEYCODE_NUMPAD_ADD; 1107 1108 /** 1109 * Dot (.) key (for decimals or digit grouping) on the 1110 * numeric keypad 1111 * 1112 * @since 9 1113 */ 1114 static const int32_t KEYCODE_NUMPAD_DOT; 1115 1116 /** 1117 * Comma (,) key (for decimals or digit grouping) on the 1118 * numeric keypad 1119 * 1120 * @since 9 1121 */ 1122 static const int32_t KEYCODE_NUMPAD_COMMA; 1123 1124 /** 1125 * Enter key on the numeric keypad 1126 * 1127 * @since 9 1128 */ 1129 static const int32_t KEYCODE_NUMPAD_ENTER; 1130 1131 /** 1132 * Equals (=) key on the numeric keypad 1133 * 1134 * @since 9 1135 */ 1136 static const int32_t KEYCODE_NUMPAD_EQUALS; 1137 1138 /** 1139 * Left parentheses (() key on the numeric keypad 1140 * 1141 * @since 9 1142 */ 1143 static const int32_t KEYCODE_NUMPAD_LEFT_PAREN; 1144 1145 /** 1146 * Right parentheses ()) key on the numeric keypad 1147 * 1148 * @since 9 1149 */ 1150 static const int32_t KEYCODE_NUMPAD_RIGHT_PAREN; 1151 1152 /** 1153 * Virtual multitask key 1154 * 1155 * @since 9 1156 */ 1157 static const int32_t KEYCODE_VIRTUAL_MULTITASK; 1158 1159 /** 1160 * Button A on the gamepad 1161 * 1162 * @since 9 1163 */ 1164 static const int32_t KEYCODE_BUTTON_A; 1165 1166 /** 1167 * Button B on the gamepad 1168 * 1169 * @since 9 1170 */ 1171 static const int32_t KEYCODE_BUTTON_B; 1172 1173 /** 1174 * Button C on the gamepad 1175 * 1176 * @since 9 1177 */ 1178 static const int32_t KEYCODE_BUTTON_C; 1179 1180 /** 1181 * Button X on the gamepad 1182 * 1183 * @since 9 1184 */ 1185 static const int32_t KEYCODE_BUTTON_X; 1186 1187 /** 1188 * Button Y on the gamepad 1189 * 1190 * @since 9 1191 */ 1192 static const int32_t KEYCODE_BUTTON_Y; 1193 1194 /** 1195 * Button Z on the gamepad 1196 * 1197 * @since 9 1198 */ 1199 static const int32_t KEYCODE_BUTTON_Z; 1200 1201 /** 1202 * Button L1 on the gamepad 1203 * 1204 * @since 9 1205 */ 1206 static const int32_t KEYCODE_BUTTON_L1; 1207 1208 /** 1209 * Button R1 on the gamepad 1210 * 1211 * @since 9 1212 */ 1213 static const int32_t KEYCODE_BUTTON_R1; 1214 1215 /** 1216 * Button L2 on the gamepad 1217 * 1218 * @since 9 1219 */ 1220 static const int32_t KEYCODE_BUTTON_L2; 1221 1222 /** 1223 * Button R2 on the gamepad 1224 * 1225 * @since 9 1226 */ 1227 static const int32_t KEYCODE_BUTTON_R2; 1228 1229 /** 1230 * Select button on the gamepad 1231 * 1232 * @since 9 1233 */ 1234 static const int32_t KEYCODE_BUTTON_SELECT; 1235 1236 /** 1237 * Start button on the gamepad 1238 * 1239 * @since 9 1240 */ 1241 static const int32_t KEYCODE_BUTTON_START; 1242 1243 /** 1244 * Mode button on the gamepad 1245 * 1246 * @since 9 1247 */ 1248 static const int32_t KEYCODE_BUTTON_MODE; 1249 1250 /** 1251 * Left Thumb button on the gamepad 1252 * 1253 * @since 9 1254 */ 1255 static const int32_t KEYCODE_BUTTON_THUMBL; 1256 1257 /** 1258 * Right Thumb button on the gamepad 1259 * 1260 * @since 9 1261 */ 1262 static const int32_t KEYCODE_BUTTON_THUMBR; 1263 1264 /** 1265 * Trigger button on the joystick 1266 * 1267 * @since 9 1268 */ 1269 static const int32_t KEYCODE_BUTTON_TRIGGER; 1270 1271 /** 1272 * Thumb button on the joystick 1273 * 1274 * @since 9 1275 */ 1276 static const int32_t KEYCODE_BUTTON_THUMB; 1277 1278 /** 1279 * Thumb button 2 on the joystick 1280 * 1281 * @since 9 1282 */ 1283 static const int32_t KEYCODE_BUTTON_THUMB2; 1284 1285 /** 1286 * Top button on the joystick 1287 * 1288 * @since 9 1289 */ 1290 static const int32_t KEYCODE_BUTTON_TOP; 1291 1292 /** 1293 * Top button 2 on the joystick 1294 * 1295 * @since 9 1296 */ 1297 static const int32_t KEYCODE_BUTTON_TOP2; 1298 1299 /** 1300 * Pinkie button on the joystick 1301 * 1302 * @since 9 1303 */ 1304 static const int32_t KEYCODE_BUTTON_PINKIE; 1305 1306 /** 1307 * Base button 1 on the joystick 1308 * 1309 * @since 9 1310 */ 1311 static const int32_t KEYCODE_BUTTON_BASE1; 1312 1313 /** 1314 * Base button 2 on the joystick 1315 * 1316 * @since 9 1317 */ 1318 static const int32_t KEYCODE_BUTTON_BASE2; 1319 1320 /** 1321 * Base button 3 on the joystick 1322 * 1323 * @since 9 1324 */ 1325 static const int32_t KEYCODE_BUTTON_BASE3; 1326 1327 /** 1328 * Base button 4 on the joystick 1329 * 1330 * @since 9 1331 */ 1332 static const int32_t KEYCODE_BUTTON_BASE4; 1333 1334 /** 1335 * Base button 5 on the joystick 1336 * 1337 * @since 9 1338 */ 1339 static const int32_t KEYCODE_BUTTON_BASE5; 1340 1341 /** 1342 * Base button 6 on the joystick 1343 * 1344 * @since 9 1345 */ 1346 static const int32_t KEYCODE_BUTTON_BASE6; 1347 1348 /** 1349 * Base button 7 on the joystick 1350 * 1351 * @since 9 1352 */ 1353 static const int32_t KEYCODE_BUTTON_BASE7; 1354 1355 /** 1356 * Base button 8 on the joystick 1357 * 1358 * @since 9 1359 */ 1360 static const int32_t KEYCODE_BUTTON_BASE8; 1361 1362 /** 1363 * Base button 9 on the joystick 1364 * 1365 * @since 9 1366 */ 1367 static const int32_t KEYCODE_BUTTON_BASE9; 1368 1369 /** 1370 * Dead button on the joystick 1371 * 1372 * @since 9 1373 */ 1374 static const int32_t KEYCODE_BUTTON_DEAD; 1375 1376 /** 1377 * List Menu key on keyboard 1378 * 1379 * @since 9 1380 */ 1381 static const int32_t KEYCODE_COMPOSE; 1382 1383 /** 1384 * Sleep key 1385 * 1386 * @since 9 1387 */ 1388 static const int32_t KEYCODE_SLEEP; 1389 1390 /** 1391 * Zenkaku_Hankaku, a Japanese modifier key that toggles between 1392 * Hankaku (half-width) and Zenkaku (full-width) characters 1393 * 1394 * @since 9 1395 */ 1396 static const int32_t KEYCODE_ZENKAKU_HANKAKU; 1397 1398 /** 1399 * 102nd key 1400 * 1401 * @since 9 1402 */ 1403 static const int32_t KEYCODE_102ND; 1404 1405 /** 1406 * Japanese Ro key 1407 * 1408 * @since 9 1409 */ 1410 static const int32_t KEYCODE_RO; 1411 1412 /** 1413 * Japanese katakana key 1414 * 1415 * @since 9 1416 */ 1417 static const int32_t KEYCODE_KATAKANA; 1418 1419 /** 1420 * Japanese hiragana key 1421 * 1422 * @since 9 1423 */ 1424 static const int32_t KEYCODE_HIRAGANA; 1425 1426 /** 1427 * Japanese conversion key 1428 * 1429 * @since 9 1430 */ 1431 static const int32_t KEYCODE_HENKAN; 1432 1433 /** 1434 * Japanese katakana/hiragana key 1435 * 1436 * @since 9 1437 */ 1438 static const int32_t KEYCODE_KATAKANA_HIRAGANA; 1439 1440 /** 1441 * Japanese non-conversion key 1442 * 1443 * @since 9 1444 */ 1445 static const int32_t KEYCODE_MUHENKAN; 1446 1447 /** 1448 * Line Feed key 1449 * 1450 * @since 9 1451 */ 1452 static const int32_t KEYCODE_LINEFEED; 1453 1454 /** 1455 * Macro key 1456 * 1457 * @since 9 1458 */ 1459 static const int32_t KEYCODE_MACRO; 1460 1461 /** 1462 * Plus/Minus key on the numeric keypad 1463 * 1464 * @since 9 1465 */ 1466 static const int32_t KEYCODE_NUMPAD_PLUSMINUS; 1467 1468 /** 1469 * Extension 1470 * 1471 * @since 9 1472 */ 1473 static const int32_t KEYCODE_SCALE; 1474 1475 /** 1476 * Japanese Hanguel key 1477 * 1478 * @since 9 1479 */ 1480 static const int32_t KEYCODE_HANGUEL; 1481 1482 /** 1483 * Japanese hanja key 1484 * 1485 * @since 9 1486 */ 1487 static const int32_t KEYCODE_HANJA; 1488 1489 /** 1490 * Japanese YEN key 1491 * 1492 * @since 9 1493 */ 1494 static const int32_t KEYCODE_YEN; 1495 1496 /** 1497 * Stop key 1498 * 1499 * @since 9 1500 */ 1501 static const int32_t KEYCODE_STOP; 1502 1503 /** 1504 * Again key 1505 * 1506 * @since 9 1507 */ 1508 static const int32_t KEYCODE_AGAIN; 1509 1510 /** 1511 * Props key 1512 * 1513 * @since 9 1514 */ 1515 static const int32_t KEYCODE_PROPS; 1516 1517 /** 1518 * Undo key 1519 * 1520 * @since 9 1521 */ 1522 static const int32_t KEYCODE_UNDO; 1523 1524 /** 1525 * Copy key 1526 * 1527 * @since 9 1528 */ 1529 static const int32_t KEYCODE_COPY; 1530 1531 /** 1532 * Open key 1533 * 1534 * @since 9 1535 */ 1536 static const int32_t KEYCODE_OPEN; 1537 1538 /** 1539 * Paste key 1540 * 1541 * @since 9 1542 */ 1543 static const int32_t KEYCODE_PASTE; 1544 1545 /** 1546 * Find key 1547 * 1548 * @since 9 1549 */ 1550 static const int32_t KEYCODE_FIND; 1551 1552 /** 1553 * Cut key 1554 * 1555 * @since 9 1556 */ 1557 static const int32_t KEYCODE_CUT; 1558 1559 /** 1560 * Help key 1561 * 1562 * @since 9 1563 */ 1564 static const int32_t KEYCODE_HELP; 1565 1566 /** 1567 * Calculate key 1568 * 1569 * @since 9 1570 */ 1571 static const int32_t KEYCODE_CALC; 1572 1573 /** 1574 * File key 1575 * 1576 * @since 9 1577 */ 1578 static const int32_t KEYCODE_FILE; 1579 1580 /** 1581 * Bookmarks key 1582 * 1583 * @since 9 1584 */ 1585 static const int32_t KEYCODE_BOOKMARKS; 1586 1587 /** 1588 * Next key 1589 * 1590 * @since 9 1591 */ 1592 static const int32_t KEYCODE_NEXT; 1593 1594 /** 1595 * Play/Pause key 1596 * 1597 * @since 9 1598 */ 1599 static const int32_t KEYCODE_PLAYPAUSE; 1600 1601 /** 1602 * Previous key 1603 * 1604 * @since 9 1605 */ 1606 static const int32_t KEYCODE_PREVIOUS; 1607 1608 /** 1609 * CD Stop key 1610 * 1611 * @since 9 1612 */ 1613 static const int32_t KEYCODE_STOPCD; 1614 1615 /** 1616 * Configuration key 1617 * 1618 * @since 9 1619 */ 1620 static const int32_t KEYCODE_CONFIG; 1621 1622 /** 1623 * Refresh key 1624 * 1625 * @since 9 1626 */ 1627 static const int32_t KEYCODE_REFRESH; 1628 1629 /** 1630 * Exit key 1631 * 1632 * @since 9 1633 */ 1634 static const int32_t KEYCODE_EXIT; 1635 1636 /** 1637 * Edit key 1638 * 1639 * @since 9 1640 */ 1641 static const int32_t KEYCODE_EDIT; 1642 1643 /** 1644 * Scroll Up key 1645 * 1646 * @since 9 1647 */ 1648 static const int32_t KEYCODE_SCROLLUP; 1649 1650 /** 1651 * Scroll Down key 1652 * 1653 * @since 9 1654 */ 1655 static const int32_t KEYCODE_SCROLLDOWN; 1656 1657 /** 1658 * New key 1659 * 1660 * @since 9 1661 */ 1662 static const int32_t KEYCODE_NEW; 1663 1664 /** 1665 * Redo key 1666 * 1667 * @since 9 1668 */ 1669 static const int32_t KEYCODE_REDO; 1670 1671 /** 1672 * Close key 1673 * 1674 * @since 9 1675 */ 1676 static const int32_t KEYCODE_CLOSE; 1677 1678 /** 1679 * Play key 1680 * 1681 * @since 9 1682 */ 1683 static const int32_t KEYCODE_PLAY; 1684 1685 /** 1686 * Bass boost key 1687 * 1688 * @since 9 1689 */ 1690 static const int32_t KEYCODE_BASSBOOST; 1691 1692 /** 1693 * Print key 1694 * 1695 * @since 9 1696 */ 1697 static const int32_t KEYCODE_PRINT; 1698 1699 /** 1700 * Chat key 1701 * 1702 * @since 9 1703 */ 1704 static const int32_t KEYCODE_CHAT; 1705 1706 /** 1707 * Finance key 1708 * 1709 * @since 9 1710 */ 1711 static const int32_t KEYCODE_FINANCE; 1712 1713 /** 1714 * Cancel key 1715 * 1716 * @since 9 1717 */ 1718 static const int32_t KEYCODE_CANCEL; 1719 1720 /** 1721 * Keyboard Illumination Toggle key 1722 * 1723 * @since 9 1724 */ 1725 static const int32_t KEYCODE_KBDILLUM_TOGGLE; 1726 1727 /** 1728 * Keyboard Illumination Down key 1729 * 1730 * @since 9 1731 */ 1732 static const int32_t KEYCODE_KBDILLUM_DOWN; 1733 1734 /** 1735 * Keyboard Illumination Up key 1736 * 1737 * @since 9 1738 */ 1739 static const int32_t KEYCODE_KBDILLUM_UP; 1740 1741 /** 1742 * Send key 1743 * 1744 * @since 9 1745 */ 1746 static const int32_t KEYCODE_SEND; 1747 1748 /** 1749 * Reply key 1750 * 1751 * @since 9 1752 */ 1753 static const int32_t KEYCODE_REPLY; 1754 1755 /** 1756 * Mail Forward key 1757 * 1758 * @since 9 1759 */ 1760 static const int32_t KEYCODE_FORWARDMAIL; 1761 1762 /** 1763 * Save key 1764 * 1765 * @since 9 1766 */ 1767 static const int32_t KEYCODE_SAVE; 1768 1769 /** 1770 * Documents key 1771 * 1772 * @since 9 1773 */ 1774 static const int32_t KEYCODE_DOCUMENTS; 1775 1776 /** 1777 * Next Video key 1778 * 1779 * @since 9 1780 */ 1781 static const int32_t KEYCODE_VIDEO_NEXT; 1782 1783 /** 1784 * Previous Video key 1785 * 1786 * @since 9 1787 */ 1788 static const int32_t KEYCODE_VIDEO_PREV; 1789 1790 /** 1791 * Brightness Cycle key 1792 * 1793 * @since 9 1794 */ 1795 static const int32_t KEYCODE_BRIGHTNESS_CYCLE; 1796 1797 /** 1798 * Brightness 0 key 1799 * 1800 * @since 9 1801 */ 1802 static const int32_t KEYCODE_BRIGHTNESS_ZERO; 1803 1804 /** 1805 * Display Off key 1806 * 1807 * @since 9 1808 */ 1809 static const int32_t KEYCODE_DISPLAY_OFF; 1810 1811 /** 1812 * Miscellaneous buttons on the gamepad 1813 * 1814 * @since 9 1815 */ 1816 static const int32_t KEYCODE_BTN_MISC; 1817 1818 /** 1819 * Go To key 1820 * 1821 * @since 9 1822 */ 1823 static const int32_t KEYCODE_GOTO; 1824 1825 /** 1826 * Info key 1827 * 1828 * @since 9 1829 */ 1830 static const int32_t KEYCODE_INFO; 1831 1832 /** 1833 * Program key 1834 * 1835 * @since 9 1836 */ 1837 static const int32_t KEYCODE_PROGRAM; 1838 1839 /** 1840 * Personal Video Recorder (PVR) key 1841 * 1842 * @since 9 1843 */ 1844 static const int32_t KEYCODE_PVR; 1845 1846 /** 1847 * Subtitle key 1848 * 1849 * @since 9 1850 */ 1851 static const int32_t KEYCODE_SUBTITLE; 1852 1853 /** 1854 * Full Screen key 1855 * 1856 * @since 9 1857 */ 1858 static const int32_t KEYCODE_FULL_SCREEN; 1859 1860 /** 1861 * Keyboard 1862 * 1863 * @since 9 1864 */ 1865 static const int32_t KEYCODE_KEYBOARD; 1866 1867 /** 1868 * Aspect Ratio key 1869 * 1870 * @since 9 1871 */ 1872 static const int32_t KEYCODE_ASPECT_RATIO; 1873 1874 /** 1875 * Port Control key 1876 * 1877 * @since 9 1878 */ 1879 static const int32_t KEYCODE_PC; 1880 1881 /** 1882 * TV key 1883 * 1884 * @since 9 1885 */ 1886 static const int32_t KEYCODE_TV; 1887 1888 /** 1889 * TV key 2 1890 * 1891 * @since 9 1892 */ 1893 static const int32_t KEYCODE_TV2; 1894 1895 /** 1896 * VCR key 1897 * 1898 * @since 9 1899 */ 1900 static const int32_t KEYCODE_VCR; 1901 1902 /** 1903 * VCR key 2 1904 * 1905 * @since 9 1906 */ 1907 static const int32_t KEYCODE_VCR2; 1908 1909 /** 1910 * SIM Application Toolkit (SAT) key 1911 * 1912 * @since 9 1913 */ 1914 static const int32_t KEYCODE_SAT; 1915 1916 /** 1917 * CD key 1918 * 1919 * @since 9 1920 */ 1921 static const int32_t KEYCODE_CD; 1922 1923 /** 1924 * Tape key 1925 * 1926 * @since 9 1927 */ 1928 static const int32_t KEYCODE_TAPE; 1929 1930 /** 1931 * Tuner key 1932 * 1933 * @since 9 1934 */ 1935 static const int32_t KEYCODE_TUNER; 1936 1937 /** 1938 * Player key 1939 * 1940 * @since 9 1941 */ 1942 static const int32_t KEYCODE_PLAYER; 1943 1944 /** 1945 * DVD key 1946 * 1947 * @since 9 1948 */ 1949 static const int32_t KEYCODE_DVD; 1950 1951 /** 1952 * Audio key 1953 * 1954 * @since 9 1955 */ 1956 static const int32_t KEYCODE_AUDIO; 1957 1958 /** 1959 * Video key 1960 * 1961 * @since 9 1962 */ 1963 static const int32_t KEYCODE_VIDEO; 1964 1965 /** 1966 * Memo key 1967 * 1968 * @since 9 1969 */ 1970 static const int32_t KEYCODE_MEMO; 1971 1972 /** 1973 * Calendar key 1974 * 1975 * @since 9 1976 */ 1977 static const int32_t KEYCODE_CALENDAR; 1978 1979 /** 1980 * Red indicator 1981 * 1982 * @since 9 1983 */ 1984 static const int32_t KEYCODE_RED; 1985 1986 /** 1987 * Green indicator 1988 * 1989 * @since 9 1990 */ 1991 static const int32_t KEYCODE_GREEN; 1992 1993 /** 1994 * Yellow indicator 1995 * 1996 * @since 9 1997 */ 1998 static const int32_t KEYCODE_YELLOW; 1999 2000 /** 2001 * Blue indicator 2002 * 2003 * @since 9 2004 */ 2005 static const int32_t KEYCODE_BLUE; 2006 2007 /** 2008 * Channel Up key 2009 * 2010 * @since 9 2011 */ 2012 static const int32_t KEYCODE_CHANNELUP; 2013 2014 /** 2015 * Channel Down key 2016 * 2017 * @since 9 2018 */ 2019 static const int32_t KEYCODE_CHANNELDOWN; 2020 2021 /** 2022 * Last key 2023 * 2024 * @since 9 2025 */ 2026 static const int32_t KEYCODE_LAST; 2027 2028 /** 2029 * Restart key 2030 * 2031 * @since 9 2032 */ 2033 static const int32_t KEYCODE_RESTART; 2034 2035 /** 2036 * Slow key 2037 * 2038 * @since 9 2039 */ 2040 static const int32_t KEYCODE_SLOW; 2041 2042 /** 2043 * Shuffle key 2044 * 2045 * @since 9 2046 */ 2047 static const int32_t KEYCODE_SHUFFLE; 2048 2049 /** 2050 * Videophone key 2051 * 2052 * @since 9 2053 */ 2054 static const int32_t KEYCODE_VIDEOPHONE; 2055 2056 /** 2057 * Games key 2058 * 2059 * @since 9 2060 */ 2061 static const int32_t KEYCODE_GAMES; 2062 2063 /** 2064 * Zoom In key 2065 * 2066 * @since 9 2067 */ 2068 static const int32_t KEYCODE_ZOOMIN; 2069 2070 /** 2071 * Zoom Out key 2072 * 2073 * @since 9 2074 */ 2075 static const int32_t KEYCODE_ZOOMOUT; 2076 2077 /** 2078 * Zoom Reset key 2079 * 2080 * @since 9 2081 */ 2082 static const int32_t KEYCODE_ZOOMRESET; 2083 2084 /** 2085 * Word Processor key 2086 * 2087 * @since 9 2088 */ 2089 static const int32_t KEYCODE_WORDPROCESSOR; 2090 2091 /** 2092 * Editor key 2093 * 2094 * @since 9 2095 */ 2096 static const int32_t KEYCODE_EDITOR; 2097 2098 /** 2099 * Spreadsheet key 2100 * 2101 * @since 9 2102 */ 2103 static const int32_t KEYCODE_SPREADSHEET; 2104 2105 /** 2106 * Graphics Editor key 2107 * 2108 * @since 9 2109 */ 2110 static const int32_t KEYCODE_GRAPHICSEDITOR; 2111 2112 /** 2113 * Presentation key 2114 * 2115 * @since 9 2116 */ 2117 static const int32_t KEYCODE_PRESENTATION; 2118 2119 /** 2120 * Database key 2121 * 2122 * @since 9 2123 */ 2124 static const int32_t KEYCODE_DATABASE; 2125 2126 /** 2127 * News key 2128 * 2129 * @since 9 2130 */ 2131 static const int32_t KEYCODE_NEWS; 2132 2133 /** 2134 * Voice mailbox 2135 * 2136 * @since 9 2137 */ 2138 static const int32_t KEYCODE_VOICEMAIL; 2139 2140 /** 2141 * Address Book key 2142 * 2143 * @since 9 2144 */ 2145 static const int32_t KEYCODE_ADDRESSBOOK; 2146 2147 /** 2148 * Messenger key 2149 * 2150 * @since 9 2151 */ 2152 static const int32_t KEYCODE_MESSENGER; 2153 2154 /** 2155 * Brightness Toggle key 2156 * 2157 * @since 9 2158 */ 2159 static const int32_t KEYCODE_BRIGHTNESS_TOGGLE; 2160 2161 /** 2162 * Spell Check key 2163 * 2164 * @since 9 2165 */ 2166 static const int32_t KEYCODE_SPELLCHECK; 2167 2168 /** 2169 * Coffee key 2170 * 2171 * @since 9 2172 */ 2173 static const int32_t KEYCODE_COFFEE; 2174 2175 /** 2176 * Media Repeat key 2177 * 2178 * @since 9 2179 */ 2180 static const int32_t KEYCODE_MEDIA_REPEAT; 2181 2182 /** 2183 * Images key 2184 * 2185 * @since 9 2186 */ 2187 static const int32_t KEYCODE_IMAGES; 2188 2189 /** 2190 * Button Configuration key 2191 * 2192 * @since 9 2193 */ 2194 static const int32_t KEYCODE_BUTTONCONFIG; 2195 2196 /** 2197 * Task Manager key 2198 * 2199 * @since 9 2200 */ 2201 static const int32_t KEYCODE_TASKMANAGER; 2202 2203 /** 2204 * Journal key 2205 * 2206 * @since 9 2207 */ 2208 static const int32_t KEYCODE_JOURNAL; 2209 2210 /** 2211 * Control Panel key 2212 * 2213 * @since 9 2214 */ 2215 static const int32_t KEYCODE_CONTROLPANEL; 2216 2217 /** 2218 * Application Select key 2219 * 2220 * @since 9 2221 */ 2222 static const int32_t KEYCODE_APPSELECT; 2223 2224 /** 2225 * Screen Saver key 2226 * 2227 * @since 9 2228 */ 2229 static const int32_t KEYCODE_SCREENSAVER; 2230 2231 /** 2232 * Assistant key 2233 * 2234 * @since 9 2235 */ 2236 static const int32_t KEYCODE_ASSISTANT; 2237 2238 /** 2239 * Next Keyboard Layout key 2240 * 2241 * @since 9 2242 */ 2243 static const int32_t KEYCODE_KBD_LAYOUT_NEXT; 2244 2245 /** 2246 * Minimum Brightness key 2247 * 2248 * @since 9 2249 */ 2250 static const int32_t KEYCODE_BRIGHTNESS_MIN; 2251 2252 /** 2253 * Maximum Brightness key 2254 * 2255 * @since 9 2256 */ 2257 static const int32_t KEYCODE_BRIGHTNESS_MAX; 2258 2259 /** 2260 * Keyboard Input Assist_Previous 2261 * 2262 * @since 9 2263 */ 2264 static const int32_t KEYCODE_KBDINPUTASSIST_PREV; 2265 2266 /** 2267 * Keyboard Input Assist_Next 2268 * 2269 * @since 9 2270 */ 2271 static const int32_t KEYCODE_KBDINPUTASSIST_NEXT; 2272 2273 /** 2274 * Keyboard Input Assist_Previous Group 2275 * 2276 * @since 9 2277 */ 2278 static const int32_t KEYCODE_KBDINPUTASSIST_PREVGROUP; 2279 2280 /** 2281 * Keyboard Input Assist_Next Group 2282 * 2283 * @since 9 2284 */ 2285 static const int32_t KEYCODE_KBDINPUTASSIST_NEXTGROUP; 2286 2287 /** 2288 * Keyboard Input Assist_Accept 2289 * 2290 * @since 9 2291 */ 2292 static const int32_t KEYCODE_KBDINPUTASSIST_ACCEPT; 2293 2294 /** 2295 * Keyboard Input Assist_Cancel 2296 * 2297 * @since 9 2298 */ 2299 static const int32_t KEYCODE_KBDINPUTASSIST_CANCEL; 2300 2301 /** 2302 * Front key 2303 * 2304 * @since 9 2305 */ 2306 static const int32_t KEYCODE_FRONT; 2307 2308 /** 2309 * Setup key 2310 * 2311 * @since 9 2312 */ 2313 static const int32_t KEYCODE_SETUP; 2314 2315 /** 2316 * Wakeup key 2317 * 2318 * @since 9 2319 */ 2320 static const int32_t KEYCODE_WAKEUP; 2321 2322 /** 2323 * Send File key 2324 * 2325 * @since 9 2326 */ 2327 static const int32_t KEYCODE_SENDFILE; 2328 2329 /** 2330 * Delete File key 2331 * 2332 * @since 9 2333 */ 2334 static const int32_t KEYCODE_DELETEFILE; 2335 2336 /** 2337 * File Transfer (XFER) key 2338 * 2339 * @since 9 2340 */ 2341 static const int32_t KEYCODE_XFER; 2342 2343 /** 2344 * Program key 1 2345 * 2346 * @since 9 2347 */ 2348 static const int32_t KEYCODE_PROG1; 2349 2350 /** 2351 * Program key 2 2352 * 2353 * @since 9 2354 */ 2355 static const int32_t KEYCODE_PROG2; 2356 2357 /** 2358 * MS-DOS key 2359 * 2360 * @since 9 2361 */ 2362 static const int32_t KEYCODE_MSDOS; 2363 2364 /** 2365 * Screen Lock key 2366 * 2367 * @since 9 2368 */ 2369 static const int32_t KEYCODE_SCREENLOCK; 2370 2371 /** 2372 * Direction Rotation Display key 2373 * 2374 * @since 9 2375 */ 2376 static const int32_t KEYCODE_DIRECTION_ROTATE_DISPLAY; 2377 2378 /** 2379 * Cycle Windows key 2380 * 2381 * @since 9 2382 */ 2383 static const int32_t KEYCODE_CYCLEWINDOWS; 2384 2385 /** 2386 * Computer key 2387 * 2388 * @since 9 2389 */ 2390 static const int32_t KEYCODE_COMPUTER; 2391 2392 /** 2393 * Eject Close CD key 2394 * 2395 * @since 9 2396 */ 2397 static const int32_t KEYCODE_EJECTCLOSECD; 2398 2399 /** 2400 * ISO key 2401 * 2402 * @since 9 2403 */ 2404 static const int32_t KEYCODE_ISO; 2405 2406 /** 2407 * Move key 2408 * 2409 * @since 9 2410 */ 2411 static const int32_t KEYCODE_MOVE; 2412 2413 /** 2414 * F13 key 2415 * 2416 * @since 9 2417 */ 2418 static const int32_t KEYCODE_F13; 2419 2420 /** 2421 * F14 key 2422 * 2423 * @since 9 2424 */ 2425 static const int32_t KEYCODE_F14; 2426 2427 /** 2428 * F15 key 2429 * 2430 * @since 9 2431 */ 2432 static const int32_t KEYCODE_F15; 2433 2434 /** 2435 * F16 key 2436 * 2437 * @since 9 2438 */ 2439 static const int32_t KEYCODE_F16; 2440 2441 /** 2442 * F17 key 2443 * 2444 * @since 9 2445 */ 2446 static const int32_t KEYCODE_F17; 2447 2448 /** 2449 * F18 key 2450 * 2451 * @since 9 2452 */ 2453 static const int32_t KEYCODE_F18; 2454 2455 /** 2456 * F19 key 2457 * 2458 * @since 9 2459 */ 2460 static const int32_t KEYCODE_F19; 2461 2462 /** 2463 * F20 key 2464 * 2465 * @since 9 2466 */ 2467 static const int32_t KEYCODE_F20; 2468 2469 /** 2470 * F21 key 2471 * 2472 * @since 9 2473 */ 2474 static const int32_t KEYCODE_F21; 2475 2476 /** 2477 * F22 key 2478 * 2479 * @since 9 2480 */ 2481 static const int32_t KEYCODE_F22; 2482 2483 /** 2484 * F23 key 2485 * 2486 * @since 9 2487 */ 2488 static const int32_t KEYCODE_F23; 2489 2490 /** 2491 * F24 key 2492 * 2493 * @since 9 2494 */ 2495 static const int32_t KEYCODE_F24; 2496 2497 /** 2498 * Program key 3 2499 * 2500 * @since 9 2501 */ 2502 static const int32_t KEYCODE_PROG3; 2503 2504 /** 2505 * Program key 4 2506 * 2507 * @since 9 2508 */ 2509 static const int32_t KEYCODE_PROG4; 2510 2511 /** 2512 * Dashboard key 2513 * 2514 * @since 9 2515 */ 2516 static const int32_t KEYCODE_DASHBOARD; 2517 2518 /** 2519 * Suspend key 2520 * 2521 * @since 9 2522 */ 2523 static const int32_t KEYCODE_SUSPEND; 2524 2525 /** 2526 * Higher Order Path key 2527 * 2528 * @since 9 2529 */ 2530 static const int32_t KEYCODE_HP; 2531 2532 /** 2533 * Sound key 2534 * 2535 * @since 9 2536 */ 2537 static const int32_t KEYCODE_SOUND; 2538 2539 /** 2540 * Question key 2541 * 2542 * @since 9 2543 */ 2544 static const int32_t KEYCODE_QUESTION; 2545 2546 /** 2547 * Connect key 2548 * 2549 * @since 9 2550 */ 2551 static const int32_t KEYCODE_CONNECT; 2552 2553 /** 2554 * Sport key 2555 * 2556 * @since 9 2557 */ 2558 static const int32_t KEYCODE_SPORT; 2559 2560 /** 2561 * Shop key 2562 * 2563 * @since 9 2564 */ 2565 static const int32_t KEYCODE_SHOP; 2566 2567 /** 2568 * Alterase key 2569 * 2570 * @since 9 2571 */ 2572 static const int32_t KEYCODE_ALTERASE; 2573 2574 /** 2575 * Enable/Disable Video Mode key 2576 * 2577 * @since 9 2578 */ 2579 static const int32_t KEYCODE_SWITCHVIDEOMODE; 2580 2581 /** 2582 * Battery key 2583 * 2584 * @since 9 2585 */ 2586 static const int32_t KEYCODE_BATTERY; 2587 2588 /** 2589 * Bluetooth key 2590 * 2591 * @since 9 2592 */ 2593 static const int32_t KEYCODE_BLUETOOTH; 2594 2595 /** 2596 * WLAN key 2597 * 2598 * @since 9 2599 */ 2600 static const int32_t KEYCODE_WLAN; 2601 2602 /** 2603 * Ultra-wideband (UWB) key 2604 * 2605 * @since 9 2606 */ 2607 static const int32_t KEYCODE_UWB; 2608 2609 /** 2610 * WWAN WiMAX key 2611 * 2612 * @since 9 2613 */ 2614 static const int32_t KEYCODE_WWAN_WIMAX; 2615 2616 /** 2617 * RF Kill key 2618 * 2619 * @since 9 2620 */ 2621 static const int32_t KEYCODE_RFKILL; 2622 2623 /** 2624 * Channel key 2625 * 2626 * @since 9 2627 */ 2628 static const int32_t KEYCODE_CHANNEL; 2629 2630 /** 2631 * Button 0 2632 * 2633 * @since 9 2634 */ 2635 static const int32_t KEYCODE_BTN_0; 2636 2637 /** 2638 * Button 1 2639 * 2640 * @since 9 2641 */ 2642 static const int32_t KEYCODE_BTN_1; 2643 2644 /** 2645 * Button 2 2646 * 2647 * @since 9 2648 */ 2649 static const int32_t KEYCODE_BTN_2; 2650 2651 /** 2652 * Button 3 2653 * 2654 * @since 9 2655 */ 2656 static const int32_t KEYCODE_BTN_3; 2657 2658 /** 2659 * Button 4 2660 * 2661 * @since 9 2662 */ 2663 static const int32_t KEYCODE_BTN_4; 2664 2665 /** 2666 * Button 5 2667 * 2668 * @since 9 2669 */ 2670 static const int32_t KEYCODE_BTN_5; 2671 2672 /** 2673 * Button 6 2674 * 2675 * @since 9 2676 */ 2677 static const int32_t KEYCODE_BTN_6; 2678 2679 /** 2680 * Button 7 2681 * 2682 * @since 9 2683 */ 2684 static const int32_t KEYCODE_BTN_7; 2685 2686 /** 2687 * Button 8 2688 * 2689 * @since 9 2690 */ 2691 static const int32_t KEYCODE_BTN_8; 2692 2693 /** 2694 * Button 9 2695 * 2696 * @since 9 2697 */ 2698 static const int32_t KEYCODE_BTN_9; 2699 2700 /** 2701 * Virtual keyboard 1 2702 * 2703 * @since 9 2704 */ 2705 static const int32_t KEYCODE_BRL_DOT1; 2706 2707 /** 2708 * Virtual keyboard 2 2709 * 2710 * @since 9 2711 */ 2712 static const int32_t KEYCODE_BRL_DOT2; 2713 2714 /** 2715 * Virtual keyboard 3 2716 * 2717 * @since 9 2718 */ 2719 static const int32_t KEYCODE_BRL_DOT3; 2720 2721 /** 2722 * Virtual keyboard 4 2723 * 2724 * @since 9 2725 */ 2726 static const int32_t KEYCODE_BRL_DOT4; 2727 2728 /** 2729 * Virtual keyboard 5 2730 * 2731 * @since 9 2732 */ 2733 static const int32_t KEYCODE_BRL_DOT5; 2734 2735 /** 2736 * Virtual keyboard 6 2737 * 2738 * @since 9 2739 */ 2740 static const int32_t KEYCODE_BRL_DOT6; 2741 2742 /** 2743 * Virtual keyboard 7 2744 * 2745 * @since 9 2746 */ 2747 static const int32_t KEYCODE_BRL_DOT7; 2748 2749 /** 2750 * Virtual keyboard 8 2751 * 2752 * @since 9 2753 */ 2754 static const int32_t KEYCODE_BRL_DOT8; 2755 2756 /** 2757 * Virtual keyboard 9 2758 * 2759 * @since 9 2760 */ 2761 static const int32_t KEYCODE_BRL_DOT9; 2762 2763 /** 2764 * Virtual keyboard 10 2765 * 2766 * @since 9 2767 */ 2768 static const int32_t KEYCODE_BRL_DOT10; 2769 2770 /** 2771 * PEN_AIR_MOUSE 2772 * 2773 * @since 9 2774 */ 2775 static const int32_t KEYCODE_KEY_PEN_AIR_MOUSE; 2776 2777 /** 2778 * PEN_LIGHT_PINCH 2779 * 2780 * @since 9 2781 */ 2782 static const int32_t KEYCODE_KEY_PEN_LIGHT_PINCH; 2783 2784 /** 2785 * KEYCODE_PEN_AI 2786 * 2787 * @since 9 2788 */ 2789 static const int32_t KEYCODE_KEY_PEN_AI; 2790 2791 /** 2792 * KEYCODE_PEN_AI 2793 * 2794 * @since 9 2795 */ 2796 static const int32_t KEYCODE_KEY_PEN_END_CLICK; 2797 2798 /** 2799 * KEYCODE_PEN_AI 2800 * 2801 * @since 9 2802 */ 2803 static const int32_t KEYCODE_KEY_PEN_END_DOUBLE_CLICK; 2804 2805 /** 2806 * KEYCODE_PEN_AI 2807 * 2808 * @since 9 2809 */ 2810 static const int32_t KEYCODE_KEY_PEN_MODE_SWITCH; 2811 2812 /** 2813 * Left Knob roll-up 2814 * <p>In contrast to {@link #static const int32_t KEYCODE_LEFT_KNOB_ROLL_DOWN}, 2815 * this key is used to roll the left knob upwards. The knob function is scenario-specific, 2816 * for example, increasing the volume or air conditioner temperature. 2817 * 2818 * @since 9 2819 */ 2820 static const int32_t KEYCODE_LEFT_KNOB_ROLL_UP; 2821 2822 /** 2823 * Left Knob roll-down 2824 * <p>In contrast to {@link #static const int32_t KEYCODE_LEFT_KNOB_ROLL_UP}, 2825 * this key is used to roll the left knob downwards. The knob function is 2826 * scenario-specific, for example, reducing the volume or air 2827 * conditioner temperature. 2828 * @since 9 2829 */ 2830 static const int32_t KEYCODE_LEFT_KNOB_ROLL_DOWN; 2831 2832 /** 2833 * Left Knob 2834 * <p>Pressing the knob will activate its adjustment function. 2835 * 2836 * @since 9 2837 */ 2838 static const int32_t KEYCODE_LEFT_KNOB; 2839 2840 /** 2841 * Right Knob roll-up 2842 * <p>In contrast to {@link #static const int32_t KEYCODE_RIGHT_KNOB_ROLL_DOWN}, 2843 * this key is used to roll the right knob upwards. The knobfunction is scenario-specific, 2844 * for example, increasing the volume or air conditioner temperature. 2845 * 2846 * @since 9 2847 */ 2848 static const int32_t KEYCODE_RIGHT_KNOB_ROLL_UP; 2849 2850 /** 2851 * Right Knob roll-down 2852 * <p>In contrast to {@link #static const int32_t KEYCODE_RIGHT_KNOB_ROLL_UP}, 2853 * this key is used to roll the right knob downwards. The knobfunction is scenario-specific, 2854 * for example, reducing the volume or air conditioner temperature. 2855 * 2856 * @since 9 2857 */ 2858 static const int32_t KEYCODE_RIGHT_KNOB_ROLL_DOWN; 2859 2860 /** 2861 * Right Knob 2862 * <p>Pressing the knob will activate its adjustment function. 2863 * 2864 * @since 9 2865 */ 2866 static const int32_t KEYCODE_RIGHT_KNOB; 2867 2868 /** 2869 * Audio Source Switch button 2870 * <p>Pressing this button will enable the audio source. Depending on the 2871 * actual scenario, it may also indicate that the Bluetooth call control 2872 * button is pressed. 2873 * @since 9 2874 */ 2875 static const int32_t KEYCODE_VOICE_SOURCE_SWITCH; 2876 2877 /** 2878 * Menu key 2879 * <p>Pressing this key will display the launcher page. 2880 * 2881 * @since 9 2882 */ 2883 static const int32_t KEYCODE_LAUNCHER_MENU; 2884 2885 /** 2886 * Stylus key 2887 * 2888 * @since 12 2889 */ 2890 static const int32_t KEYCODE_STYLUS_SCREEN; 2891 2892 /** 2893 * Unknown key operation, which is usually used to indicate the initial invalid value. 2894 * 2895 * @since 9 2896 */ 2897 static const int32_t KEY_ACTION_UNKNOWN; 2898 2899 /** 2900 * Action Cancel 2901 * Pressing this key will cause the failure in reporting the Action Up event. 2902 * Instead, the action of pressing the Action Cancel key is reported. 2903 * 2904 * @since 9 2905 */ 2906 static const int32_t KEY_ACTION_CANCEL; 2907 2908 /** 2909 * Action Down 2910 * 2911 * @since 9 2912 */ 2913 static const int32_t KEY_ACTION_DOWN; 2914 2915 /** 2916 * Action Up 2917 * 2918 * @since 9 2919 */ 2920 static const int32_t KEY_ACTION_UP; 2921 2922 /** 2923 * Unknown intention 2924 * 2925 * @since 9 2926 */ 2927 static const int32_t INTENTION_UNKNOWN; 2928 2929 /** 2930 * Up intention 2931 * 2932 * @since 9 2933 */ 2934 static const int32_t INTENTION_UP; 2935 2936 /** 2937 * Down intention 2938 * 2939 * @since 9 2940 */ 2941 static const int32_t INTENTION_DOWN; 2942 2943 /** 2944 * Left intention 2945 * 2946 * @since 9 2947 */ 2948 static const int32_t INTENTION_LEFT; 2949 2950 /** 2951 * Right intention 2952 * 2953 * @since 9 2954 */ 2955 static const int32_t INTENTION_RIGHT; 2956 2957 /** 2958 * Select intention 2959 * 2960 * @since 9 2961 */ 2962 static const int32_t INTENTION_SELECT; 2963 2964 /** 2965 * Escape intention 2966 * 2967 * @since 9 2968 */ 2969 static const int32_t INTENTION_ESCAPE; 2970 2971 /** 2972 * Back intention 2973 * 2974 * @since 9 2975 */ 2976 static const int32_t INTENTION_BACK; 2977 2978 /** 2979 * Forward intention 2980 * 2981 * @since 9 2982 */ 2983 static const int32_t INTENTION_FORWARD; 2984 2985 /** 2986 * Menu intention 2987 * 2988 * @since 9 2989 */ 2990 static const int32_t INTENTION_MENU; 2991 2992 /** 2993 * Home intention 2994 * 2995 * @since 9 2996 */ 2997 static const int32_t INTENTION_HOME; 2998 2999 /** 3000 * Page Up intention 3001 * 3002 * @since 9 3003 */ 3004 static const int32_t INTENTION_PAGE_UP; 3005 3006 /** 3007 * Page down intention 3008 * 3009 * @since 9 3010 */ 3011 static const int32_t INTENTION_PAGE_DOWN; 3012 3013 /** 3014 * Zoom out intention 3015 * 3016 * @since 9 3017 */ 3018 static const int32_t INTENTION_ZOOM_OUT; 3019 3020 /** 3021 * Zoom in intention 3022 * 3023 * @since 9 3024 */ 3025 static const int32_t INTENTION_ZOOM_IN; 3026 3027 /** 3028 * Media play/pause intention 3029 * 3030 * @since 9 3031 */ 3032 static const int32_t INTENTION_MEDIA_PLAY_PAUSE; 3033 3034 /** 3035 * Media fast forward intention 3036 * 3037 * @since 9 3038 */ 3039 static const int32_t INTENTION_MEDIA_FAST_FORWARD; 3040 3041 /** 3042 * Media fast rewind intention 3043 * 3044 * @since 9 3045 */ 3046 static const int32_t INTENTION_MEDIA_FAST_REWIND; 3047 3048 /** 3049 * Media fast playback intention 3050 * 3051 * @since 9 3052 */ 3053 static const int32_t INTENTION_MEDIA_FAST_PLAYBACK; 3054 3055 /** 3056 * Media next intention 3057 * 3058 * @since 9 3059 */ 3060 static const int32_t INTENTION_MEDIA_NEXT; 3061 3062 /** 3063 * Media previous intention 3064 * 3065 * @since 9 3066 */ 3067 static const int32_t INTENTION_MEDIA_PREVIOUS; 3068 3069 /** 3070 * Media mute intention 3071 * 3072 * @since 9 3073 */ 3074 static const int32_t INTENTION_MEDIA_MUTE; 3075 3076 /** 3077 * Volume up intention 3078 * 3079 * @since 9 3080 */ 3081 static const int32_t INTENTION_VOLUTE_UP; 3082 3083 /** 3084 * Volume down intention 3085 * 3086 * @since 9 3087 */ 3088 static const int32_t INTENTION_VOLUTE_DOWN; 3089 3090 /** 3091 * Call intention 3092 * 3093 * @since 9 3094 */ 3095 static const int32_t INTENTION_CALL; 3096 3097 /** 3098 * End call intention 3099 * 3100 * @since 9 3101 */ 3102 static const int32_t INTENTION_ENDCALL; 3103 3104 /** 3105 * Reject call intention 3106 * 3107 * @since 9 3108 */ 3109 static const int32_t INTENTION_REJECTCALL; 3110 3111 /** 3112 * Camera intention 3113 * 3114 * @since 9 3115 */ 3116 static const int32_t INTENTION_CAMERA; 3117 3118 /** 3119 * Outbound Notification Center 3120 * 3121 * @since 11 3122 */ 3123 static const int32_t KEYCODE_CALL_NOTIFICATION_CENTER; 3124 3125 /** 3126 * Outbound Control Center 3127 * 3128 * @since 11 3129 */ 3130 static const int32_t KEYCODE_CALL_CONTROL_CENTER; 3131 3132 /** 3133 * Dagger Press 3134 * 3135 * @since 12 3136 */ 3137 static const int32_t KEYCODE_DAGGER_CLICK; 3138 3139 /** 3140 * Dagger Click 3141 * 3142 * @since 13 3143 */ 3144 static const int32_t KEYCODE_DAGGER_DOUBLE_CLICK; 3145 3146 /** 3147 * Dagger Long Press 3148 * 3149 * @since 14 3150 */ 3151 static const int32_t KEYCODE_DAGGER_LONG_PRESS; 3152 3153 /** 3154 * Aod slide unlock 3155 * 3156 * @since 16 3157 */ 3158 static const int32_t KEYCODE_AOD_SLIDE_UNLOCK; 3159 3160 /** 3161 * Recent 3162 * 3163 * @since 18 3164 */ 3165 static const int32_t KEYCODE_RECENT; 3166 3167 /** 3168 * Floating back 3169 * 3170 * @since 18 3171 */ 3172 static const int32_t KEYCODE_FLOATING_BACK; 3173 /** 3174 * Div key 3175 * 3176 * @since 20 3177 */ 3178 static const int32_t KEYCODE_DIV; 3179 public: 3180 class KeyItem { 3181 public: 3182 KeyItem(); 3183 ~KeyItem(); 3184 3185 /** 3186 * @brief Obtains the key code of the key. 3187 * @return Returns the key code. 3188 * @since 9 3189 */ 3190 int32_t GetKeyCode() const; 3191 3192 /** 3193 * @brief Sets a key code for the key. 3194 * @param keyCode Indicates the key code to set. 3195 * @return void 3196 * @since 9 3197 */ 3198 void SetKeyCode(int32_t keyCode); 3199 3200 /** 3201 * @brief Obtains the time when the key is pressed. 3202 * @return Returns the time. 3203 * @since 9 3204 */ 3205 int64_t GetDownTime() const; 3206 3207 /** 3208 * @brief Sets the time when the key is pressed. 3209 * @param downTime Indicates the time to set. 3210 * @return void 3211 * @since 9 3212 */ 3213 void SetDownTime(int64_t downTime); 3214 3215 /** 3216 * @brief Obtains the unique identifier of the device that reports this event. 3217 * @return Returns the device ID. 3218 * @since 9 3219 */ 3220 int32_t GetDeviceId() const; 3221 3222 /** 3223 * @brief Sets a unique identifier for the device that reports this event. 3224 * @param deviceId Indicates the device ID to set. 3225 * @return void 3226 * @since 9 3227 */ 3228 void SetDeviceId(int32_t deviceId); 3229 3230 /** 3231 * @brief Checks whether the key is pressed. 3232 * @return Returns <b>true</b> if the key is pressed; returns <b>false</b> otherwise. 3233 * @since 9 3234 */ 3235 bool IsPressed() const; 3236 3237 /** 3238 * @brief Sets whether to enable the pressed state for the key. 3239 * @param pressed Specifies whether to set the pressed state for the key. 3240 * The value <b>true</b> means to set the pressed state for the key, 3241 * and the <b>false</b> means the opposite. 3242 * @return void 3243 * @since 9 3244 */ 3245 void SetPressed(bool pressed); 3246 3247 /** 3248 * @brief Sets the Unicode value corresponding to the current key. 3249 * @param unicode Unicode value. 3250 * @return Null 3251 * @since 9 3252 */ 3253 void SetUnicode(uint32_t unicode); 3254 3255 /** 3256 * @brief Obtains the Unicode value of the current key. 3257 * @return Returns the Unicode value. 3258 * @since 9 3259 */ 3260 uint32_t GetUnicode() const; 3261 3262 public: 3263 /** 3264 * @brief Writes data to a <b>Parcel</b> object. 3265 * @param out Indicates the object into which data will be written. 3266 * @return Returns <b>true</b> if the data is successfully written; returns <b>false</b> otherwise. 3267 * @since 9 3268 */ 3269 bool WriteToParcel(Parcel &out) const; 3270 3271 /** 3272 * @brief Reads data from a <b>Parcel</b> object. 3273 * @param in Indicates the object from which data will be read. 3274 * @return Returns <b>true</b> if the data is successfully read; returns <b>false</b> otherwise. 3275 * @since 9 3276 */ 3277 bool ReadFromParcel(Parcel &in); 3278 3279 private: 3280 bool pressed_ = false; 3281 int32_t deviceId_ = -1; 3282 int32_t keyCode_ = -1; 3283 int64_t downTime_ = 0; 3284 uint32_t unicode_ { 0 }; 3285 }; 3286 3287 public: 3288 static std::shared_ptr<KeyEvent> from(std::shared_ptr<InputEvent> inputEvent); 3289 3290 /** 3291 * @brief Converts the action of this key event as a string. 3292 * @param action Indicates the action represented by pressing a key. 3293 * @return Returns the pointer to the action string. 3294 * @since 9 3295 */ 3296 static const char* ActionToString(int32_t action); 3297 3298 /** 3299 * @brief Converts the key code of this key event as a string. 3300 * @param keyCode Indicates the code that identifies the key. 3301 * @return Returns the pointer to the key code string. 3302 * @since 9 3303 */ 3304 static const char* KeyCodeToString(int32_t keyCode); 3305 3306 static std::shared_ptr<KeyEvent> Clone(std::shared_ptr<KeyEvent> keyEvent); 3307 3308 public: 3309 /** 3310 * @brief Constructor of KeyEvent. 3311 * @since 9 3312 */ 3313 KeyEvent(const KeyEvent& other); 3314 3315 /** 3316 * @brief Virtual destructor of KeyEvent. 3317 * @since 9 3318 */ 3319 virtual ~KeyEvent(); 3320 3321 KeyEvent& operator=(const KeyEvent& other) = delete; 3322 DISALLOW_MOVE(KeyEvent); 3323 3324 /** 3325 * @brief Creates a key event. 3326 * @since 9 3327 */ 3328 static std::shared_ptr<KeyEvent> Create(); 3329 3330 virtual void Reset() override; 3331 3332 virtual std::string ToString() override; 3333 3334 /** 3335 * @brief Obtains the key code of this key event. 3336 * @return Returns the key code. 3337 * @since 9 3338 */ 3339 int32_t GetKeyCode() const; 3340 3341 /** 3342 * @brief Sets a key code for this key event. 3343 * @param keyCode Indicates the key code to set. 3344 * @return void 3345 * @since 9 3346 */ 3347 void SetKeyCode(int32_t keyCode); 3348 3349 /** 3350 * @brief Obtains the key action of this key event. 3351 * @return Returns the key action. 3352 * @since 9 3353 */ 3354 int32_t GetKeyAction() const; 3355 3356 /** 3357 * @brief Sets a key action for this key event. 3358 * @param keyAction Indicates the key action to set. 3359 * @return void 3360 * @since 9 3361 */ 3362 void SetKeyAction(int32_t keyAction); 3363 3364 /** 3365 * @brief Obtains the list of pressed keys in this key event. 3366 * @return Returns the list of pressed keys. 3367 * @since 9 3368 */ 3369 std::vector<int32_t> GetPressedKeys() const; 3370 3371 /** 3372 * @brief Adds a key item. 3373 * @param keyItem Indicates the key item to add. 3374 * @return void 3375 * @since 9 3376 */ 3377 void AddKeyItem(const KeyItem& keyItem); 3378 3379 /** 3380 * @brief Set key item. 3381 * @param keyItem Indicates the key item to set. 3382 * @return void 3383 * @since 13 3384 */ 3385 void SetKeyItem(std::vector<KeyItem> keyItem); 3386 3387 /** 3388 * @brief Obtains the key item. 3389 * @return Returns the key item. 3390 * @since 9 3391 */ 3392 std::vector<KeyEvent::KeyItem> GetKeyItems() const; 3393 3394 /** 3395 * @brief Adds the pressed key items. 3396 * @param keyItem Indicates the key item to add. 3397 * @return void 3398 * @since 9 3399 */ 3400 void AddPressedKeyItems(const KeyItem& keyItem); 3401 3402 /** 3403 * @brief Removes the released key Items. 3404 * @param keyItem Indicates the key item to remove. 3405 * @return void 3406 * @since 9 3407 */ 3408 void RemoveReleasedKeyItems(const KeyItem& keyItem); 3409 3410 /** 3411 * @brief Obtains the key item of this key event. 3412 * @return Returns the key item. 3413 * @since 9 3414 */ 3415 std::optional<KeyEvent::KeyItem> GetKeyItem() const; 3416 3417 /** 3418 * @brief Obtains the key item based on a key code. 3419 * @param keyCode Indicates the key code. 3420 * @return Returns the key item. 3421 * @since 9 3422 */ 3423 std::optional<KeyEvent::KeyItem> GetKeyItem(int32_t keyCode) const; 3424 3425 /** 3426 * @brief Checks whether this key event is valid. 3427 * @return Returns <b>true</b> if the key event is valid; returns <b>false</b> otherwise. 3428 * @since 9 3429 */ 3430 bool IsValid() const; 3431 3432 /** 3433 * @brief Converts a specific key to a function key. 3434 * @param keyCode Indicates the keycode of the key to convert. 3435 * @return Returns the converted function key. 3436 * @since 9 3437 */ 3438 int32_t TransitionFunctionKey(int32_t keyCode); 3439 3440 /** 3441 * @brief Sets the enable status of the specified function key. 3442 * @param funcKey Indicates the function key. 3443 * @param value Indicates the enable status of the function key. 3444 * @return Returns the result indicating whether the setting is successful. 3445 * @since 9 3446 */ 3447 int32_t SetFunctionKey(int32_t funcKey, int32_t value); 3448 3449 /** 3450 * @brief Obtains the enable status of the specified function key. 3451 * @param funcKey Indicates the function key. 3452 * @return Returns the enable status of the function key. 3453 * @since 9 3454 */ 3455 bool GetFunctionKey(int32_t funcKey) const; 3456 3457 /** 3458 * @brief Obtains the key intention of the current event. 3459 * @param void 3460 * @return Returns the key intention of the current event. 3461 * @since 9 3462 */ 3463 int32_t GetKeyIntention() const; 3464 3465 /** 3466 * @brief Sets the key intention for the current key event. 3467 * @param keyIntention Specified key intention. 3468 * @return void 3469 * @since 9 3470 */ 3471 void SetKeyIntention(int32_t keyIntention); 3472 3473 /** 3474 * @brief Gets the automatic keystroke repeat status. 3475 * @return bool 3476 * @since 10 3477 */ 3478 bool IsRepeat() const; 3479 3480 /** 3481 * @brief Sets the injection key to repeat automatically. 3482 * @param repeat Key injection automatic repeat identification. 3483 * @return void 3484 * @since 10 3485 */ 3486 void SetRepeat(bool repeat); 3487 3488 /** 3489 * @brief Gets the real-time operation keystroke repeat status. 3490 * @return bool 3491 * @since 13 3492 */ 3493 bool IsRepeatKey() const; 3494 3495 /** 3496 * @brief Sets the injection key to repeat practical real-time operation. 3497 * @param repeat Key injection automatic repeat identification. 3498 * @return void 3499 * @since 13 3500 */ 3501 void SetRepeatKey(bool repeatKey); 3502 3503 #ifdef OHOS_BUILD_ENABLE_SECURITY_COMPONENT 3504 /** 3505 * @brief Set the enhance data. 3506 * @return void. 3507 * @since 11 3508 */ 3509 void SetEnhanceData(std::vector<uint8_t> enhanceData); 3510 /** 3511 * @brief Obtains the enhance data. 3512 * @return Returns the enhance data. 3513 * @since 11 3514 */ 3515 std::vector<uint8_t> GetEnhanceData() const; 3516 #endif // OHOS_BUILD_ENABLE_SECURITY_COMPONENT 3517 public: 3518 /** 3519 * @brief Writes data to a <b>Parcel</b> object. 3520 * @param out Indicates the object into which data will be written. 3521 * @return Returns <b>true</b> if the data is successfully written; returns <b>false</b> otherwise. 3522 * @since 9 3523 */ 3524 bool WriteToParcel(Parcel &out) const; 3525 bool Marshalling(Parcel &out) const override; 3526 3527 /** 3528 * @brief Reads data from a <b>Parcel</b> object. 3529 * @param in Indicates the object from which data will be read. 3530 * @return Returns <b>true</b> if the data is successfully read; returns <b>false</b> otherwise. 3531 * @since 9 3532 */ 3533 bool ReadFromParcel(Parcel &in); 3534 static KeyEvent *Unmarshalling(Parcel &in); 3535 3536 /** 3537 * @brief Converts a key event action into a short string. 3538 * @param Indicates the key event action. 3539 * @return Returns the string converted from the key action. 3540 * @since 12 3541 */ 3542 static std::string_view ActionToShortStr(int32_t action); 3543 protected: 3544 /** 3545 * @brief Constructs an input event object by using the specified input event type. Generally, this method 3546 * is used to construct a base class object when constructing a derived class object. 3547 * @since 9 3548 */ 3549 explicit KeyEvent(int32_t eventType); 3550 3551 public: 3552 void SetFourceMonitorFlag(bool fourceMonitorFlag); 3553 bool GetFourceMonitorFlag(); 3554 3555 private: 3556 #ifdef OHOS_BUILD_ENABLE_SECURITY_COMPONENT 3557 bool ReadEnhanceDataFromParcel(Parcel &in); 3558 #endif // OHOS_BUILD_ENABLE_SECURITY_COMPONENT 3559 bool IsValidKeyItem() const; 3560 3561 private: 3562 int32_t keyCode_ { -1 }; 3563 std::vector<KeyItem> keys_; 3564 int32_t keyAction_ { 0 }; 3565 int32_t keyIntention_ { -1 }; 3566 bool numLock_ { false }; 3567 bool capsLock_ { false }; 3568 bool scrollLock_ { false }; 3569 #ifdef OHOS_BUILD_ENABLE_SECURITY_COMPONENT 3570 std::vector<uint8_t> enhanceData_; 3571 #endif // OHOS_BUILD_ENABLE_SECURITY_COMPONENT 3572 bool repeat_ { false }; 3573 bool repeatKey_ { false }; 3574 bool fourceMonitorFlag_ { false }; 3575 }; 3576 } // namespace MMI 3577 } // namespace OHOS 3578 #endif // KEY_EVENT_H 3579