diff options
Diffstat (limited to 'gnss/aidl/default/GnssMeasurementInterface.cpp')
-rw-r--r-- | gnss/aidl/default/GnssMeasurementInterface.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gnss/aidl/default/GnssMeasurementInterface.cpp b/gnss/aidl/default/GnssMeasurementInterface.cpp index 9e4f7c7f25..2c7241b82e 100644 --- a/gnss/aidl/default/GnssMeasurementInterface.cpp +++ b/gnss/aidl/default/GnssMeasurementInterface.cpp @@ -56,11 +56,29 @@ ndk::ScopedAStatus GnssMeasurementInterface::setCallback( return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus GnssMeasurementInterface::setCallbackWithOptions( + const std::shared_ptr<IGnssMeasurementCallback>& callback, const Options& options) { + ALOGD("setCallbackWithOptions: fullTracking:%d, corrVec:%d, intervalMs:%d", + (int)options.enableFullTracking, (int)options.enableCorrVecOutputs, options.intervalMs); + std::unique_lock<std::mutex> lock(mMutex); + sCallback = callback; + + if (mIsActive) { + ALOGW("GnssMeasurement callback already set. Resetting the callback..."); + stop(); + } + mMinIntervalMillis = options.intervalMs; + start(options.enableCorrVecOutputs); + + return ndk::ScopedAStatus::ok(); +} + ndk::ScopedAStatus GnssMeasurementInterface::close() { ALOGD("close"); stop(); std::unique_lock<std::mutex> lock(mMutex); sCallback = nullptr; + mMinIntervalMillis = 1000; return ndk::ScopedAStatus::ok(); } |