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