diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl index 747ee90933..8c1784174d 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl @@ -34,9 +34,13 @@ package android.hardware.gnss; @VintfStability parcelable SatellitePvt { + int flags; android.hardware.gnss.SatellitePositionEcef satPosEcef; android.hardware.gnss.SatelliteVelocityEcef satVelEcef; android.hardware.gnss.SatelliteClockInfo satClockInfo; double ionoDelayMeters; double tropoDelayMeters; + const int HAS_POSITION_VELOCITY_CLOCK_INFO = 1; + const int HAS_IONO = 2; + const int HAS_TROPO = 4; } diff --git a/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl b/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl index ea55f0c257..a238e3fc26 100644 --- a/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl +++ b/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl @@ -16,9 +16,9 @@ package android.hardware.gnss; +import android.hardware.gnss.SatelliteClockInfo; import android.hardware.gnss.SatellitePositionEcef; import android.hardware.gnss.SatelliteVelocityEcef; -import android.hardware.gnss.SatelliteClockInfo; /** * Contains estimates of the satellite position, velocity and time in the @@ -26,6 +26,34 @@ import android.hardware.gnss.SatelliteClockInfo; */ @VintfStability parcelable SatellitePvt { + /** + * Bit mask indicating valid satellite position, velocity and clock info fields are + * stored in the SatellitePvt. + */ + const int HAS_POSITION_VELOCITY_CLOCK_INFO = 1 << 0; + + /** + * Bit mask indicating a valid iono delay field is stored in the SatellitePvt. + */ + const int HAS_IONO = 1 << 1; + + /** + * Bit mask indicating a valid tropo delay field is stored in the SatellitePvt. + */ + const int HAS_TROPO = 1 << 2; + + /** + * A bitfield of flags indicating the validity of the fields in this SatellitePvt. + * The bit masks are defined in the constants with prefix HAS_* + * + * Fields for which there is no corresponding flag must be filled in with a valid value. + * For convenience, these are marked as mandatory. + * + * Others fields may have invalid information in them, if not marked as valid by the + * corresponding bit in flags. + */ + int flags; + /** * Satellite position in WGS84 ECEF. See comments of * SatellitePositionEcef for units. @@ -46,4 +74,4 @@ parcelable SatellitePvt { /** Tropospheric delay in meters. */ double tropoDelayMeters; -} \ No newline at end of file +} diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp index 0fc2ff8a38..67ccf52c15 100644 --- a/gnss/aidl/vts/gnss_hal_test_cases.cpp +++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp @@ -38,6 +38,7 @@ using android::hardware::gnss::IGnssMeasurementInterface; using android::hardware::gnss::IGnssPowerIndication; using android::hardware::gnss::IGnssPsds; using android::hardware::gnss::PsdsType; +using android::hardware::gnss::SatellitePvt; using GnssConstellationTypeAidl = android::hardware::gnss::GnssConstellationType; @@ -128,22 +129,39 @@ TEST_P(GnssHalTest, TestGnssMeasurementExtension) { GnssMeasurement::HAS_SATELLITE_PVT | GnssMeasurement::HAS_CORRELATION_VECTOR)); - if ((measurement.flags & GnssMeasurement::HAS_SATELLITE_PVT) && - (has_capability_satpvt == true)) { - ASSERT_TRUE(measurement.satellitePvt.satPosEcef.posXMeters >= -43000000 && - measurement.satellitePvt.satPosEcef.posXMeters <= 43000000); - ASSERT_TRUE(measurement.satellitePvt.satPosEcef.posYMeters >= -43000000 && - measurement.satellitePvt.satPosEcef.posYMeters <= 43000000); - ASSERT_TRUE(measurement.satellitePvt.satPosEcef.posZMeters >= -43000000 && - measurement.satellitePvt.satPosEcef.posZMeters <= 43000000); - ASSERT_TRUE(measurement.satellitePvt.satPosEcef.ureMeters > 0); - ASSERT_TRUE(measurement.satellitePvt.satVelEcef.velXMps >= -4000 && - measurement.satellitePvt.satVelEcef.velXMps <= 4000); - ASSERT_TRUE(measurement.satellitePvt.satVelEcef.velYMps >= -4000 && - measurement.satellitePvt.satVelEcef.velYMps <= 4000); - ASSERT_TRUE(measurement.satellitePvt.satVelEcef.velZMps >= -4000 && - measurement.satellitePvt.satVelEcef.velZMps <= 4000); - ASSERT_TRUE(measurement.satellitePvt.satVelEcef.ureRateMps > 0); + if (measurement.flags & GnssMeasurement::HAS_SATELLITE_PVT && + has_capability_satpvt == true) { + if (measurement.satellitePvt.flags & SatellitePvt::HAS_POSITION_VELOCITY_CLOCK_INFO) { + ASSERT_TRUE(measurement.satellitePvt.satPosEcef.posXMeters >= -43000000 && + measurement.satellitePvt.satPosEcef.posXMeters <= 43000000); + ASSERT_TRUE(measurement.satellitePvt.satPosEcef.posYMeters >= -43000000 && + measurement.satellitePvt.satPosEcef.posYMeters <= 43000000); + ASSERT_TRUE(measurement.satellitePvt.satPosEcef.posZMeters >= -43000000 && + measurement.satellitePvt.satPosEcef.posZMeters <= 43000000); + ASSERT_TRUE(measurement.satellitePvt.satPosEcef.ureMeters > 0); + ASSERT_TRUE(measurement.satellitePvt.satVelEcef.velXMps >= -4000 && + measurement.satellitePvt.satVelEcef.velXMps <= 4000); + ASSERT_TRUE(measurement.satellitePvt.satVelEcef.velYMps >= -4000 && + measurement.satellitePvt.satVelEcef.velYMps <= 4000); + ASSERT_TRUE(measurement.satellitePvt.satVelEcef.velZMps >= -4000 && + measurement.satellitePvt.satVelEcef.velZMps <= 4000); + ASSERT_TRUE(measurement.satellitePvt.satVelEcef.ureRateMps > 0); + ASSERT_TRUE( + measurement.satellitePvt.satClockInfo.satHardwareCodeBiasMeters > -17.869 && + measurement.satellitePvt.satClockInfo.satHardwareCodeBiasMeters < 17.729); + ASSERT_TRUE(measurement.satellitePvt.satClockInfo.satTimeCorrectionMeters > -3e6 && + measurement.satellitePvt.satClockInfo.satTimeCorrectionMeters < 3e6); + ASSERT_TRUE(measurement.satellitePvt.satClockInfo.satClkDriftMps > -1.117 && + measurement.satellitePvt.satClockInfo.satClkDriftMps < 1.117); + } + if (measurement.satellitePvt.flags & SatellitePvt::HAS_IONO) { + ASSERT_TRUE(measurement.satellitePvt.ionoDelayMeters > 0 && + measurement.satellitePvt.ionoDelayMeters < 100); + } + if (measurement.satellitePvt.flags & SatellitePvt::HAS_TROPO) { + ASSERT_TRUE(measurement.satellitePvt.tropoDelayMeters > 0 && + measurement.satellitePvt.tropoDelayMeters < 100); + } } if (kIsCorrelationVectorSupported && diff --git a/gnss/common/utils/default/Utils.cpp b/gnss/common/utils/default/Utils.cpp index 9bc6786b80..569dac4c59 100644 --- a/gnss/common/utils/default/Utils.cpp +++ b/gnss/common/utils/default/Utils.cpp @@ -31,6 +31,7 @@ using aidl::android::hardware::gnss::GnssData; using aidl::android::hardware::gnss::GnssMeasurement; using aidl::android::hardware::gnss::IGnss; using aidl::android::hardware::gnss::IGnssMeasurementCallback; +using aidl::android::hardware::gnss::SatellitePvt; using GnssSvFlags = V1_0::IGnssCallback::GnssSvFlags; using GnssMeasurementFlagsV1_0 = V1_0::IGnssMeasurementCallback::GnssMeasurementFlags; @@ -175,7 +176,9 @@ GnssData Utils::getMockMeasurement(const bool enableCorrVecOutputs) { .fullInterSignalBiasUncertaintyNs = 792.0, .satelliteInterSignalBiasNs = 233.9, .satelliteInterSignalBiasUncertaintyNs = 921.2, - .satellitePvt = {.satPosEcef = {.posXMeters = 10442993.1153328, + .satellitePvt = {.flags = SatellitePvt::HAS_POSITION_VELOCITY_CLOCK_INFO | + SatellitePvt::HAS_IONO | SatellitePvt::HAS_TROPO, + .satPosEcef = {.posXMeters = 10442993.1153328, .posYMeters = -19926932.8051666, .posZMeters = -12034295.0216203, .ureMeters = 1000.2345678},