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