1 #ifndef ANDROIDTVREMOTE_SERVICE_JNI_KEYS_H_
2 #define ANDROIDTVREMOTE_SERVICE_JNI_KEYS_H_
3 
4 #include <android/keycodes.h>
5 #include <linux/input.h>
6 
7 namespace android {
8 
9 // Map the keys specified in virtual-remote.kl.
10 // Only specify the keys actually used in the layout here.
11 struct Key {
12     int linuxKeyCode;
13     int32_t androidKeyCode;
14 };
15 
16 // List of all of the keycodes that the emote is capable of sending.
17 static Key KEYS[] = {
18         // Volume Control
19         {KEY_VOLUMEDOWN, AKEYCODE_VOLUME_DOWN},
20         {KEY_VOLUMEUP, AKEYCODE_VOLUME_UP},
21         {KEY_MUTE, AKEYCODE_VOLUME_MUTE},
22         {KEY_MUTE, AKEYCODE_MUTE},
23 
24         {KEY_POWER, AKEYCODE_POWER},
25         {KEY_HOMEPAGE, AKEYCODE_HOME},
26         {KEY_BACK, AKEYCODE_BACK},
27 
28         // Media Control
29         {KEY_PLAYPAUSE, AKEYCODE_MEDIA_PLAY_PAUSE},
30         {KEY_PLAY, AKEYCODE_MEDIA_PLAY},
31         {KEY_PAUSECD, AKEYCODE_MEDIA_PAUSE},
32         {KEY_NEXTSONG, AKEYCODE_MEDIA_NEXT},
33         {KEY_PREVIOUSSONG, AKEYCODE_MEDIA_PREVIOUS},
34         {KEY_STOPCD, AKEYCODE_MEDIA_STOP},
35         {KEY_RECORD, AKEYCODE_MEDIA_RECORD},
36         {KEY_REWIND, AKEYCODE_MEDIA_REWIND},
37         {KEY_FASTFORWARD, AKEYCODE_MEDIA_FAST_FORWARD},
38 
39         // TV Control
40         {KEY_0, AKEYCODE_0},
41         {KEY_1, AKEYCODE_1},
42         {KEY_2, AKEYCODE_2},
43         {KEY_3, AKEYCODE_3},
44         {KEY_4, AKEYCODE_4},
45         {KEY_5, AKEYCODE_5},
46         {KEY_6, AKEYCODE_6},
47         {KEY_7, AKEYCODE_7},
48         {KEY_8, AKEYCODE_8},
49         {KEY_9, AKEYCODE_9},
50         {KEY_BACKSPACE, AKEYCODE_DEL},
51         {KEY_ENTER, AKEYCODE_ENTER},
52         {KEY_CHANNELUP, AKEYCODE_CHANNEL_UP},
53         {KEY_CHANNELDOWN, AKEYCODE_CHANNEL_DOWN},
54 
55         // Old School TV Controls
56         {KEY_F1, AKEYCODE_F1},
57         {KEY_F2, AKEYCODE_F2},
58         {KEY_F3, AKEYCODE_F3},
59         {KEY_F4, AKEYCODE_F4},
60         {KEY_F5, AKEYCODE_F5},
61         {KEY_F6, AKEYCODE_F6},
62         {KEY_F7, AKEYCODE_F7},
63         {KEY_F8, AKEYCODE_F8},
64         {KEY_F9, AKEYCODE_F9},
65         {KEY_F10, AKEYCODE_F10},
66         {KEY_F11, AKEYCODE_F11},
67         {KEY_F12, AKEYCODE_F12},
68         {KEY_FN_F1, AKEYCODE_F1},
69         {KEY_FN_F2, AKEYCODE_F2},
70         {KEY_FN_F3, AKEYCODE_F3},
71         {KEY_FN_F4, AKEYCODE_F4},
72         {KEY_FN_F5, AKEYCODE_F5},
73         {KEY_FN_F6, AKEYCODE_F6},
74         {KEY_FN_F7, AKEYCODE_F7},
75         {KEY_FN_F8, AKEYCODE_F8},
76         {KEY_FN_F9, AKEYCODE_F9},
77         {KEY_FN_F10, AKEYCODE_F10},
78         {KEY_FN_F11, AKEYCODE_F11},
79         {KEY_FN_F12, AKEYCODE_F12},
80         {KEY_TV, AKEYCODE_TV},
81         {KEY_RED, AKEYCODE_PROG_RED},
82         {KEY_GREEN, AKEYCODE_PROG_GREEN},
83         {KEY_YELLOW, AKEYCODE_PROG_YELLOW},
84         {KEY_BLUE, AKEYCODE_PROG_BLUE},
85 
86         {KEY_FAVORITES, AKEYCODE_BUTTON_MODE},
87         {KEY_WWW, AKEYCODE_EXPLORER},
88         {KEY_MENU, AKEYCODE_MENU},
89         {KEY_INFO, AKEYCODE_INFO},
90         {KEY_EPG, AKEYCODE_GUIDE},
91         {KEY_TEXT, AKEYCODE_TV_TELETEXT},
92         {KEY_SUBTITLE, AKEYCODE_CAPTIONS},
93         {KEY_PVR, AKEYCODE_DVR},
94         {KEY_AUDIO, AKEYCODE_MEDIA_AUDIO_TRACK},
95         {KEY_OPTION, AKEYCODE_SETTINGS},
96 
97         // Gamepad buttons
98         {KEY_UP, AKEYCODE_DPAD_UP},
99         {KEY_DOWN, AKEYCODE_DPAD_DOWN},
100         {KEY_LEFT, AKEYCODE_DPAD_LEFT},
101         {KEY_RIGHT, AKEYCODE_DPAD_RIGHT},
102         {KEY_SELECT, AKEYCODE_DPAD_CENTER},
103         {BTN_A, AKEYCODE_BUTTON_A},
104         {BTN_B, AKEYCODE_BUTTON_B},
105         {BTN_X, AKEYCODE_BUTTON_X},
106         {BTN_Y, AKEYCODE_BUTTON_Y},
107 
108         {KEY_SEARCH, AKEYCODE_SEARCH},
109         {KEY_ASSISTANT, AKEYCODE_ASSIST},
110 };
111 
112 } // namespace android
113 
114 #endif // ANDROIDTVREMOTE_SERVICE_JNI_KEYS_H_
115