BOOL HSC::Parse( const SENTENCE& sentence ) { ASSERT_VALID( this ); /* ** HSC - Heading Steering Command ** ** 1 2 3 4 5 ** | | | | | ** $--HSC,x.x,T,x.x,M,*hh<CR><LF> ** ** Field Number: ** 1) Heading Degrees, True ** 2) T = True ** 3) Heading Degrees, Magnetic ** 4) M = Magnetic ** 5) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 5 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( FALSE ); } DegreesTrue = sentence.Double( 1 ); DegreesMagnetic = sentence.Double( 3 ); return( TRUE ); }
BOOL ZTG::Parse( const SENTENCE& sentence ) { ASSERT_VALID( this ); /* ** ZTG - UTC & Time to Destination Waypoint ** ** 1 2 3 4 ** | | | | ** $--ZTG,hhmmss.ss,hhmmss.ss,c--c*hh<CR><LF> ** ** Fields: ** 1) Universal Time Coordinated (UTC) ** 2) Time Remaining ** 3) Destination Waypoint ID ** 4) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 4 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( FALSE ); } UTCTime = sentence.Field( 1 ); TimeRemaining = sentence.Field( 2 ); To = sentence.Field( 3 ); return( TRUE ); }
bool HDM::Parse( const SENTENCE& sentence ) { /* ** HDM - Heading - Deviation & Variation ** ** 1 2 3 ** | | | ** $--HDM,x.x,M*hh<CR><LF> ** ** Field Number: ** 1) Heading in degrees ** 2) M, Magnetic Deviation ** 3) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 3 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( false ); } HeadingDegrees = sentence.Double( 1 ); return( true ); }
bool MTW::Parse( const SENTENCE& sentence ) { // ASSERT_VALID( this ); /* ** MTW - Water Temperature ** ** 1 2 3 ** | | | ** $--MTW,x.x,C*hh<CR><LF> ** ** Field Number: ** 1) Degrees ** 2) Unit of Measurement, Celcius ** 3) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 3 ) == TRUE ) { SetErrorMessage( _T("Invalid Checksum") ); return( FALSE ); } Temperature = sentence.Double( 1 ); UnitOfMeasurement = sentence.Field( 2 ); return( TRUE ); }
bool WDR::Parse( const SENTENCE& sentence ) { /* ** WDR - Distance to Waypoint, Rhumb Line ** ** 1 2 3 4 ** | | | | ** $--WDR,x.x,N,c--c*hh<CR><LF> ** ** 1) Distance to waypoint ** 2) N = Nautical Miles ** 3) Waypoint ID (To) ** 4) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 4 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( false ); } NauticalMiles = sentence.Double( 1 ); To = sentence.Field( 3 ); return( true ); }
bool APB::Write( SENTENCE& sentence ) { // ASSERT_VALID( this ); /* ** Let the parent do its thing */ RESPONSE::Write( sentence ); sentence += IsLoranBlinkOK; sentence += IsLoranCCycleLockOK; sentence.Add( CrossTrackErrorMagnitude, g_NMEAAPBPrecision); if(DirectionToSteer == Left) sentence += _T("L"); else sentence += _T("R"); sentence += CrossTrackUnits; sentence += IsArrivalCircleEntered; sentence += IsPerpendicular; sentence.Add( BearingOriginToDestination, g_NMEAAPBPrecision); sentence += BearingOriginToDestinationUnits; sentence += To; sentence.Add( BearingPresentPositionToDestination, g_NMEAAPBPrecision ); sentence += BearingPresentPositionToDestinationUnits; sentence.Add( HeadingToSteer, g_NMEAAPBPrecision ); sentence += HeadingToSteerUnits; sentence.Finish(); return( TRUE ); }
bool HDT::Parse( const SENTENCE& sentence ) { /* ** HDT - Heading - True ** ** 1 2 3 ** | | | ** $--HDT,x.x,T*hh<CR><LF> ** ** Field Number: ** 1) Heading Degrees, TRUE ** 2) T = True ** 3) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 3 ) == TRUE ) { SetErrorMessage( _T("Invalid Checksum") ); return( FALSE ); } DegreesTrue = sentence.Double( 1 ); 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 VPW::Parse( const SENTENCE& sentence ) { /* ** VPW - Speed - Measured Parallel to Wind ** ** 1 2 3 4 5 ** | | | | | ** $--VPW,x.x,N,x.x,M*hh<CR><LF> ** ** Field Number: ** 1) Speed, "-" means downwind ** 2) N = Knots ** 3) Speed, "-" means downwind ** 4) M = Meters per second ** 5) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 5 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( false ); } Knots = sentence.Double( 1 ); MetersPerSecond = sentence.Double( 3 ); return( true ); }
bool DPT::Parse( const SENTENCE& sentence ) { // ASSERT_VALID( this ); /* ** DPT - Heading - Deviation & Variation ** ** 1 2 3 ** | | | ** $--DPT,x.x,x.x*hh<CR><LF> ** ** Field Number: ** 1) Depth, meters ** 2) Offset from transducer, ** positive means distance from tansducer to water line ** negative means distance from transducer to keel ** 3) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 3 ) == TRUE ) { SetErrorMessage( _T("Invalid Checksum") ); return( FALSE ); } DepthMeters = sentence.Double( 1 ); OffsetFromTransducerMeters = sentence.Double( 2 ); 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 ); }
bool GPWPL::Parse( const SENTENCE& sentence ) { /* ** WPL - Waypoint Location ** ** +-------------------------------- 1) Latitude ** | +------------------------ 2) N or S (North or South) ** | | +---------------------- 3) Longitude ** | | | +------------- 4) E or W (East or West) ** | | | | +----------- 5) Waypoint name ** | | | | | +-------6) Checksum ** | | | | | | ** $--WPL,llll.ll,a,yyyyy.yy,a,c--c*hh<CR><LF> */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 6 ) == NTrue ) { SetErrorMessage( _T("Invalid Checksum") ); return( FALSE ); } Position.Parse( 1, 2, 3, 4, sentence ); To = sentence.Field( 5 ); return( TRUE ); }
bool HDM::Parse( const SENTENCE& sentence ) { /* ** HDM - Heading - Magnetic ** ** 1 2 3 ** | | | ** $--HDM,x.x,M*hh<CR><LF> ** ** Field Number: ** 1) Heading Degrees, Magnetic ** 2) M = Magnetic ** 3) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 3 ) == TRUE ) { SetErrorMessage( _T("Invalid Checksum") ); return( FALSE ); } DegreesMagnetic = sentence.Double( 1 ); return( TRUE ); }
bool GTD::Parse( const SENTENCE& sentence ) { /* ** GTD - Geographical Position, Loran-C TDs ** ** 1 2 3 4 5 6 ** | | | | | | ** $--GTD,x.x,x.x,x.x,x,x,x.x*hh<CR><LF> ** ** 1) Time Difference 1 Microseconds ** 2) Time Difference 2 Microseconds ** 3) Time Difference 3 Microseconds ** 4) Time Difference 4 Microseconds ** 5) Time Difference 5 Microseconds ** 6) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 6 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( false ); } TimeDifference1 = sentence.Field( 1 ); TimeDifference2 = sentence.Field( 2 ); TimeDifference3 = sentence.Field( 3 ); TimeDifference4 = sentence.Field( 4 ); TimeDifference5 = sentence.Field( 5 ); return( true ); }
bool TEP::Parse( const SENTENCE& sentence ) { /* ** TEP - TRANSIT Satellite Predicted Elevation ** ** 1 2 3 ** | | | ** $--TEP,x.x,T*hh<CR><LF> ** ** Field Number: ** 1) Elevation degrees ** 2) D = Degrees ** 3) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 3 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( false ); } ElevationDegrees = sentence.Double( 1 ); return( true ); }
bool ZZU::Parse( const SENTENCE& sentence ) { /* ** ZZU - Time UTC ** ** 1 2 ** | | ** $--ZZU,hhmmss.ss,*hh<CR><LF> ** ** 1) Universal Time Coordinated (UTC) ** 2) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 2 ) == 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 ); return( true ); }
void LATITUDE::Parse( int position_field_number, int north_or_south_field_number, const SENTENCE& sentence ) { // Thanks go to Eric Parsonage ([email protected]) for finding a nasty // little bug that used to live here. double position = 0.0; position = sentence.Double( position_field_number ); std::string north_or_south = sentence.Field( north_or_south_field_number ); Set( position, north_or_south.c_str() ); }
bool RMB::Parse( const SENTENCE& sentence ) { /* ** RMB - Recommended Minimum Navigation Information ** 14 ** 1 2 3 4 5 6 7 8 9 10 11 12 13| ** | | | | | | | | | | | | | | ** $--RMB,A,x.x,a,c--c,c--c,llll.ll,a,yyyyy.yy,a,x.x,x.x,x.x,A*hh<CR><LF> ** ** Field Number: ** 1) Status, V = Navigation receiver warning ** 2) Cross Track error - nautical miles ** 3) Direction to Steer, Left or Right ** 4) TO Waypoint ID ** 5) FROM Waypoint ID ** 6) Destination Waypoint Latitude ** 7) N or S ** 8) Destination Waypoint Longitude ** 9) E or W ** 10) Range to destination in nautical miles ** 11) Bearing to destination in degrees True ** 12) Destination closing velocity in knots ** 13) Arrival Status, A = Arrival Circle Entered ** 14) Checksum */ /* ** First we check the checksum... */ NMEA0183_BOOLEAN check = sentence.IsChecksumBad( 14 ); if ( check == NTrue ) { SetErrorMessage( _T("Invalid Checksum") ); return( FALSE ); } /* if ( check == Unknown0183 ) { SetErrorMessage( _T("Missing Checksum") ); return( FALSE ); } */ IsDataValid = sentence.Boolean( 1 ); CrossTrackError = sentence.Double( 2 ); DirectionToSteer = sentence.LeftOrRight( 3 ); From = sentence.Field( 4 ); To = sentence.Field( 5 ); DestinationPosition.Parse( 6, 7, 8, 9, sentence ); RangeToDestinationNauticalMiles = sentence.Double( 10 ); BearingToDestinationDegreesTrue = sentence.Double( 11 ); DestinationClosingVelocityKnots = sentence.Double( 12 ); IsArrivalCircleEntered = sentence.Boolean( 13 ); return( TRUE ); }
bool XTE::Parse( const SENTENCE& sentence ) { // ASSERT_VALID( this ); wxString field_data; /* ** XTE - Autopilot Sentence ** ** 1 2 3 4 5 6 ** | | | | | | ** $--XTE,A,A,x.x,a,N*hh<CR><LF> ** ** 1) Status ** V = LORAN-C Blink or SNR warning ** V = general warning flag or other navigation systems when a reliable ** fix is not available ** 2) Status ** V = Loran-C Cycle Lock warning flag ** A = OK or not used ** 3) Cross Track Error Magnitude ** 4) Direction to steer, L or R ** 5) Cross Track Units, N = Nautical Miles ** 6) Checksum */ /* ** First we check the checksum... */ NMEA0183_BOOLEAN check = sentence.IsChecksumBad( 15 ); if ( check == NTrue ) { SetErrorMessage( _T("Invalid Checksum") ); return( FALSE ); } /* ** Line has already been checked for checksum validity */ IsLoranBlinkOK = sentence.Boolean( 1 ); IsLoranCCycleLockOK = sentence.Boolean( 2 ); CrossTrackErrorDistance = sentence.Double( 3 ); DirectionToSteer = sentence.LeftOrRight( 4 ); CrossTrackUnits = sentence.Field( 5 ); return( TRUE ); }
bool RMC::Write( SENTENCE& sentence ) { // ASSERT_VALID( this ); /* ** Let the parent do its thing */ RESPONSE::Write( sentence ); sentence += UTCTime; sentence += IsDataValid; sentence += Position; sentence += SpeedOverGroundKnots; sentence += TrackMadeGoodDegreesTrue; sentence += Date; if(MagneticVariation > 360.) sentence += _T(",,"); else { sentence += MagneticVariation; sentence += MagneticVariationDirection; } sentence.Finish(); return( TRUE ); }
bool XTE::Write( SENTENCE& sentence ) { // ASSERT_VALID( this ); /* ** Let the parent do its thing */ RESPONSE::Write( sentence ); sentence += IsLoranBlinkOK; sentence += IsLoranCCycleLockOK; sentence += CrossTrackErrorDistance; if(DirectionToSteer == Left) sentence += _T("L"); else sentence += _T("R"); sentence += CrossTrackUnits; sentence.Finish(); return( TRUE ); }
bool RMB::Write( SENTENCE& sentence ) { /* ** Let the parent do its thing */ RESPONSE::Write( sentence ); sentence += IsDataValid; sentence += CrossTrackError; if(DirectionToSteer == Left) sentence += _T("L"); else sentence += _T("R"); sentence += From; sentence += To; sentence += DestinationPosition; sentence += RangeToDestinationNauticalMiles; sentence += BearingToDestinationDegreesTrue; sentence += DestinationClosingVelocityKnots; sentence += IsArrivalCircleEntered; sentence.Finish(); // NMEA0183_BOOLEAN check = sentence.IsChecksumBad( 14 ); return( TRUE ); }
bool GGA::Write( SENTENCE& sentence ) { // ASSERT_VALID( this ); /* ** Let the parent do its thing */ RESPONSE::Write( sentence ); sentence += UTCTime; sentence += Position; sentence += GPSQuality; sentence += NumberOfSatellitesInUse; sentence += HorizontalDilutionOfPrecision; sentence += AntennaAltitudeMeters; sentence += _T("M"); sentence += GeoidalSeparationMeters; sentence += _T("M"); sentence += AgeOfDifferentialGPSDataSeconds; sentence += DifferentialReferenceStationID; sentence.Finish(); 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 MDA::Parse( const SENTENCE& sentence ) { // ASSERT_VALID( this ); /*Wind speed, meters/second **Wind speed, knots **Wind direction, **degrees Magnetic **Wind direction, degrees True **$ **-- **MDA,x.x,I,x.x,B,x.x,C,x.x,C,x.x,x.x,x.x,C,x.x,T,x.x,M,x.x,N,x.x,M*hh<CR><LF> ** | | | | Dew point, degrees C ** | | | | Absolute humidity, percent ** | | | | Relative humidity, percent ** | | | | Water temperature, degrees C ** | | | | Air temperature, degrees C ** | | |----Barometric pressure, bars ** |----- Barometric pressure, inches of mercur */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( sentence.GetNumberOfDataFields() ) == TRUE || FALSE ) //diferent vendors have different length of data message and not 24 field as in standard. { SetErrorMessage( _T("Invalid Checksum") ); return( FALSE ); } Pressure = sentence.Double( 3 ); UnitOfMeasurement = sentence.Field( 4 ); if(UnitOfMeasurement==wxT("B")) { Pressure = sentence.Double( 3 ); //from bar to Hecto pascal } return( TRUE ); }
bool IMA::Parse( const SENTENCE& sentence ) { /* ** IMA - Vessel Identification ** 11 13 ** 1 2 3 4 5 6 7 8 9 10| 12| ** | | | | | | | | | | | | | ** $--IMA,aaaaaaaaaaaa,aaaxxxx,llll.ll,a,yyyyy.yy,a,x.x,T,x.x,M,x.x,N*hh<CR><LF> ** ** 1) Twelve character vessel name ** 2) Radio Call Sign ** 3) Latitude ** 4) North/South ** 5) Longitude ** 6) East/West ** 7) Heading, degrees true ** 8) T = True ** 9) Heading, degrees magnetic ** 10) M = Magnetic ** 11) Speed ** 12) N = Knots ** 13) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 13 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( false ); } VesselName = sentence.Field( 1 ); Callsign = sentence.Field( 2 ); Position.Parse( 3, 4, 5, 6, sentence ); HeadingDegreesTrue = sentence.Double( 7 ); HeadingDegreesMagnetic = sentence.Double( 9 ); SpeedKnots = sentence.Double( 11 ); return( true ); }
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::Write( SENTENCE& sentence ) { /* ** Let the parent do its thing */ RESPONSE::Write( sentence ); sentence.Finish(); return( TRUE ); }
bool VHW::Parse( const SENTENCE& sentence ) { // ASSERT_VALID( this ); /* ** VHW - Water speed and heading ** ** 1 2 3 4 5 6 7 8 9 ** | | | | | | | | | ** $--VHW,x.x,T,x.x,M,x.x,N,x.x,K*hh<CR><LF> ** ** Field Number: ** 1) Degress True ** 2) T = True ** 3) Degrees Magnetic ** 4) M = Magnetic ** 5) Knots (speed of vessel relative to the water) ** 6) N = Knots ** 7) Kilometers (speed of vessel relative to the water) ** 8) K = Kilometers ** 9) Checksum */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 9 ) == TRUE ) { SetErrorMessage( _T("Invalid Checksum") ); return( FALSE ); } DegreesTrue = sentence.Double( 1 ); DegreesMagnetic = sentence.Double( 3 ); Knots = sentence.Double( 5 ); KilometersPerHour = sentence.Double( 7 ); return( TRUE ); }
bool BEC::Parse( const SENTENCE& sentence ) { /* ** BEC - Bearing & Distance to Waypoint - Dead Reckoning ** 12 ** 1 2 3 4 5 6 7 8 9 10 11| 13 ** | | | | | | | | | | | | | ** $--BEC,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x.x,T,x.x,M,x.x,N,c--c*hh<CR><LF> */ /* ** First we check the checksum... */ if ( sentence.IsChecksumBad( 13 ) == True ) { SetErrorMessage( "Invalid Checksum" ); return( false ); } UTCTime = sentence.Field( 1 ); Time = sentence.Time( 1 ); Position.Parse( 2, 3, 4, 5, sentence ); BearingTrue = sentence.Double( 6 ); BearingMagnetic = sentence.Double( 8 ); DistanceNauticalMiles = sentence.Double( 10 ); To = sentence.Field( 12 ); return( true ); }