コード例 #1
0
ファイル: BEC.CPP プロジェクト: SammyB428/NMEA0183
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 );
}
コード例 #2
0
ファイル: rmb.cpp プロジェクト: AluOne/OpenCPN
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 );
}
コード例 #3
0
ファイル: gga.cpp プロジェクト: SethDart/logbook_pi
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 );
}
コード例 #4
0
ファイル: rma.cpp プロジェクト: mikejwatts/epl_pi
BOOL RMA::Parse( const SENTENCE& sentence )
{
   ASSERT_VALID( this );

   /*
   ** RMA - Recommended Minimum Navigation Information
   **                                                    12
   **        1 2       3 4        5 6   7   8   9   10  11|
   **        | |       | |        | |   |   |   |   |   | |
   ** $--RMA,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,x.x,x.x,x.x,a*hh<CR><LF>
   **
   ** Field Number: 
   **  1) Blink Warning
   **  2) Latitude
   **  3) N or S
   **  4) Longitude
   **  5) E or W
   **  6) Time Difference A, uS
   **  7) Time Difference B, uS
   **  8) Speed Over Ground, Knots
   **  9) Track Made Good, degrees true
   ** 10) Magnetic Variation, degrees
   ** 11) E or W
   ** 12) Checksum
   */

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

   NMEA0183_BOOLEAN check = sentence.IsChecksumBad( 12 );

   if ( check == True )
   {
      SetErrorMessage( "Invalid Checksum" );
      return( FALSE );
   }
   
   if ( check == Unknown )
   {
      SetErrorMessage( "Missing Checksum" );
      return( FALSE );
   } 

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

   return( TRUE );
}
コード例 #5
0
ファイル: TRF.CPP プロジェクト: SammyB428/NMEA0183
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 );
}
コード例 #6
0
ファイル: hsc.cpp プロジェクト: mikejwatts/epl_pi
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 );
}
コード例 #7
0
ファイル: hdm.cpp プロジェクト: JONA-GA/connectorga_pi
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 );
}
コード例 #8
0
ファイル: VPW.CPP プロジェクト: SammyB428/NMEA0183
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 );
}
コード例 #9
0
ファイル: HDM.CPP プロジェクト: SammyB428/NMEA0183
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 );
}
コード例 #10
0
ファイル: mtw.cpp プロジェクト: JONA-GA/connectorga_pi
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 );
}
コード例 #11
0
ファイル: WDR.CPP プロジェクト: SammyB428/NMEA0183
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 );
}
コード例 #12
0
ファイル: hdt.cpp プロジェクト: AluOne/OpenCPN
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 );
}
コード例 #13
0
ファイル: TEP.CPP プロジェクト: SammyB428/NMEA0183
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 );
}
コード例 #14
0
ファイル: dpt.cpp プロジェクト: AluOne/OpenCPN
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 );
}
コード例 #15
0
ファイル: mda.cpp プロジェクト: JONA-GA/OpenCPN
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 );
}
コード例 #16
0
ファイル: IMA.cpp プロジェクト: SammyB428/NMEA0183
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 );
}
コード例 #17
0
ファイル: vhw.cpp プロジェクト: JONA-GA/connectorga_pi
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 );
}
コード例 #18
0
ファイル: vwr.cpp プロジェクト: CarCode/Cocoa-OCPN
bool VWR::Parse( const SENTENCE& sentence )
{
//   ASSERT_VALID( this );

   /*
	** MWV - Wind Speed and Angle
	**
	**        1   2 3 4   5 6   7   8
	**        |   | | |   | |   |   |
	** $--VWR,x.x,L,x.x,N,x.x,M,x.x,K,*hh<CR><LF>
	**
	** 1) Wind direction magnitude in degrees
	** 2) Wind direction Left/Right of bow
	** 3) Speed
	** 4) N = Knots
	** 5) Speed
	** 6) M = Meters Per Second
	** 7) Speed
	** 8) K = Kilometers Per Hour
	** 9) Checksum
   */

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

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

   WindDirectionMagnitude = sentence.Double( 1 );
   DirectionOfWind = sentence.LeftOrRight( 2 );
   WindSpeedKnots = sentence.Double( 3 );
   WindSpeedms = sentence.Double( 5 );
   WindSpeedKmh = sentence.Double( 7 );

   return( TRUE );
}
コード例 #19
0
ファイル: LAT.CPP プロジェクト: SammyB428/NMEA0183
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() );
}
コード例 #20
0
ファイル: mwv.cpp プロジェクト: AluOne/OpenCPN
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 );
}
コード例 #21
0
ファイル: xte.cpp プロジェクト: AluOne/OpenCPN
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 );
}
コード例 #22
0
ファイル: rsa.cpp プロジェクト: JONA-GA/connectorga_pi
bool RSA::Parse( const SENTENCE& sentence )
{
//   ASSERT_VALID( this );

   /*
   ** RSA - Rudder Sensor Angle
   **
   **        1   2 3   4 5
   **        |   | |   | |
   ** $--RSA,x.x,A,x.x,A*hh<CR><LF>
   **
   ** Field Number: 
   **  1) Starboard (or single) rudder sensor, "-" means Turn To Port
   **  2) Status, A means data is valid
   **  3) Port rudder sensor
   **  4) Status, A means data is valid
   **  5) Checksum
   */

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

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

   Starboard            = sentence.Double(  1 );
   IsStarboardDataValid = sentence.Boolean( 2 );
   Port                 = sentence.Double(  3 );
   IsPortDataValid      = sentence.Boolean( 4 );

   return( TRUE );
}
コード例 #23
0
ファイル: hdg.cpp プロジェクト: AluOne/OpenCPN
bool HDG::Parse( const SENTENCE& sentence )
{
   /*
   ** HDG - Heading - Deviation & Variation
   **
   **        1   2   3 4   5 6
   **        |   |   | |   | |
   ** $--HDG,x.x,x.x,a,x.x,a*hh<CR><LF>
   **
   ** Field Number:
   **  1) Magnetic Sensor heading in degrees
   **  2) Magnetic Deviation, degrees
   **  3) Magnetic Deviation direction, E = Easterly, W = Westerly
   **  4) Magnetic Variation degrees
   **  5) Magnetic Variation direction, E = Easterly, W = Westerly
   **  6) Checksum
   */

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

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

   MagneticSensorHeadingDegrees = sentence.Double( 1 );
   MagneticDeviationDegrees     = sentence.Double( 2 );
   MagneticDeviationDirection   = sentence.EastOrWest( 3 );
   MagneticVariationDegrees     = sentence.Double( 4 );
   MagneticVariationDirection   = sentence.EastOrWest( 5 );

   return( TRUE );
}
コード例 #24
0
ファイル: bod.cpp プロジェクト: mikejwatts/epl_pi
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 );
}
コード例 #25
0
ファイル: WNC.CPP プロジェクト: SammyB428/NMEA0183
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 );
}
コード例 #26
0
ファイル: RPM.CPP プロジェクト: SammyB428/NMEA0183
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 );
}
コード例 #27
0
ファイル: lat.cpp プロジェクト: CarCode/Cocoa-OCPN
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 );
}
コード例 #28
0
ファイル: long.cpp プロジェクト: AluOne/OpenCPN
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 );
}
コード例 #29
0
ファイル: RTE.CPP プロジェクト: SammyB428/NMEA0183
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 );
}
コード例 #30
0
ファイル: rmc.cpp プロジェクト: JesperWe/OpenCPN
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 );
}