Update android-L/include/android

Added more constants, and 6 new sensor functions

Change-Id: I0b8a028ec948ba66074e949bc20435cb05845a80
This commit is contained in:
Andrew Hsieh
2014-08-28 13:14:59 +08:00
parent 4123e0886b
commit c7f04c38a0
9 changed files with 1048 additions and 0 deletions

View File

@@ -154,14 +154,20 @@ ASensorEventQueue_enableSensor
ASensorEventQueue_getEvents
ASensorEventQueue_hasEvents
ASensorEventQueue_setEventRate
ASensor_getFifoMaxEventCount
ASensor_getFifoReservedEventCount
ASensor_getMinDelay
ASensor_getName
ASensor_getReportingMode
ASensor_getResolution
ASensor_getStringType
ASensor_getType
ASensor_getVendor
ASensor_isWakeUpSensor
ASensorManager_createEventQueue
ASensorManager_destroyEventQueue
ASensorManager_getDefaultSensor
ASensorManager_getDefaultSensorEx
ASensorManager_getInstance
ASensorManager_getSensorList
AStorageManager_delete

View File

@@ -154,14 +154,20 @@ ASensorEventQueue_enableSensor
ASensorEventQueue_getEvents
ASensorEventQueue_hasEvents
ASensorEventQueue_setEventRate
ASensor_getFifoMaxEventCount
ASensor_getFifoReservedEventCount
ASensor_getMinDelay
ASensor_getName
ASensor_getReportingMode
ASensor_getResolution
ASensor_getStringType
ASensor_getType
ASensor_getVendor
ASensor_isWakeUpSensor
ASensorManager_createEventQueue
ASensorManager_destroyEventQueue
ASensorManager_getDefaultSensor
ASensorManager_getDefaultSensorEx
ASensorManager_getInstance
ASensorManager_getSensorList
AStorageManager_delete

View File

@@ -154,14 +154,20 @@ ASensorEventQueue_enableSensor
ASensorEventQueue_getEvents
ASensorEventQueue_hasEvents
ASensorEventQueue_setEventRate
ASensor_getFifoMaxEventCount
ASensor_getFifoReservedEventCount
ASensor_getMinDelay
ASensor_getName
ASensor_getReportingMode
ASensor_getResolution
ASensor_getStringType
ASensor_getType
ASensor_getVendor
ASensor_isWakeUpSensor
ASensorManager_createEventQueue
ASensorManager_destroyEventQueue
ASensorManager_getDefaultSensor
ASensorManager_getDefaultSensorEx
ASensorManager_getInstance
ASensorManager_getSensorList
AStorageManager_delete

View File

@@ -154,14 +154,20 @@ ASensorEventQueue_enableSensor
ASensorEventQueue_getEvents
ASensorEventQueue_hasEvents
ASensorEventQueue_setEventRate
ASensor_getFifoMaxEventCount
ASensor_getFifoReservedEventCount
ASensor_getMinDelay
ASensor_getName
ASensor_getReportingMode
ASensor_getResolution
ASensor_getStringType
ASensor_getType
ASensor_getVendor
ASensor_isWakeUpSensor
ASensorManager_createEventQueue
ASensorManager_destroyEventQueue
ASensorManager_getDefaultSensor
ASensorManager_getDefaultSensorEx
ASensorManager_getInstance
ASensorManager_getSensorList
AStorageManager_delete

View File

@@ -154,14 +154,20 @@ ASensorEventQueue_enableSensor
ASensorEventQueue_getEvents
ASensorEventQueue_hasEvents
ASensorEventQueue_setEventRate
ASensor_getFifoMaxEventCount
ASensor_getFifoReservedEventCount
ASensor_getMinDelay
ASensor_getName
ASensor_getReportingMode
ASensor_getResolution
ASensor_getStringType
ASensor_getType
ASensor_getVendor
ASensor_isWakeUpSensor
ASensorManager_createEventQueue
ASensorManager_destroyEventQueue
ASensorManager_getDefaultSensor
ASensorManager_getDefaultSensorEx
ASensorManager_getInstance
ASensorManager_getSensorList
AStorageManager_delete

View File

@@ -154,14 +154,20 @@ ASensorEventQueue_enableSensor
ASensorEventQueue_getEvents
ASensorEventQueue_hasEvents
ASensorEventQueue_setEventRate
ASensor_getFifoMaxEventCount
ASensor_getFifoReservedEventCount
ASensor_getMinDelay
ASensor_getName
ASensor_getReportingMode
ASensor_getResolution
ASensor_getStringType
ASensor_getType
ASensor_getVendor
ASensor_isWakeUpSensor
ASensorManager_createEventQueue
ASensorManager_destroyEventQueue
ASensorManager_getDefaultSensor
ASensorManager_getDefaultSensorEx
ASensorManager_getInstance
ASensorManager_getSensorList
AStorageManager_delete

View File

