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: gtd.cpp $
|
---|
13 | ** $Revision: 5 $
|
---|
14 | ** $Modtime: 10/10/98 2:48p $
|
---|
15 | */
|
---|
16 |
|
---|
17 |
|
---|
18 |
|
---|
19 | GTD::GTD()
|
---|
20 | {
|
---|
21 | Mnemonic = "GTD";
|
---|
22 | Empty();
|
---|
23 | }
|
---|
24 |
|
---|
25 | GTD::~GTD()
|
---|
26 | {
|
---|
27 | //Mnemonic.Empty();
|
---|
28 | Empty();
|
---|
29 | }
|
---|
30 |
|
---|
31 | void GTD::Empty( void )
|
---|
32 | {
|
---|
33 | //TimeDifference1.Empty();
|
---|
34 | //TimeDifference2.Empty();
|
---|
35 | //TimeDifference3.Empty();
|
---|
36 | //TimeDifference4.Empty();
|
---|
37 | //TimeDifference5.Empty();
|
---|
38 | }
|
---|
39 |
|
---|
40 | BOOL GTD::Parse( const SENTENCE& sentence )
|
---|
41 | {
|
---|
42 | /*
|
---|
43 | ** GTD - Geographical Position, Loran-C TDs
|
---|
44 | **
|
---|
45 | ** 1 2 3 4 5 6
|
---|
46 | ** | | | | | |
|
---|
47 | ** $--GTD,x.x,x.x,x.x,x,x,x.x*hh<CR><LF>
|
---|
48 | **
|
---|
49 | ** 1) Time Difference 1 Microseconds
|
---|
50 | ** 2) Time Difference 2 Microseconds
|
---|
51 | ** 3) Time Difference 3 Microseconds
|
---|
52 | ** 4) Time Difference 4 Microseconds
|
---|
53 | ** 5) Time Difference 5 Microseconds
|
---|
54 | ** 6) Checksum
|
---|
55 | */
|
---|
56 |
|
---|
57 | /*
|
---|
58 | ** First we check the checksum...
|
---|
59 | */
|
---|
60 |
|
---|
61 | if ( sentence.IsChecksumBad( 6 ) == True )
|
---|
62 | {
|
---|
63 | SetErrorMessage( "Invalid Checksum" );
|
---|
64 | return( FALSE );
|
---|
65 | }
|
---|
66 |
|
---|
67 | TimeDifference1 = sentence.Field( 1 );
|
---|
68 | TimeDifference2 = sentence.Field( 2 );
|
---|
69 | TimeDifference3 = sentence.Field( 3 );
|
---|
70 | TimeDifference4 = sentence.Field( 4 );
|
---|
71 | TimeDifference5 = sentence.Field( 5 );
|
---|
72 |
|
---|
73 | return( TRUE );
|
---|
74 | }
|
---|
75 |
|
---|
76 | BOOL GTD::Write( SENTENCE& sentence )
|
---|
77 | {
|
---|
78 | /*
|
---|
79 | ** Let the parent do its thing
|
---|
80 | */
|
---|
81 |
|
---|
82 | RESPONSE::Write( sentence );
|
---|
83 |
|
---|
84 | sentence += TimeDifference1;
|
---|
85 | sentence += TimeDifference2;
|
---|
86 | sentence += TimeDifference3;
|
---|
87 | sentence += TimeDifference4;
|
---|
88 | sentence += TimeDifference5;
|
---|
89 |
|
---|
90 | sentence.Finish();
|
---|
91 |
|
---|
92 | return( TRUE );
|
---|
93 | }
|
---|
94 |
|
---|
95 | const GTD& GTD::operator = ( const GTD& source )
|
---|
96 | {
|
---|
97 | TimeDifference1 = source.TimeDifference1;
|
---|
98 | TimeDifference2 = source.TimeDifference2;
|
---|
99 | TimeDifference3 = source.TimeDifference3;
|
---|
100 | TimeDifference4 = source.TimeDifference4;
|
---|
101 | TimeDifference5 = source.TimeDifference5;
|
---|
102 |
|
---|
103 | return( *this );
|
---|
104 | }
|
---|