Skip to content

Commit

Permalink
[gps] Support GNGGA nmea messages
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 5, 2019
1 parent 99c8afe commit 299c612
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions external/nmea/parse.c
Expand Up @@ -231,14 +231,23 @@ int nmea_parse_GPGGA( const char *buff, int buff_sz, nmeaGPGGA *pack )

nmea_trace_buff( buff, buff_sz );

if ( 14 != nmea_scanf( buff, buff_sz,
"$GPGGA,%s,%f,%C,%f,%C,%d,%d,%f,%f,%C,%f,%C,%f,%d*",
char type;

if ( 15 != nmea_scanf( buff, buff_sz,
"$G%CGGA,%s,%f,%C,%f,%C,%d,%d,%f,%f,%C,%f,%C,%f,%d*",
&( type ),
&( time_buff[0] ),
&( pack->lat ), &( pack->ns ), &( pack->lon ), &( pack->ew ),
&( pack->sig ), &( pack->satinuse ), &( pack->HDOP ), &( pack->elv ), &( pack->elv_units ),
&( pack->diff ), &( pack->diff_units ), &( pack->dgps_age ), &( pack->dgps_sid ) ) )
{
nmea_error( "GPGGA parse error!" );
nmea_error( "G?GGA parse error!" );
return 0;
}

if ( type != 'P' && type != 'N' )
{
nmea_error( "G?GGA invalid type " );
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/gps/qgsnmeaconnection.cpp
Expand Up @@ -94,7 +94,7 @@ void QgsNmeaConnection::processStringBuffer()
{
QString substring = mStringBuffer.mid( dollarIndex, endSentenceIndex );
QByteArray ba = substring.toLocal8Bit();
if ( substring.startsWith( QLatin1String( "$GPGGA" ) ) )
if ( substring.startsWith( QLatin1String( "$GPGGA" ) ) || substring.startsWith( QLatin1String( "$GNGGA" ) ) )
{
QgsDebugMsgLevel( substring, 2 );
processGgaSentence( ba.data(), ba.length() );
Expand Down

0 comments on commit 299c612

Please sign in to comment.