mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
[gps] Support GNGSV messages
This commit is contained in:
parent
2234d92be6
commit
07915f7af7
17
external/nmea/parse.c
vendored
17
external/nmea/parse.c
vendored
@ -350,12 +350,15 @@ int nmea_parse_GPGSV( const char *buff, int buff_sz, nmeaGPGSV *pack )
|
||||
|
||||
nmea_trace_buff( buff, buff_sz );
|
||||
|
||||
char type;
|
||||
|
||||
nsen = nmea_scanf( buff, buff_sz,
|
||||
"$GPGSV,%d,%d,%d,"
|
||||
"$G%CGSV,%d,%d,%d,"
|
||||
"%d,%d,%d,%d,"
|
||||
"%d,%d,%d,%d,"
|
||||
"%d,%d,%d,%d,"
|
||||
"%d,%d,%d,%d*",
|
||||
&( type ),
|
||||
&( pack->pack_count ), &( pack->pack_index ), &( pack->sat_count ),
|
||||
&( pack->sat_data[0].id ), &( pack->sat_data[0].elv ), &( pack->sat_data[0].azimuth ), &( pack->sat_data[0].sig ),
|
||||
&( pack->sat_data[1].id ), &( pack->sat_data[1].elv ), &( pack->sat_data[1].azimuth ), &( pack->sat_data[1].sig ),
|
||||
@ -366,9 +369,15 @@ int nmea_parse_GPGSV( const char *buff, int buff_sz, nmeaGPGSV *pack )
|
||||
nsat = ( nsat + NMEA_SATINPACK > pack->sat_count ) ? pack->sat_count - nsat : NMEA_SATINPACK;
|
||||
nsat = nsat * 4 + 3 /* first three sentence`s */;
|
||||
|
||||
if ( nsen < nsat || nsen > ( NMEA_SATINPACK * 4 + 3 ) )
|
||||
if ( nsen - 1 < nsat || nsen - 1 > ( NMEA_SATINPACK * 4 + 3 ) )
|
||||
{
|
||||
nmea_error( "GPGSV parse error!" );
|
||||
nmea_error( "G?GSV parse error!" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( type != 'P' && type != 'N' )
|
||||
{
|
||||
nmea_error( "G?GSV invalid type " );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -404,7 +413,7 @@ int nmea_parse_GPRMC( const char *buff, int buff_sz, nmeaGPRMC *pack )
|
||||
|
||||
if ( nsen != 14 && nsen != 15 )
|
||||
{
|
||||
nmea_error( "GPRMC parse error!" );
|
||||
nmea_error( "G?RMC parse error!" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -108,12 +108,12 @@ void QgsNmeaConnection::processStringBuffer()
|
||||
mStatus = GPSDataReceived;
|
||||
QgsDebugMsgLevel( QStringLiteral( "*******************GPS data received****************" ), 2 );
|
||||
}
|
||||
else if ( substring.startsWith( QLatin1String( "$GPGSV" ) ) )
|
||||
else if ( substring.startsWith( QLatin1String( "$GPGSV" ) ) || substring.startsWith( QLatin1String( "$GNGSV" ) ) )
|
||||
{
|
||||
QgsDebugMsg( substring );
|
||||
QgsDebugMsgLevel( substring, 2 );
|
||||
processGsvSentence( ba.data(), ba.length() );
|
||||
mStatus = GPSDataReceived;
|
||||
QgsDebugMsg( QStringLiteral( "*******************GPS data received****************" ) );
|
||||
QgsDebugMsgLevel( QStringLiteral( "*******************GPS data received****************" ), 2 );
|
||||
}
|
||||
else if ( substring.startsWith( QLatin1String( "$GPVTG" ) ) )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user