blob: 78c6a268cccf07ea07f063c72a335530fb585f19 [file] [log] [blame]
The Android Open Source Project9877e2e2009-03-18 17:39:44 -07001/* Copyright (C) 2009 The Android Open Source Project
2**
3** This software is licensed under the terms of the GNU General Public
4** License version 2, as published by the Free Software Foundation, and
5** may be copied, distributed, and modified under those terms.
6**
7** This program is distributed in the hope that it will be useful,
8** but WITHOUT ANY WARRANTY; without even the implied warranty of
9** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10** GNU General Public License for more details.
11*/
12#ifndef _android_sensors_h
13#define _android_sensors_h
14
15#include "qemu-common.h"
16
17/* initialize sensor emulation */
18extern void android_hw_sensors_init( void );
19
Tim Wan736e01f2011-01-10 10:58:25 +010020/* NOTE: Sensor status Error definition, It will be used in the Sensors Command
21 * part in android/console.c. Details:
22 * SENSOR_STATUS_NO_SERVICE: "sensors" qemud service is not available/initiated.
23 * SENSOR_STATUS_DISABLED: sensor is disabled.
24 * SENSOR_STATUS_UNKNOWN: wrong sensor name.
25 * SENSOR_STATUS_OK: Everything is OK to the current sensor.
26 * */
27typedef enum{
28 SENSOR_STATUS_NO_SERVICE = -3,
29 SENSOR_STATUS_DISABLED = -2,
30 SENSOR_STATUS_UNKNOWN = -1,
31 SENSOR_STATUS_OK = 0,
32} SensorStatus;
33
The Android Open Source Project9877e2e2009-03-18 17:39:44 -070034/* NOTE: this list must be the same that the one defined in
35 * the sensors_qemu.c source of the libsensors.goldfish.so
36 * library.
David 'Digit' Turner607461d2011-02-24 16:27:48 +010037 *
38 * DO NOT CHANGE THE ORDER IN THIS LIST, UNLESS YOU INTEND
39 * TO BREAK SNAPSHOTS!
The Android Open Source Project9877e2e2009-03-18 17:39:44 -070040 */
41#define SENSORS_LIST \
42 SENSOR_(ACCELERATION,"acceleration") \
43 SENSOR_(MAGNETIC_FIELD,"magnetic-field") \
44 SENSOR_(ORIENTATION,"orientation") \
45 SENSOR_(TEMPERATURE,"temperature") \
Ola Albertsson7c8397a2010-12-17 14:53:44 +010046 SENSOR_(PROXIMITY,"proximity") \
The Android Open Source Project9877e2e2009-03-18 17:39:44 -070047
48typedef enum {
49#define SENSOR_(x,y) ANDROID_SENSOR_##x,
50 SENSORS_LIST
51#undef SENSOR_
52 MAX_SENSORS /* do not remove */
53} AndroidSensor;
54
55extern void android_hw_sensor_enable( AndroidSensor sensor );
56
57/* COARSE ORIENTATION VALUES */
58typedef enum {
59 ANDROID_COARSE_PORTRAIT,
60 ANDROID_COARSE_LANDSCAPE
61} AndroidCoarseOrientation;
62
63/* change the coarse orientation value */
Tim Wan736e01f2011-01-10 10:58:25 +010064extern void android_sensors_set_coarse_orientation( AndroidCoarseOrientation orient );
65
66/* get sensor values */
67extern int android_sensors_get( int sensor_id, float* a, float* b, float* c );
68
69/* set sensor values */
70extern int android_sensors_set( int sensor_id, float a, float b, float c );
71
72/* Get sensor id from sensor name */
73extern int android_sensors_get_id_from_name( char* sensorname );
74
75/* Get sensor name from sensor id */
76extern const char* android_sensors_get_name_from_id( int sensor_id );
77
78/* Get sensor from sensor id */
79extern uint8_t android_sensors_get_sensor_status( int sensor_id );
The Android Open Source Project9877e2e2009-03-18 17:39:44 -070080
81#endif /* _android_gps_h */