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