Add support for generating NMEA sentences for BDS.
Change-Id: I77ccaac3da4d79ed6d43d1a4e59e4d438ba3d2f3 CRs-Fixed: 2047785
This commit is contained in:
parent
0029fafd92
commit
0d01cc0b5b
1 changed files with 54 additions and 10 deletions
|
@ -60,10 +60,12 @@ typedef struct loc_sv_cache_info_s
|
|||
uint32_t glo_used_mask;
|
||||
uint32_t gal_used_mask;
|
||||
uint32_t qzss_used_mask;
|
||||
uint32_t bds_used_mask;
|
||||
uint32_t gps_count;
|
||||
uint32_t glo_count;
|
||||
uint32_t gal_count;
|
||||
uint32_t qzss_count;
|
||||
uint32_t bds_count;
|
||||
float hdop;
|
||||
float pdop;
|
||||
float vdop;
|
||||
|
@ -127,6 +129,14 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
|
|||
// QZSS SV ids are from 193-197. So keep svIdOffset 0
|
||||
sv_meta.systemId = SYSTEM_ID_QZSS;
|
||||
break;
|
||||
case GNSS_SV_TYPE_BEIDOU:
|
||||
sv_meta.talker[0] = 'P';
|
||||
sv_meta.talker[1] = 'Q';
|
||||
sv_meta.mask = sv_cache_info.bds_used_mask;
|
||||
sv_meta.svCount = sv_cache_info.bds_count;
|
||||
// BDS SV ids are from 201-235. So keep svIdOffset 0
|
||||
sv_meta.systemId = SYSTEM_ID_BEIDOU;
|
||||
break;
|
||||
default:
|
||||
LOC_LOGE("NMEA Error unknow constellation type: %d", svType);
|
||||
return NULL;
|
||||
|
@ -135,9 +145,10 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
|
|||
(sv_cache_info.gps_used_mask ? 1 : 0) +
|
||||
(sv_cache_info.glo_used_mask ? 1 : 0) +
|
||||
(sv_cache_info.gal_used_mask ? 1 : 0) +
|
||||
(sv_cache_info.qzss_used_mask ? 1 : 0) > 1)
|
||||
(sv_cache_info.qzss_used_mask ? 1 : 0) +
|
||||
(sv_cache_info.bds_used_mask ? 1 : 0) > 1)
|
||||
{
|
||||
// If GPS, GLONASS, Galileo, QZSS etc. are combined
|
||||
// If GPS, GLONASS, Galileo, QZSS, BDS etc. are combined
|
||||
// to obtain the reported position solution,
|
||||
// talker shall be set to GN, to indicate that
|
||||
// the satellites are used in a combined solution
|
||||
|
@ -420,7 +431,8 @@ static void loc_nmea_generate_GSV(const GnssSvNotification &svNotify,
|
|||
}
|
||||
|
||||
// The following entries are specific to QZSS and BDS
|
||||
if (sv_meta_p->svType == GNSS_SV_TYPE_QZSS)
|
||||
if ((sv_meta_p->svType == GNSS_SV_TYPE_QZSS) ||
|
||||
(sv_meta_p->svType == GNSS_SV_TYPE_BEIDOU))
|
||||
{
|
||||
// last one is System id and second last is Signal Id which is always zero
|
||||
length = snprintf(pMarker, lengthRemaining,",%d,%d",0,sv_meta_p->systemId);
|
||||
|
@ -528,9 +540,9 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
|||
talker[1] = sv_meta.talker[1];
|
||||
}
|
||||
|
||||
// -------------------
|
||||
// ---$PQGSA/$GNGSA---
|
||||
// -------------------
|
||||
// --------------------------
|
||||
// ---$PQGSA/$GNGSA (QZSS)---
|
||||
// --------------------------
|
||||
|
||||
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
|
||||
loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_QZSS, false), nmeaArraystr);
|
||||
|
@ -540,6 +552,17 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
|||
// talker should be default "GP". If GPS, GLO etc is used, it should be "GN"
|
||||
}
|
||||
|
||||
// ----------------------------
|
||||
// ---$PQGSA/$GNGSA (BEIDOU)---
|
||||
// ----------------------------
|
||||
count = loc_nmea_generate_GSA(locationExtended, sentence, sizeof(sentence),
|
||||
loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_BEIDOU, false), nmeaArraystr);
|
||||
if (count > 0)
|
||||
{
|
||||
svUsedCount += count;
|
||||
// talker should be default "GP". If GPS, GLO etc is used, it should be "GN"
|
||||
}
|
||||
|
||||
// -------------------
|
||||
// ------$--VTG-------
|
||||
// -------------------
|
||||
|
@ -903,6 +926,7 @@ void loc_nmea_generate_pos(const UlpLocation &location,
|
|||
sv_cache_info.glo_used_mask = 0;
|
||||
sv_cache_info.gal_used_mask = 0;
|
||||
sv_cache_info.qzss_used_mask = 0;
|
||||
sv_cache_info.bds_used_mask = 0;
|
||||
}
|
||||
//Send blank NMEA reports for non-final fixes
|
||||
else {
|
||||
|
@ -972,11 +996,13 @@ void loc_nmea_generate_sv(const GnssSvNotification &svNotify,
|
|||
sv_cache_info.glo_used_mask = 0;
|
||||
sv_cache_info.gal_used_mask = 0;
|
||||
sv_cache_info.qzss_used_mask = 0;
|
||||
sv_cache_info.bds_used_mask = 0;
|
||||
|
||||
sv_cache_info.gps_count = 0;
|
||||
sv_cache_info.glo_count = 0;
|
||||
sv_cache_info.gal_count = 0;
|
||||
sv_cache_info.qzss_count = 0;
|
||||
sv_cache_info.bds_count = 0;
|
||||
for(svNumber=1; svNumber <= svCount; svNumber++) {
|
||||
if (GNSS_SV_TYPE_GPS == svNotify.gnssSvs[svNumber - 1].type)
|
||||
{
|
||||
|
@ -1026,7 +1052,18 @@ void loc_nmea_generate_sv(const GnssSvNotification &svNotify,
|
|||
}
|
||||
sv_cache_info.qzss_count++;
|
||||
}
|
||||
|
||||
else if (GNSS_SV_TYPE_BEIDOU == svNotify.gnssSvs[svNumber - 1].type)
|
||||
{
|
||||
// cache the used in fix mask, as it will be needed to send $PQGSA
|
||||
// during the position report
|
||||
if (GNSS_SV_OPTIONS_USED_IN_FIX_BIT ==
|
||||
(svNotify.gnssSvs[svNumber - 1].gnssSvOptionsMask &
|
||||
GNSS_SV_OPTIONS_USED_IN_FIX_BIT))
|
||||
{
|
||||
sv_cache_info.bds_used_mask |= (1 << (svNotify.gnssSvs[svNumber - 1].svId - 1));
|
||||
}
|
||||
sv_cache_info.bds_count++;
|
||||
}
|
||||
}
|
||||
|
||||
loc_nmea_sv_meta sv_meta;
|
||||
|
@ -1051,12 +1088,19 @@ void loc_nmea_generate_sv(const GnssSvNotification &svNotify,
|
|||
loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
|
||||
loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_GALILEO, false), nmeaArraystr);
|
||||
|
||||
// ------------------
|
||||
// ------$PQGSV------
|
||||
// ------------------
|
||||
// -------------------------
|
||||
// ------$PQGSV (QZSS)------
|
||||
// -------------------------
|
||||
|
||||
loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
|
||||
loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_QZSS, false), nmeaArraystr);
|
||||
|
||||
// ---------------------------
|
||||
// ------$PQGSV (BEIDOU)------
|
||||
// ---------------------------
|
||||
|
||||
loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
|
||||
loc_nmea_sv_meta_init(sv_meta, GNSS_SV_TYPE_BEIDOU, false), nmeaArraystr);
|
||||
|
||||
EXIT_LOG(%d, 0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue