source: pacpussensors/trunk/NMEA0183/src/HDT.cpp@ 59

Last change on this file since 59 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: 1.6 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: hdt.cpp $
13** $Revision: 4 $
14** $Modtime: 10/10/98 3:01p $
15*/
16
17
18
19HDT::HDT()
20{
21 Mnemonic = "HDT";
22 Empty();
23}
24
25HDT::~HDT()
26{
27 //Mnemonic.Empty();
28 Empty();
29}
30
31void HDT::Empty( void )
32{
33 DegreesTrue = 0.0;
34}
35
36BOOL HDT::Parse( const SENTENCE& sentence )
37{
38 /*
39 ** HDT - Heading - True
40 **
41 ** 1 2 3
42 ** | | |
43 ** $--HDT,x.x,T*hh<CR><LF>
44 **
45 ** Field Number:
46 ** 1) Heading Degrees, TRUE
47 ** 2) T = True
48 ** 3) Checksum
49 */
50
51 /*
52 ** First we check the checksum...
53 */
54
55 if ( sentence.IsChecksumBad( 3 ) == True )
56 {
57 SetErrorMessage( "Invalid Checksum" );
58 return( FALSE );
59 }
60
61 DegreesTrue = sentence.Double( 1 );
62
63 return( TRUE );
64}
65
66QString HDT::PlainEnglish( void ) const
67{
68 QString return_string;
69
70 //return_string.Format( "Your true heading is %6.2lf degrees.", DegreesTrue );
71 return_string = "Your true heading is " + QString::number(DegreesTrue) + "degrees.";
72 return( return_string );
73}
74
75BOOL HDT::Write( SENTENCE& sentence )
76{
77 /*
78 ** Let the parent do its thing
79 */
80
81 RESPONSE::Write( sentence );
82
83 sentence += DegreesTrue;
84 sentence += "T";
85
86 sentence.Finish();
87
88 return( TRUE );
89}
90
91const HDT& HDT::operator = ( const HDT& source )
92{
93 DegreesTrue = source.DegreesTrue;
94
95 return( *this );
96}
Note: See TracBrowser for help on using the repository browser.