source: pacpussensors/trunk/NMEA0183/src/VLW.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: 1.8 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: vlw.cpp $
13** $Revision: 4 $
14** $Modtime: 10/10/98 2:40p $
15*/
16
17
18
19VLW::VLW()
20{
21 Mnemonic = "VLW";
22 Empty();
23}
24
25VLW::~VLW()
26{
27 //Mnemonic.Empty();
28 Empty();
29}
30
31void VLW::Empty( void )
32{
33 TotalDistanceNauticalMiles = 0.0;
34 DistanceSinceResetNauticalMiles = 0.0;
35}
36
37BOOL VLW::Parse( const SENTENCE& sentence )
38{
39 /*
40 ** VLW - Distance Traveled through Water
41 **
42 ** 1 2 3 4 5
43 ** | | | | |
44 ** $--VLW,x.x,N,x.x,N*hh<CR><LF>
45 **
46 ** Field Number:
47 ** 1) Total cumulative distance
48 ** 2) N = Nautical Miles
49 ** 3) Distance since Reset
50 ** 4) N = Nautical Miles
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 TotalDistanceNauticalMiles = sentence.Double( 1 );
65 DistanceSinceResetNauticalMiles = sentence.Double( 3 );
66
67 return( TRUE );
68}
69
70BOOL VLW::Write( SENTENCE& sentence )
71{
72 /*
73 ** Let the parent do its thing
74 */
75
76 RESPONSE::Write( sentence );
77
78 sentence += TotalDistanceNauticalMiles;
79 sentence += "N";
80 sentence += DistanceSinceResetNauticalMiles;
81 sentence += "N";
82
83 sentence.Finish();
84
85 return( TRUE );
86}
87
88const VLW& VLW::operator = ( const VLW& source )
89{
90 TotalDistanceNauticalMiles = source.TotalDistanceNauticalMiles;
91 DistanceSinceResetNauticalMiles = source.DistanceSinceResetNauticalMiles;
92
93 return( *this );
94}
Note: See TracBrowser for help on using the repository browser.