Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Rehosting onto Github.
  • Loading branch information
SammyB428 committed Nov 16, 2015
1 parent a56c8db commit 4c11adc
Show file tree
Hide file tree
Showing 215 changed files with 22,726 additions and 1 deletion.
126 changes: 126 additions & 0 deletions AAM.CPP
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/*
Author: Samuel R. Blackburn
Internet: [email protected]
"You can get credit for something or get it done, but not both."
Dr. Richard Garwin
The MIT License (MIT)
Copyright (c) 1996-2015 Sam Blackburn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

#include "nmea0183.h"
#pragma hdrstop

#if defined( _DEBUG ) && defined( _INC_CRTDBG )
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#define new DEBUG_NEW
#endif // _DEBUG

AAM::AAM()
{
Mnemonic = "AAM";
Empty();
}

AAM::~AAM()
{
Mnemonic.clear();
Empty();
}

void AAM::Empty( void )
{
IsArrivalCircleEntered = NMEA_Unknown;
IsPerpendicular = NMEA_Unknown;
CircleRadius = 0.0;
WaypointID.clear();
}

bool AAM::Parse( const SENTENCE& sentence )
{
/*
** AAM - Waypoint Arrival Alarm
**
** 1 2 3 4 5 6
** | | | | | |
** $--AAM,A,A,x.x,N,c--c*hh<CR><LF>
**
** 1) Status, A = Arrival circle entered
** 2) Status, A = perpendicular passed at waypoint
** 3) Arrival circle radius
** 4) Units of radius, nautical miles
** 5) Waypoint ID
** 6) Checksum
*/

/*
** First we check the checksum...
*/

if ( sentence.IsChecksumBad( 6 ) == True )
{
SetErrorMessage( "Invalid Checksum" );
return( false );
}

/*
** Line has already been checked for checksum validity
*/

IsArrivalCircleEntered = sentence.Boolean( 1 );
IsPerpendicular = sentence.Boolean( 2 );
CircleRadius = sentence.Double( 3 );
WaypointID = sentence.Field( 5 );

return( true );
}

bool AAM::Write( SENTENCE& sentence )
{
/*
** Let the parent do its thing
*/

RESPONSE::Write( sentence );

sentence += IsArrivalCircleEntered;
sentence += IsPerpendicular;
sentence += CircleRadius;
sentence += "N";
sentence += WaypointID;

sentence.Finish();

return( true );
}

const AAM& AAM::operator = ( const AAM& source )
{
IsArrivalCircleEntered = source.IsArrivalCircleEntered;
IsPerpendicular = source.IsPerpendicular;
CircleRadius = source.CircleRadius;
WaypointID = source.WaypointID;

return( *this );
}
66 changes: 66 additions & 0 deletions AAM.HPP
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
Author: Samuel R. Blackburn
Internet: [email protected]
"You can get credit for something or get it done, but not both."
Dr. Richard Garwin
The MIT License (MIT)
Copyright (c) 1996-2015 Sam Blackburn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

#if ! defined( AAM_CLASS_HEADER )

#define AAM_CLASS_HEADER

class AAM : public RESPONSE
{
public:

AAM();
virtual ~AAM();

/*
** Data
*/

NMEA0183_BOOLEAN IsArrivalCircleEntered;
NMEA0183_BOOLEAN IsPerpendicular;
double CircleRadius;
std::string WaypointID;

/*
** Methods
*/

virtual void Empty( void ) override;
virtual bool Parse( const SENTENCE& sentence ) override;
virtual bool Write( SENTENCE& sentence ) override;

/*
** Operators
*/

virtual const AAM& operator = ( const AAM& source );
};

