Android Hardware Abstraction Layer
Data Structures | Macros | Typedefs | Enumerations
sensors.h File Reference
#include <stdint.h>
#include <sys/cdefs.h>
#include <sys/types.h>
#include <hardware/hardware.h>
#include <cutils/native_handle.h>

Go to the source code of this file.

Data Structures

struct  sensors_vec_t
 
struct  uncalibrated_event_t
 
struct  meta_data_event
 
struct  sensors_event_t
 
struct  sensors_module_t
 
struct  sensor_t
 
struct  sensors_poll_device_t
 
struct  sensors_poll_device_1
 

Macros

#define SENSORS_HEADER_VERSION   1
 
#define SENSORS_MODULE_API_VERSION_0_1   HARDWARE_MODULE_API_VERSION(0, 1)
 
#define SENSORS_DEVICE_API_VERSION_0_1   HARDWARE_DEVICE_API_VERSION_2(0, 1, SENSORS_HEADER_VERSION)
 
#define SENSORS_DEVICE_API_VERSION_1_0   HARDWARE_DEVICE_API_VERSION_2(1, 0, SENSORS_HEADER_VERSION)
 
#define SENSORS_DEVICE_API_VERSION_1_1   HARDWARE_DEVICE_API_VERSION_2(1, 1, SENSORS_HEADER_VERSION)
 
#define SENSORS_HARDWARE_MODULE_ID   "sensors"
 
#define SENSORS_HARDWARE_POLL   "poll"
 
#define SENSORS_HANDLE_BASE   0
 
#define SENSORS_HANDLE_BITS   8
 
#define SENSORS_HANDLE_COUNT   (1<<SENSORS_HANDLE_BITS)
 
#define SENSOR_TYPE_DEVICE_PRIVATE_BASE   0x10000
 
#define SENSOR_TYPE_META_DATA   (0)
 
#define SENSOR_TYPE_ACCELEROMETER   (1)
 
#define SENSOR_TYPE_GEOMAGNETIC_FIELD   (2)
 
#define SENSOR_TYPE_MAGNETIC_FIELD   SENSOR_TYPE_GEOMAGNETIC_FIELD
 
#define SENSOR_TYPE_ORIENTATION   (3)
 
#define SENSOR_TYPE_GYROSCOPE   (4)
 
#define SENSOR_TYPE_LIGHT   (5)
 
#define SENSOR_TYPE_PRESSURE   (6)
 
#define SENSOR_TYPE_TEMPERATURE   (7)
 
#define SENSOR_TYPE_PROXIMITY   (8)
 
#define SENSOR_TYPE_GRAVITY   (9)
 
#define SENSOR_TYPE_LINEAR_ACCELERATION   (10)
 
#define SENSOR_TYPE_ROTATION_VECTOR   (11)
 
#define SENSOR_TYPE_RELATIVE_HUMIDITY   (12)
 
#define SENSOR_TYPE_AMBIENT_TEMPERATURE   (13)
 
#define SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED   (14)
 
#define SENSOR_TYPE_GAME_ROTATION_VECTOR   (15)
 
#define SENSOR_TYPE_GYROSCOPE_UNCALIBRATED   (16)
 
#define SENSOR_TYPE_SIGNIFICANT_MOTION   (17)
 
#define SENSOR_TYPE_STEP_DETECTOR   (18)
 
#define SENSOR_TYPE_STEP_COUNTER   (19)
 
#define SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR   (20)
 
#define GRAVITY_SUN   (275.0f)
 
#define GRAVITY_EARTH   (9.80665f)
 
#define MAGNETIC_FIELD_EARTH_MAX   (60.0f)
 
#define MAGNETIC_FIELD_EARTH_MIN   (30.0f)
 
#define SENSOR_STATUS_UNRELIABLE   0
 
#define SENSOR_STATUS_ACCURACY_LOW   1
 
#define SENSOR_STATUS_ACCURACY_MEDIUM   2
 
#define SENSOR_STATUS_ACCURACY_HIGH   3
 

Typedefs

typedef struct meta_data_event meta_data_event_t
 
typedef struct sensors_event_t sensors_event_t
 
typedef sensors_event_t sensors_meta_data_event_t
 
typedef struct
sensors_poll_device_1 
sensors_poll_device_1_t
 

Enumerations

enum  { SENSORS_BATCH_DRY_RUN = 0x00000001, SENSORS_BATCH_WAKE_UPON_FIFO_FULL = 0x00000002 }
 
enum  { META_DATA_FLUSH_COMPLETE = 1, META_DATA_VERSION }
 

Macro Definition Documentation

#define GRAVITY_EARTH   (9.80665f)

Definition at line 741 of file sensors.h.

#define GRAVITY_SUN   (275.0f)

Values returned by the accelerometer in various locations in the universe. all values are in SI units (m/s^2)

Definition at line 740 of file sensors.h.

#define MAGNETIC_FIELD_EARTH_MAX   (60.0f)

Maximum magnetic field on Earth's surface

Definition at line 744 of file sensors.h.

#define MAGNETIC_FIELD_EARTH_MIN   (30.0f)

Minimum magnetic field on Earth's surface

Definition at line 747 of file sensors.h.

#define SENSOR_STATUS_ACCURACY_HIGH   3

Definition at line 757 of file sensors.h.

#define SENSOR_STATUS_ACCURACY_LOW   1

Definition at line 755 of file sensors.h.

#define SENSOR_STATUS_ACCURACY_MEDIUM   2

