source: pacpussensors/trunk/NMEA0183/src/GLL.cpp@ 109

Last change on this file since 109 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.3 KB
RevLine 
[59]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: gll.cpp $
13** $Revision: 6 $
14** $Modtime: 10/12/98 6:39a $
15*/
16
17
18
19GLL::GLL()
20{
21 Mnemonic = "GLL";
22 Empty();
23}
24
25GLL::~GLL()
26{
27 //Mnemonic.Empty();
28 Empty();
29}
30
31void GLL::Empty( void )
32{
33 Position.Empty();
34 //UTCTime.Empty();
35 IsDataValid = NMEA_Unknown;
36}
37
38BOOL GLL::Parse( const SENTENCE& sentence )
39{
40 /*
41 ** GLL - Geographic Position - Latitude/Longitude
42 ** Latitude, N/S, Longitude, E/W, UTC, Status
43 **
44 ** 1 2 3 4 5 6 7
45 ** | | | | | | |
46 ** $--GLL,llll.ll,a,yyyyy.yy,a,hhmmss.ss,A*hh<CR><LF>
47 **
48 ** Field Number:
49 ** 1) Latitude
50 ** 2) N or S (North or South)
51 ** 3) Longitude
52 ** 4) E or W (East or West)
53 ** 5) Universal Time Coordinated (UTC)
54 ** 6) Status A - Data Valid, V - Data Invalid
55 ** 7) Checksum
56 */
57
58 /*
59 ** First we check the checksum...
60 */
61
62 if ( sentence.IsChecksumBad( 7 ) == True )
63 {
64 SetErrorMessage( "Invalid Checksum" );
65 return( FALSE );
66 }
67
68 Position.Parse( 1, 2, 3, 4, sentence );
69 UTCTime = sentence.Field( 5 );
70 Time = sentence.Time( 5 );
71 IsDataValid = sentence.Boolean( 6 );
72
73 return( TRUE );
74}
75
76QString GLL::PlainEnglish( void ) const
77{
78 QString return_string;
79
80 //return_string.Empty();
81
82 return_string = "At ";
83 return_string += Time.time().toString();
84 return_string += " UTC, you were at ";
85 return_string += Position.PlainEnglish();
86 return_string += ".";
87
88 return( return_string );
89}
90
91BOOL GLL::Write( SENTENCE& sentence )
92{
93 /*
94 ** Let the parent do its thing
95 */
96
97 RESPONSE::Write( sentence );
98
99 sentence += Position;
100 sentence += UTCTime;
101 sentence += IsDataValid;
102
103 sentence.Finish();
104
105 return( TRUE );
106}
107
108const GLL& GLL::operator = ( const GLL& source )
109{
110 Position = source.Position;
111 UTCTime = source.UTCTime;
112 Time = source.Time;
113 IsDataValid = source.IsDataValid;
114
115 return( *this );
116}
Note: See TracBrowser for help on using the repository browser.