source: pacpussensors/trunk/NMEA0183/src/WCV.cpp@ 107

Last change on this file since 107 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.5 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: wcv.cpp $
13** $Revision: 4 $
14** $Modtime: 10/10/98 2:39p $
15*/
16
17
18WCV::WCV()
19{
20 Mnemonic = "WCV";
21 Empty();
22}
23
24WCV::~WCV()
25{
26 //Mnemonic.Empty();
27 Empty();
28}
29
30void WCV::Empty( void )
31{
32 Velocity = 0.0;
33 //To.Empty();
34}
35
36BOOL WCV::Parse( const SENTENCE& sentence )
37{
38 /*
39 ** WCV - Waypoint Closure Velocity
40 **
41 ** 1 2 3 4
42 ** | | | |
43 ** $--WCV,x.x,N,c--c*hh<CR><LF>
44 **
45 ** Field Number:
46 ** 1) Velocity
47 ** 2) N = knots
48 ** 3) Waypoint ID
49 ** 4) Checksum
50 */
51
52 /*
53 ** First we check the checksum...
54 */
55
56 if ( sentence.IsChecksumBad( 4 ) == True )
57 {
58 SetErrorMessage( "Invalid Checksum" );
59 return( FALSE );
60 }
61
62 Velocity = sentence.Double( 1 );
63 To = sentence.Field( 3 );
64
65 return( TRUE );
66}
67
68BOOL WCV::Write( SENTENCE& sentence )
69{
70 /*
71 ** Let the parent do its thing
72 */
73
74 RESPONSE::Write( sentence );
75
76 sentence += Velocity;
77 sentence += "N";
78 sentence += To;
79
80 sentence.Finish();
81 return( TRUE );
82}
83
84const WCV& WCV::operator = ( const WCV& source )
85{
86 Velocity = source.Velocity;
87 To = source.To;
88
89 return( *this );
90}
Note: See TracBrowser for help on using the repository browser.