[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: aam.cpp $
|
---|
| 13 | ** $Revision: 5 $
|
---|
| 14 | ** $Modtime: 10/10/98 2:40p $
|
---|
| 15 | */
|
---|
| 16 |
|
---|
| 17 |
|
---|
| 18 | AAM::AAM()
|
---|
| 19 | {
|
---|
| 20 | Mnemonic = "AAM";
|
---|
| 21 | Empty();
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | AAM::~AAM()
|
---|
| 25 | {
|
---|
| 26 | //Mnemonic.Empty();
|
---|
| 27 | Empty();
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | void AAM::Empty( void )
|
---|
| 31 | {
|
---|
| 32 | IsArrivalCircleEntered = NMEA_Unknown;
|
---|
| 33 | IsPerpendicular = NMEA_Unknown;
|
---|
| 34 | CircleRadius = 0.0;
|
---|
| 35 | //WaypointID.Empty();
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | BOOL AAM::Parse( const SENTENCE& sentence )
|
---|
| 39 | {
|
---|
| 40 | /*
|
---|
| 41 | ** AAM - Waypoint Arrival Alarm
|
---|
| 42 | **
|
---|
| 43 | ** 1 2 3 4 5 6
|
---|
| 44 | ** | | | | | |
|
---|
| 45 | ** $--AAM,A,A,x.x,N,c--c*hh<CR><LF>
|
---|
| 46 | **
|
---|
| 47 | ** 1) Status, A = Arrival circle entered
|
---|
| 48 | ** 2) Status, A = perpendicular passed at waypoint
|
---|
| 49 | ** 3) Arrival circle radius
|
---|
| 50 | ** 4) Units of radius, nautical miles
|
---|
| 51 | ** 5) Waypoint ID
|
---|
| 52 | ** 6) Checksum
|
---|
| 53 | */
|
---|
| 54 |
|
---|
| 55 | /*
|
---|
| 56 | ** First we check the checksum...
|
---|
| 57 | */
|
---|
| 58 |
|
---|
| 59 | if ( sentence.IsChecksumBad( 6 ) == True )
|
---|
| 60 | {
|
---|
| 61 | SetErrorMessage( "Invalid Checksum" );
|
---|
| 62 | return( FALSE );
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | /*
|
---|
| 66 | ** Line has already been checked for checksum validity
|
---|
| 67 | */
|
---|
| 68 |
|
---|
| 69 | IsArrivalCircleEntered = sentence.Boolean( 1 );
|
---|
| 70 | IsPerpendicular = sentence.Boolean( 2 );
|
---|
| 71 | CircleRadius = sentence.Double( 3 );
|
---|
| 72 | WaypointID = sentence.Field( 5 );
|
---|
| 73 |
|
---|
| 74 | return( TRUE );
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | BOOL AAM::Write( SENTENCE& sentence )
|
---|
| 78 | {
|
---|
| 79 | /*
|
---|
| 80 | ** Let the parent do its thing
|
---|
| 81 | */
|
---|
| 82 |
|
---|
| 83 | RESPONSE::Write( sentence );
|
---|
| 84 |
|
---|
| 85 | sentence += IsArrivalCircleEntered;
|
---|
| 86 | sentence += IsPerpendicular;
|
---|
| 87 | sentence += CircleRadius;
|
---|
| 88 | sentence += "N";
|
---|
| 89 | sentence += WaypointID;
|
---|
| 90 |
|
---|
| 91 | sentence.Finish();
|
---|
| 92 |
|
---|
| 93 | return( TRUE );
|
---|
| 94 | }
|
---|
| 95 |
|
---|
| 96 | const AAM& AAM::operator = ( const AAM& source )
|
---|
| 97 | {
|
---|
| 98 | IsArrivalCircleEntered = source.IsArrivalCircleEntered;
|
---|
| 99 | IsPerpendicular = source.IsPerpendicular;
|
---|
| 100 | CircleRadius = source.CircleRadius;
|
---|
| 101 | WaypointID = source.WaypointID;
|
---|
| 102 |
|
---|
| 103 | return( *this );
|
---|
| 104 | }
|
---|