Exemplo n.º 1
0
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 );
}
Exemplo n.º 2
0
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 );
}
Exemplo n.º 3
0
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 );
}
Exemplo n.º 4
0
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 );
}
Exemplo n.º 5
0
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 );
}
Exemplo n.º 6
0
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 );
}
Exemplo n.º 7
0
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 );
}
Exemplo n.º 8
0
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 );
}
Exemplo n.º 9
0
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 );
}
Exemplo n.º 10
0
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 );
}
Exemplo n.º 11
0
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() );
}
Exemplo n.º 12
0
bool MWV::Parse( const SENTENCE& sentence )
{
//   ASSERT_VALID( this );

   /*
   ** MWV - Wind Speed and Angle
   **
   **        1   2 3   4 5
   **        |   | |   | |
   ** $--MWV,x.x,a,x.x,a*hh<CR><LF>
   **
   ** Field Number: 
   **  1) Wind Angle, 0 to 360 degrees
   **  2) Reference, R = Relative, T = True
   **  3) Wind Speed
   **  4) Wind Speed Units, K/M/N
   **  5) Status, A = Data Valid
   **  6) Checksum
   */

   /*
   ** First we check the checksum...
   */

   if ( sentence.IsChecksumBad( 6 ) == TRUE )
   {
      SetErrorMessage( _T("Invalid Checksum") );
      return( FALSE );
   } 

   WindAngle      = sentence.Double( 1 );
   Reference      = sentence.Field( 2 );
   WindSpeed      = sentence.Double( 3 );
   WindSpeedUnits = sentence.Field( 4 );
   IsDataValid    = sentence.Boolean( 5 );

   return( TRUE );
}
Exemplo n.º 13
0
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 );
}
Exemplo n.º 14
0
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 );
   }
     
}
Exemplo n.º 15
0
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 );
}
Exemplo n.º 16
0
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 );
}
Exemplo n.º 17
0
BOOL BOD::Parse( const SENTENCE& sentence )
{
   ASSERT_VALID( this );

   /*
   ** BOD - Bearing - Waypoint to Waypoint
   **
   **        1   2 3   4 5    6    7
   **        |   | |   | |    |    |
   ** $--BOD,x.x,T,x.x,M,c--c,c--c*hh<CR><LF>
   **
   ** Field Number: 
   **  1) Bearing Degrees, TRUE
   **  2) T = True
   **  3) Bearing Degrees, Magnetic
   **  4) M = Magnetic
   **  5) TO Waypoint
   **  6) FROM Waypoint
   **  7) Checksum
   */

   /*
   ** First we check the checksum...
   */

   if ( sentence.IsChecksumBad( 7 ) == True )
   {
      SetErrorMessage( "Invalid Checksum" );
      return( FALSE );
   } 

   BearingTrue     = sentence.Double( 1 );
   BearingMagnetic = sentence.Double( 3 );
   To              = sentence.Field( 5 );
   From            = sentence.Field( 6 );

   return( TRUE );
}
Exemplo n.º 18
0
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 );
}
Exemplo n.º 19
0
bool WNC::Parse( const SENTENCE& sentence )
{
   /*
   ** WNC - Distance - Waypoint to Waypoint
   **
   **        1   2 3   4 5    6    7
   **        |   | |   | |    |    |
   ** $--WNC,x.x,N,x.x,K,c--c,c--c*hh<CR><LF>
   **
   ** Field Number: 
   **  1) Distance, Nautical Miles
   **  2) N = Nautical Miles
   **  3) Distance, Kilometers
   **  4) K = Kilometers
   **  5) TO Waypoint
   **  6) FROM Waypoint
   **  7) Checksum
   */

   /*
   ** First we check the checksum...
   */

   if ( sentence.IsChecksumBad( 7 ) == True )
   {
      SetErrorMessage( "Invalid Checksum" );
      return( false );
   } 

   MilesDistance      = sentence.Double( 1 );
   KilometersDistance = sentence.Double( 3 );
   To                 = sentence.Field( 5 );
   From               = sentence.Field( 6 );

   return( true );
}
Exemplo n.º 20
0
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 );
}
Exemplo n.º 21
0
bool GLL::Parse( const SENTENCE& sentence )
{
//   ASSERT_VALID( this );

   /*
   ** GLL - Geographic Position - Latitude/Longitude
   ** Latitude, N/S, Longitude, E/W, UTC, Status
   **
   **        +-------------------------------- 1) Latitude
   **        |       +------------------------ 2) N or S (North or South)
   **        |       | +---------------------- 3) Longitude
   **        |       | |        +------------- 4) E or W (East or West)
   **        |       | |        | +----------- 5) Universal Time Coordinated (UTC)
   **        |       | |        | |         +- 6) Status A - Data Valid, V - Data Invalid
   **        |       | |        | |         | +7) Checksum
   ** $--GLL,llll.ll,a,yyyyy.yy,a,hhmmss.ss,A*hh<CR><LF>
   */

   /*
   ** First we check the checksum...
   */

      int target_field_count = 6;

      NMEA0183_BOOLEAN check = sentence.IsChecksumBad( 7 );

      if ( check == NTrue )
      {

  /*
            ** This may be an NMEA Version 2.3 sentence, with "Mode" field
  */
            wxString checksum_in_sentence = sentence.Field( 7 );
            if(checksum_in_sentence.StartsWith(_T("*")))       // Field is a valid erroneous checksum
            {
                  SetErrorMessage( _T("Invalid Checksum") );
                  return( FALSE );
            }

            else
            {
                  target_field_count = 7;
                  check = sentence.IsChecksumBad( 8 );
                  if( check == NTrue)
                  {
                        SetErrorMessage( _T("Invalid Checksum") );
                        return( FALSE );
                  }
            }
      }


      if ( sentence.GetNumberOfDataFields() == target_field_count )
      {
            Position.Parse( 1, 2, 3, 4, sentence );
            UTCTime     = sentence.Field( 5 );
            IsDataValid = sentence.Boolean( 6 );

            return( TRUE );
      }

      //    May be old style GLL sentence
      if ( sentence.GetNumberOfDataFields() == 4 )
      {
            Position.Parse( 1, 2, 3, 4, sentence );
            IsDataValid = NTrue;

            return( TRUE );
      }

      //    A real error...
      SetErrorMessage( _T("Invalid FieldCount") );
      return( FALSE );
}
Exemplo n.º 22
0
bool VTG::Parse( const SENTENCE& sentence )
{
//   ASSERT_VALID( this );

   /*
   ** VTG - Track made good and Ground speed
   **
   **        1   2 3   4 5	 6 7   8 9
   **        |   | |   | |	 | |   | |
   ** $--VTG,x.x,T,x.x,M,x.x,N,x.x,K*hh<CR><LF>
   **
   ** Field Number:
   **  1) Track Degrees
   **  2) T = True
   **  3) Track Degrees
   **  4) M = Magnetic
   **  5) Speed Knots
   **  6) N = Knots
   **  7) Speed Kilometers Per Hour
   **  8) K = Kilometers Per Hour
   **  9) Checksum
   */

   /*
   ** First we check the checksum...
   */

      int target_field_count = 8;

      NMEA0183_BOOLEAN check = sentence.IsChecksumBad( 9 );

      if ( check == NTrue )
      {

  /*
      ** This may be an NMEA Version 2.3 sentence, with "Mode" field
  */
            wxString checksum_in_sentence = sentence.Field( 9 );
            if(checksum_in_sentence.StartsWith(_T("*")))       // Field is a valid erroneous checksum
            {
                  SetErrorMessage( _T("Invalid Checksum") );
                  return( FALSE );
            }

           else
           {
                  target_field_count = 9;
                  check = sentence.IsChecksumBad( 10 );
                  if( check == NTrue)
                  {
                        SetErrorMessage( _T("Invalid Checksum") );
                        return( FALSE );
                  }
            }
      }



   if ( sentence.GetNumberOfDataFields() != target_field_count )
   {
         SetErrorMessage( _T("Invalid FieldCount") );
         return( FALSE );
   }


   TrackDegreesTrue       = sentence.Double( 1 );
   TrackDegreesMagnetic   = sentence.Double( 3 );
   SpeedKnots             = sentence.Double( 5 );
   SpeedKilometersPerHour = sentence.Double( 7 );

   return( TRUE );
}
Exemplo n.º 23
0
void LONGITUDE::Parse( int position_field_number, int east_or_west_field_number, const SENTENCE& sentence )
{
   wxString w_or_e = sentence.Field( east_or_west_field_number );
   Set( sentence.Double( position_field_number ), w_or_e );
}
Exemplo n.º 24
0
void LINE_OF_POSITION::Parse( int first_field_number, const SENTENCE& sentence )
{
   ZoneID         = sentence.Field(   first_field_number );
   LineOfPosition = sentence.Double(  first_field_number + 1 );
   MasterLine     = sentence.Boolean( first_field_number + 2 );
}
Exemplo n.º 25
0
bool RMC::Parse( const SENTENCE& sentence )
{
//   ASSERT_VALID( this );

   /*
   ** RMC - Recommended Minimum Navigation Information
   **
   **  Version 2.0 Format
   **                                                            12
   **        1         2 3       4 5        6 7   8   9    10  11|
   **        |         | |       | |        | |   |   |    |   | |
   ** $--RMC,hhmmss.ss,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,xxxx,x.x,a*hh<CR><LF>
   **
   ** Field Number:
   **  1) UTC Time
   **  2) Status, V = Navigation receiver warning
   **  3) Latitude
   **  4) N or S
   **  5) Longitude
   **  6) E or W
   **  7) Speed over ground, knots
   **  8) Track made good, degrees true
   **  9) Date, ddmmyy
   ** 10) Magnetic Variation, degrees
   ** 11) E or W

   ** Version 2.0
   ** 12) Checksum

   ** Version 2.3
   ** 12) Mode (D or A), optional, may be NULL
   ** 13) Checksum
   */

   /*
   ** First we check the checksum...
   */

   NMEA0183_BOOLEAN check = sentence.IsChecksumBad( 12 );

   if ( check == NTrue )
   {
   /*
   ** This may be an NMEA Version 2.3 sentence, with "Mode" field
   */
       wxString checksum_in_sentence = sentence.Field( 12 );
       if(checksum_in_sentence.StartsWith(_T("*")))       // Field is a valid erroneous checksum
       {
         SetErrorMessage( _T("Invalid Checksum") );
         return( FALSE );
       }
       else
       {
         check = sentence.IsChecksumBad( 13 );
         if( check == NTrue)
         {
            SetErrorMessage( _T("Invalid Checksum") );
            return( FALSE );
         }
       }
   }

/*
   if ( check == Unknown0183 )
   {
       SetErrorMessage( _T("Missing Checksum") );
      return( FALSE );
   }
*/

   UTCTime                    = sentence.Field( 1 );
   IsDataValid                = sentence.Boolean( 2 );
   Position.Parse( 3, 4, 5, 6, sentence );
   SpeedOverGroundKnots       = sentence.Double( 7 );
   TrackMadeGoodDegreesTrue   = sentence.Double( 8 );
   Date                       = sentence.Field( 9 );
   MagneticVariation          = sentence.Double( 10 );
   MagneticVariationDirection = sentence.EastOrWest( 11 );

   return( TRUE );
}
Exemplo n.º 26
0
void LATITUDE::Parse( int position_field_number, int north_or_south_field_number, const SENTENCE& sentence )
{
   wxString n_or_s = sentence.Field( north_or_south_field_number );
   Set( sentence.Double( position_field_number ), n_or_s );
}
Exemplo n.º 27
0
bool APB::Parse( const SENTENCE& sentence )
{
//   ASSERT_VALID( this );

   wxString field_data;

   /*
   ** APB - Autopilot Sentence "B"
   **                                         13    15
   **        1 2 3   4 5 6 7 8   9 10   11  12|   14|
   **        | | |   | | | | |   | |    |   | |   | |
   ** $--APB,A,A,x.x,a,N,A,A,x.x,a,c--c,x.x,a,x.x,a*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) Status
   **     A = Arrival Circle Entered
   **  7) Status
   **     A = Perpendicular passed at waypoint
   **  8) Bearing origin to destination
   **  9) M = Magnetic, T = True
   ** 10) Destination Waypoint ID
   ** 11) Bearing, present position to Destination
   ** 12) M = Magnetic, T = True
   ** 13) Heading to steer to destination waypoint
   ** 14) M = Magnetic, T = True
   ** 15) 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 );
   CrossTrackErrorMagnitude                 = sentence.Double( 3 );
   DirectionToSteer                         = sentence.LeftOrRight( 4 );
   CrossTrackUnits                          = sentence.Field( 5 );
   IsArrivalCircleEntered                   = sentence.Boolean( 6 );
   IsPerpendicular                          = sentence.Boolean( 7 );
   BearingOriginToDestination               = sentence.Double( 8 );
   BearingOriginToDestinationUnits          = sentence.Field( 9 );
   To                                       = sentence.Field( 10 );
   BearingPresentPositionToDestination      = sentence.Double( 11 );
   BearingPresentPositionToDestinationUnits = sentence.Field( 12 );
   HeadingToSteer                           = sentence.Double( 13 );
   HeadingToSteerUnits                      = sentence.Field( 14 );

   return( TRUE );
}
Exemplo n.º 28
0
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 );
}
Exemplo n.º 29
0
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
   */

   Waypoints.clear();

   int field_number = 1;

   m_TotalNumberOfMessages = sentence.Double( 1 );
   
   double this_message_number = sentence.Double( 2 );
   
   if ( this_message_number == 1.0 )
   {
      /*
      ** Make sure we've got a clean list
      */

       Waypoints.clear();
   }

   std::string field_data = sentence.Field( 3 );

   if ( field_data == "c" )
   {
      TypeOfRoute = CompleteRoute;
   }
   else if ( field_data == "w" )
   {
      TypeOfRoute = WorkingRoute;
   }
   else
   {
      TypeOfRoute = RouteUnknown;
   }

   RouteName = sentence.Field( 4 );

   int number_of_data_fields = sentence.GetNumberOfDataFields();
   field_number = 5;

   std::string string_to_add;

   while( field_number < number_of_data_fields )
   {
      Waypoints.push_back(sentence.Field(field_number));
      field_number++;
   }

   return( true );
}