source: pacpussensors/trunk/NMEA0183/src/XTE.cpp@ 129

Last change on this file since 129 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: 2.5 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: xte.cpp $
13** $Revision: 4 $
14** $Modtime: 10/10/98 2:39p $
15*/
16
17
18XTE::XTE()
19{
20 Mnemonic = "XTE";
21 Empty();
22}
23
24XTE::~XTE()
25{
26 //Mnemonic.Empty();
27 Empty();
28}
29
30void XTE::Empty( void )
31{
32 CrossTrackErrorMagnitude = 0.0;
33 DirectionToSteer = LR_Unknown;
34 //CrossTrackUnits.Empty();
35}
36
37BOOL XTE::Parse( const SENTENCE& sentence )
38{
39 QString field_data;
40
41 /*
42 ** XTE - Cross-Track Error, Measured
43 **
44 ** 1 2 3 4 5 6
45 ** | | | | | |
46 ** $--XTE,A,A,x.x,a,N,*hh<CR><LF>
47 **
48 ** 1) Status
49 ** V = LORAN-C Blink or SNR warning
50 ** V = general warning flag or other navigation systems when a reliable
51 ** fix is not available
52 ** 2) Status
53 ** V = Loran-C Cycle Lock warning flag
54 ** A = OK or not used
55 ** 3) Cross Track Error Magnitude
56 ** 4) Direction to steer, L or R
57 ** 5) Cross Track Units, N = Nautical Miles
58 ** 6) Checksum
59 */
60
61 /*
62 ** First we check the checksum...
63 */
64
65 if ( sentence.IsChecksumBad( 6 ) == True )
66 {
67 SetErrorMessage( "Invalid Checksum" );
68 return( FALSE );
69 }
70
71 /*
72 ** Line has already been checked for checksum validity
73 */
74
75 IsLoranBlinkOK = sentence.Boolean( 1 );
76 IsLoranCCycleLockOK = sentence.Boolean( 2 );
77 CrossTrackErrorMagnitude = sentence.Double( 3 );
78 DirectionToSteer = sentence.LeftOrRight( 4 );
79 CrossTrackUnits = sentence.Field( 5 );
80
81 return( TRUE );
82}
83
84BOOL XTE::Write( SENTENCE& sentence )
85{
86 /*
87 ** Let the parent do its thing
88 */
89
90 RESPONSE::Write( sentence );
91
92 sentence += IsLoranBlinkOK;
93 sentence += IsLoranCCycleLockOK;
94 sentence += CrossTrackErrorMagnitude;
95 sentence += DirectionToSteer;
96 sentence += CrossTrackUnits;
97
98 sentence.Finish();
99
100 return( TRUE );
101}
102
103const XTE& XTE::operator = ( const XTE& source )
104{
105 IsLoranBlinkOK = source.IsLoranBlinkOK;
106 IsLoranCCycleLockOK = source.IsLoranCCycleLockOK;
107 CrossTrackErrorMagnitude = source.CrossTrackErrorMagnitude;
108 DirectionToSteer = source.DirectionToSteer;
109 CrossTrackUnits = source.CrossTrackUnits;
110
111 return( *this );
112}
Note: See TracBrowser for help on using the repository browser.