diff options
Diffstat (limited to 'sensors')
5 files changed, 187 insertions, 5 deletions
diff --git a/sensors/1.0/default/convert.cpp b/sensors/1.0/default/convert.cpp index 53ceb0d92f..43ee3276b9 100644 --- a/sensors/1.0/default/convert.cpp +++ b/sensors/1.0/default/convert.cpp @@ -190,8 +190,6 @@ void convertFromSensorEvent(const sensors_event_t &src, Event *dst) { } default: { - CHECK_GE((int32_t)dst->sensorType, (int32_t)SensorType::DEVICE_PRIVATE_BASE); - memcpy(dst->u.data.data(), src.data, 16 * sizeof(float)); break; } @@ -330,9 +328,6 @@ void convertToSensorEvent(const Event &src, sensors_event_t *dst) { } default: { - CHECK_GE((int32_t)src.sensorType, - (int32_t)SensorType::DEVICE_PRIVATE_BASE); - memcpy(dst->data, src.u.data.data(), 16 * sizeof(float)); break; } diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/Event.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/Event.aidl index c92ab1ab0c..4f49002fce 100644 --- a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/Event.aidl +++ b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/Event.aidl @@ -52,6 +52,9 @@ parcelable Event { android.hardware.sensors.AdditionalInfo additional; android.hardware.sensors.Event.EventPayload.Data data; android.hardware.sensors.Event.EventPayload.HeadTracker headTracker; + android.hardware.sensors.Event.EventPayload.LimitedAxesImu limitedAxesImu; + android.hardware.sensors.Event.EventPayload.LimitedAxesImuUncal limitedAxesImuUncal; + android.hardware.sensors.Event.EventPayload.Heading heading; @FixedSize @VintfStability parcelable Vec4 { float x; @@ -86,11 +89,37 @@ parcelable Event { int discontinuityCount; } @FixedSize @VintfStability + parcelable LimitedAxesImu { + float x; + float y; + float z; + float xSupported; + float ySupported; + float zSupported; + } + @FixedSize @VintfStability + parcelable LimitedAxesImuUncal { + float x; + float y; + float z; + float xBias; + float yBias; + float zBias; + float xSupported; + float ySupported; + float zSupported; + } + @FixedSize @VintfStability parcelable HeartRate { float bpm; android.hardware.sensors.SensorStatus status; } @FixedSize @VintfStability + parcelable Heading { + float heading; + float accuracy; + } + @FixedSize @VintfStability parcelable MetaData { android.hardware.sensors.Event.EventPayload.MetaData.MetaDataEventType what; @Backing(type="int") @VintfStability diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorType.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorType.aidl index 3d7ab45cd8..8c864e90be 100644 --- a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorType.aidl +++ b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorType.aidl @@ -71,5 +71,10 @@ enum SensorType { ACCELEROMETER_UNCALIBRATED = 35, HINGE_ANGLE = 36, HEAD_TRACKER = 37, + ACCELEROMETER_LIMITED_AXES = 38, + GYROSCOPE_LIMITED_AXES = 39, + ACCELEROMETER_LIMITED_AXES_UNCALIBRATED = 40, + GYROSCOPE_LIMITED_AXES_UNCALIBRATED = 41, + HEADING = 42, DEVICE_PRIVATE_BASE = 65536, } diff --git a/sensors/aidl/android/hardware/sensors/Event.aidl b/sensors/aidl/android/hardware/sensors/Event.aidl index fd6a8cc4ba..e8550f184b 100644 --- a/sensors/aidl/android/hardware/sensors/Event.aidl +++ b/sensors/aidl/android/hardware/sensors/Event.aidl @@ -132,6 +132,23 @@ parcelable Event { */ HeadTracker headTracker; + /** + * SensorType::ACCELEROMETER_LIMITED_AXES + * SensorType::GYROSCOPE_LIMITED_AXES + */ + LimitedAxesImu limitedAxesImu; + + /** + * SensorType::ACCELEROMETER_LIMITED_AXES_UNCALIBRATED + * SensorType::GYROSCOPE_LIMITED_AXES_UNCALIBRATED + */ + LimitedAxesImuUncal limitedAxesImuUncal; + + /** + * SensorType::HEADING + */ + Heading heading; + @FixedSize @VintfStability parcelable Vec4 { @@ -201,6 +218,70 @@ parcelable Event { int discontinuityCount; } + /** + * Payload of the ACCELEROMETER_LIMITED_AXES and GYROSCOPE_LIMITED_AXES + * sensor types. + */ + @FixedSize + @VintfStability + parcelable LimitedAxesImu { + /** + * Acceleration or angular speed values. If certain axes are not + * supported, the associated value must be set to 0. + */ + float x; + float y; + float z; + + /** + * Limited axes sensors must not be supported for all three axes. + * These values indicate which axes are supported with a 1.0 for + * supported, and a 0 for not supported. The supported axes should + * be determined at build time and these values must not change + * during runtime. + */ + float xSupported; + float ySupported; + float zSupported; + } + + /** + * Payload of the ACCELEROMETER_LIMITED_AXES_UNCALIBRATED and + * GYROSCOPE_LIMITED_AXES_UNCALIBRATED sensor types. + */ + @FixedSize + @VintfStability + parcelable LimitedAxesImuUncal { + /** + * Acceleration (without bias compensation) or angular (speed + * (without drift compensation) values. If certain axes are not + * supported, the associated value must be set to 0. + */ + float x; + float y; + float z; + + /** + * Estimated bias values for uncalibrated accelerometer or + * estimated drift values for uncalibrated gyroscope. If certain + * axes are not supported, the associated value must be set to 0. + */ + float xBias; + float yBias; + float zBias; + + /** + * Limited axes sensors must not be supported for all three axes. + * These values indicate which axes are supported with a 1.0 for + * supported, and a 0 for not supported. The supported axes should + * be determined at build time and these values must not change + * during runtime. + */ + float xSupported; + float ySupported; + float zSupported; + } + @FixedSize @VintfStability parcelable HeartRate { @@ -218,6 +299,27 @@ parcelable Event { @FixedSize @VintfStability + parcelable Heading { + /** + * The direction in which the device is pointing relative to true + * north in degrees. The value must be between 0.0 (inclusive) and + * 360.0 (exclusive), with 0 indicating north, 90 east, 180 south, + * and 270 west. + */ + float heading; + /** + * Accuracy is defined at 68% confidence. In the case where the + * underlying distribution is assumed Gaussian normal, this would be + * considered one standard deviation. For example, if the heading + * returns 60 degrees, and accuracy returns 10 degrees, then there + * is a 68 percent probability of the true heading being between 50 + * degrees and 70 degrees. + */ + float accuracy; + } + + @FixedSize + @VintfStability parcelable MetaData { MetaDataEventType what; diff --git a/sensors/aidl/android/hardware/sensors/SensorType.aidl b/sensors/aidl/android/hardware/sensors/SensorType.aidl index 01e6bee1d5..9098894cc7 100644 --- a/sensors/aidl/android/hardware/sensors/SensorType.aidl +++ b/sensors/aidl/android/hardware/sensors/SensorType.aidl @@ -667,6 +667,57 @@ enum SensorType { HEAD_TRACKER = 37, /** + * ACCELEROMETER_LIMITED_AXES + * reporting-mode: continuous + * + * Equivalent to ACCELEROMETER, but supporting cases where one or two axes + * are not supported. + */ + ACCELEROMETER_LIMITED_AXES = 38, + + /** + * GYROSCOPE_LIMITED_AXES + * reporting-mode: continuous + * + * Equivalent to GYROSCOPE, but supporting cases where one or two axes are + * not supported. + */ + GYROSCOPE_LIMITED_AXES = 39, + + /** + * ACCELEROMETER_LIMITED_AXES_UNCALIBRATED + * reporting-mode: continuous + * + * Equivalent to ACCELEROMETER_UNCALIBRATED, but supporting cases where one + * or two axes are not supported. + */ + ACCELEROMETER_LIMITED_AXES_UNCALIBRATED = 40, + + /** + * GYROSCOPE_LIMITED_AXES_UNCALIBRATED + * reporting-mode: continuous + * + * Equivalent to GYROSCOPE_UNCALIBRATED, but supporting cases where one or + * two axes are not supported. + */ + GYROSCOPE_LIMITED_AXES_UNCALIBRATED = 41, + + /** + * HEADING + * reporting-mode: continuous + * + * A sensor of this type measures the direction in which the device is + * pointing relative to true north in degrees. + * + * This sensor was added for automotive form factors. Other devices with a + * clear forward direction might find it useful as well. However, devices + * with a more ambiguous orientation such as phones or wearables might want + * to consider using other sensors such as Sensor.TYPE_ROTATION_VECTOR + * which might be more suitable. + */ + HEADING = 42, + + /** * Base for device manufacturers private sensor types. * These sensor types can't be exposed in the SDK. */ |