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
|
Rev | Line | |
---|
[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: vpw.cpp $
|
---|
| 13 | ** $Revision: 4 $
|
---|
| 14 | ** $Modtime: 10/10/98 2:39p $
|
---|
| 15 | */
|
---|
| 16 |
|
---|
| 17 |
|
---|
| 18 |
|
---|
| 19 | VPW::VPW()
|
---|
| 20 | {
|
---|
| 21 | Mnemonic = "VPW";
|
---|
| 22 | Empty();
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | VPW::~VPW()
|
---|
| 26 | {
|
---|
| 27 | //Mnemonic.Empty();
|
---|
| 28 | Empty();
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | void VPW::Empty( void )
|
---|
| 32 | {
|
---|
| 33 | Knots = 0.0;
|
---|
| 34 | MetersPerSecond = 0.0;
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | BOOL VPW::Parse( const SENTENCE& sentence )
|
---|
| 38 | {
|
---|
| 39 | /*
|
---|
| 40 | ** VPW - Speed - Measured Parallel to Wind
|
---|
| 41 | **
|
---|
| 42 | ** 1 2 3 4 5
|
---|
| 43 | ** | | | | |
|
---|
| 44 | ** $--VPW,x.x,N,x.x,M*hh<CR><LF>
|
---|
| 45 | **
|
---|
| 46 | ** Field Number:
|
---|
| 47 | ** 1) Speed, "-" means downwind
|
---|
| 48 | ** 2) N = Knots
|
---|
| 49 | ** 3) Speed, "-" means downwind
|
---|
| 50 | ** 4) M = Meters per second
|
---|
| 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 | Knots = sentence.Double( 1 );
|
---|
| 65 | MetersPerSecond = sentence.Double( 3 );
|
---|
| 66 |
|
---|
| 67 | return( TRUE );
|
---|
| 68 | }
|
---|
| 69 |
|
---|
| 70 | BOOL VPW::Write( SENTENCE& sentence )
|
---|
| 71 | {
|
---|
| 72 | /*
|
---|
| 73 | ** Let the parent do its thing
|
---|
| 74 | */
|
---|
| 75 |
|
---|
| 76 | RESPONSE::Write( sentence );
|
---|
| 77 |
|
---|
| 78 | sentence += Knots;
|
---|
| 79 | sentence += "N";
|
---|
| 80 | sentence += MetersPerSecond;
|
---|
| 81 | sentence += "M";
|
---|
| 82 |
|
---|
| 83 | sentence.Finish();
|
---|
| 84 |
|
---|
| 85 | return( TRUE );
|
---|
| 86 | }
|
---|
| 87 |
|
---|
| 88 | const VPW& VPW::operator = ( const VPW& source )
|
---|
| 89 | {
|
---|
| 90 | Knots = source.Knots;
|
---|
| 91 | MetersPerSecond = source.MetersPerSecond;
|
---|
| 92 |
|
---|
| 93 | return( *this );
|
---|
| 94 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.