source: pacpussensors/trunk/NMEA0183/src/ALM.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: 5.1 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: alm.cpp $
13** $Revision: 6 $
14** $Modtime: 10/10/98 2:41p $
15*/
16
17
18ALM::ALM()
19{
20 Mnemonic = "ALM";
21 Empty();
22}
23
24ALM::~ALM()
25{
26 //Mnemonic.Empty();
27 Empty();
28}
29
30void ALM::Empty( void )
31{
32 NumberOfMessages = 0;
33 MessageNumber = 0;
34 PRNNumber = 0;
35 WeekNumber = 0;
36 SVHealth = 0;
37 Eccentricity = 0;
38 AlmanacReferenceTime = 0;
39 InclinationAngle = 0;
40 RateOfRightAscension = 0;
41 RootOfSemiMajorAxis = 0;
42 ArgumentOfPerigee = 0;
43 LongitudeOfAscensionNode = 0;
44 MeanAnomaly = 0;
45 F0ClockParameter = 0;
46 F1ClockParameter = 0;
47}
48
49BOOL ALM::Parse( const SENTENCE& sentence )
50{
51 QString field_data;
52
53 /*
54 ** ALM - GPS Almanac Data
55 **
56 ** 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
57 ** | | | | | | | | | | | | | | | |
58 ** $--ALM,x.x,x.x,xx,x.x,hh,hhhh,hh,hhhh,hhhh,hhhhhh,hhhhhh,hhhhhh,hhhhhh,hhh,hhh,*hh<CR><LF>
59 **
60 ** 1) Total number of messages
61 ** 2) Message Number
62 ** 3) Satellite PRN number (01 to 32)
63 ** 4) GPS Week Number
64 ** 5) SV health, bits 17-24 of each almanac page
65 ** 6) Eccentricity
66 ** 7) Almanac Reference Time
67 ** 8) Inclination Angle
68 ** 9) Rate of Right Ascension
69 ** 10) Root of semi-major axis
70 ** 11) Argument of perigee
71 ** 12) Longitude of ascension node
72 ** 13) Mean anomaly
73 ** 14) F0 Clock Parameter
74 ** 15) F1 Clock Parameter
75 ** 16) Checksum
76 */
77
78 /*
79 ** First we check the checksum...
80 */
81
82 if ( sentence.IsChecksumBad( 16 ) == True )
83 {
84 SetErrorMessage( "Invalid Checksum" );
85 return( FALSE );
86 }
87
88 NumberOfMessages = (WORD) sentence.Integer( 1 );
89 MessageNumber = (WORD) sentence.Integer( 2 );
90 PRNNumber = (WORD) sentence.Integer( 3 );
91 WeekNumber = (WORD) sentence.Integer( 4 );
92 SVHealth = (WORD) ::HexValue( sentence.Field( 5 ).toLatin1() );
93 Eccentricity = (WORD) ::HexValue( sentence.Field( 6 ).toLatin1() );
94 AlmanacReferenceTime = (WORD) ::HexValue( sentence.Field( 7 ).toLatin1() );
95 InclinationAngle = (WORD) ::HexValue( sentence.Field( 8 ).toLatin1() );
96 RateOfRightAscension = (WORD) ::HexValue( sentence.Field( 9 ).toLatin1() );
97 RootOfSemiMajorAxis = ::HexValue( sentence.Field( 10 ).toLatin1() );
98 ArgumentOfPerigee = ::HexValue( sentence.Field( 11 ).toLatin1() );
99 LongitudeOfAscensionNode = ::HexValue( sentence.Field( 12 ).toLatin1() );
100 MeanAnomaly = ::HexValue( sentence.Field( 13 ).toLatin1() );
101 F0ClockParameter = (WORD) ::HexValue( sentence.Field( 14 ).toLatin1() );
102 F1ClockParameter = (WORD) ::HexValue( sentence.Field( 15 ).toLatin1() );
103
104 return( TRUE );
105}
106
107BOOL ALM::Write( SENTENCE& sentence )
108{
109 /*
110 ** Let the parent do its thing
111 */
112
113 RESPONSE::Write( sentence );
114
115 sentence += Hex( NumberOfMessages ); // Thanks to Chuck Shannon, cshannon@imtn.tpd.dsccc.com
116 sentence += Hex( MessageNumber ); // Thanks to Chuck Shannon, cshannon@imtn.tpd.dsccc.com
117 sentence += Hex( PRNNumber ); // Thanks to Chuck Shannon, cshannon@imtn.tpd.dsccc.com
118 sentence += Hex( WeekNumber ); // Thanks to Chuck Shannon, cshannon@imtn.tpd.dsccc.com
119 sentence += Hex( SVHealth );
120 sentence += Hex( Eccentricity );
121 sentence += Hex( AlmanacReferenceTime );
122 sentence += Hex( InclinationAngle );
123 sentence += Hex( RateOfRightAscension );
124 sentence += Hex( RootOfSemiMajorAxis );
125 sentence += Hex( ArgumentOfPerigee );
126 sentence += Hex( LongitudeOfAscensionNode );
127 sentence += Hex( MeanAnomaly );
128 sentence += Hex( F0ClockParameter );
129 sentence += Hex( F1ClockParameter );
130
131 sentence.Finish();
132
133 return( TRUE );
134}
135
136const ALM& ALM::operator = ( const ALM& source )
137{
138 NumberOfMessages = source.NumberOfMessages;
139 MessageNumber = source.MessageNumber;
140 PRNNumber = source.PRNNumber;
141 WeekNumber = source.WeekNumber;
142 SVHealth = source.SVHealth;
143 Eccentricity = source.Eccentricity;
144 AlmanacReferenceTime = source.AlmanacReferenceTime;
145 InclinationAngle = source.InclinationAngle;
146 RateOfRightAscension = source.RateOfRightAscension;
147 RootOfSemiMajorAxis = source.RootOfSemiMajorAxis;
148 ArgumentOfPerigee = source.ArgumentOfPerigee;
149 LongitudeOfAscensionNode = source.LongitudeOfAscensionNode;
150 MeanAnomaly = source.MeanAnomaly;
151 F0ClockParameter = source.F0ClockParameter;
152 F1ClockParameter = source.F1ClockParameter;
153
154 return( *this );
155}
Note: See TracBrowser for help on using the repository browser.