Adjust NMEA sentence to comply with v4.1

1. Add Navigational status to $--RMC sentence
2. Add Signal ID to $--GSV sentence

Change-Id: I5ae26bed8dcca577ee661a4129858a8482d172a6
CRs-fixed: 2109692
This commit is contained in:
Baili Feng 2017-10-24 18:05:52 +08:00 committed by Gerrit - the friendly Code Review server
parent 6ccaa83f60
commit 08cbff337d

View file

@ -51,6 +51,7 @@ typedef struct loc_nmea_sv_meta_s
uint32_t mask;
uint32_t svCount;
uint32_t svIdOffset;
uint32_t signalId;
uint32_t systemId;
} loc_nmea_sv_meta;
@ -103,6 +104,7 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
sv_meta.talker[1] = 'P';
sv_meta.mask = sv_cache_info.gps_used_mask;
sv_meta.svCount = sv_cache_info.gps_count;
sv_meta.signalId = 1;
sv_meta.systemId = SYSTEM_ID_GPS;
break;
case GNSS_SV_TYPE_GLONASS:
@ -112,6 +114,7 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
sv_meta.svCount = sv_cache_info.glo_count;
// GLONASS SV ids are from 65-96
sv_meta.svIdOffset = GLONASS_SV_ID_OFFSET;
sv_meta.signalId = 1;
sv_meta.systemId = SYSTEM_ID_GLONASS;
break;
case GNSS_SV_TYPE_GALILEO:
@ -119,6 +122,7 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
sv_meta.talker[1] = 'A';
sv_meta.mask = sv_cache_info.gal_used_mask;
sv_meta.svCount = sv_cache_info.gal_count;
sv_meta.signalId = 7;
sv_meta.systemId = SYSTEM_ID_GALILEO;
break;
case GNSS_SV_TYPE_QZSS:
@ -127,6 +131,7 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
sv_meta.mask = sv_cache_info.qzss_used_mask;
sv_meta.svCount = sv_cache_info.qzss_count;
// QZSS SV ids are from 193-197. So keep svIdOffset 0
sv_meta.signalId = 0;
sv_meta.systemId = SYSTEM_ID_QZSS;
break;
case GNSS_SV_TYPE_BEIDOU:
@ -135,6 +140,7 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
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.signalId = 0;
sv_meta.systemId = SYSTEM_ID_BEIDOU;
break;
default:
@ -260,13 +266,14 @@ static uint32_t loc_nmea_generate_GSA(const GpsLocationExtended &locationExtende
fixType = '3'; // 3D fix
// Start printing the sentence
// Format: $--GSA,a,x,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,p.p,h.h,v.v*cc
// Format: $--GSA,a,x,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,p.p,h.h,v.v,s*cc
// a : Mode : A : Automatic, allowed to automatically switch 2D/3D
// x : Fixtype : 1 (no fix), 2 (2D fix), 3 (3D fix)
// xx : 12 SV ID
// p.p : Position DOP (Dilution of Precision)
// h.h : Horizontal DOP
// v.v : Vertical DOP
// s : GNSS System Id
// cc : Checksum value
length = snprintf(pMarker, lengthRemaining, "$%sGSA,A,%c,", talker, fixType);
@ -329,7 +336,7 @@ DESCRIPTION
Generate NMEA GSV sentences generated based on sv report
Currently below sentences are generated:
- $GPGSV: GPS Satellites in View
- $GNGSV: GLONASS Satellites in View
- $GLGSV: GLONASS Satellites in View
- $GAGSV: GALILEO Satellites in View
DEPENDENCIES
@ -368,7 +375,7 @@ static void loc_nmea_generate_GSV(const GnssSvNotification &svNotify,
if (svCount <= 0)
{
// no svs in view, so just send a blank $--GSV sentence
snprintf(sentence, lengthRemaining, "$%sGSV,1,1,0,", talker);
snprintf(sentence, lengthRemaining, "$%sGSV,1,1,0,%d", talker, sv_meta_p->signalId);
length = loc_nmea_put_checksum(sentence, bufSize);
nmeaArraystr.push_back(sentence);
return;
@ -430,15 +437,10 @@ 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) ||
(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);
pMarker += length;
lengthRemaining -= length;
}
// append signalId
length = snprintf(pMarker, lengthRemaining,",%d",sv_meta_p->signalId);
pMarker += length;
lengthRemaining -= length;
length = loc_nmea_put_checksum(sentence, bufSize);
nmeaArraystr.push_back(sentence);
@ -639,7 +641,8 @@ void loc_nmea_generate_pos(const UlpLocation &location,
pMarker = sentence;
lengthRemaining = sizeof(sentence);
length = snprintf(pMarker, lengthRemaining, "$%sRMC,%02d%02d%02d.%02d,A," ,
// hardcode Navigation Status field to 'V'
length = snprintf(pMarker, lengthRemaining, "$%sRMC,%02d%02d%02d.%02d,A,V" ,
talker, utcHours, utcMinutes, utcSeconds,utcMSeconds/10);
if (length < 0 || length >= lengthRemaining)