Loading gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,9 @@ interface IGnssMeasurementInterface { * output rate of 1Hz (occasional intra-measurement time offsets in the range from 0-2000msec * can be tolerated.) * * If setCallback() is invoked without a previous close(), the HAL must use the new callback * and parameters to provide updates. * * @param callback Handle to GnssMeasurement callback interface. * @param enableFullTracking If true, GNSS chipset must switch off duty cycling. In such mode * no clock discontinuities are expected and, when supported, carrier phase should be Loading @@ -104,6 +107,9 @@ interface IGnssMeasurementInterface { /** * Initializes the interface and registers the callback routines with the HAL. * * If setCallbackWithOptions() is invoked without a previous close(), the HAL must use the new * callback and options to provide updates. * * @param options See Options definition. */ void setCallbackWithOptions(in IGnssMeasurementCallback callback, in Options options); Loading gnss/aidl/vts/gnss_hal_test_cases.cpp +29 −0 Original line number Diff line number Diff line Loading @@ -1494,3 +1494,32 @@ TEST_P(GnssHalTest, TestGnssMeasurementIntervals_LocationOnAfterMeasurement) { assertMeanAndStdev(locationIntervalMs, deltas); } } TEST_P(GnssHalTest, TestGnssMeasurementSetCallback) { if (aidl_gnss_hal_->getInterfaceVersion() <= 2) { return; } sp<IGnssMeasurementInterface> iGnssMeasurement; auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement); ASSERT_TRUE(status.isOk()); ASSERT_TRUE(iGnssMeasurement != nullptr); ALOGD("TestGnssMeasurementSetCallback"); auto callback = sp<GnssMeasurementCallbackAidl>::make(); std::vector<int> deltas; // setCallback at 20s interval and wait for 1 measurement startMeasurementWithInterval(20000, iGnssMeasurement, callback); collectMeasurementIntervals(callback, /* numEvents= */ 1, /* timeoutSeconds= */ 10, deltas); // setCallback at 1s interval and wait for 5 measurements startMeasurementWithInterval(1000, iGnssMeasurement, callback); collectMeasurementIntervals(callback, /* numEvents= */ 5, /* timeoutSeconds= */ 10, deltas); // verify the measurements were received at 1Hz assertMeanAndStdev(1000, deltas); status = iGnssMeasurement->close(); ASSERT_TRUE(status.isOk()); } Loading
gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,9 @@ interface IGnssMeasurementInterface { * output rate of 1Hz (occasional intra-measurement time offsets in the range from 0-2000msec * can be tolerated.) * * If setCallback() is invoked without a previous close(), the HAL must use the new callback * and parameters to provide updates. * * @param callback Handle to GnssMeasurement callback interface. * @param enableFullTracking If true, GNSS chipset must switch off duty cycling. In such mode * no clock discontinuities are expected and, when supported, carrier phase should be Loading @@ -104,6 +107,9 @@ interface IGnssMeasurementInterface { /** * Initializes the interface and registers the callback routines with the HAL. * * If setCallbackWithOptions() is invoked without a previous close(), the HAL must use the new * callback and options to provide updates. * * @param options See Options definition. */ void setCallbackWithOptions(in IGnssMeasurementCallback callback, in Options options); Loading
gnss/aidl/vts/gnss_hal_test_cases.cpp +29 −0 Original line number Diff line number Diff line Loading @@ -1494,3 +1494,32 @@ TEST_P(GnssHalTest, TestGnssMeasurementIntervals_LocationOnAfterMeasurement) { assertMeanAndStdev(locationIntervalMs, deltas); } } TEST_P(GnssHalTest, TestGnssMeasurementSetCallback) { if (aidl_gnss_hal_->getInterfaceVersion() <= 2) { return; } sp<IGnssMeasurementInterface> iGnssMeasurement; auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement); ASSERT_TRUE(status.isOk()); ASSERT_TRUE(iGnssMeasurement != nullptr); ALOGD("TestGnssMeasurementSetCallback"); auto callback = sp<GnssMeasurementCallbackAidl>::make(); std::vector<int> deltas; // setCallback at 20s interval and wait for 1 measurement startMeasurementWithInterval(20000, iGnssMeasurement, callback); collectMeasurementIntervals(callback, /* numEvents= */ 1, /* timeoutSeconds= */ 10, deltas); // setCallback at 1s interval and wait for 5 measurements startMeasurementWithInterval(1000, iGnssMeasurement, callback); collectMeasurementIntervals(callback, /* numEvents= */ 5, /* timeoutSeconds= */ 10, deltas); // verify the measurements were received at 1Hz assertMeanAndStdev(1000, deltas); status = iGnssMeasurement->close(); ASSERT_TRUE(status.isOk()); }