summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gnss/1.0-legacy/Gnss.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/gnss/1.0-legacy/Gnss.cpp b/gnss/1.0-legacy/Gnss.cpp
index 32c131c..1ab465c 100644
--- a/gnss/1.0-legacy/Gnss.cpp
+++ b/gnss/1.0-legacy/Gnss.cpp
@@ -198,6 +198,8 @@ void Gnss::gpsSvStatusCb(GpsSvStatus* svInfo) {
uint32_t ephemerisMask = svInfo->ephemeris_mask;
uint32_t almanacMask = svInfo->almanac_mask;
uint32_t usedInFixMask = svInfo->used_in_fix_mask;
+ // Our HALs report a bigger svinfo struct, HaxxSvStatus, which includes a GLONASS usage mask
+ uint32_t gloUsedInFixMask = *(&(svInfo->used_in_fix_mask) + 1); // the next int
/*
* Conversion from GpsSvInfo to IGnssCallback::GnssSvInfo happens below.
*/
@@ -231,10 +233,11 @@ void Gnss::gpsSvStatusCb(GpsSvStatus* svInfo) {
info.svFlag = static_cast<uint8_t>(IGnssCallback::GnssSvFlags::NONE);
/*
- * Only GPS info is valid for these fields, as these masks are just 32
- * bits, by GPS prn.
+ * GPS and GLONASS info is valid for these fields, as these masks are just 32
+ * bits, by GPS prn and another for GLONASS prn.
*/
- if (info.constellation == GnssConstellationType::GPS) {
+ if (info.constellation == GnssConstellationType::GPS ||
+ info.constellation == GnssConstellationType::GLONASS) {
int32_t svidMask = (1 << (info.svid - 1));
if ((ephemerisMask & svidMask) != 0) {
info.svFlag |= IGnssCallback::GnssSvFlags::HAS_EPHEMERIS_DATA;
@@ -242,7 +245,10 @@ void Gnss::gpsSvStatusCb(GpsSvStatus* svInfo) {
if ((almanacMask & svidMask) != 0) {
info.svFlag |= IGnssCallback::GnssSvFlags::HAS_ALMANAC_DATA;
}
- if ((usedInFixMask & svidMask) != 0) {
+ if ((info.constellation == GnssConstellationType::GPS &&
+ (usedInFixMask & svidMask) != 0) ||
+ (info.constellation == GnssConstellationType::GLONASS &&
+ (gloUsedInFixMask & svidMask) != 0)) {
info.svFlag |= IGnssCallback::GnssSvFlags::USED_IN_FIX;
}
}