source: pacpussensors/trunk/NMEA0183/src/TRF.cpp@ 127

Last change on this file since 127 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: 3.3 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: trf.cpp $
13** $Revision: 4 $
14** $Modtime: 10/10/98 2:40p $
15*/
16
17
18
19TRF::TRF()
20{
21 Mnemonic = "TRF";
22 Empty();
23}
24
25TRF::~TRF()
26{
27 //Mnemonic.Empty();
28 Empty();
29}
30
31void TRF::Empty( void )
32{
33 //UTCTime.Empty();
34 //Date.Empty();
35 Position.Empty();
36 ElevationAngle = 0.0;
37 NumberOfIterations = 0.0;
38 NumberOfDopplerIntervals = 0.0;
39 UpdateDistanceNauticalMiles = 0.0;
40 SatelliteID = 0;
41 IsDataValid = NMEA_Unknown;
42}
43
44BOOL TRF::Parse( const SENTENCE& sentence )
45{
46 /*
47 ** TRF - TRANSIT Fix Data
48 ** 13
49 ** 1 2 3 4 5 6 7 8 9 10 11 12|
50 ** | | | | | | | | | | | | |
51 ** $--TRF,hhmmss.ss,xxxxxx,llll.ll,a,yyyyy.yy,a,x.x,x.x,x.x,x.x,xxx,A*hh<CR><LF>
52 **
53 ** Field Number:
54 ** 1) UTC Time
55 ** 2) Date, ddmmyy
56 ** 3) Latitude
57 ** 4) N or S
58 ** 5) Longitude
59 ** 6) E or W
60 ** 7) Elevation Angle
61 ** 8) Number of iterations
62 ** 9) Number of Doppler intervals
63 ** 10) Update distance, nautical miles
64 ** 11) Satellite ID
65 ** 12) Data Validity
66 ** 13) Checksum
67 */
68
69 /*
70 ** First we check the checksum...
71 */
72
73 if ( sentence.IsChecksumBad( 13 ) == True )
74 {
75 SetErrorMessage( "Invalid Checksum" );
76 return( FALSE );
77 }
78
79 UTCTime = sentence.Field( 1 );
80 Time = sentence.Time( 1 );
81 Date = sentence.Field( 2 );
82 Position.Parse( 3, 4, 5, 6, sentence );
83 ElevationAngle = sentence.Double( 7 );
84 NumberOfIterations = sentence.Double( 8 );
85 NumberOfDopplerIntervals = sentence.Double( 9 );
86 UpdateDistanceNauticalMiles = sentence.Double( 10 );
87 SatelliteID = sentence.Integer( 11 );
88 IsDataValid = sentence.Boolean( 12 );
89
90 return( TRUE );
91}
92
93BOOL TRF::Write( SENTENCE& sentence )
94{
95 /*
96 ** Let the parent do its thing
97 */
98
99 RESPONSE::Write( sentence );
100
101 sentence += UTCTime;
102 sentence += Date;
103 sentence += Position;
104 sentence += ElevationAngle;
105 sentence += NumberOfIterations;
106 sentence += NumberOfDopplerIntervals;
107 sentence += UpdateDistanceNauticalMiles;
108 sentence += SatelliteID;
109 sentence += IsDataValid;
110
111 sentence.Finish();
112
113 return( TRUE );
114}
115
116const TRF& TRF::operator = ( const TRF& source )
117{
118 UTCTime = source.UTCTime;
119 Time = source.Time;
120 Date = source.Date;
121 Position = source.Position;
122 ElevationAngle = source.ElevationAngle;
123 NumberOfIterations = source.NumberOfIterations;
124 NumberOfDopplerIntervals = source.NumberOfDopplerIntervals;
125 UpdateDistanceNauticalMiles = source.UpdateDistanceNauticalMiles;
126 SatelliteID = source.SatelliteID;
127 IsDataValid = source.IsDataValid;
128
129 return( *this );
130}
Note: See TracBrowser for help on using the repository browser.