source: pacpussensors/trunk/NMEA0183/src/VBW.cpp@ 91

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