diff options
-rw-r--r-- | android/1.0/location_api/LocationUtil.cpp | 12 | ||||
-rw-r--r-- | android/1.1/location_api/LocationUtil.cpp | 12 | ||||
-rw-r--r-- | android/2.0/location_api/LocationUtil.cpp | 12 | ||||
-rw-r--r-- | android/2.1/location_api/LocationUtil.cpp | 12 | ||||
-rw-r--r-- | location/LocationDataTypes.h | 1 | ||||
-rw-r--r-- | utils/gps_extended_c.h | 2 | ||||
-rw-r--r-- | utils/loc_nmea.cpp | 10 |
7 files changed, 35 insertions, 26 deletions
diff --git a/android/1.0/location_api/LocationUtil.cpp b/android/1.0/location_api/LocationUtil.cpp index 7bbc064..870a8aa 100644 --- a/android/1.0/location_api/LocationUtil.cpp +++ b/android/1.0/location_api/LocationUtil.cpp @@ -157,7 +157,11 @@ void convertGnssSvid(GnssSv& in, int16_t& out) out = in.svId; break; case GNSS_SV_TYPE_GLONASS: - out = in.svId - GLO_SV_PRN_MIN + 1; + if (!isGloSlotUnknown(in.svId)) { // OSN is known + out = in.svId - GLO_SV_PRN_MIN + 1; + } else { // OSN is not known, report FCN + out = in.gloFrequency + 92; + } break; case GNSS_SV_TYPE_QZSS: out = in.svId; @@ -169,8 +173,6 @@ void convertGnssSvid(GnssSv& in, int16_t& out) out = in.svId - GAL_SV_PRN_MIN + 1; break; case GNSS_SV_TYPE_NAVIC: - /*Android doesn't define Navic svid range yet, use Naviv svid [1, 14] now - will update this once Android give Navic svid definiitons */ out = in.svId - NAVIC_SV_PRN_MIN + 1; break; default: @@ -189,7 +191,7 @@ void convertGnssSvid(GnssMeasurementsData& in, int16_t& out) out = in.svId; break; case GNSS_SV_TYPE_GLONASS: - if (in.svId != 255) { // OSN is known + if (!isGloSlotUnknown(in.svId)) { // OSN is known out = in.svId - GLO_SV_PRN_MIN + 1; } else { // OSN is not known, report FCN out = in.gloFrequency + 92; @@ -205,8 +207,6 @@ void convertGnssSvid(GnssMeasurementsData& in, int16_t& out) out = in.svId - GAL_SV_PRN_MIN + 1; break; case GNSS_SV_TYPE_NAVIC: - /*Android doesn't define Navic svid range yet, use Naviv svid [1, 14] now - will update this once Android give Navic svid definiitons */ out = in.svId - NAVIC_SV_PRN_MIN + 1; break; default: diff --git a/android/1.1/location_api/LocationUtil.cpp b/android/1.1/location_api/LocationUtil.cpp index e0c1849..26fd920 100644 --- a/android/1.1/location_api/LocationUtil.cpp +++ b/android/1.1/location_api/LocationUtil.cpp @@ -157,7 +157,11 @@ void convertGnssSvid(GnssSv& in, int16_t& out) out = in.svId; break; case GNSS_SV_TYPE_GLONASS: - out = in.svId - GLO_SV_PRN_MIN + 1; + if (!isGloSlotUnknown(in.svId)) { // OSN is known + out = in.svId - GLO_SV_PRN_MIN + 1; + } else { //OSN is not known, report FCN + out = in.gloFrequency + 92; + } break; case GNSS_SV_TYPE_QZSS: out = in.svId; @@ -169,8 +173,6 @@ void convertGnssSvid(GnssSv& in, int16_t& out) out = in.svId - GAL_SV_PRN_MIN + 1; break; case GNSS_SV_TYPE_NAVIC: - /*Android doesn't define Navic svid range yet, use Naviv svid [1, 14] now - will update this once Android give Navic svid definiitons */ out = in.svId - NAVIC_SV_PRN_MIN + 1; break; default: @@ -189,7 +191,7 @@ void convertGnssSvid(GnssMeasurementsData& in, int16_t& out) out = in.svId; break; case GNSS_SV_TYPE_GLONASS: - if (in.svId != 255) { // OSN is known + if (!isGloSlotUnknown(in.svId)) { // OSN is known out = in.svId - GLO_SV_PRN_MIN + 1; } else { // OSN is not known, report FCN out = in.gloFrequency + 92; @@ -205,8 +207,6 @@ void convertGnssSvid(GnssMeasurementsData& in, int16_t& out) out = in.svId - GAL_SV_PRN_MIN + 1; break; case GNSS_SV_TYPE_NAVIC: - /*Android doesn't define Navic svid range yet, use Naviv svid [1, 14] now - will update this once Android give Navic svid definiitons */ out = in.svId - NAVIC_SV_PRN_MIN + 1; break; default: diff --git a/android/2.0/location_api/LocationUtil.cpp b/android/2.0/location_api/LocationUtil.cpp index 0742f27..961b7b1 100644 --- a/android/2.0/location_api/LocationUtil.cpp +++ b/android/2.0/location_api/LocationUtil.cpp @@ -217,7 +217,11 @@ void convertGnssSvid(GnssSv& in, int16_t& out) out = in.svId; break; case GNSS_SV_TYPE_GLONASS: - out = in.svId - GLO_SV_PRN_MIN + 1; + if (!isGloSlotUnknown(in.svId)) { // OSN is known + out = in.svId - GLO_SV_PRN_MIN + 1; + } else { // OSN is not known, report FCN + out = in.gloFrequency + 92; + } break; case GNSS_SV_TYPE_QZSS: out = in.svId; @@ -229,8 +233,6 @@ void convertGnssSvid(GnssSv& in, int16_t& out) out = in.svId - GAL_SV_PRN_MIN + 1; break; case GNSS_SV_TYPE_NAVIC: - /*Android doesn't define Navic svid range yet, use Naviv svid [1, 14] now - will update this once Android give Navic svid definiitons */ out = in.svId - NAVIC_SV_PRN_MIN + 1; break; default: @@ -249,7 +251,7 @@ void convertGnssSvid(GnssMeasurementsData& in, int16_t& out) out = in.svId; break; case GNSS_SV_TYPE_GLONASS: - if (in.svId != 255) { // OSN is known + if (!isGloSlotUnknown(in.svId)) { // OSN is known out = in.svId - GLO_SV_PRN_MIN + 1; } else { // OSN is not known, report FCN out = in.gloFrequency + 92; @@ -265,8 +267,6 @@ void convertGnssSvid(GnssMeasurementsData& in, int16_t& out) out = in.svId - GAL_SV_PRN_MIN + 1; break; case GNSS_SV_TYPE_NAVIC: - /*Android doesn't define Navic svid range yet, use Naviv svid [1, 14] now - will update this once Android give Navic svid definiitons */ out = in.svId - NAVIC_SV_PRN_MIN + 1; break; default: diff --git a/android/2.1/location_api/LocationUtil.cpp b/android/2.1/location_api/LocationUtil.cpp index e5b49b2..5154e70 100644 --- a/android/2.1/location_api/LocationUtil.cpp +++ b/android/2.1/location_api/LocationUtil.cpp @@ -218,7 +218,11 @@ void convertGnssSvid(GnssSv& in, int16_t& out) out = in.svId; break; case GNSS_SV_TYPE_GLONASS: - out = in.svId - GLO_SV_PRN_MIN + 1; + if (!isGloSlotUnknown(in.svId)) { // OSN is known + out = in.svId - GLO_SV_PRN_MIN + 1; + } else { // OSN is not known, report FCN + out = in.gloFrequency + 92; + } break; case GNSS_SV_TYPE_QZSS: out = in.svId; @@ -230,8 +234,6 @@ void convertGnssSvid(GnssSv& in, int16_t& out) out = in.svId - GAL_SV_PRN_MIN + 1; break; case GNSS_SV_TYPE_NAVIC: - /*Android doesn't define Navic svid range yet, use Naviv svid [1, 14] now - will update this once Android give Navic svid definiitons */ out = in.svId - NAVIC_SV_PRN_MIN + 1; break; default: @@ -250,7 +252,7 @@ void convertGnssSvid(GnssMeasurementsData& in, int16_t& out) out = in.svId; break; case GNSS_SV_TYPE_GLONASS: - if (in.svId != 255) { // OSN is known + if (!isGloSlotUnknown(in.svId)) { // OSN is known out = in.svId - GLO_SV_PRN_MIN + 1; } else { // OSN is not known, report FCN out = in.gloFrequency + 92; @@ -266,8 +268,6 @@ void convertGnssSvid(GnssMeasurementsData& in, int16_t& out) out = in.svId - GAL_SV_PRN_MIN + 1; break; case GNSS_SV_TYPE_NAVIC: - /*Android doesn't define Navic svid range yet, use Naviv svid [1, 14] now - will update this once Android give Navic svid definiitons */ out = in.svId - NAVIC_SV_PRN_MIN + 1; break; default: diff --git a/location/LocationDataTypes.h b/location/LocationDataTypes.h index eb85d3b..b85464a 100644 --- a/location/LocationDataTypes.h +++ b/location/LocationDataTypes.h @@ -1310,6 +1310,7 @@ typedef struct { float carrierFrequencyHz; // carrier frequency of the signal tracked GnssSignalTypeMask gnssSignalTypeMask; // Specifies GNSS signal type double basebandCarrierToNoiseDbHz; // baseband signal strength + uint16_t gloFrequency; // GLONASS Frequency channel number } GnssSv; struct GnssConfigSetAssistanceServer { diff --git a/utils/gps_extended_c.h b/utils/gps_extended_c.h index 39f80f8..f368975 100644 --- a/utils/gps_extended_c.h +++ b/utils/gps_extended_c.h @@ -486,6 +486,7 @@ typedef uint32_t GnssAdditionalSystemInfoMask; #define GAL_SV_PRN_MAX 336 #define NAVIC_SV_PRN_MIN 401 #define NAVIC_SV_PRN_MAX 414 +#define GLO_SV_PRN_SLOT_UNKNOWN 255 /* Checking svIdOneBase can be set to the corresponding bit in mask */ #define svFitsMask(mask, svIdOneBase) \ @@ -495,6 +496,7 @@ typedef uint32_t GnssAdditionalSystemInfoMask; if (svFitsMask(mask, svIdOneBase)) mask |= (1ULL << ((svIdOneBase) - 1)) #define isValInRangeInclusive(val, min, max) ((val) >= (min) && (val) <= (max)) +#define isGloSlotUnknown(val) ((val) == GLO_SV_PRN_SLOT_UNKNOWN) typedef enum { LOC_RELIABILITY_NOT_SET = 0, diff --git a/utils/loc_nmea.cpp b/utils/loc_nmea.cpp index 1dcbedd..6b5e60e 100644 --- a/utils/loc_nmea.cpp +++ b/utils/loc_nmea.cpp @@ -864,11 +864,17 @@ static void loc_nmea_generate_GSV(const GnssSvNotification &svNotify, if (GNSS_SV_TYPE_SBAS == svNotify.gnssSvs[svNumber - 1].type) { svIdOffset = SBAS_SV_ID_OFFSET; } - length = snprintf(pMarker, lengthRemaining,",%02d,%02d,%03d,", + if (GNSS_SV_TYPE_GLONASS == svNotify.gnssSvs[svNumber - 1].type && + GLO_SV_PRN_SLOT_UNKNOWN == svNotify.gnssSvs[svNumber - 1].svId) { + length = snprintf(pMarker, lengthRemaining, ",,%02d,%03d,", + (int)(0.5 + svNotify.gnssSvs[svNumber - 1].elevation), //float to int + (int)(0.5 + svNotify.gnssSvs[svNumber - 1].azimuth)); //float to int + } else { + length = snprintf(pMarker, lengthRemaining, ",%02d,%02d,%03d,", svNotify.gnssSvs[svNumber - 1].svId - svIdOffset, (int)(0.5 + svNotify.gnssSvs[svNumber - 1].elevation), //float to int (int)(0.5 + svNotify.gnssSvs[svNumber - 1].azimuth)); //float to int - + } if (length < 0 || length >= lengthRemaining) { LOC_LOGE("NMEA Error in string formatting"); |