source: pacpussensors/trunk/NMEA0183/src/WDC.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.6 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: wdc.cpp $
13** $Revision: 4 $
14** $Modtime: 10/10/98 2:39p $
15*/
16
17/*
18** This Sentence Not Recommended For New Designs
19** BWC is recommended.
20*/
21
22
23
24WDC::WDC()
25{
26 Mnemonic = "WDC";
27 Empty();
28}
29
30WDC::~WDC()
31{
32 //Mnemonic.Empty();
33 Empty();
34}
35
36void WDC::Empty( void )
37{
38 NauticalMiles = 0;
39 //To.Empty();
40}
41
42BOOL WDC::Parse( const SENTENCE& sentence )
43{
44 /*
45 ** WDC - Distance to Waypoint
46 **
47 ** 1 2 3 4
48 ** | | | |
49 ** $--WDC,x.x,N,c--c*hh<CR><LF>
50 **
51 ** 1) Distance to waypoint
52 ** 2) N = Nautical Miles
53 ** 3) Waypoint ID (To)
54 ** 4) Checksum
55 */
56
57 /*
58 ** First we check the checksum...
59 */
60
61 if ( sentence.IsChecksumBad( 4 ) == True )
62 {
63 SetErrorMessage( "Invalid Checksum" );
64 return( FALSE );
65 }
66
67 NauticalMiles = sentence.Double( 1 );
68 To = sentence.Field( 3 );
69
70 return( TRUE );
71}
72
73BOOL WDC::Write( SENTENCE& sentence )
74{
75 /*
76 ** Let the parent do its thing
77 */
78
79 RESPONSE::Write( sentence );
80
81 sentence += NauticalMiles;
82 sentence += "N";
83 sentence += To;
84
85 sentence.Finish();
86
87 return( TRUE );
88}
89
90const WDC& WDC::operator = ( const WDC& source )
91{
92 NauticalMiles = source.NauticalMiles;
93 To = source.To;
94
95 return( *this );
96}
Note: See TracBrowser for help on using the repository browser.