source: pacpussensors/trunk/NMEA0183/src/MHU.cpp@ 70

Last change on this file since 70 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
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: mhu.cpp $
13** $Revision: 4 $
14** $Modtime: 10/10/98 2:42p $
15*/
16
17/*
18** This Sentence Not Recommended For New Designs
19** XDR is recommended.
20*/
21
22
23
24MHU::MHU()
25{
26 Mnemonic = "MHU";
27 Empty();
28}
29
30MHU::~MHU()
31{
32 //Mnemonic.Empty();
33 Empty();
34}
35
36void MHU::Empty( void )
37{
38 RelativeHumidityPercent = 0.0;
39 AbsoluteHumidityPercent = 0.0;
40 DewPointDegreesCelcius = 0.0;
41}
42
43BOOL MHU::Parse( const SENTENCE& sentence )
44{
45 /*
46 ** MHU - Humidity
47 **
48 ** 1 2 3 4 5
49 ** | | | | |
50 ** $--MHU,x.x,x.x,x.x,C*hh<CR><LF>
51 **
52 ** Field Number:
53 ** 1) Relative Humidity Percent
54 ** 2) Absolute humidity percent
55 ** 3) Dew Point
56 ** 4) C = Degrees Celsius
57 ** 5) Checksum
58 */
59
60 /*
61 ** First we check the checksum...
62 */
63
64 if ( sentence.IsChecksumBad( 5 ) == True )
65 {
66 SetErrorMessage( "Invalid Checksum" );
67 return( FALSE );
68 }
69
70 RelativeHumidityPercent = sentence.Double( 1 );
71 AbsoluteHumidityPercent = sentence.Double( 2 );
72 DewPointDegreesCelcius = sentence.Double( 3 );
73
74 return( TRUE );
75}
76
77BOOL MHU::Write( SENTENCE& sentence )
78{
79 /*
80 ** Let the parent do its thing
81 */
82
83 RESPONSE::Write( sentence );
84
85 sentence += RelativeHumidityPercent;
86 sentence += AbsoluteHumidityPercent;
87 sentence += DewPointDegreesCelcius;
88 sentence += "C";
89
90 sentence.Finish();
91
92 return( TRUE );
93}
94
95const MHU& MHU::operator = ( const MHU& source )
96{
97 RelativeHumidityPercent = source.RelativeHumidityPercent;
98 AbsoluteHumidityPercent = source.AbsoluteHumidityPercent;
99 DewPointDegreesCelcius = source.DewPointDegreesCelcius;
100
101 return( *this );
102}
Note: See TracBrowser for help on using the repository browser.