Definition at line 756 of file sensors.h.

#define SENSOR_STATUS_UNRELIABLE   0

status of orientation sensor

Definition at line 754 of file sensors.h.

#define SENSOR_TYPE_ACCELEROMETER   (1)

Definition at line 265 of file sensors.h.

#define SENSOR_TYPE_AMBIENT_TEMPERATURE   (13)

Definition at line 475 of file sensors.h.

#define SENSOR_TYPE_DEVICE_PRIVATE_BASE   0x10000

Definition of the axis used by the sensor HAL API

This API is relative to the screen of the device in its default orientation, that is, if the device can be used in portrait or landscape, this API is only relative to the NATURAL orientation of the screen. In other words, the axis are not swapped when the device's screen orientation changes. Higher level services /may/ perform this transformation.

x<0 x>0 ^ | +--------—+–> y>0

| | / z<0 | | / | | / O--------—+/ |[] [ ] []/ +-------—/+ y<0 / / |/ z>0 (toward the sky)

O: Origin (x=0,y=0,z=0)

Definition at line 156 of file sensors.h.

#define SENSOR_TYPE_GAME_ROTATION_VECTOR   (15)

Definition at line 538 of file sensors.h.

#define SENSOR_TYPE_GEOMAGNETIC_FIELD   (2)

Definition at line 282 of file sensors.h.

#define SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR   (20)

Definition at line 734 of file sensors.h.

#define SENSOR_TYPE_GRAVITY   (9)

Definition at line 389 of file sensors.h.

#define SENSOR_TYPE_GYROSCOPE   (4)

Definition at line 343 of file sensors.h.

#define SENSOR_TYPE_GYROSCOPE_UNCALIBRATED   (16)

Definition at line 581 of file sensors.h.

#define SENSOR_TYPE_LIGHT   (5)

Definition at line 352 of file sensors.h.

#define SENSOR_TYPE_LINEAR_ACCELERATION   (10)

Definition at line 406 of file sensors.h.

#define SENSOR_TYPE_MAGNETIC_FIELD   SENSOR_TYPE_GEOMAGNETIC_FIELD

Definition at line 283 of file sensors.h.

#define SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED   (14)

Definition at line 514 of file sensors.h.

#define SENSOR_TYPE_META_DATA   (0)

Definition at line 230 of file sensors.h.

#define SENSOR_TYPE_ORIENTATION   (3)

Definition at line 323 of file sensors.h.

#define SENSOR_TYPE_PRESSURE   (6)

Definition at line 361 of file sensors.h.

#define SENSOR_TYPE_PROXIMITY   (8)

Definition at line 376 of file sensors.h.

#define SENSOR_TYPE_RELATIVE_HUMIDITY   (12)

Definition at line 466 of file sensors.h.

#define SENSOR_TYPE_ROTATION_VECTOR   (11)

Definition at line 456 of file sensors.h.

#define SENSOR_TYPE_SIGNIFICANT_MOTION   (17)

Definition at line 633 of file sensors.h.

#define SENSOR_TYPE_STEP_COUNTER   (19)

Definition at line 712 of file sensors.h.

#define SENSOR_TYPE_STEP_DETECTOR   (18)

Definition at line 659 of file sensors.h.

#define SENSOR_TYPE_TEMPERATURE   (7)

Definition at line 364 of file sensors.h.

#define SENSORS_DEVICE_API_VERSION_0_1   HARDWARE_DEVICE_API_VERSION_2(0, 1, SENSORS_HEADER_VERSION)

Definition at line 33 of file sensors.h.

#define SENSORS_DEVICE_API_VERSION_1_0   HARDWARE_DEVICE_API_VERSION_2(1, 0, SENSORS_HEADER_VERSION)

Definition at line 34 of file sensors.h.

#define SENSORS_DEVICE_API_VERSION_1_1   HARDWARE_DEVICE_API_VERSION_2(1, 1, SENSORS_HEADER_VERSION)

Definition at line 35 of file sensors.h.

#define SENSORS_HANDLE_BASE   0

Handles must be higher than SENSORS_HANDLE_BASE and must be unique. A Handle identifies a given sensors. The handle is used to activate and/or deactivate sensors. In this version of the API there can only be 256 handles.

Definition at line 53 of file sensors.h.

#define SENSORS_HANDLE_BITS   8

Definition at line 54 of file sensors.h.

#define SENSORS_HANDLE_COUNT   (1<<SENSORS_HANDLE_BITS)

Definition at line 55 of file sensors.h.

#define SENSORS_HARDWARE_MODULE_ID   "sensors"

The id of this module

Definition at line 40 of file sensors.h.

#define SENSORS_HARDWARE_POLL   "poll"

Name of the sensors device to open

Definition at line 45 of file sensors.h.

#define SENSORS_HEADER_VERSION   1

Definition at line 31 of file sensors.h.

#define SENSORS_MODULE_API_VERSION_0_1   HARDWARE_MODULE_API_VERSION(0, 1)

Definition at line 32 of file sensors.h.

Typedef Documentation

Union of the various types of sensor data that can be returned.

Definition at line 884 of file sensors.h.

Enumeration Type Documentation

anonymous enum
Enumerator
SENSORS_BATCH_DRY_RUN 
SENSORS_BATCH_WAKE_UPON_FIFO_FULL 

Definition at line 63 of file sensors.h.

anonymous enum
Enumerator
META_DATA_FLUSH_COMPLETE 
META_DATA_VERSION 

Definition at line 71 of file sensors.h.