source: pacpusframework/branches/2.0-beta1/src/TestComponents/CPT/NMEA0183/src/GLC.cpp@ 89

Last change on this file since 89 was 89, checked in by morasjul, 11 years ago

PACPUS 2.0 Beta deployed in new branch

Major changes:
-Add communication interface between components
-Add examples for communications interface (TestComponents)
-Move to Qt5 support

  • Property svn:executable set to *
File size: 3.0 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: glc.cpp $
13** $Revision: 5 $
14** $Modtime: 10/10/98 2:47p $
15*/
16
17
18
19GLC::GLC()
20{
21 Mnemonic = "GLC";
22 Empty();
23}
24
25GLC::~GLC()
26{
27 //Mnemonic.Empty();
28 Empty();
29}
30
31void GLC::Empty( void )
32{
33 GroupRepetitionInterval = 0;
34 MasterTOA.Empty();
35 TimeDifference1.Empty();
36 TimeDifference2.Empty();
37 TimeDifference3.Empty();
38 TimeDifference4.Empty();
39 TimeDifference5.Empty();
40}
41
42BOOL GLC::Parse( const SENTENCE& sentence )
43{
44 /*
45 ** GLC - Geographic Position, Loran-C
46 ** 12 14
47 ** 1 2 3 4 5 6 7 8 9 10 11| 13|
48 ** | | | | | | | | | | | | | |
49 ** $--GLC,xxxx,x.x,a,x.x,a,x.x,a.x,x,a,x.x,a,x.x,a*hh<CR><LF>
50 **
51 ** 1) Group Repetition Interval (GRI) Microseconds/10
52 ** 2) Master TOA Microseconds
53 ** 3) Master TOA Signal Status
54 ** 4) Time Difference 1 Microseconds
55 ** 5) Time Difference 1 Signal Status
56 ** 6) Time Difference 2 Microseconds
57 ** 7) Time Difference 2 Signal Status
58 ** 8) Time Difference 3 Microseconds
59 ** 9) Time Difference 3 Signal Status
60 ** 10) Time Difference 4 Microseconds
61 ** 11) Time Difference 4 Signal Status
62 ** 12) Time Difference 5 Microseconds
63 ** 13) Time Difference 5 Signal Status
64 ** 14) Checksum
65 */
66
67 /*
68 ** First we check the checksum...
69 */
70
71 if ( sentence.IsChecksumBad( 14 ) == True )
72 {
73 SetErrorMessage( "Invalid Checksum" );
74 return( FALSE );
75 }
76
77 GroupRepetitionInterval = sentence.Integer( 1 );
78 MasterTOA.Parse( 2, sentence );
79 TimeDifference1.Parse( 4, sentence );
80 TimeDifference2.Parse( 6, sentence );
81 TimeDifference3.Parse( 8, sentence );
82 TimeDifference4.Parse( 10, sentence );
83 TimeDifference5.Parse( 12, sentence );
84
85 return( TRUE );
86}
87
88BOOL GLC::Write( SENTENCE& sentence )
89{
90 /*
91 ** Let the parent do its thing
92 */
93
94 RESPONSE::Write( sentence );
95
96 sentence += GroupRepetitionInterval;
97 MasterTOA.Write( sentence );
98 TimeDifference1.Write( sentence );
99 TimeDifference2.Write( sentence );
100 TimeDifference3.Write( sentence );
101 TimeDifference4.Write( sentence );
102 TimeDifference5.Write( sentence );
103
104 sentence.Finish();
105
106 return( TRUE );
107}
108
109const GLC& GLC::operator = ( const GLC& source )
110{
111 GroupRepetitionInterval = source.GroupRepetitionInterval;
112 MasterTOA = source.MasterTOA;
113 TimeDifference1 = source.TimeDifference1;
114 TimeDifference2 = source.TimeDifference2;
115 TimeDifference3 = source.TimeDifference3;
116 TimeDifference4 = source.TimeDifference4;
117 TimeDifference5 = source.TimeDifference5;
118
119 return( *this );
120}
Note: See TracBrowser for help on using the repository browser.