Loading include/android/sensor.h +26 −0 Original line number Original line Diff line number Diff line Loading @@ -301,6 +301,14 @@ enum { * supported and a value of 0 means not supported. * supported and a value of 0 means not supported. */ */ ASENSOR_TYPE_GYROSCOPE_LIMITED_AXES_UNCALIBRATED = 41, ASENSOR_TYPE_GYROSCOPE_LIMITED_AXES_UNCALIBRATED = 41, /** * {@link ASENSOR_TYPE_HEADING} * reporting-mode: continuous * * A heading sensor measures the direction in which the device is pointing * relative to true north in degrees. */ ASENSOR_TYPE_HEADING = 42, }; }; /** /** Loading Loading @@ -563,6 +571,23 @@ typedef struct ALimitedAxesImuUncalibratedEvent { }; }; } ALimitedAxesImuUncalibratedEvent; } ALimitedAxesImuUncalibratedEvent; typedef struct AHeadingEvent { /** * 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; } AHeadingEvent; /** /** * Information that describes a sensor event, refer to * Information that describes a sensor event, refer to * <a href="/reference/android/hardware/SensorEvent">SensorEvent</a> for additional * <a href="/reference/android/hardware/SensorEvent">SensorEvent</a> for additional Loading Loading @@ -602,6 +627,7 @@ typedef struct ASensorEvent { AHeadTrackerEvent head_tracker; AHeadTrackerEvent head_tracker; ALimitedAxesImuEvent limited_axes_imu; ALimitedAxesImuEvent limited_axes_imu; ALimitedAxesImuUncalibratedEvent limited_axes_imu_uncalibrated; ALimitedAxesImuUncalibratedEvent limited_axes_imu_uncalibrated; AHeadingEvent heading; }; }; union { union { uint64_t data[8]; uint64_t data[8]; Loading libs/sensor/Sensor.cpp +4 −0 Original line number Original line Diff line number Diff line Loading @@ -296,6 +296,10 @@ Sensor::Sensor(struct sensor_t const& hwSensor, const uuid_t& uuid, int halVersi mStringType = SENSOR_STRING_TYPE_GYROSCOPE_LIMITED_AXES_UNCALIBRATED; mStringType = SENSOR_STRING_TYPE_GYROSCOPE_LIMITED_AXES_UNCALIBRATED; mFlags |= SENSOR_FLAG_CONTINUOUS_MODE; mFlags |= SENSOR_FLAG_CONTINUOUS_MODE; break; break; case SENSOR_TYPE_HEADING: mStringType = SENSOR_STRING_TYPE_HEADING; mFlags |= SENSOR_FLAG_CONTINUOUS_MODE; break; default: default: // Only pipe the stringType, requiredPermission and flags for custom sensors. // Only pipe the stringType, requiredPermission and flags for custom sensors. if (halVersion > SENSORS_DEVICE_API_VERSION_1_0 && hwSensor.stringType) { if (halVersion > SENSORS_DEVICE_API_VERSION_1_0 && hwSensor.stringType) { Loading services/sensorservice/SensorServiceUtils.cpp +3 −0 Original line number Original line Diff line number Diff line Loading @@ -67,6 +67,9 @@ size_t eventSizeBySensorType(int type) { case SENSOR_TYPE_HEAD_TRACKER: case SENSOR_TYPE_HEAD_TRACKER: return 7; return 7; case SENSOR_TYPE_HEADING: return 2; default: default: return 3; return 3; } } Loading Loading
include/android/sensor.h +26 −0 Original line number Original line Diff line number Diff line Loading @@ -301,6 +301,14 @@ enum { * supported and a value of 0 means not supported. * supported and a value of 0 means not supported. */ */ ASENSOR_TYPE_GYROSCOPE_LIMITED_AXES_UNCALIBRATED = 41, ASENSOR_TYPE_GYROSCOPE_LIMITED_AXES_UNCALIBRATED = 41, /** * {@link ASENSOR_TYPE_HEADING} * reporting-mode: continuous * * A heading sensor measures the direction in which the device is pointing * relative to true north in degrees. */ ASENSOR_TYPE_HEADING = 42, }; }; /** /** Loading Loading @@ -563,6 +571,23 @@ typedef struct ALimitedAxesImuUncalibratedEvent { }; }; } ALimitedAxesImuUncalibratedEvent; } ALimitedAxesImuUncalibratedEvent; typedef struct AHeadingEvent { /** * 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; } AHeadingEvent; /** /** * Information that describes a sensor event, refer to * Information that describes a sensor event, refer to * <a href="/reference/android/hardware/SensorEvent">SensorEvent</a> for additional * <a href="/reference/android/hardware/SensorEvent">SensorEvent</a> for additional Loading Loading @@ -602,6 +627,7 @@ typedef struct ASensorEvent { AHeadTrackerEvent head_tracker; AHeadTrackerEvent head_tracker; ALimitedAxesImuEvent limited_axes_imu; ALimitedAxesImuEvent limited_axes_imu; ALimitedAxesImuUncalibratedEvent limited_axes_imu_uncalibrated; ALimitedAxesImuUncalibratedEvent limited_axes_imu_uncalibrated; AHeadingEvent heading; }; }; union { union { uint64_t data[8]; uint64_t data[8]; Loading
libs/sensor/Sensor.cpp +4 −0 Original line number Original line Diff line number Diff line Loading @@ -296,6 +296,10 @@ Sensor::Sensor(struct sensor_t const& hwSensor, const uuid_t& uuid, int halVersi mStringType = SENSOR_STRING_TYPE_GYROSCOPE_LIMITED_AXES_UNCALIBRATED; mStringType = SENSOR_STRING_TYPE_GYROSCOPE_LIMITED_AXES_UNCALIBRATED; mFlags |= SENSOR_FLAG_CONTINUOUS_MODE; mFlags |= SENSOR_FLAG_CONTINUOUS_MODE; break; break; case SENSOR_TYPE_HEADING: mStringType = SENSOR_STRING_TYPE_HEADING; mFlags |= SENSOR_FLAG_CONTINUOUS_MODE; break; default: default: // Only pipe the stringType, requiredPermission and flags for custom sensors. // Only pipe the stringType, requiredPermission and flags for custom sensors. if (halVersion > SENSORS_DEVICE_API_VERSION_1_0 && hwSensor.stringType) { if (halVersion > SENSORS_DEVICE_API_VERSION_1_0 && hwSensor.stringType) { Loading
services/sensorservice/SensorServiceUtils.cpp +3 −0 Original line number Original line Diff line number Diff line Loading @@ -67,6 +67,9 @@ size_t eventSizeBySensorType(int type) { case SENSOR_TYPE_HEAD_TRACKER: case SENSOR_TYPE_HEAD_TRACKER: return 7; return 7; case SENSOR_TYPE_HEADING: return 2; default: default: return 3; return 3; } } Loading