source: pacpussensors/trunk/NMEA0183/src/HCC.cpp@ 80

Last change on this file since 80 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.9 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: hcc.cpp $
13** $Revision: 4 $
14** $Modtime: 10/10/98 2:55p $
15*/
16
17#ifdef _MSC_VER
18# pragma warning(disable:4996)
19#endif // _MSC_VER
20
21/*
22** This Sentence Not Recommended For New Designs
23** Use of HDG is recommended.
24*/
25
26HCC::HCC()
27{
28 Mnemonic = "HCC";
29 Empty();
30}
31
32HCC::~HCC()
33{
34 //Mnemonic.Empty();
35 Empty();
36}
37
38void HCC::Empty( void )
39{
40 HeadingDegrees = 0.0;
41}
42
43BOOL HCC::Parse( const SENTENCE& sentence )
44{
45 /*
46 ** HCC - Compass Heading
47 ** Vessel compass heading, which differs from magnetic heading by the amount of
48 ** uncorrected magnetic deviation.
49 **
50 ** 1 2
51 ** | |
52 ** $--HCC,x.x*hh<CR><LF>
53 **
54 ** Field Number:
55 ** 1) Commpass heading, degrees
56 ** 2) Checksum
57 */
58
59 /*
60 ** First we check the checksum...
61 */
62
63 if ( sentence.IsChecksumBad( 2 ) == True )
64 {
65 SetErrorMessage( "Invalid Checksum" );
66 return( FALSE );
67 }
68
69 HeadingDegrees = sentence.Double( 1 );
70
71 return( TRUE );
72}
73
74QString HCC::PlainEnglish( void ) const
75{
76 QString return_string;
77
78 return_string = "The compass heading is ";
79
80 char temp_string[ 80 ];
81
82 ::sprintf( temp_string, "%6.2lf degrees.", HeadingDegrees );
83
84 return_string += temp_string;
85
86 return( return_string );
87}
88
89BOOL HCC::Write( SENTENCE& sentence )
90{
91 /*
92 ** Let the parent do its thing
93 */
94
95 RESPONSE::Write( sentence );
96
97 sentence += HeadingDegrees;
98
99 sentence.Finish();
100
101 return( TRUE );
102}
103
104const HCC& HCC::operator = ( const HCC& source )
105{
106 HeadingDegrees = source.HeadingDegrees;
107
108 return( *this );
109}
Note: See TracBrowser for help on using the repository browser.