Implementation of sensor additional info report
This implements a mechanism for sensor hardware/HAL to deliver additional information beside sensor
readings to application. It includes internal temperature reading, untracked delay of sample,
location and pose of sensor device placement in phone frame, etc. This is also a very expandable
frame to account for future need.
Change-Id: Ib7780ac765f24d14eaed72b9862cd84b76054d74
diff --git a/include/android/sensor.h b/include/android/sensor.h
index 5b79d3c..f2647be 100644
--- a/include/android/sensor.h
+++ b/include/android/sensor.h
@@ -184,34 +184,43 @@
} AMetaDataEvent;
typedef struct AUncalibratedEvent {
- union {
- float uncalib[3];
- struct {
- float x_uncalib;
- float y_uncalib;
- float z_uncalib;
+ 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;
+ union {
+ float bias[3];
+ struct {
+ float x_bias;
+ float y_bias;
+ float z_bias;
+ };
};
- };
} AUncalibratedEvent;
typedef struct AHeartRateEvent {
- float bpm;
- int8_t status;
+ float bpm;
+ int8_t status;
} AHeartRateEvent;
typedef struct ADynamicSensorEvent {
- bool connected;
- int handle;
+ int32_t connected;
+ int32_t handle;
} ADynamicSensorEvent;
+typedef struct {
+ int32_t type;
+ int32_t serial;
+ union {
+ int32_t data_int32[14];
+ float data_float[14];
+ };
+} AAdditionalInfoEvent;
+
/* NOTE: Must match hardware/sensors.h */
typedef struct ASensorEvent {
int32_t version; /* sizeof(struct ASensorEvent) */
@@ -235,6 +244,7 @@
AMetaDataEvent meta_data;
AHeartRateEvent heart_rate;
ADynamicSensorEvent dynamic_sensor_meta;
+ AAdditionalInfoEvent additional_info;
};
union {
uint64_t data[8];