source: pacpussensors/trunk/NMEA0183/src/XTR.cpp

Last change on this file was 59, checked in by DHERBOMEZ Gérald, 10 years ago

Integration of new modules:

  • GPS NMEA0183 decoder
  • Span CPT Decoder

Update of:

File size: 1.6 KB
Line 
1#include "nmea0183.h"
2#pragma hdrstop
3
4/*
5** Author: Samuel R. Blackburn
6** Internet: sam_blackburn@pobox.com
7**
8** You can use it any way you like as long as you don't try to sell it.
9**
10** Copyright, 1996, Samuel R. Blackburn
11**
12** $Workfile: xtr.cpp $
13** $Revision: 4 $
14** $Modtime: 10/10/98 2:40p $
15*/
16
17
18
19XTR::XTR()
20{
21 Mnemonic = "XTR";
22 Empty();
23}
24
25XTR::~XTR()
26{
27 //Mnemonic.Empty();
28 Empty();
29}
30
31void XTR::Empty( void )
32{
33 Magnitude = 0.0;
34 DirectionToSteer = LR_Unknown;
35}
36
37BOOL XTR::Parse( const SENTENCE& sentence )
38{
39 /*
40 ** XTR - Cross Track Error - Dead Reckoning
41 **
42 ** 1 2 3 4
43 ** | | | |
44 ** $--XTR,x.x,a,N*hh<CR><LF>
45 **
46 ** Field Number:
47 ** 1) Magnitude of cross track error
48 ** 2) Direction to steer, L or R
49 ** 3) Units, N = Nautical Miles
50 ** 4) Checksum
51 */
52
53 /*
54 ** First we check the checksum...
55 */
56
57 if ( sentence.IsChecksumBad( 4 ) == True )
58 {
59 SetErrorMessage( "Invalid Checksum" );
60 return( FALSE );
61 }
62
63 Magnitude = sentence.Double( 1 );
64 DirectionToSteer = sentence.LeftOrRight( 2 );
65
66 return( TRUE );
67}
68
69BOOL XTR::Write( SENTENCE& sentence )
70{
71 /*
72 ** Let the parent do its thing
73 */
74
75 RESPONSE::Write( sentence );
76
77 sentence += Magnitude;
78 sentence += DirectionToSteer;
79 sentence += "N";
80
81 sentence.Finish();
82
83 return( TRUE );
84}
85
86const XTR& XTR::operator = ( const XTR& source )
87{
88 Magnitude = source.Magnitude;
89 DirectionToSteer = source.DirectionToSteer;
90
91 return( *this );
92}
Note: See TracBrowser for help on using the repository browser.