blob: a09b02e17b58f40c9d098be0017231ad7c0ccf57 [file] [log] [blame]
Prabir Pradhanae10ee62023-05-12 19:44:18 +00001/*
2 * Copyright 2023 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include <android/input.h>
20#include <set>
21
22namespace android {
23
24/** The set of all Android key codes that are required for a device to be classified as a D-pad. */
25static const std::set<int32_t> DPAD_REQUIRED_KEYCODES = {
26 AKEYCODE_DPAD_UP, AKEYCODE_DPAD_DOWN, AKEYCODE_DPAD_LEFT,
27 AKEYCODE_DPAD_RIGHT, AKEYCODE_DPAD_CENTER,
28};
29
30/** The set of all Android key codes that correspond to D-pad keys. */
31static const std::set<int32_t> DPAD_ALL_KEYCODES = {
32 AKEYCODE_DPAD_UP, AKEYCODE_DPAD_DOWN, AKEYCODE_DPAD_LEFT,
33 AKEYCODE_DPAD_RIGHT, AKEYCODE_DPAD_CENTER, AKEYCODE_DPAD_UP_LEFT,
34 AKEYCODE_DPAD_UP_RIGHT, AKEYCODE_DPAD_DOWN_LEFT, AKEYCODE_DPAD_DOWN_RIGHT,
35};
36
37/** The set of all Android key codes that correspond to gamepad buttons. */
38static const std::set<int32_t> GAMEPAD_KEYCODES = {
39 AKEYCODE_BUTTON_A, AKEYCODE_BUTTON_B, AKEYCODE_BUTTON_C, //
40 AKEYCODE_BUTTON_X, AKEYCODE_BUTTON_Y, AKEYCODE_BUTTON_Z, //
41 AKEYCODE_BUTTON_L1, AKEYCODE_BUTTON_R1, //
42 AKEYCODE_BUTTON_L2, AKEYCODE_BUTTON_R2, //
43 AKEYCODE_BUTTON_THUMBL, AKEYCODE_BUTTON_THUMBR, //
44 AKEYCODE_BUTTON_START, AKEYCODE_BUTTON_SELECT, AKEYCODE_BUTTON_MODE, //
45};
46
47/** The set of all Android key codes that correspond to buttons (bit-switches) on a stylus. */
48static const std::set<int32_t> STYLUS_BUTTON_KEYCODES = {
49 AKEYCODE_STYLUS_BUTTON_PRIMARY,
50 AKEYCODE_STYLUS_BUTTON_SECONDARY,
51 AKEYCODE_STYLUS_BUTTON_TERTIARY,
52 AKEYCODE_STYLUS_BUTTON_TAIL,
53};
54
55} // namespace android