@@ -0,0 +1,385 @@
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_CONFIGURATION_H
#define ANDROID_CONFIGURATION_H
#include <android/asset_manager.h>
#ifdef __cplusplus
extern "C" {
#endif
struct AConfiguration;
typedef struct AConfiguration AConfiguration;
enum {
ACONFIGURATION_ORIENTATION_ANY = 0x0000,
ACONFIGURATION_ORIENTATION_PORT = 0x0001,
ACONFIGURATION_ORIENTATION_LAND = 0x0002,
ACONFIGURATION_ORIENTATION_SQUARE = 0x0003,
ACONFIGURATION_TOUCHSCREEN_ANY = 0x0000,
ACONFIGURATION_TOUCHSCREEN_NOTOUCH = 0x0001,
ACONFIGURATION_TOUCHSCREEN_STYLUS = 0x0002,
ACONFIGURATION_TOUCHSCREEN_FINGER = 0x0003,
ACONFIGURATION_DENSITY_DEFAULT = 0,
ACONFIGURATION_DENSITY_LOW = 120,
ACONFIGURATION_DENSITY_MEDIUM = 160,
ACONFIGURATION_DENSITY_TV = 213,
ACONFIGURATION_DENSITY_HIGH = 240,
ACONFIGURATION_DENSITY_XHIGH = 320,
ACONFIGURATION_DENSITY_XXHIGH = 480,
ACONFIGURATION_DENSITY_XXXHIGH = 640,
ACONFIGURATION_DENSITY_ANY = 0xfffe,
ACONFIGURATION_DENSITY_NONE = 0xffff,
ACONFIGURATION_KEYBOARD_ANY = 0x0000,
ACONFIGURATION_KEYBOARD_NOKEYS = 0x0001,
ACONFIGURATION_KEYBOARD_QWERTY = 0x0002,
ACONFIGURATION_KEYBOARD_12KEY = 0x0003,
ACONFIGURATION_NAVIGATION_ANY = 0x0000,
ACONFIGURATION_NAVIGATION_NONAV = 0x0001,
ACONFIGURATION_NAVIGATION_DPAD = 0x0002,
ACONFIGURATION_NAVIGATION_TRACKBALL = 0x0003,
ACONFIGURATION_NAVIGATION_WHEEL = 0x0004,
ACONFIGURATION_KEYSHIDDEN_ANY = 0x0000,
ACONFIGURATION_KEYSHIDDEN_NO = 0x0001,
ACONFIGURATION_KEYSHIDDEN_YES = 0x0002,
ACONFIGURATION_KEYSHIDDEN_SOFT = 0x0003,
ACONFIGURATION_NAVHIDDEN_ANY = 0x0000,
ACONFIGURATION_NAVHIDDEN_NO = 0x0001,
ACONFIGURATION_NAVHIDDEN_YES = 0x0002,
ACONFIGURATION_SCREENSIZE_ANY = 0x00,
ACONFIGURATION_SCREENSIZE_SMALL = 0x01,
ACONFIGURATION_SCREENSIZE_NORMAL = 0x02,
ACONFIGURATION_SCREENSIZE_LARGE = 0x03,
ACONFIGURATION_SCREENSIZE_XLARGE = 0x04,
ACONFIGURATION_SCREENLONG_ANY = 0x00,
ACONFIGURATION_SCREENLONG_NO = 0x1,
ACONFIGURATION_SCREENLONG_YES = 0x2,
ACONFIGURATION_UI_MODE_TYPE_ANY = 0x00,
ACONFIGURATION_UI_MODE_TYPE_NORMAL = 0x01,
ACONFIGURATION_UI_MODE_TYPE_DESK = 0x02,
ACONFIGURATION_UI_MODE_TYPE_CAR = 0x03,
ACONFIGURATION_UI_MODE_TYPE_TELEVISION = 0x04,
ACONFIGURATION_UI_MODE_TYPE_APPLIANCE = 0x05,
ACONFIGURATION_UI_MODE_TYPE_WATCH = 0x06,
ACONFIGURATION_UI_MODE_NIGHT_ANY = 0x00,
ACONFIGURATION_UI_MODE_NIGHT_NO = 0x1,
ACONFIGURATION_UI_MODE_NIGHT_YES = 0x2,
ACONFIGURATION_SCREEN_WIDTH_DP_ANY = 0x0000,
ACONFIGURATION_SCREEN_HEIGHT_DP_ANY = 0x0000,
ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY = 0x0000,
ACONFIGURATION_LAYOUTDIR_ANY = 0x00,
ACONFIGURATION_LAYOUTDIR_LTR = 0x01,
ACONFIGURATION_LAYOUTDIR_RTL = 0x02,
ACONFIGURATION_MCC = 0x0001,
ACONFIGURATION_MNC = 0x0002,
ACONFIGURATION_LOCALE = 0x0004,
ACONFIGURATION_TOUCHSCREEN = 0x0008,
ACONFIGURATION_KEYBOARD = 0x0010,
ACONFIGURATION_KEYBOARD_HIDDEN = 0x0020,
ACONFIGURATION_NAVIGATION = 0x0040,
ACONFIGURATION_ORIENTATION = 0x0080,
ACONFIGURATION_DENSITY = 0x0100,
ACONFIGURATION_SCREEN_SIZE = 0x0200,
ACONFIGURATION_VERSION = 0x0400,
ACONFIGURATION_SCREEN_LAYOUT = 0x0800,
ACONFIGURATION_UI_MODE = 0x1000,
ACONFIGURATION_SMALLEST_SCREEN_SIZE = 0x2000,
ACONFIGURATION_LAYOUTDIR = 0x4000,
ACONFIGURATION_MNC_ZERO = 0xffff,
};
/**
* Create a new AConfiguration, initialized with no values set.
*/
AConfiguration* AConfiguration_new();
/**
* Free an AConfiguration that was previously created with
* AConfiguration_new().
*/
void AConfiguration_delete(AConfiguration* config);
/**
* Create and return a new AConfiguration based on the current configuration in
* use in the given AssetManager.
*/
void AConfiguration_fromAssetManager(AConfiguration* out, AAssetManager* am);
/**
* Copy the contents of 'src' to 'dest'.
*/
void AConfiguration_copy(AConfiguration* dest, AConfiguration* src);
/**
* Return the current MCC set in the configuration. 0 if not set.
*/
int32_t AConfiguration_getMcc(AConfiguration* config);
/**
* Set the current MCC in the configuration. 0 to clear.
*/
void AConfiguration_setMcc(AConfiguration* config, int32_t mcc);
/**
* Return the current MNC set in the configuration. 0 if not set.
*/
int32_t AConfiguration_getMnc(AConfiguration* config);
/**
* Set the current MNC in the configuration. 0 to clear.
*/
void AConfiguration_setMnc(AConfiguration* config, int32_t mnc);
/**
* Return the current language code set in the configuration. The output will
* be filled with an array of two characters. They are not 0-terminated. If
* a language is not set, they will be 0.
*/
void AConfiguration_getLanguage(AConfiguration* config, char* outLanguage);
/**
* Set the current language code in the configuration, from the first two
* characters in the string.
*/
void AConfiguration_setLanguage(AConfiguration* config, const char* language);
/**
* Return the current country code set in the configuration. The output will
* be filled with an array of two characters. They are not 0-terminated. If
* a country is not set, they will be 0.
*/
void AConfiguration_getCountry(AConfiguration* config, char* outCountry);
/**
* Set the current country code in the configuration, from the first two
* characters in the string.
*/
void AConfiguration_setCountry(AConfiguration* config, const char* country);
/**
* Return the current ACONFIGURATION_ORIENTATION_* set in the configuration.
*/
int32_t AConfiguration_getOrientation(AConfiguration* config);
/**
* Set the current orientation in the configuration.
*/
void AConfiguration_setOrientation(AConfiguration* config, int32_t orientation);
/**
* Return the current ACONFIGURATION_TOUCHSCREEN_* set in the configuration.
*/
int32_t AConfiguration_getTouchscreen(AConfiguration* config);
/**
* Set the current touchscreen in the configuration.
*/
void AConfiguration_setTouchscreen(AConfiguration* config, int32_t touchscreen);
/**
* Return the current ACONFIGURATION_DENSITY_* set in the configuration.
*/
int32_t AConfiguration_getDensity(AConfiguration* config);
/**
* Set the current density in the configuration.
*/
void AConfiguration_setDensity(AConfiguration* config, int32_t density);
/**
* Return the current ACONFIGURATION_KEYBOARD_* set in the configuration.
*/
int32_t AConfiguration_getKeyboard(AConfiguration* config);
/**
* Set the current keyboard in the configuration.
*/
void AConfiguration_setKeyboard(AConfiguration* config, int32_t keyboard);
/**
* Return the current ACONFIGURATION_NAVIGATION_* set in the configuration.
*/
int32_t AConfiguration_getNavigation(AConfiguration* config);
/**
* Set the current navigation in the configuration.
*/
void AConfiguration_setNavigation(AConfiguration* config, int32_t navigation);
/**
* Return the current ACONFIGURATION_KEYSHIDDEN_* set in the configuration.
*/
int32_t AConfiguration_getKeysHidden(AConfiguration* config);
/**
* Set the current keys hidden in the configuration.
*/
void AConfiguration_setKeysHidden(AConfiguration* config, int32_t keysHidden);
/**
* Return the current ACONFIGURATION_NAVHIDDEN_* set in the configuration.
*/
int32_t AConfiguration_getNavHidden(AConfiguration* config);
/**
* Set the current nav hidden in the configuration.
*/
void AConfiguration_setNavHidden(AConfiguration* config, int32_t navHidden);
/**
* Return the current SDK (API) version set in the configuration.
*/
int32_t AConfiguration_getSdkVersion(AConfiguration* config);
/**
* Set the current SDK version in the configuration.
*/
void AConfiguration_setSdkVersion(AConfiguration* config, int32_t sdkVersion);
/**
* Return the current ACONFIGURATION_SCREENSIZE_* set in the configuration.
*/
int32_t AConfiguration_getScreenSize(AConfiguration* config);
/**
* Set the current screen size in the configuration.
*/
void AConfiguration_setScreenSize(AConfiguration* config, int32_t screenSize);
/**
* Return the current ACONFIGURATION_SCREENLONG_* set in the configuration.
*/
int32_t AConfiguration_getScreenLong(AConfiguration* config);
/**
* Set the current screen long in the configuration.
*/
void AConfiguration_setScreenLong(AConfiguration* config, int32_t screenLong);
/**
* Return the current ACONFIGURATION_UI_MODE_TYPE_* set in the configuration.
*/
int32_t AConfiguration_getUiModeType(AConfiguration* config);
/**
* Set the current UI mode type in the configuration.
*/
void AConfiguration_setUiModeType(AConfiguration* config, int32_t uiModeType);
/**
* Return the current ACONFIGURATION_UI_MODE_NIGHT_* set in the configuration.
*/
int32_t AConfiguration_getUiModeNight(AConfiguration* config);
/**
* Set the current UI mode night in the configuration.
*/
void AConfiguration_setUiModeNight(AConfiguration* config, int32_t uiModeNight);
/**
* Return the current configuration screen width in dp units, or
* ACONFIGURATION_SCREEN_WIDTH_DP_ANY if not set.
*/
int32_t AConfiguration_getScreenWidthDp(AConfiguration* config);
/**
* Set the configuration's current screen width in dp units.
*/
void AConfiguration_setScreenWidthDp(AConfiguration* config, int32_t value);
/**
* Return the current configuration screen height in dp units, or
* ACONFIGURATION_SCREEN_HEIGHT_DP_ANY if not set.
*/
int32_t AConfiguration_getScreenHeightDp(AConfiguration* config);
/**
* Set the configuration's current screen width in dp units.
*/
void AConfiguration_setScreenHeightDp(AConfiguration* config, int32_t value);
/**
* Return the configuration's smallest screen width in dp units, or
* ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY if not set.
*/
int32_t AConfiguration_getSmallestScreenWidthDp(AConfiguration* config);
/**
* Set the configuration's smallest screen width in dp units.
*/
void AConfiguration_setSmallestScreenWidthDp(AConfiguration* config, int32_t value);
/**
* Return the configuration's layout direction, or
* ACONFIGURATION_LAYOUTDIR_ANY if not set.
*/
int32_t AConfiguration_getLayoutDirection(AConfiguration* config);
/**
* Set the configuration's layout direction.
*/
void AConfiguration_setLayoutDirection(AConfiguration* config, int32_t value);
/**
* Perform a diff between two configurations. Returns a bit mask of
* ACONFIGURATION_* constants, each bit set meaning that configuration element
* is different between them.
*/
int32_t AConfiguration_diff(AConfiguration* config1, AConfiguration* config2);
/**
* Determine whether 'base' is a valid configuration for use within the
* environment 'requested'. Returns 0 if there are any values in 'base'
* that conflict with 'requested'. Returns 1 if it does not conflict.
*/
int32_t AConfiguration_match(AConfiguration* base, AConfiguration* requested);
/**
* Determine whether the configuration in 'test' is better than the existing
* configuration in 'base'. If 'requested' is non-NULL, this decision is based
* on the overall configuration given there. If it is NULL, this decision is
* simply based on which configuration is more specific. Returns non-0 if
* 'test' is better than 'base'.
*
* This assumes you have already filtered the configurations with
* AConfiguration_match().
*/
int32_t AConfiguration_isBetterThan(AConfiguration* base, AConfiguration* test,
AConfiguration* requested);
#ifdef __cplusplus
};
#endif
#endif // ANDROID_CONFIGURATION_H

