source: pacpussensors/trunk/NMEA0183/src/WAYPTLOC.cpp@ 90

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