source: pacpussensors/trunk/NMEA0183/src/GXA.cpp@ 67

Last change on this file since 67 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.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: gxa.cpp $
13** $Revision: 5 $
14** $Modtime: 10/10/98 2:44p $
15*/
16
17
18
19GXA::GXA()
20{
21 Mnemonic = "GXA";
22 Empty();
23}
24
25GXA::~GXA()
26{
27 //Mnemonic.Empty();
28 Empty();
29}
30
31void GXA::Empty( void )
32{
33 //UTCTime.Empty();
34 Position.Empty();
35 //WaypointID.Empty();
36 SatelliteNumber = 0;
37}
38
39BOOL GXA::Parse( const SENTENCE& sentence )
40{
41 /*
42 ** GXA - TRANSIT Position - Latitude/Longitude
43 ** Location and time of TRANSIT fix at waypoint
44 **
45 ** 1 2 3 4 5 6 7 8
46 ** | | | | | | | |
47 ** $--GXA,hhmmss.ss,llll.ll,a,yyyyy.yy,a,c--c,X*hh<CR><LF>
48 **
49 ** 1) UTC of position fix
50 ** 2) Latitude
51 ** 3) East or West
52 ** 4) Longitude
53 ** 5) North or South
54 ** 6) Waypoint ID
55 ** 7) Satelite number
56 ** 8) Checksum
57 */
58
59 /*
60 ** First we check the checksum...
61 */
62
63 if ( sentence.IsChecksumBad( 8 ) == True )
64 {
65 SetErrorMessage( "Invalid Checksum" );
66 return( FALSE );
67 }
68
69 UTCTime = sentence.Field( 1 );
70 Time = sentence.Time( 1 );
71 Position.Parse( 2, 3, 4, 5, sentence );
72 WaypointID = sentence.Field( 6 );
73 SatelliteNumber = (WORD) sentence.Integer( 7 );
74
75 return( TRUE );
76}
77
78BOOL GXA::Write( SENTENCE& sentence )
79{
80 /*
81 ** Let the parent do its thing
82 */
83
84 RESPONSE::Write( sentence );
85
86 sentence += UTCTime;
87 sentence += Position;
88 sentence += WaypointID;
89 sentence += Hex( SatelliteNumber ); // Thanks to Chuck Shannon, cshannon@imtn.tpd.dsccc.com
90
91 sentence.Finish();
92
93 return( TRUE );
94}
95
96const GXA& GXA::operator = ( const GXA& source )
97{
98 UTCTime = source.UTCTime;
99 Time = source.Time;
100 Position = source.Position;
101 WaypointID = source.WaypointID;
102 SatelliteNumber = source.SatelliteNumber;
103
104 return( *this );
105}
Note: See TracBrowser for help on using the repository browser.