Last change
on this file since 109 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
|
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: wdr.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 |
|
---|
24 | WDR::WDR()
|
---|
25 | {
|
---|
26 | Mnemonic = "WDR";
|
---|
27 | Empty();
|
---|
28 | }
|
---|
29 |
|
---|
30 | WDR::~WDR()
|
---|
31 | {
|
---|
32 | //Mnemonic.Empty();
|
---|
33 | Empty();
|
---|
34 | }
|
---|
35 |
|
---|
36 | void WDR::Empty( void )
|
---|
37 | {
|
---|
38 | NauticalMiles = 0;
|
---|
39 | //To.Empty();
|
---|
40 | }
|
---|
41 |
|
---|
42 | BOOL WDR::Parse( const SENTENCE& sentence )
|
---|
43 | {
|
---|
44 | /*
|
---|
45 | ** WDR - Distance to Waypoint, Rhumb Line
|
---|
46 | **
|
---|
47 | ** 1 2 3 4
|
---|
48 | ** | | | |
|
---|
49 | ** $--WDR,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 |
|
---|
73 | BOOL WDR::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 |
|
---|
90 | const WDR& WDR::operator = ( const WDR& 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.