mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Clarify setCallback() can be called without a previous close() call
Add a VTS test case to enforce this. Bug: 253453668 Test: atest VtsHalGnssTargetTest Change-Id: I1d1f9587e590360198274ef5583893c35051ef8e
This commit is contained in:
@@ -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
|
||||
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user