summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/GnssDebug.cpp19
-rw-r--r--core/SystemStatus.cpp3
-rw-r--r--gnss/GnssAdapter.cpp24
-rw-r--r--location/LocationAPI.h8
4 files changed, 27 insertions, 27 deletions
diff --git a/android/GnssDebug.cpp b/android/GnssDebug.cpp
index e6f59df..ff467d3 100644
--- a/android/GnssDebug.cpp
+++ b/android/GnssDebug.cpp
@@ -30,7 +30,7 @@ namespace implementation {
using ::android::hardware::hidl_vec;
-#define GNSS_DEBUG_UNKNOWN_UTC_TIME (1483228800ULL) // 1/1/2017 00:00 GMT
+#define GNSS_DEBUG_UNKNOWN_UTC_TIME (1483228800000ULL) // 1/1/2017 00:00 GMT
#define GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC (1.57783680E17) // 5 years in ns
GnssDebug::GnssDebug(Gnss* gnss) : mGnss(gnss)
@@ -45,7 +45,7 @@ GnssDebug::GnssDebug(Gnss* gnss) : mGnss(gnss)
*/
Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb)
{
- LOC_LOGI("GnssDebug - 0426a");
+ LOC_LOGD("%s]: ", __func__);
DebugData data = { };
@@ -78,21 +78,14 @@ Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb)
reports.mLocation.speedAccuracyMetersPerSecond;
data.position.bearingAccuracyDegrees =
reports.mLocation.bearingAccuracyDegrees;
- LOC_LOGI("GnssDebug - lat=%f lon=%f",
- data.position.latitudeDegrees, data.position.longitudeDegrees);
timeval tv_now, tv_report;
- tv_report.tv_sec = reports.mLocation.mLocation.timestamp / 1000ULL;
- tv_report.tv_usec =
- (reports.mLocation.mLocation.timestamp % 1000ULL) * 1000ULL;
+ tv_report.tv_sec = reports.mLocation.mUtcReported.tv_sec;
+ tv_report.tv_usec = reports.mLocation.mUtcReported.tv_nsec / 1000ULL;
gettimeofday(&tv_now, NULL);
data.position.ageSeconds =
(tv_now.tv_sec - tv_report.tv_sec) +
(float)((tv_now.tv_usec - tv_report.tv_usec)) / 1000000;
-
- LOC_LOGI("GnssDebug - time now=%lld:%lld", tv_now.tv_sec, tv_now.tv_usec);
- LOC_LOGI("GnssDebug - time rep=%lld:%lld",tv_report.tv_sec, tv_report.tv_usec);
- LOC_LOGI("GnssDebug - age=%f", data.position.ageSeconds);
}
else {
data.position.valid = false;
@@ -110,7 +103,6 @@ Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb)
data.time.timeUncertaintyNs = (float)(GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC);
data.time.frequencyUncertaintyNsPerSec = 0;
}
- LOC_LOGI("GnssDebug - timeestimate=%lld", data.time.timeEstimate);
// satellite data block
SatelliteData s = { };
@@ -138,12 +130,9 @@ Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb)
s_array.push_back(s);
}
data.satelliteDataArray = s_array;
- LOC_LOGI("GnssDebug - satellite=%d", data.satelliteDataArray.size());
// callback HIDL with collected debug data
_hidl_cb(data);
-
- LOC_LOGI("GnssDebug - done");
return Void();
}
diff --git a/core/SystemStatus.cpp b/core/SystemStatus.cpp
index f4f07f2..80406f6 100644
--- a/core/SystemStatus.cpp
+++ b/core/SystemStatus.cpp
@@ -181,11 +181,12 @@ public:
SystemStatusPQWM1parser(const char *str_in, uint32_t len_in)
: SystemStatusNmeaBase(str_in, len_in)
{
+ memset(&mM1, 0, sizeof(mM1));
if (mField.size() < eMax) {
LOC_LOGE("PQWM1parser - invalid size=%d", mField.size());
+ mM1.mTimeValid = 0;
return;
}
- memset(&mM1, 0, sizeof(mM1));
mM1.mGpsWeek = atoi(mField[eGpsWeek].c_str());
mM1.mGpsTowMs = atoi(mField[eGpsTowMs].c_str());
mM1.mTimeValid = atoi(mField[eTimeValid].c_str());
diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp
index fc7d55e..d36496e 100644
--- a/gnss/GnssAdapter.cpp
+++ b/gnss/GnssAdapter.cpp
@@ -1814,7 +1814,7 @@ GnssAdapter::reportPositionEvent(const UlpLocation& ulpLocation,
inline virtual void proc() const {
// extract bug report info - this returns true if consumed by systemstatus
SystemStatus* s = LocDualContext::getSystemStatus();
- if (nullptr != s) {
+ if ((nullptr != s) && (LOC_SESS_SUCCESS == mStatus)){
s->eventPosition(mUlpLocation, mLocationExtended);
}
mAdapter.reportPosition(mUlpLocation, mLocationExtended, mStatus, mTechMask);
@@ -2615,7 +2615,7 @@ void GnssAdapter::convertSatelliteInfo(std::vector<GnssDebugSatelliteInfo>& out,
// set constellationi based parameters
switch (in_constellation) {
case GNSS_SV_TYPE_GPS:
- svid_min = GPS_MIN;
+ svid_min = GNSS_BUGREPORT_GPS_MIN;
svid_num = GPS_NUM;
svid_idx = 0;
if (!in.mSvHealth.empty()) {
@@ -2628,7 +2628,7 @@ void GnssAdapter::convertSatelliteInfo(std::vector<GnssDebugSatelliteInfo>& out,
}
break;
case GNSS_SV_TYPE_GLONASS:
- svid_min = GLO_MIN;
+ svid_min = GNSS_BUGREPORT_GLO_MIN;
svid_num = GLO_NUM;
svid_idx = GPS_NUM;
if (!in.mSvHealth.empty()) {
@@ -2641,7 +2641,7 @@ void GnssAdapter::convertSatelliteInfo(std::vector<GnssDebugSatelliteInfo>& out,
}
break;
case GNSS_SV_TYPE_QZSS:
- svid_min = QZSS_MIN;
+ svid_min = GNSS_BUGREPORT_QZSS_MIN;
svid_num = QZSS_NUM;
svid_idx = GPS_NUM+GLO_NUM;
if (!in.mSvHealth.empty()) {
@@ -2654,7 +2654,7 @@ void GnssAdapter::convertSatelliteInfo(std::vector<GnssDebugSatelliteInfo>& out,
}
break;
case GNSS_SV_TYPE_BEIDOU:
- svid_min = BDS_MIN;
+ svid_min = GNSS_BUGREPORT_BDS_MIN;
svid_num = BDS_NUM;
svid_idx = GPS_NUM+GLO_NUM+QZSS_NUM;
if (!in.mSvHealth.empty()) {
@@ -2667,7 +2667,7 @@ void GnssAdapter::convertSatelliteInfo(std::vector<GnssDebugSatelliteInfo>& out,
}
break;
case GNSS_SV_TYPE_GALILEO:
- svid_min = GAL_MIN;
+ svid_min = GNSS_BUGREPORT_GAL_MIN;
svid_num = GAL_NUM;
svid_idx = GPS_NUM+GLO_NUM+QZSS_NUM+BDS_NUM;
if (!in.mSvHealth.empty()) {
@@ -2771,8 +2771,8 @@ bool GnssAdapter::getDebugReport(GnssDebugReport& r)
r.mLocation.bearingAccuracyDegrees =
reports.mLocation.back().mLocationEx.bearing_unc;
- r.mLocation.mLocation.timestamp =
- reports.mLocation.back().mLocation.gpsLocation.timestamp;
+ r.mLocation.mUtcReported =
+ reports.mLocation.back().mUtcReported;
}
else if(!reports.mBestPosition.empty()) {
r.mLocation.mValid = true;
@@ -2801,11 +2801,11 @@ bool GnssAdapter::getDebugReport(GnssDebugReport& r)
// time block
r.mTime.size = sizeof(r.mTime);
- if(!reports.mTimeAndClock.empty()) {
+ if(!reports.mTimeAndClock.empty() && reports.mTimeAndClock.back().mTimeValid) {
r.mTime.mValid = true;
r.mTime.timeEstimate =
(((int64_t)(reports.mTimeAndClock.back().mGpsWeek)*7 +
- GNSS_UTC_TIME_OFFSET)*24*60*60 +
+ GNSS_UTC_TIME_OFFSET)*24*60*60 -
(int64_t)(reports.mTimeAndClock.back().mLeapSeconds))*1000ULL +
(int64_t)(reports.mTimeAndClock.back().mGpsTowMs);
@@ -2814,7 +2814,9 @@ bool GnssAdapter::getDebugReport(GnssDebugReport& r)
reports.mTimeAndClock.back().mLeapSecUnc)*1000);
r.mTime.frequencyUncertaintyNsPerSec =
(float)(reports.mTimeAndClock.back().mClockFreqBiasUnc);
- LOC_LOGV("getDebugReport - timeestimate=%ld", r.mTime.timeEstimate);
+ LOC_LOGV("getDebugReport - timeestimate=%ld unc=%f frequnc=%f",
+ r.mTime.timeEstimate,
+ r.mTime.timeUncertaintyNs, r.mTime.frequencyUncertaintyNsPerSec);
}
else {
r.mTime.mValid = false;
diff --git a/location/LocationAPI.h b/location/LocationAPI.h
index 88b1554..88ce5f1 100644
--- a/location/LocationAPI.h
+++ b/location/LocationAPI.h
@@ -39,6 +39,13 @@
#define GNSS_MEASUREMENTS_MAX 64
#define GNSS_UTC_TIME_OFFSET (3657)
+#define GNSS_BUGREPORT_GPS_MIN (1)
+#define GNSS_BUGREPORT_SBAS_MIN (120)
+#define GNSS_BUGREPORT_GLO_MIN (1)
+#define GNSS_BUGREPORT_QZSS_MIN (193)
+#define GNSS_BUGREPORT_BDS_MIN (1)
+#define GNSS_BUGREPORT_GAL_MIN (1)
+
typedef enum {
LOCATION_ERROR_SUCCESS = 0,
LOCATION_ERROR_GENERAL_FAILURE,
@@ -584,6 +591,7 @@ typedef struct {
double verticalAccuracyMeters;
double speedAccuracyMetersPerSecond;
double bearingAccuracyDegrees;
+ timespec mUtcReported;
} GnssDebugLocation;
typedef struct {