source: pacpussensors/trunk/NMEA0183/src/MWV.cpp

Last change on this file 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: 2.0 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: mwv.cpp $
13** $Revision: 4 $
14** $Modtime: 10/10/98 2:42p $
15*/
16
17
18
19MWV::MWV()
20{
21 Mnemonic = "MWV";
22 Empty();
23}
24
25MWV::~MWV()
26{
27 //Mnemonic.Empty();
28 Empty();
29}
30
31void MWV::Empty( void )
32{
33 WindAngle = 0.0;
34 //Reference.Empty();
35 WindSpeed = 0.0;
36 //WindSpeedUnits.Empty();
37 IsDataValid = NMEA_Unknown;
38}
39
40BOOL MWV::Parse( const SENTENCE& sentence )
41{
42 /*
43 ** MWV - Wind Speed and Angle
44 **
45 ** 1 2 3 4 5
46 ** | | | | |
47 ** $--MWV,x.x,a,x.x,a*hh<CR><LF>
48 **
49 ** Field Number:
50 ** 1) Wind Angle, 0 to 360 degrees
51 ** 2) Reference, R = Relative, T = True
52 ** 3) Wind Speed
53 ** 4) Wind Speed Units, K/M/N
54 ** 5) Status, A = Data Valid
55 ** 6) Checksum
56 */
57
58 /*
59 ** First we check the checksum...
60 */
61
62 if ( sentence.IsChecksumBad( 6 ) == True )
63 {
64 SetErrorMessage( "Invalid Checksum" );
65 return( FALSE );
66 }
67
68 WindAngle = sentence.Double( 1 );
69 Reference = sentence.Field( 2 );
70 WindSpeed = sentence.Double( 3 );
71 WindSpeedUnits = sentence.Field( 4 );
72 IsDataValid = sentence.Boolean( 5 );
73
74 return( TRUE );
75}
76
77BOOL MWV::Write( SENTENCE& sentence )
78{
79 /*
80 ** Let the parent do its thing
81 */
82
83 RESPONSE::Write( sentence );
84
85 sentence += WindAngle;
86 sentence += Reference;
87 sentence += WindSpeed;
88 sentence += WindSpeedUnits;
89 sentence += IsDataValid;
90
91 sentence.Finish();
92
93 return( TRUE );
94}
95
96const MWV& MWV::operator = ( const MWV& source )
97{
98 WindAngle = source.WindAngle;
99 Reference = source.Reference;
100 WindSpeed = source.WindSpeed;
101 WindSpeedUnits = source.WindSpeedUnits;
102 IsDataValid = source.IsDataValid;
103
104 return( *this );
105}
Note: See TracBrowser for help on using the repository browser.