Add an uncalibrated acclerometer sensor type.

Adding the uncalibrated accelerometer sensor type.

Test: Build compiles.
Change-Id: I586bd924e0fb90ef4b4a9565f8fbf72a39eccb36
This commit is contained in:
Ashutosh Joshi
2017-01-10 21:55:50 -08:00
parent bd439dcef0
commit e33eb92809
5 changed files with 64 additions and 0 deletions

View File

@@ -644,6 +644,31 @@ public final class Sensor {
public static final String STRING_TYPE_DYNAMIC_SENSOR_META =
"android.sensor.dynamic_sensor_meta";
/* TYPE_ADDITIONAL_INFO - defined as type 33 in the HAL is not exposed to
* applications. There are parts of the framework that require the sensors
* to be in the same order as the HAL. Skipping this sensor
*/
/* TYPE_LOW_LATENCY_OFF_BODY_SENSOR - defined as type 34 in the HAL needs to
* be defined in this space.
*/
/**
* A constant describing an uncalibrated accelerometer sensor.
*
* See {@link android.hardware.SensorEvent#values SensorEvent.values} for more details.
*
*/
public static final int TYPE_ACCELEROMETER_UNCALIBRATED = 35;
/**
* A constant string describing an uncalibrated accelerometer sensor.
*
* @see #TYPE_ACCELEROMETER_UNCALIBRATED
*
*/
public static final String STRING_TYPE_ACCELEROMETER_UNCALIBRATED =
"android.sensor.accelerometer_uncalibrated";
/**
* A constant describing all sensor types.
*/
@@ -752,6 +777,9 @@ public final class Sensor {
1, // SENSOR_TYPE_MOTION_DETECT
1, // SENSOR_TYPE_HEART_BEAT
2, // SENSOR_TYPE_DYNAMIC_SENSOR_META
16,// skip over additional sensor info type
1, // reserving for LLOB sensor type
6, // SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED
};
/**
@@ -1123,6 +1151,9 @@ public final class Sensor {
case TYPE_DYNAMIC_SENSOR_META:
mStringType = STRING_TYPE_DYNAMIC_SENSOR_META;
return true;
case TYPE_ACCELEROMETER_UNCALIBRATED:
mStringType = STRING_TYPE_ACCELEROMETER_UNCALIBRATED;
return true;
default:
return false;
}

View File

@@ -578,6 +578,33 @@ public class SensorEvent {
* A confidence value of 1.0 indicates complete certainly - that a peak is
* completely unlikely to be anywhere else on the QRS complex.
* </p>
*
* <h4>{@link android.hardware.Sensor#TYPE_ACCELEROMETER_UNCALIBRATED
* Sensor.TYPE_ACCELEROMETER_UNCALIBRATED}:</h4> All values are in SI
* units (m/s^2)
*
* Similar to {@link android.hardware.Sensor#TYPE_ACCELEROMETER},
* Factory calibration and temperature compensation will still be applied
* to the "uncalibrated" measurement.
*
* <p>
* The values array is shown below:
* <ul>
* <li> values[0] = x_uncalib without bias compensation </li>
* <li> values[1] = y_uncalib without bias compensation </li>
* <li> values[2] = z_uncalib without bias compensation </li>
* <li> values[3] = estimated x_bias </li>
* <li> values[4] = estimated y_bias </li>
* <li> values[5] = estimated z_bias </li>
* </ul>
* </p>
* <p>
* x_uncalib, y_uncalib, z_uncalib are the measured acceleration in X, Y, Z
* axes similar to the {@link android.hardware.Sensor#TYPE_ACCELEROMETER},
* without any bias correction (factory bias compensation and any
* temperature compensation is allowed).
* x_bias, y_bias, z_bias are the estimated biases.
* </p>
*/
public final float[] values;