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