#endif // AAM_CLASS_HEADER
175 changes: 175 additions & 0 deletions ALM.CPP
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
/*
Author: Samuel R. Blackburn
Internet: [email protected]
"You can get credit for something or get it done, but not both."
Dr. Richard Garwin
The MIT License (MIT)
Copyright (c) 1996-2015 Sam Blackburn
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

#include "nmea0183.h"
#pragma hdrstop

#if defined( _DEBUG ) && defined( _INC_CRTDBG )
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#define new DEBUG_NEW
#endif // _DEBUG

ALM::ALM()
{
Mnemonic = "ALM";
Empty();
}

ALM::~ALM()
{
Mnemonic.clear();
Empty();
}

void ALM::Empty( void )
{
NumberOfMessages = 0;
MessageNumber = 0;
PRNNumber = 0;
WeekNumber = 0;
SVHealth = 0;
Eccentricity = 0;
AlmanacReferenceTime = 0;
InclinationAngle = 0;
RateOfRightAscension = 0;
RootOfSemiMajorAxis = 0;
ArgumentOfPerigee = 0;
LongitudeOfAscensionNode = 0;
MeanAnomaly = 0;
F0ClockParameter = 0;
F1ClockParameter = 0;
}

bool ALM::Parse( const SENTENCE& sentence )
{
/*
** ALM - GPS Almanac Data
**
** 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
** | | | | | | | | | | | | | | | |
** $--ALM,x.x,x.x,xx,x.x,hh,hhhh,hh,hhhh,hhhh,hhhhhh,hhhhhh,hhhhhh,hhhhhh,hhh,hhh,*hh<CR><LF>
**
** 1) Total number of messages
** 2) Message Number
** 3) Satellite PRN number (01 to 32)
** 4) GPS Week Number
** 5) SV health, bits 17-24 of each almanac page
** 6) Eccentricity
** 7) Almanac Reference Time
** 8) Inclination Angle
** 9) Rate of Right Ascension
** 10) Root of semi-major axis
** 11) Argument of perigee
** 12) Longitude of ascension node
** 13) Mean anomaly
** 14) F0 Clock Parameter
** 15) F1 Clock Parameter
** 16) Checksum
*/

/*
** First we check the checksum...
*/

if ( sentence.IsChecksumBad( 16 ) == True )
{
SetErrorMessage( "Invalid Checksum" );
return( false );
}

NumberOfMessages = (uint16_t) sentence.Integer( 1 );
MessageNumber = (uint16_t) sentence.Integer( 2 );
PRNNumber = (uint16_t) sentence.Integer( 3 );
WeekNumber = (uint16_t) sentence.Integer( 4 );
SVHealth = (uint16_t) ::HexValue( sentence.Field( 5 ) );
Eccentricity = (uint16_t) ::HexValue( sentence.Field( 6 ) );
AlmanacReferenceTime = (uint16_t) ::HexValue( sentence.Field( 7 ) );
InclinationAngle = (uint16_t) ::HexValue( sentence.Field( 8 ) );
RateOfRightAscension = (uint16_t) ::HexValue( sentence.Field( 9 ) );
RootOfSemiMajorAxis = ::HexValue( sentence.Field( 10 ) );
ArgumentOfPerigee = ::HexValue( sentence.Field( 11 ) );
LongitudeOfAscensionNode = ::HexValue( sentence.Field( 12 ) );
MeanAnomaly = ::HexValue( sentence.Field( 13 ) );
F0ClockParameter = (uint16_t) ::HexValue( sentence.Field( 14 ) );
F1ClockParameter = (uint16_t) ::HexValue( sentence.Field( 15 ) );

return( true );
}

bool ALM::Write( SENTENCE& sentence )
{
/*
** Let the parent do its thing
*/

RESPONSE::Write( sentence );

sentence += Hex( NumberOfMessages ); // Thanks to Chuck Shannon, [email protected]
sentence += Hex( MessageNumber ); // Thanks to Chuck Shannon, [email protected]
sentence += Hex( PRNNumber ); // Thanks to Chuck Shannon, [email protected]
sentence += Hex( WeekNumber ); // Thanks to Chuck Shannon, [email protected]
sentence += Hex( SVHealth );
sentence += Hex( Eccentricity );
sentence += Hex( AlmanacReferenceTime );
sentence += Hex( InclinationAngle );
sentence += Hex( RateOfRightAscension );
sentence += Hex( RootOfSemiMajorAxis );
sentence += Hex( ArgumentOfPerigee );
sentence += Hex( LongitudeOfAscensionNode );
sentence += Hex( MeanAnomaly );
sentence += Hex( F0ClockParameter );
sentence += Hex( F1ClockParameter );

sentence.Finish();

return( true );
}

const ALM& ALM::operator = ( const ALM& source )
{
NumberOfMessages = source.NumberOfMessages;
MessageNumber = source.MessageNumber;
PRNNumber = source.PRNNumber;
WeekNumber = source.WeekNumber;
SVHealth = source.SVHealth;
Eccentricity = source.Eccentricity;
AlmanacReferenceTime = source.AlmanacReferenceTime;
InclinationAngle = source.InclinationAngle;
RateOfRightAscension = source.RateOfRightAscension;
RootOfSemiMajorAxis = source.RootOfSemiMajorAxis;
ArgumentOfPerigee = source.ArgumentOfPerigee;
LongitudeOfAscensionNode = source.LongitudeOfAscensionNode;
MeanAnomaly = source.MeanAnomaly;
F0ClockParameter = source.F0ClockParameter;
F1ClockParameter = source.F1ClockParameter;

return( *this );
}
Loading

0 comments on commit 4c11adc

Please sign in to comment.