source: pacpussensors/trunk/NMEA0183/src/ZTG.cpp@ 59

Last change on this file since 59 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.8 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: ztg.cpp $
13** $Revision: 4 $
14** $Modtime: 10/10/98 2:38p $
15*/
16
17
18ZTG::ZTG()
19{
20 Mnemonic = "ZTG";
21 Empty();
22}
23
24ZTG::~ZTG()
25{
26 //Mnemonic.Empty();
27 Empty();
28}
29
30void ZTG::Empty( void )
31{
32 //UTCTime.Empty();
33 //TimeRemaining.Empty();
34 //To.Empty();
35}
36
37BOOL ZTG::Parse( const SENTENCE& sentence )
38{
39 /*
40 ** ZTG - UTC & Time to Destination Waypoint
41 **
42 ** 1 2 3 4
43 ** | | | |
44 ** $--ZTG,hhmmss.ss,hhmmss.ss,c--c*hh<CR><LF>
45 **
46 ** Fields:
47 ** 1) Universal Time Coordinated (UTC)
48 ** 2) Time Remaining
49 ** 3) Destination Waypoint ID
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 UTCTime = sentence.Field( 1 );
64 Time = sentence.Time( 1 );
65 TimeRemaining = sentence.Field( 2 );
66 To = sentence.Field( 3 );
67
68 return( TRUE );
69}
70
71BOOL ZTG::Write( SENTENCE& sentence )
72{
73 /*
74 ** Let the parent do its thing
75 */
76
77 RESPONSE::Write( sentence );
78
79 sentence += UTCTime;
80 sentence += TimeRemaining;
81 sentence += To;
82
83 sentence.Finish();
84
85 return( TRUE );
86}
87
88const ZTG& ZTG::operator = ( const ZTG& source )
89{
90 UTCTime = source.UTCTime;
91 Time = source.Time;
92 TimeRemaining = source.TimeRemaining;
93 To = source.To;
94
95 return( *this );
96}
Note: See TracBrowser for help on using the repository browser.