source: pacpussensors/trunk/NMEA0183/src/BWW.cpp@ 85

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