17 #ifndef ANDROID_SENSORS_INTERFACE_H
18 #define ANDROID_SENSORS_INTERFACE_H
21 #include <sys/cdefs.h>
22 #include <sys/types.h>
24 #include <hardware/hardware.h>
25 #include <cutils/native_handle.h>
32 #define SENSORS_HARDWARE_MODULE_ID "sensors"
37 #define SENSORS_HARDWARE_POLL "poll"
45 #define SENSORS_HANDLE_BASE 0
46 #define SENSORS_HANDLE_BITS 8
47 #define SENSORS_HANDLE_COUNT (1<<SENSORS_HANDLE_BITS)
53 #define SENSOR_TYPE_ACCELEROMETER 1
54 #define SENSOR_TYPE_MAGNETIC_FIELD 2
55 #define SENSOR_TYPE_ORIENTATION 3
56 #define SENSOR_TYPE_GYROSCOPE 4
57 #define SENSOR_TYPE_LIGHT 5
58 #define SENSOR_TYPE_PRESSURE 6
59 #define SENSOR_TYPE_TEMPERATURE 7 // deprecated
60 #define SENSOR_TYPE_PROXIMITY 8
61 #define SENSOR_TYPE_GRAVITY 9
62 #define SENSOR_TYPE_LINEAR_ACCELERATION 10
63 #define SENSOR_TYPE_ROTATION_VECTOR 11
64 #define SENSOR_TYPE_RELATIVE_HUMIDITY 12
65 #define SENSOR_TYPE_AMBIENT_TEMPERATURE 13
72 #define GRAVITY_SUN (275.0f)
73 #define GRAVITY_EARTH (9.80665f)
76 #define MAGNETIC_FIELD_EARTH_MAX (60.0f)
79 #define MAGNETIC_FIELD_EARTH_MIN (30.0f)
86 #define SENSOR_STATUS_UNRELIABLE 0
87 #define SENSOR_STATUS_ACCURACY_LOW 1
88 #define SENSOR_STATUS_ACCURACY_MEDIUM 2
89 #define SENSOR_STATUS_ACCURACY_HIGH 3
445 int handle,
int enabled);
457 int handle, int64_t ns);
473 static inline int sensors_open(
const struct hw_module_t* module,
475 return module->methods->open(module,
476 SENSORS_HARDWARE_POLL, (
struct hw_device_t**)device);
485 #endif // ANDROID_SENSORS_INTERFACE_H
sensors_vec_t orientation
int(* get_sensors_list)(struct sensors_module_t *module, struct sensor_t const **list)
Enumerate all available sensors.
int(* activate)(struct sensors_poll_device_t *dev, int handle, int enabled)
Activate/deactivate one sensor.
struct hw_module_t common
sensors_vec_t acceleration
Every hardware module must have a data structure named HAL_MODULE_INFO_SYM and the fields of this dat...
Every device data structure must begin with hw_device_t followed by module specific public methods an...
int(* poll)(struct sensors_poll_device_t *dev, sensors_event_t *data, int count)
Returns an array of sensor data.
Union of the various types of sensor data that can be returned.
int(* setDelay)(struct sensors_poll_device_t *dev, int handle, int64_t ns)
Set the delay between sensor events in nanoseconds for a given sensor.
struct hw_device_t common
struct sensors_event_t sensors_event_t
Union of the various types of sensor data that can be returned.