summaryrefslogtreecommitdiffstats
path: root/include/hardware/sensors.h
diff options
context:
space:
mode:
authorAshutosh Joshi <ashutoshj@google.com>2015-04-03 16:22:32 -0700
committerAshutosh Joshi <ashutoshj@google.com>2015-04-14 15:11:49 -0700
commit6507f5080bc3fdc8d4b23cfa2d73d3602cc60a6a (patch)
tree05e620c994fa2c2a7cb8745c59fd2daf6bd99099 /include/hardware/sensors.h
parentb3a7d37fa20457e62fd4c30c02dcd14400f0839e (diff)
downloadhardware_libhardware-6507f5080bc3fdc8d4b23cfa2d73d3602cc60a6a.zip
hardware_libhardware-6507f5080bc3fdc8d4b23cfa2d73d3602cc60a6a.tar.gz
hardware_libhardware-6507f5080bc3fdc8d4b23cfa2d73d3602cc60a6a.tar.bz2
Sensors HAL changes
Adding HAL changes for the following i) a method to place the HAL in a special mode. Expect to use this method for data-injection. ii) a method to inject sensor data into the sensors subsystem. iii) New sensor type for a SYNC event (google custom sensor). iv) New sensor type for a nudge gesture (google custom sensor). Change-Id: Idf0479b6301c5363cf51938e23aabc790b69fa96
Diffstat (limited to 'include/hardware/sensors.h')
-rw-r--r--include/hardware/sensors.h69
1 files changed, 68 insertions, 1 deletions
diff --git a/include/hardware/sensors.h b/include/hardware/sensors.h
index e917c0a..90036b6 100644
--- a/include/hardware/sensors.h
+++ b/include/hardware/sensors.h
@@ -35,6 +35,7 @@ __BEGIN_DECLS
#define SENSORS_DEVICE_API_VERSION_1_1 HARDWARE_DEVICE_API_VERSION_2(1, 1, SENSORS_HEADER_VERSION)
#define SENSORS_DEVICE_API_VERSION_1_2 HARDWARE_DEVICE_API_VERSION_2(1, 2, SENSORS_HEADER_VERSION)
#define SENSORS_DEVICE_API_VERSION_1_3 HARDWARE_DEVICE_API_VERSION_2(1, 3, SENSORS_HEADER_VERSION)
+#define SENSORS_DEVICE_API_VERSION_1_4 HARDWARE_DEVICE_API_VERSION_2(1, 4, SENSORS_HEADER_VERSION)
/**
* Please see the Sensors section of source.android.com for an
@@ -93,6 +94,28 @@ enum {
#define SENSOR_PERMISSION_BODY_SENSORS "android.permission.BODY_SENSORS"
/*
+ * Availability: SENSORS_DEVICE_API_VERSION_1_4
+ * Sensor HAL modes uses in set_operation_mode method
+ */
+enum {
+ /*
+ * Operating modes for the HAL.
+ */
+
+ /*
+ * Normal mode operation. This is the default state of operation.
+ * The HAL shall initialize into this mode on device startup.
+ */
+ SENSOR_HAL_NORMAL_MODE = 0,
+
+ /* Loopback mode. In this mode, the device shall not source data from the
+ * physical sensors as it would in normal mode. Instead sensor data is
+ * injected by the sensor service.
+ */
+ SENSOR_HAL_LOOPBACK_MODE = 0x1
+};
+
+/*
* Availability: SENSORS_DEVICE_API_VERSION_1_3
* Sensor flags used in sensor_t.flags.
*/
@@ -619,6 +642,36 @@ enum {
#define SENSOR_STRING_TYPE_WRIST_TILT_GESTURE "android.sensor.wrist_tilt_gesture"
/**
+ * SENSOR_TYPE_TIME_SYNC
+ * reporting-mode: continuous
+ *
+ * A time synchronization mechanism sensor to synchronize timing between
+ * differnt parts of the device.
+ * This sensor returns the following values in the sensor_event
+ * Time_stamp of the event
+ * u64.data[0] -> Type of event latched
+ * u64.data[1] -> count
+ *
+ * Implement only the wake-up version of this sensor.
+ */
+#define SENSOR_TYPE_TIME_SYNC (SENSOR_TYPE_DEVICE_PRIVATE_BASE + 0x10)
+#define SENSOR_STRING_TYPE_TIME_SYNC "android.sensor.time_sync"
+
+/**
+ * SENSOR_TYPE_NUDGE_GESTURE
+ * reporting-mode: one-shot
+ *
+ * A sensor of this type triggers when the device is nudged.
+ *
+ * The only allowed return value is 1.0. This sensor
+ * de-activates itself immediately after it triggers.
+ *
+ * Implement only the wake-up version of this sensor.
+ */
+#define SENSOR_TYPE_NUDGE_GESTURE (SENSOR_TYPE_DEVICE_PRIVATE_BASE + 0x11)
+#define SENSOR_STRING_NUDGE_UP_GESTURE "android.sensor.nudge_gesture"
+
+/**
* Values returned by the accelerometer in various locations in the universe.
* all values are in SI units (m/s^2)
*/
@@ -807,6 +860,15 @@ struct sensors_module_t {
*/
int (*get_sensors_list)(struct sensors_module_t* module,
struct sensor_t const** list);
+
+ /**
+ * Place the module in a specific mode. The following modes are defined
+ *
+ * 0 - Normal operation. Default state of the module.
+ * 1 - Loopback mode. Data is injected for the the supported sensors by
+ * the sensor service in this mode.
+ */
+ int (*set_operation_mode)(unsigned int mode);
};
struct sensor_t {
@@ -1004,7 +1066,12 @@ typedef struct sensors_poll_device_1 {
*/
int (*flush)(struct sensors_poll_device_1* dev, int sensor_handle);
- void (*reserved_procs[8])(void);
+ /*
+ * Inject a sensor samples to be to this device.
+ */
+ int (*inject_sensor_data)(struct sensors_poll_device_1 *dev, const sensors_event_t *data);
+
+ void (*reserved_procs[7])(void);
} sensors_poll_device_1_t;