View File

@@ -0,0 +1,287 @@
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _ANDROID_KEYCODES_H
#define _ANDROID_KEYCODES_H
/******************************************************************
*
* IMPORTANT NOTICE:
*
* This file is part of Android's set of stable system headers
* exposed by the Android NDK (Native Development Kit).
*
* Third-party source AND binary code relies on the definitions
* here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
*
* - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES)
* - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS
* - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY
* - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
*/
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Key codes.
*/
enum {
AKEYCODE_UNKNOWN = 0,
AKEYCODE_SOFT_LEFT = 1,
AKEYCODE_SOFT_RIGHT = 2,
AKEYCODE_HOME = 3,
AKEYCODE_BACK = 4,
AKEYCODE_CALL = 5,
AKEYCODE_ENDCALL = 6,
AKEYCODE_0 = 7,
AKEYCODE_1 = 8,
AKEYCODE_2 = 9,
AKEYCODE_3 = 10,
AKEYCODE_4 = 11,
AKEYCODE_5 = 12,
AKEYCODE_6 = 13,
AKEYCODE_7 = 14,
AKEYCODE_8 = 15,
AKEYCODE_9 = 16,
AKEYCODE_STAR = 17,
AKEYCODE_POUND = 18,
AKEYCODE_DPAD_UP = 19,
AKEYCODE_DPAD_DOWN = 20,
AKEYCODE_DPAD_LEFT = 21,
AKEYCODE_DPAD_RIGHT = 22,
AKEYCODE_DPAD_CENTER = 23,
AKEYCODE_VOLUME_UP = 24,
AKEYCODE_VOLUME_DOWN = 25,
AKEYCODE_POWER = 26,
AKEYCODE_CAMERA = 27,
AKEYCODE_CLEAR = 28,
AKEYCODE_A = 29,
AKEYCODE_B = 30,
AKEYCODE_C = 31,
AKEYCODE_D = 32,
AKEYCODE_E = 33,
AKEYCODE_F = 34,
AKEYCODE_G = 35,
AKEYCODE_H = 36,
AKEYCODE_I = 37,
AKEYCODE_J = 38,
AKEYCODE_K = 39,
AKEYCODE_L = 40,
AKEYCODE_M = 41,
AKEYCODE_N = 42,
AKEYCODE_O = 43,
AKEYCODE_P = 44,
AKEYCODE_Q = 45,
AKEYCODE_R = 46,
AKEYCODE_S = 47,
AKEYCODE_T = 48,
AKEYCODE_U = 49,
AKEYCODE_V = 50,
AKEYCODE_W = 51,
AKEYCODE_X = 52,
AKEYCODE_Y = 53,
AKEYCODE_Z = 54,
AKEYCODE_COMMA = 55,
AKEYCODE_PERIOD = 56,
AKEYCODE_ALT_LEFT = 57,
AKEYCODE_ALT_RIGHT = 58,
AKEYCODE_SHIFT_LEFT = 59,
AKEYCODE_SHIFT_RIGHT = 60,
AKEYCODE_TAB = 61,
AKEYCODE_SPACE = 62,
AKEYCODE_SYM = 63,
AKEYCODE_EXPLORER = 64,
AKEYCODE_ENVELOPE = 65,
AKEYCODE_ENTER = 66,
AKEYCODE_DEL = 67,
AKEYCODE_GRAVE = 68,
AKEYCODE_MINUS = 69,
AKEYCODE_EQUALS = 70,
AKEYCODE_LEFT_BRACKET = 71,
AKEYCODE_RIGHT_BRACKET = 72,
AKEYCODE_BACKSLASH = 73,
AKEYCODE_SEMICOLON = 74,
AKEYCODE_APOSTROPHE = 75,
AKEYCODE_SLASH = 76,
AKEYCODE_AT = 77,
AKEYCODE_NUM = 78,
AKEYCODE_HEADSETHOOK = 79,
AKEYCODE_FOCUS = 80, // *Camera* focus
AKEYCODE_PLUS = 81,
AKEYCODE_MENU = 82,
AKEYCODE_NOTIFICATION = 83,
AKEYCODE_SEARCH = 84,
AKEYCODE_MEDIA_PLAY_PAUSE= 85,
AKEYCODE_MEDIA_STOP = 86,
AKEYCODE_MEDIA_NEXT = 87,
AKEYCODE_MEDIA_PREVIOUS = 88,
AKEYCODE_MEDIA_REWIND = 89,
AKEYCODE_MEDIA_FAST_FORWARD = 90,
AKEYCODE_MUTE = 91,
AKEYCODE_PAGE_UP = 92,
AKEYCODE_PAGE_DOWN = 93,
AKEYCODE_PICTSYMBOLS = 94,
AKEYCODE_SWITCH_CHARSET = 95,
AKEYCODE_BUTTON_A = 96,
AKEYCODE_BUTTON_B = 97,
AKEYCODE_BUTTON_C = 98,
AKEYCODE_BUTTON_X = 99,
AKEYCODE_BUTTON_Y = 100,
AKEYCODE_BUTTON_Z = 101,
AKEYCODE_BUTTON_L1 = 102,
AKEYCODE_BUTTON_R1 = 103,
AKEYCODE_BUTTON_L2 = 104,
AKEYCODE_BUTTON_R2 = 105,
AKEYCODE_BUTTON_THUMBL = 106,
AKEYCODE_BUTTON_THUMBR = 107,
AKEYCODE_BUTTON_START = 108,
AKEYCODE_BUTTON_SELECT = 109,
AKEYCODE_BUTTON_MODE = 110,
AKEYCODE_ESCAPE = 111,
AKEYCODE_FORWARD_DEL = 112,
AKEYCODE_CTRL_LEFT = 113,
AKEYCODE_CTRL_RIGHT = 114,
AKEYCODE_CAPS_LOCK = 115,
AKEYCODE_SCROLL_LOCK = 116,
AKEYCODE_META_LEFT = 117,
AKEYCODE_META_RIGHT = 118,
AKEYCODE_FUNCTION = 119,
AKEYCODE_SYSRQ = 120,
AKEYCODE_BREAK = 121,
AKEYCODE_MOVE_HOME = 122,
AKEYCODE_MOVE_END = 123,
AKEYCODE_INSERT = 124,
AKEYCODE_FORWARD = 125,
AKEYCODE_MEDIA_PLAY = 126,
AKEYCODE_MEDIA_PAUSE = 127,
AKEYCODE_MEDIA_CLOSE = 128,
AKEYCODE_MEDIA_EJECT = 129,
AKEYCODE_MEDIA_RECORD = 130,
AKEYCODE_F1 = 131,
AKEYCODE_F2 = 132,
AKEYCODE_F3 = 133,
AKEYCODE_F4 = 134,
AKEYCODE_F5 = 135,
AKEYCODE_F6 = 136,
AKEYCODE_F7 = 137,
AKEYCODE_F8 = 138,
AKEYCODE_F9 = 139,
AKEYCODE_F10 = 140,
AKEYCODE_F11 = 141,
AKEYCODE_F12 = 142,
AKEYCODE_NUM_LOCK = 143,
AKEYCODE_NUMPAD_0 = 144,
AKEYCODE_NUMPAD_1 = 145,
AKEYCODE_NUMPAD_2 = 146,
AKEYCODE_NUMPAD_3 = 147,
AKEYCODE_NUMPAD_4 = 148,
AKEYCODE_NUMPAD_5 = 149,
AKEYCODE_NUMPAD_6 = 150,
AKEYCODE_NUMPAD_7 = 151,
AKEYCODE_NUMPAD_8 = 152,
AKEYCODE_NUMPAD_9 = 153,
AKEYCODE_NUMPAD_DIVIDE = 154,
AKEYCODE_NUMPAD_MULTIPLY = 155,
AKEYCODE_NUMPAD_SUBTRACT = 156,
AKEYCODE_NUMPAD_ADD = 157,
AKEYCODE_NUMPAD_DOT = 158,
AKEYCODE_NUMPAD_COMMA = 159,
AKEYCODE_NUMPAD_ENTER = 160,
AKEYCODE_NUMPAD_EQUALS = 161,
AKEYCODE_NUMPAD_LEFT_PAREN = 162,
AKEYCODE_NUMPAD_RIGHT_PAREN = 163,
AKEYCODE_VOLUME_MUTE = 164,
AKEYCODE_INFO = 165,
AKEYCODE_CHANNEL_UP = 166,
AKEYCODE_CHANNEL_DOWN = 167,
AKEYCODE_ZOOM_IN = 168,
AKEYCODE_ZOOM_OUT = 169,
AKEYCODE_TV = 170,
AKEYCODE_WINDOW = 171,
AKEYCODE_GUIDE = 172,
AKEYCODE_DVR = 173,
AKEYCODE_BOOKMARK = 174,
AKEYCODE_CAPTIONS = 175,
AKEYCODE_SETTINGS = 176,
AKEYCODE_TV_POWER = 177,
AKEYCODE_TV_INPUT = 178,
AKEYCODE_STB_POWER = 179,
AKEYCODE_STB_INPUT = 180,
AKEYCODE_AVR_POWER = 181,
AKEYCODE_AVR_INPUT = 182,
AKEYCODE_PROG_RED = 183,
AKEYCODE_PROG_GREEN = 184,
AKEYCODE_PROG_YELLOW = 185,
AKEYCODE_PROG_BLUE = 186,
AKEYCODE_APP_SWITCH = 187,
AKEYCODE_BUTTON_1 = 188,
AKEYCODE_BUTTON_2 = 189,
AKEYCODE_BUTTON_3 = 190,
AKEYCODE_BUTTON_4 = 191,
AKEYCODE_BUTTON_5 = 192,
AKEYCODE_BUTTON_6 = 193,
AKEYCODE_BUTTON_7 = 194,
AKEYCODE_BUTTON_8 = 195,
AKEYCODE_BUTTON_9 = 196,
AKEYCODE_BUTTON_10 = 197,
AKEYCODE_BUTTON_11 = 198,
AKEYCODE_BUTTON_12 = 199,
AKEYCODE_BUTTON_13 = 200,
AKEYCODE_BUTTON_14 = 201,
AKEYCODE_BUTTON_15 = 202,
AKEYCODE_BUTTON_16 = 203,
AKEYCODE_LANGUAGE_SWITCH = 204,
AKEYCODE_MANNER_MODE = 205,
AKEYCODE_3D_MODE = 206,
AKEYCODE_CONTACTS = 207,
AKEYCODE_CALENDAR = 208,
AKEYCODE_MUSIC = 209,
AKEYCODE_CALCULATOR = 210,
AKEYCODE_ZENKAKU_HANKAKU = 211,
AKEYCODE_EISU = 212,
AKEYCODE_MUHENKAN = 213,
AKEYCODE_HENKAN = 214,
AKEYCODE_KATAKANA_HIRAGANA = 215,
AKEYCODE_YEN = 216,
AKEYCODE_RO = 217,
AKEYCODE_KANA = 218,
AKEYCODE_ASSIST = 219,
AKEYCODE_BRIGHTNESS_DOWN = 220,
AKEYCODE_BRIGHTNESS_UP = 221,
AKEYCODE_MEDIA_AUDIO_TRACK = 222,
AKEYCODE_SLEEP = 223,
AKEYCODE_WAKEUP = 224,
AKEYCODE_PAIRING = 225,
AKEYCODE_MEDIA_TOP_MENU = 226,
AKEYCODE_11 = 227,
AKEYCODE_12 = 228,
AKEYCODE_LAST_CHANNEL = 229,
AKEYCODE_TV_DATA_SERVICE = 230,
AKEYCODE_VOICE_ASSIST = 231
// NOTE: If you add a new keycode here you must also add it to several other files.
// Refer to frameworks/base/core/java/android/view/KeyEvent.java for the full list.
};
#ifdef __cplusplus
}
#endif
#endif // _ANDROID_KEYCODES_H

