[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: wpl.cpp $
|
---|
| 13 | ** $Revision: 4 $
|
---|
| 14 | ** $Modtime: 10/10/98 2:39p $
|
---|
| 15 | */
|
---|
| 16 |
|
---|
| 17 |
|
---|
| 18 |
|
---|
| 19 | WPL::WPL()
|
---|
| 20 | {
|
---|
| 21 | Mnemonic = "WPL";
|
---|
| 22 | Empty();
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | WPL::~WPL()
|
---|
| 26 | {
|
---|
| 27 | //Mnemonic.Empty();
|
---|
| 28 | Empty();
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | void WPL::Empty( void )
|
---|
| 32 | {
|
---|
| 33 | Position.Empty();
|
---|
| 34 | //To.Empty();
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | BOOL WPL::Parse( const SENTENCE& sentence )
|
---|
| 38 | {
|
---|
| 39 | /*
|
---|
| 40 | ** WPL - Waypoint Location
|
---|
| 41 | **
|
---|
| 42 | ** +-------------------------------- 1) Latitude
|
---|
| 43 | ** | +------------------------ 2) N or S (North or South)
|
---|
| 44 | ** | | +---------------------- 3) Longitude
|
---|
| 45 | ** | | | +------------- 4) E or W (East or West)
|
---|
| 46 | ** | | | | +----------- 5) Waypoint name
|
---|
| 47 | ** | | | | | +-------6) Checksum
|
---|
| 48 | ** | | | | | |
|
---|
| 49 | ** $--WPL,llll.ll,a,yyyyy.yy,a,c--c*hh<CR><LF>
|
---|
| 50 | */
|
---|
| 51 |
|
---|
| 52 | /*
|
---|
| 53 | ** First we check the checksum...
|
---|
| 54 | */
|
---|
| 55 |
|
---|
| 56 | if ( sentence.IsChecksumBad( 6 ) == True )
|
---|
| 57 | {
|
---|
| 58 | SetErrorMessage( "Invalid Checksum" );
|
---|
| 59 | return( FALSE );
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | Position.Parse( 1, 2, 3, 4, sentence );
|
---|
| 63 | To = sentence.Field( 5 );
|
---|
| 64 |
|
---|
| 65 | return( TRUE );
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | BOOL WPL::Write( SENTENCE& sentence )
|
---|
| 69 | {
|
---|
| 70 | /*
|
---|
| 71 | ** Let the parent do its thing
|
---|
| 72 | */
|
---|
| 73 |
|
---|
| 74 | RESPONSE::Write( sentence );
|
---|
| 75 |
|
---|
| 76 | sentence += Position;
|
---|
| 77 | sentence += To;
|
---|
| 78 |
|
---|
| 79 | sentence.Finish();
|
---|
| 80 |
|
---|
| 81 | return( TRUE );
|
---|
| 82 | }
|
---|
| 83 |
|
---|
| 84 | const WPL& WPL::operator = ( const WPL& source )
|
---|
| 85 | {
|
---|
| 86 | Position = source.Position;
|
---|
| 87 | To = source.To;
|
---|
| 88 |
|
---|
| 89 | return( *this );
|
---|
| 90 | }
|
---|