bool GGA::Parse( const SENTENCE& sentence ) { // ASSERT_VALID( this ); /* ** GGA - Global Positioning System Fix Data ** Time, Position and fix related data fora GPS receiver. ** ** 11 ** 1 2 3 4 5 6 7 8 9 10 | 12 13 14 15 ** | | | | | | | | | | | | | | | ** $--GGA,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx*hh<CR><LF> ** ** Field Number: ** 1) Universal Time Coordinated (UTC) ** 2) Latitude ** 3) N or S (North or South) ** 4) Longitude ** 5) E or W (East or West) ** 6) GPS Quality Indicator, ** 0 - fix not available, ** 1 - GPS fix, ** 2 - Differential GPS fix ** 7) Number of satellites in view, 00 - 12 ** 8) Horizontal Dilution of precision ** 9) Antenna Altitude above/below mean-sea-level (geoid) ** 10) Units of antenna altitude, meters ** 11) Geoidal separation, the difference between the WGS-84 earth ** ellipsoid and mean-sea-level (geoid), "-" means mean-sea-level ** below ellipsoid ** 12) Units of geoidal separation, meters ** 13) Age of differential GPS data, time in seconds since last SC104 ** type 1 or 9 update, null field when DGPS is not used ** 14) Differential reference station ID, 0000-1023 ** 15) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 15 ) ==NTrue ) { SetErrorMessage( _T("Invalid Checksum" )); return( FALSE ); } UTCTime = sentence.Field( 1 ); Position.Parse( 2, 3, 4, 5, sentence ); GPSQuality = sentence.Integer( 6 ); NumberOfSatellitesInUse = sentence.Integer( 7 ); HorizontalDilutionOfPrecision = sentence.Double( 8 ); AntennaAltitudeMeters = sentence.Double( 9 ); GeoidalSeparationMeters = sentence.Double( 11 ); AgeOfDifferentialGPSDataSeconds = sentence.Double( 13 ); DifferentialReferenceStationID = sentence.Integer( 14 ); return( TRUE ); }
BOOL STN::Parse( const SENTENCE& sentence ) { ASSERT_VALID( this ); /* ** STN - Multiple Data ID ** ** 1 2 ** | | ** $--STN,x.x,*hh<CR><LF> ** ** Field Number: ** 1) Talker ID Number ** 2) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 2 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( FALSE ); } TalkerIDNumber = sentence.Integer( 1 ); return( TRUE ); }
bool VWE::Parse( const SENTENCE& sentence ) { /* ** VWE - Wind Track Efficiency ** ** 1 2 ** | | ** $--VWE,x.x,*hh<CR><LF> ** ** Field Number: ** 1) Efficiency, Percent ** 2) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 2 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( false ); } EfficiencyPercent = sentence.Integer( 1 ); return( true ); }
void SATELLITE_DATA::Parse( int first_field_number, const SENTENCE& sentence ) { SatelliteNumber = sentence.Integer( first_field_number ); ElevationDegrees = sentence.Integer( first_field_number + 1 ); AzimuthDegreesTrue = sentence.Integer( first_field_number + 2 ); std::string field_data = sentence.Field( first_field_number + 3 ); if ( field_data == "" ) { SignalToNoiseRatio = (-1); } else { SignalToNoiseRatio = sentence.Integer( first_field_number + 3 ); } }
bool TRF::Parse( const SENTENCE& sentence ) { /* ** TRF - TRANSIT Fix Data ** 13 ** 1 2 3 4 5 6 7 8 9 10 11 12| ** | | | | | | | | | | | | | ** $--TRF,hhmmss.ss,xxxxxx,llll.ll,a,yyyyy.yy,a,x.x,x.x,x.x,x.x,xxx,A*hh<CR><LF> ** ** Field Number: ** 1) UTC Time ** 2) Date, ddmmyy ** 3) Latitude ** 4) N or S ** 5) Longitude ** 6) E or W ** 7) Elevation Angle ** 8) Number of iterations ** 9) Number of Doppler intervals ** 10) Update distance, nautical miles ** 11) Satellite ID ** 12) Data Validity ** 13) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 13 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( false ); } UTCTime = sentence.Field( 1 ); Time = sentence.Time( 1 ); Date = sentence.Field( 2 ); Position.Parse( 3, 4, 5, 6, sentence ); ElevationAngle = sentence.Double( 7 ); NumberOfIterations = sentence.Double( 8 ); NumberOfDopplerIntervals = sentence.Double( 9 ); UpdateDistanceNauticalMiles = sentence.Double( 10 ); SatelliteID = sentence.Integer( 11 ); IsDataValid = sentence.Boolean( 12 ); return( true ); }
bool GSV::Parse( const SENTENCE& sentence ) { /* $GPGSV,2,1,08,01,40,083,46,02,17,308,41,12,07,344,39,14,22,228,45*75 Where: GSV Satellites in view 2 Number of sentences for full data 1 sentence 1 of 2 08 Number of satellites in view 01 Satellite PRN number 40 Elevation, degrees 083 Azimuth, degrees 46 SNR - higher is better for up to 4 satellites per sentence *75 the checksum data, always begins with * */ /* ** GSV - GPS satellite Status ** ** 1 2 3 4 5 6 7 n ** | | | | | | | | ** $--GSV,x,x,x,x,x,x,x.........*hh<CR><LF> ** ** Field Number: ** 1) Number of sentences for full data ** 2) sentence number ** 3) Number of satellites in view ** 4) Satellite PRN number ** 5) Elevation, degrees ** 6) Azimuth, degrees ** 7) SNR - higher is better ** Fields 4-7 may repeat up to 4 times per sentence ** n) Checksum */ /* ** Ignore the checksum... */ SatsInView = sentence.Integer( 3 ); return( TRUE ); }
bool RPM::Parse( const SENTENCE& sentence ) { /* ** RPM - Revolutions ** ** 1 2 3 4 5 6 ** | | | | | | ** $--RPM,a,x,x.x,x.x,A*hh<CR><LF> ** ** Field Number: ** 1) Sourse, S = Shaft, E = Engine ** 2) Engine or shaft number ** 3) Speed, Revolutions per minute ** 4) Propeller pitch, % of maximum, "-" means astern ** 5) Status, A means data is valid ** 6) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 6 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( false ); } Source = sentence.Field( 1 ); SourceNumber = sentence.Integer( 2 ); RevolutionsPerMinute = sentence.Double( 3 ); PropellerPitchPercentage = sentence.Double( 4 ); IsDataValid = sentence.Boolean( 5 ); return( true ); }
bool ZLZ::Parse( const SENTENCE& sentence ) { /* ** ZLZ - Time of Day ** UTC, local time, zone ** ** 1 2 3 4 ** | | | | ** $--ZLZ,hhmmss.ss,hhmmss.ss,xx*hh<CR><LF> ** ** 1) Universal Time Coordinated (UTC) ** 2) Local Time ** 3) Local Zone Description, number of whole hours added to local time to obtain GMT ** 4) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 4 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( false ); } time_t temp_time = time(nullptr); struct tm * tm_p = gmtime(&temp_time); int year = tm_p->tm_year + 1900; int month = tm_p->tm_mon; int day = tm_p->tm_mday; UTCTimeString = sentence.Field( 1 ); char temp_number[ 3 ]; temp_number[ 2 ] = 0x00; temp_number[ 0 ] = UTCTimeString[ 0 ]; temp_number[ 1 ] = UTCTimeString[ 1 ]; int hours = ::atoi( temp_number ); temp_number[ 0 ] = UTCTimeString[ 2 ]; temp_number[ 1 ] = UTCTimeString[ 3 ]; int minutes = ::atoi( temp_number ); temp_number[ 0 ] = UTCTimeString[ 4 ]; temp_number[ 1 ] = UTCTimeString[ 5 ]; int seconds = ::atoi( temp_number ); UTCTime = ctime( year, month, day, hours, minutes, seconds ); LocalTimeString = sentence.Field( 2 ); temp_number[ 0 ] = LocalTimeString[ 0 ]; temp_number[ 1 ] = LocalTimeString[ 1 ]; hours = ::atoi( temp_number ); temp_number[ 0 ] = LocalTimeString[ 2 ]; temp_number[ 1 ] = LocalTimeString[ 3 ]; minutes = ::atoi( temp_number ); temp_number[ 0 ] = LocalTimeString[ 4 ]; temp_number[ 1 ] = LocalTimeString[ 5 ]; seconds = ::atoi( temp_number ); LocalTime = ctime( year, month, day, hours, minutes, seconds ); LocalHourDeviation = sentence.Integer( 3 ); return( true ); }
bool RTE::Parse( const SENTENCE& sentence ) { /* ** RTE - Routes ** ** 1 2 3 4 5 x n ** | | | | | | | ** $--RTE,x.x,x.x,a,c--c,c--c, ..... c--c*hh<CR><LF> ** ** Field Number: ** 1) Total number of messages being transmitted ** 2) Message Number ** 3) Message mode ** c = complete route, all waypoints ** w = working route, the waypoint you just left, the waypoint you're heading to then all the rest ** 4) Waypoint ID ** x) More Waypoints ** n) Checksum */ delete_all_entries(); int field_number = 1; total_number_of_messages = sentence.Integer( 1 ); // total_number_of_messages = sentence.Double( 1 ); int this_message_number = sentence.Integer( 2 ); // double this_message_number = sentence.Double( 2 ); if ( this_message_number == 1 ) { /* ** Make sure we've got a clean list */ delete_all_entries(); } if ( sentence.Field( 3 ).StartsWith(_T("c")) ) { TypeOfRoute = CompleteRoute; } else if ( sentence.Field( 3 ).StartsWith(_T("w"))) { TypeOfRoute = WorkingRoute; } else { TypeOfRoute = RouteUnknown; } RouteName = sentence.Field( 4 ); int number_of_data_fields = sentence.GetNumberOfDataFields(); field_number = 5; while( field_number < number_of_data_fields ) { Waypoints.Add( ( sentence.Field( field_number ) )) ; field_number++; } return( TRUE ); }
bool GSV::Parse( const SENTENCE& sentence ) { /* $GPGSV,2,1,08,01,40,083,46,02,17,308,41,12,07,344,39,14,22,228,45*75 Where: GSV Satellites in view 2 Number of sentences for full data 1 sentence 1 of 2 08 Number of satellites in view 01 Satellite PRN number 40 Elevation, degrees 083 Azimuth, degrees 46 SNR - higher is better for up to 4 satellites per sentence *75 the checksum data, always begins with * */ /* ** GSV - GPS satellite Status ** ** 1 2 3 4 5 6 7 n ** | | | | | | | | ** $--GSV,x,x,x,x,x,x,x.........*hh<CR><LF> ** ** Field Number: ** 1) Number of sentences for full data ** 2) sentence number ** 3) Number of satellites in view ** 4) Satellite PRN number ** 5) Elevation, degrees ** 6) Azimuth, degrees ** 7) SNR - higher is better ** Fields 4-7 may repeat up to 4 times per sentence ** n) Checksum */ /* ** First we check the checksum... */ int cksumFieldNr = 0; int satInfoCnt = 0; switch (sentence.GetNumberOfDataFields()) { case 19: cksumFieldNr = 20; satInfoCnt = 4; break; case 15: cksumFieldNr = 16; satInfoCnt = 3; break; case 11: cksumFieldNr = 12; satInfoCnt = 2; break; case 7: cksumFieldNr = 8; satInfoCnt = 1; break; default: SetErrorMessage( _T("Invalid Field count" )); return( FALSE ); } if ( sentence.IsChecksumBad( cksumFieldNr ) == NTrue ) { SetErrorMessage( _T("Invalid Checksum" )); return( FALSE ); } NumberOfMessages = sentence.Integer( 1 ); MessageNumber = sentence.Integer( 2 ); SatsInView = sentence.Integer( 3 ); for (int idx = 0; idx < satInfoCnt; idx++) { SatInfo[idx].SatNumber = sentence.Integer( idx*4+4 ); SatInfo[idx].ElevationDegrees = sentence.Integer( idx*4+5 ); SatInfo[idx].AzimuthDegreesTrue = sentence.Integer( idx*4+6 ); SatInfo[idx].SignalToNoiseRatio = sentence.Integer( idx*4+7 ); } return( TRUE ); }