View File

@@ -0,0 +1,340 @@
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_SENSOR_H
#define ANDROID_SENSOR_H
/******************************************************************
*
* IMPORTANT NOTICE:
*
* This file is part of Android's set of stable system headers
* exposed by the Android NDK (Native Development Kit).
*
* Third-party source AND binary code relies on the definitions
* here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
*
* - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES)
* - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS
* - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY
* - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
*/
/*
* Structures and functions to receive and process sensor events in
* native code.
*
*/
#include <sys/types.h>
#include <android/looper.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Sensor types
* (keep in sync with hardware/sensor.h)
*/
enum {
ASENSOR_TYPE_ACCELEROMETER = 1,
ASENSOR_TYPE_MAGNETIC_FIELD = 2,
ASENSOR_TYPE_GYROSCOPE = 4,
ASENSOR_TYPE_LIGHT = 5,
ASENSOR_TYPE_PROXIMITY = 8
};
/*
* Sensor accuracy measure
*/
enum {
ASENSOR_STATUS_NO_CONTACT = -1,
ASENSOR_STATUS_UNRELIABLE = 0,
ASENSOR_STATUS_ACCURACY_LOW = 1,
ASENSOR_STATUS_ACCURACY_MEDIUM = 2,
ASENSOR_STATUS_ACCURACY_HIGH = 3
};
/*
* Sensor Reporting Modes.
*/
enum {
AREPORTING_MODE_CONTINUOUS = 0,
AREPORTING_MODE_ON_CHANGE = 1,
AREPORTING_MODE_ONE_SHOT = 2,
AREPORTING_MODE_SPECIAL_TRIGGER = 3
};
/*
* A few useful constants
*/
/* Earth's gravity in m/s^2 */
#define ASENSOR_STANDARD_GRAVITY (9.80665f)
/* Maximum magnetic field on Earth's surface in uT */
#define ASENSOR_MAGNETIC_FIELD_EARTH_MAX (60.0f)
/* Minimum magnetic field on Earth's surface in uT*/
#define ASENSOR_MAGNETIC_FIELD_EARTH_MIN (30.0f)
/*
* A sensor event.
*/
/* NOTE: Must match hardware/sensors.h */
typedef struct ASensorVector {
union {
float v[3];
struct {
float x;
float y;
float z;
};
struct {
float azimuth;
float pitch;
float roll;
};
};
int8_t status;
uint8_t reserved[3];
} ASensorVector;
typedef struct AMetaDataEvent {
int32_t what;
int32_t sensor;
} AMetaDataEvent;
typedef struct AUncalibratedEvent {
union {
float uncalib[3];
struct {
float x_uncalib;
float y_uncalib;
float z_uncalib;
};
};
union {
float bias[3];
struct {
float x_bias;
float y_bias;
float z_bias;
};
};
} AUncalibratedEvent;
typedef struct AHeartRateEvent {
float bpm;
int8_t status;
} AHeartRateEvent;
/* NOTE: Must match hardware/sensors.h */
typedef struct ASensorEvent {
int32_t version; /* sizeof(struct ASensorEvent) */
int32_t sensor;
int32_t type;
int32_t reserved0;
int64_t timestamp;
union {
union {
float data[16];
ASensorVector vector;
ASensorVector acceleration;
ASensorVector magnetic;
float temperature;
float distance;
float light;
float pressure;
float relative_humidity;
AUncalibratedEvent uncalibrated_gyro;
AUncalibratedEvent uncalibrated_magnetic;
AMetaDataEvent meta_data;
AHeartRateEvent heart_rate;
};
union {
uint64_t data[8];
uint64_t step_counter;
} u64;
};
uint32_t flags;
int32_t reserved1[3];
} ASensorEvent;
struct ASensorManager;
typedef struct ASensorManager ASensorManager;
struct ASensorEventQueue;
typedef struct ASensorEventQueue ASensorEventQueue;
struct ASensor;
typedef struct ASensor ASensor;
typedef ASensor const* ASensorRef;
typedef ASensorRef const* ASensorList;
/*****************************************************************************/
/*
* Get a reference to the sensor manager. ASensorManager is a singleton.
*
* Example:
*
* ASensorManager* sensorManager = ASensorManager_getInstance();
*
*/
ASensorManager* ASensorManager_getInstance();
/*
* Returns the list of available sensors.
*/
int ASensorManager_getSensorList(ASensorManager* manager, ASensorList* list);
/*
* Returns the default sensor for the given type, or NULL if no sensor
* of that type exists.
*/
ASensor const* ASensorManager_getDefaultSensor(ASensorManager* manager, int type);
/*
* Returns the default sensor with the given type and wakeUp properties or NULL if no sensor
* of this type and wakeUp properties exists.
*/
ASensor const* ASensorManager_getDefaultSensorEx(ASensorManager* manager, int type,
bool wakeUp);
/*
* Creates a new sensor event queue and associate it with a looper.
*/
ASensorEventQueue* ASensorManager_createEventQueue(ASensorManager* manager,
ALooper* looper, int ident, ALooper_callbackFunc callback, void* data);
/*
* Destroys the event queue and free all resources associated to it.
*/
int ASensorManager_destroyEventQueue(ASensorManager* manager, ASensorEventQueue* queue);
/*****************************************************************************/
/*
* Enable the selected sensor. Returns a negative error code on failure.
*/
int ASensorEventQueue_enableSensor(ASensorEventQueue* queue, ASensor const* sensor);
/*
* Disable the selected sensor. Returns a negative error code on failure.
*/
int ASensorEventQueue_disableSensor(ASensorEventQueue* queue, ASensor const* sensor);
/*
* Sets the delivery rate of events in microseconds for the given sensor.
* Note that this is a hint only, generally event will arrive at a higher
* rate. It is an error to set a rate inferior to the value returned by
* ASensor_getMinDelay().
* Returns a negative error code on failure.
*/
int ASensorEventQueue_setEventRate(ASensorEventQueue* queue, ASensor const* sensor, int32_t usec);
/*
* Returns true if there are one or more events available in the
* sensor queue. Returns 1 if the queue has events; 0 if
* it does not have events; and a negative value if there is an error.
*/
int ASensorEventQueue_hasEvents(ASensorEventQueue* queue);
/*
* Returns the next available events from the queue. Returns a negative
* value if no events are available or an error has occurred, otherwise
* the number of events returned.
*
* Examples:
* ASensorEvent event;
* ssize_t numEvent = ASensorEventQueue_getEvents(queue, &event, 1);
*
* ASensorEvent eventBuffer[8];
* ssize_t numEvent = ASensorEventQueue_getEvents(queue, eventBuffer, 8);
*
*/
ssize_t ASensorEventQueue_getEvents(ASensorEventQueue* queue,
ASensorEvent* events, size_t count);
/*****************************************************************************/
/*
* Returns this sensor's name (non localized)
*/
const char* ASensor_getName(ASensor const* sensor);
/*
* Returns this sensor's vendor's name (non localized)
*/
const char* ASensor_getVendor(ASensor const* sensor);
/*
* Return this sensor's type
*/
int ASensor_getType(ASensor const* sensor);
/*
* Returns this sensors's resolution
*/
float ASensor_getResolution(ASensor const* sensor);
/*
* Returns the minimum delay allowed between events in microseconds.
* A value of zero means that this sensor doesn't report events at a
* constant rate, but rather only when a new data is available.
*/
int ASensor_getMinDelay(ASensor const* sensor);
/*
* Returns the maximum size of batches for this sensor. Batches will often be
* smaller, as the hardware fifo might be used for other sensors.
*/
int ASensor_getFifoMaxEventCount(ASensor const* sensor);
/*
* Returns the hardware batch fifo size reserved to this sensor.
*/
int ASensor_getFifoReservedEventCount(ASensor const* sensor);
/*
* Returns this sensor's string type.
*/
const char* ASensor_getStringType(ASensor const* sensor);
/*
* Returns the reporting mode for this sensor. One of AREPORTING_MODE_* constants.
*/
int ASensor_getReportingMode(ASensor const* sensor);
/*
* Returns true if this is a wake up sensor, false otherwise.
*/
bool ASensor_isWakeUpSensor(ASensor const* sensor);
#ifdef __cplusplus
};
#endif
#endif // ANDROID_SENSOR_H