summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWei (GPS SD) Chen <quic_weic@quicinc.com>2022-03-08 16:21:25 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2022-03-14 19:44:06 -0700
commit39dfeb6a76b3f06b7324c1071e3341b1cd016a15 (patch)
treedb9890a69a0cf69dfa8c5151e5a04ae659bac924
parent52b4c56c503cf960a1cfafff6c1eddd28617ddc2 (diff)
Elapsed real time: save the time association if time unc good
Only if time unc is good, then we save the association of GPS time and qtimer to be used to calcualte elapsed real time. Otherwise, the info will not be used. Change-Id: Ib96dc4c7fec4c655c7fe9be2eedc493a1ad18929 CRs-fixed: 3147215
-rw-r--r--core/LocApiBase.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp
index 1931b7b..f21e66c 100644
--- a/core/LocApiBase.cpp
+++ b/core/LocApiBase.cpp
@@ -40,6 +40,9 @@
namespace loc_core {
+#define MSEC_IN_ONE_WEEK 604800000LL
+#define REAL_TIME_ESTIMATOR_TIME_UNC_THRESHOLD_MSEC 20.0f
+
#define TO_ALL_LOCADAPTERS(call) TO_ALL_ADAPTERS(mLocAdapters, (call))
#define TO_1ST_HANDLING_LOCADAPTERS(call) TO_1ST_HANDLING_ADAPTER(mLocAdapters, (call))
@@ -1041,6 +1044,8 @@ void ElapsedRealtimeEstimator::saveGpsTimeAndQtimerPairInPvtReport(
// Use GPS timestamp and qtimer tick for 1Hz PVT report for association
if ((locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_GPS_TIME) &&
(locationExtended.gpsTime.gpsTimeOfWeekMs % 1000 == 0) &&
+ (locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_TIME_UNC) &&
+ (locationExtended.timeUncMs < REAL_TIME_ESTIMATOR_TIME_UNC_THRESHOLD_MSEC) &&
(locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_SYSTEM_TICK) &&
(locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_SYSTEM_TICK_UNC)) {
mTimePairPVTReport.gpsTime.gpsWeek = locationExtended.gpsTime.gpsWeek;
@@ -1062,16 +1067,18 @@ void ElapsedRealtimeEstimator::saveGpsTimeAndQtimerPairInMeasReport(
// Use 1Hz measurement report timestamp and qtimer tick for association
if ((svMeasurementSet.isNhz == false) &&
(svMeasSetHeader.gpsSystemTime.validityMask & GNSS_SYSTEM_TIME_WEEK_VALID) &&
- (svMeasSetHeader.gpsSystemTime.validityMask & GNSS_SYSTEM_TIME_WEEK_MS_VALID)) {
+ (svMeasSetHeader.gpsSystemTime.validityMask & GNSS_SYSTEM_TIME_WEEK_MS_VALID) &&
+ (svMeasSetHeader.gpsSystemTime.validityMask & GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID) &&
+ (svMeasSetHeader.gpsSystemTime.systemClkTimeUncMs <
+ REAL_TIME_ESTIMATOR_TIME_UNC_THRESHOLD_MSEC)) {
LOC_LOGv("gps time %d %d, meas unc %f, ref cnt tick %" PRIi64 ","
- "system rtc ms %" PRIi64 ", systemClkTimeUncMs %f",
+ "system rtc ms %" PRIi64 "",
svMeasurementSet.svMeasSetHeader.gpsSystemTime.systemWeek,
svMeasurementSet.svMeasSetHeader.gpsSystemTime.systemMsec,
svMeasurementSet.svMeasSetHeader.gpsSystemTime.systemClkTimeUncMs,
svMeasurementSet.svMeasSetHeader.refCountTicks,
- svMeasurementSet.svMeasSetHeader.gpsSystemTimeExt.systemRtcMs,
- svMeasurementSet.svMeasSetHeader.gpsSystemTime.systemClkTimeUncMs);
+ svMeasurementSet.svMeasSetHeader.gpsSystemTimeExt.systemRtcMs);
if ((svMeasSetHeader.flags & GNSS_SV_MEAS_HEADER_HAS_REF_COUNT_TICKS) &&
(svMeasSetHeader.flags & GNSS_SV_MEAS_HEADER_HAS_REF_COUNT_TICKS_UNC)) {
mTimePairMeasReport.gpsTime.gpsWeek = svMeasSetHeader.gpsSystemTime.systemWeek;
@@ -1079,14 +1086,9 @@ void ElapsedRealtimeEstimator::saveGpsTimeAndQtimerPairInMeasReport(
mTimePairMeasReport.qtimerTick = svMeasurementSet.svMeasSetHeader.refCountTicks;
mTimePairMeasReport.timeUncMsec = svMeasurementSet.svMeasSetHeader.refCountTicksUnc;
}
-
- LOC_LOGv("gps time (%d, %d), qtimer tick %" PRIi64 ", unc %f",
- mTimePairMeasReport.gpsTime.gpsWeek, mTimePairMeasReport.gpsTime.gpsTimeOfWeekMs,
- mTimePairMeasReport.qtimerTick, mTimePairMeasReport.timeUncMsec);
}
}
-#define MSEC_IN_ONE_WEEK 604800000LL
bool ElapsedRealtimeEstimator::getElapsedRealtimeForGpsTime(
const GPSTimeStruct& gpsTimeAtOrigin, int64_t &bootTimeNsAtOrigin, float & bootTimeUnc) {
struct timespec curBootTime = {};