summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWei (GPS SD) Chen <weic@codeaurora.org>2021-11-18 21:06:58 -0800
committerWei (GPS SD) Chen <quic_weic@quicinc.com>2021-12-17 15:42:21 -0800
commit96d2b390a6efac3512cb670bf8539b3bc3936ceb (patch)
treec651e3adf8b9b354c0e5c6cce9112d2826db2edc
parentea7cf0e1ea30ec5e8228f2706c9b1d5208d02fa1 (diff)
GNSS adapter: cleanup related to elapsed timestamp in PVT report
(1) getElapsedRealtimeEstimateNanos expects time between fixes in unit of nano second (2) remove unused defines Change-Id: I6295fad9d57ecf821cea1fa307c712cbfd04777d CRs-fixed: 3078635
-rw-r--r--android/2.0/location_api/LocationUtil.cpp2
-rw-r--r--android/2.1/location_api/LocationUtil.cpp2
-rw-r--r--core/LocApiBase.cpp4
-rw-r--r--core/LocApiBase.h2
-rw-r--r--gnss/GnssAdapter.cpp9
-rw-r--r--location/LocationDataTypes.h5
-rw-r--r--utils/loc_gps.h4
7 files changed, 10 insertions, 18 deletions
diff --git a/android/2.0/location_api/LocationUtil.cpp b/android/2.0/location_api/LocationUtil.cpp
index 961b7b1..f55a5f9 100644
--- a/android/2.0/location_api/LocationUtil.cpp
+++ b/android/2.0/location_api/LocationUtil.cpp
@@ -89,7 +89,7 @@ void convertGnssLocation(Location& in, V2_0::GnssLocation& out)
memset(&out, 0, sizeof(V2_0::GnssLocation));
convertGnssLocation(in, out.v1_0);
- if (in.flags & LOCATION_HAS_ELAPSED_REAL_TIME) {
+ if (in.flags & LOCATION_HAS_ELAPSED_REAL_TIME_BIT) {
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
out.elapsedRealtime.timestampNs = in.elapsedRealTime;
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
diff --git a/android/2.1/location_api/LocationUtil.cpp b/android/2.1/location_api/LocationUtil.cpp
index 5154e70..690b820 100644
--- a/android/2.1/location_api/LocationUtil.cpp
+++ b/android/2.1/location_api/LocationUtil.cpp
@@ -90,7 +90,7 @@ void convertGnssLocation(Location& in, V2_0::GnssLocation& out)
memset(&out, 0, sizeof(V2_0::GnssLocation));
convertGnssLocation(in, out.v1_0);
- if (in.flags & LOCATION_HAS_ELAPSED_REAL_TIME) {
+ if (in.flags & LOCATION_HAS_ELAPSED_REAL_TIME_BIT) {
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
out.elapsedRealtime.timestampNs = in.elapsedRealTime;
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp
index b67e464..80d1e3f 100644
--- a/core/LocApiBase.cpp
+++ b/core/LocApiBase.cpp
@@ -934,7 +934,7 @@ void LocApiBase::
DEFAULT_IMPL()
int64_t ElapsedRealtimeEstimator::getElapsedRealtimeEstimateNanos(int64_t curDataTimeNanos,
- bool isCurDataTimeTrustable, int64_t tbf) {
+ bool isCurDataTimeTrustable, int64_t tbfNanos) {
//The algorithm works follow below steps:
//When isCurDataTimeTrustable is meet (means Modem timestamp is already stable),
//1, Wait for mFixTimeStablizationThreshold fixes; While waiting for modem time
@@ -957,7 +957,7 @@ int64_t ElapsedRealtimeEstimator::getElapsedRealtimeEstimateNanos(int64_t curDat
int64_t sinceBootTimeNanos = 0;
if (getCurrentTime(currentTime, sinceBootTimeNanos)) {
if (isCurDataTimeTrustable) {
- if (tbf > 0 && tbf != curDataTimeNanos - mPrevDataTimeNanos) {
+ if (tbfNanos > 0 && tbfNanos != curDataTimeNanos - mPrevDataTimeNanos) {
mFixTimeStablizationThreshold = 5;
}
int64_t currentTimeNanos = (int64_t)currentTime.tv_sec*1000000000 + currentTime.tv_nsec;
diff --git a/core/LocApiBase.h b/core/LocApiBase.h
index bc68787..1ce1d29 100644
--- a/core/LocApiBase.h
+++ b/core/LocApiBase.h
@@ -380,7 +380,7 @@ public:
reset();
}
int64_t getElapsedRealtimeEstimateNanos(int64_t curDataTimeNanos,
- bool isCurDataTimeTrustable, int64_t tbf);
+ bool isCurDataTimeTrustable, int64_t tbfNanos);
inline int64_t getElapsedRealtimeUncNanos() { return 5000000;}
void reset();
static int64_t getElapsedRealtimeQtimer(int64_t qtimerTicksAtOrigin);
diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp
index 2e194dd..0a52511 100644
--- a/gnss/GnssAdapter.cpp
+++ b/gnss/GnssAdapter.cpp
@@ -353,14 +353,9 @@ GnssAdapter::convertLocation(Location& out, const UlpLocation& ulpLocation,
}
if (LOC_GPS_LOCATION_HAS_SPOOF_MASK & ulpLocation.gpsLocation.flags) {
- out.flags |= LOCATION_HAS_SPOOF_MASK;
+ out.flags |= LOCATION_HAS_SPOOF_MASK_BIT;
out.spoofMask = ulpLocation.gpsLocation.spoof_mask;
}
- if (LOC_GPS_LOCATION_HAS_ELAPSED_REAL_TIME & ulpLocation.gpsLocation.flags) {
- out.flags |= LOCATION_HAS_ELAPSED_REAL_TIME;
- out.elapsedRealTime = ulpLocation.gpsLocation.elapsedRealTime;
- out.elapsedRealTimeUnc = ulpLocation.gpsLocation.elapsedRealTimeUnc;
- }
out.qualityType = LOCATION_STANDALONE_QUALITY_TYPE;
if (GPS_LOCATION_EXTENDED_HAS_NAV_SOLUTION_MASK & locationExtended.flags) {
out.flags |= LOCATION_HAS_QUALITY_TYPE_BIT;
@@ -400,7 +395,7 @@ void GnssAdapter::fillElapsedRealTime(const GpsLocationExtended& locationExtende
out.flags |= LOCATION_HAS_ELAPSED_REAL_TIME_BIT;
out.elapsedRealTime = mPositionElapsedRealTimeCal.getElapsedRealtimeEstimateNanos(
locationTimeNanos, isCurDataTimeTrustable,
- (int64_t)mLocPositionMode.min_interval * 1000);
+ (int64_t)mLocPositionMode.min_interval * 1000000);
out.elapsedRealTimeUnc = mPositionElapsedRealTimeCal.getElapsedRealtimeUncNanos();
}
#endif //FEATURE_AUTOMOTIVE
diff --git a/location/LocationDataTypes.h b/location/LocationDataTypes.h
index 87bb48f..06dcb85 100644
--- a/location/LocationDataTypes.h
+++ b/location/LocationDataTypes.h
@@ -76,12 +76,11 @@ typedef enum {
LOCATION_HAS_VERTICAL_ACCURACY_BIT = (1<<5), // location has valid vertical accuracy
LOCATION_HAS_SPEED_ACCURACY_BIT = (1<<6), // location has valid speed accuracy
LOCATION_HAS_BEARING_ACCURACY_BIT = (1<<7), // location has valid bearing accuracy
- LOCATION_HAS_SPOOF_MASK = (1<<8), // location has valid spoof mask
- LOCATION_HAS_ELAPSED_REAL_TIME = (1<<9), // location has valid elapsed real time
+ LOCATION_HAS_SPOOF_MASK_BIT = (1<<8), // location has valid spoof mask
+ LOCATION_HAS_ELAPSED_REAL_TIME_BIT = (1<<9), // location has valid elapsed real time
LOCATION_HAS_CONFORMITY_INDEX_BIT = (1<<10), // location has valid conformity index
LOCATION_HAS_QUALITY_TYPE_BIT = (1<<11), // location has valid quality type
LOCATION_HAS_TECH_MASK_BIT = (1<<12), // location has valid tech mask
- LOCATION_HAS_ELAPSED_REAL_TIME_BIT = (1<<13), // location has valid elapsed real time
} LocationFlagsBits;
typedef uint16_t LocationTechnologyMask;
diff --git a/utils/loc_gps.h b/utils/loc_gps.h
index faa897b..0c122fb 100644
--- a/utils/loc_gps.h
+++ b/utils/loc_gps.h
@@ -106,10 +106,8 @@ typedef uint16_t LocGpsLocationFlags;
#define LOC_GPS_LOCATION_HAS_BEARING_ACCURACY 0x0080
/** LocGpsLocation has valid spoof mask */
#define LOC_GPS_LOCATION_HAS_SPOOF_MASK 0x0100
-/** LocGpsLocation has valid Real Time and Real Time Uncertainty */
-#define LOC_GPS_LOCATION_HAS_ELAPSED_REAL_TIME 0x0200
/** Location has valid source information. */
-#define LOC_GPS_LOCATION_HAS_SOURCE_INFO 0x0400
+#define LOC_GPS_LOCATION_HAS_SOURCE_INFO 0x0200
/** Spoof mask in LocGpsLocation */
typedef uint32_t LocGpsSpoofMask;