From 2c71ec9e02ea234106d520717fc36eb4f3ad7c48 Mon Sep 17 00:00:00 2001 From: Katz Yamada Date: Fri, 11 May 2018 14:59:44 -0700 Subject: feat: Add timeuncNs in PQWM1 message Add timeuncNs field in PQWM1 of debug NMEA message generated by modem. SystemStaus to parse it. GnssDebug adds this value in timeunc when it generates GNSS debug report. Change-Id: I649915f95730dc8db22e8b4cb88008edc6d8b9d0 CRs-Fixed: 2236950 --- gnss/GnssAdapter.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'gnss') diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp index 5253a1b..1a6bdd9 100644 --- a/gnss/GnssAdapter.cpp +++ b/gnss/GnssAdapter.cpp @@ -4340,9 +4340,18 @@ bool GnssAdapter::getDebugReport(GnssDebugReport& r) (int64_t)(reports.mTimeAndClock.back().mLeapSeconds))*1000ULL + (int64_t)(reports.mTimeAndClock.back().mGpsTowMs); - r.mTime.timeUncertaintyNs = - ((float)(reports.mTimeAndClock.back().mTimeUnc) + - (float)(reports.mTimeAndClock.back().mLeapSecUnc))*1000.0f; + if (reports.mTimeAndClock.back().mTimeUncNs > 0) { + // TimeUncNs value is available + r.mTime.timeUncertaintyNs = + (float)(reports.mTimeAndClock.back().mLeapSecUnc)*1000.0f + + (float)(reports.mTimeAndClock.back().mTimeUncNs); + } else { + // fall back to legacy TimeUnc + r.mTime.timeUncertaintyNs = + ((float)(reports.mTimeAndClock.back().mTimeUnc) + + (float)(reports.mTimeAndClock.back().mLeapSecUnc))*1000.0f; + } + r.mTime.frequencyUncertaintyNsPerSec = (float)(reports.mTimeAndClock.back().mClockFreqBiasUnc); LOC_LOGV("getDebugReport - timeestimate=%" PRIu64 " unc=%f frequnc=%f", -- cgit v1.2.3