From 4c11adc85806ff9747de991a57d40a9c4d638abd Mon Sep 17 00:00:00 2001 From: Sam Blackburn Date: Mon, 16 Nov 2015 17:22:35 -0500 Subject: [PATCH] Initial commit Rehosting onto Github. --- AAM.CPP | 126 ++++++++ AAM.HPP | 66 ++++ ALM.CPP | 175 ++++++++++ ALM.HPP | 77 +++++ APB.CPP | 173 ++++++++++ APB.HPP | 76 +++++ ASD.CPP | 82 +++++ ASD.HPP | 47 +++ BEC.CPP | 126 ++++++++ BEC.HPP | 69 ++++ BOD.CPP | 144 +++++++++ BOD.HPP | 67 ++++ BWC.CPP | 141 ++++++++ BWC.HPP | 69 ++++ BWR.CPP | 141 ++++++++ BWR.HPP | 69 ++++ BWW.CPP | 125 ++++++++ BWW.HPP | 66 ++++ DBT.CPP | 122 +++++++ DBT.HPP | 65 ++++ DCN.CPP | 202 ++++++++++++ DCN.HPP | 80 +++++ DECCALOP.CPP | 78 +++++ DECCALOP.HPP | 65 ++++ DPT.CPP | 113 +++++++ DPT.HPP | 64 ++++ EXPID.CPP | 426 ++++++++++++++++++++++++ FREQMODE.CPP | 74 +++++ FREQMODE.HPP | 64 ++++ FSI.CPP | 121 +++++++ FSI.HPP | 66 ++++ GDA.CPP | 53 +++ GDA.HPP | 48 +++ GDF.CPP | 53 +++ GDF.HPP | 48 +++ GDP.CPP | 53 +++ GDP.HPP | 48 +++ GGA.CPP | 198 ++++++++++++ GGA.HPP | 73 +++++ GLA.CPP | 53 +++ GLA.HPP | 48 +++ GLC.CPP | 141 ++++++++ GLC.HPP | 69 ++++ GLF.CPP | 53 +++ GLF.HPP | 48 +++ GLL.CPP | 134 ++++++++ GLL.HPP | 67 ++++ GLP.CPP | 53 +++ GLP.HPP | 48 +++ GOA.CPP | 53 +++ GOA.HPP | 48 +++ GOF.CPP | 53 +++ GOF.HPP | 48 +++ GOP.CPP | 53 +++ GOP.HPP | 48 +++ GSA.CPP | 257 +++++++++++++++ GSA.HPP | 85 +++++ GSV.CPP | 153 +++++++++ GSV.HPP | 64 ++++ GTD.CPP | 125 ++++++++ GTD.HPP | 67 ++++ GXA.CPP | 126 ++++++++ GXA.HPP | 67 ++++ GXF.CPP | 53 +++ GXF.HPP | 48 +++ GXP.CPP | 53 +++ GXP.HPP | 48 +++ HCC.CPP | 126 ++++++++ HCC.hpp | 69 ++++ HDG.CPP | 126 ++++++++ HDG.HPP | 67 ++++ HDM.CPP | 126 ++++++++ HDM.hpp | 69 ++++ HDT.CPP | 121 +++++++ HDT.HPP | 64 ++++ HEX.CPP | 47 +++ HEXVALUE.CPP | 47 +++ HSC.CPP | 115 +++++++ HSC.HPP | 64 ++++ IMA.cpp | 143 +++++++++ IMA.hpp | 73 +++++ LAT.CPP | 207 ++++++++++++ LATLONG.CPP | 116 +++++++ LATLONG.HPP | 148 +++++++++ LCD.CPP | 141 ++++++++ LCD.HPP | 69 ++++ LICENSE | 2 +- LONG.CPP | 131 ++++++++ LORANTD.CPP | 122 +++++++ LORANTD.HPP | 74 +++++ MANUFACT.CPP | 56 ++++ MANUFACT.HPP | 47 +++ MHU.cpp | 123 +++++++ MHU.hpp | 70 ++++ MLIST.CPP | 430 +++++++++++++++++++++++++ MLIST.HPP | 63 ++++ MTA.CPP | 131 ++++++++ MTA.HPP | 70 ++++ MTW.CPP | 126 ++++++++ MTW.HPP | 65 ++++ MWV.CPP | 126 ++++++++ MWV.HPP | 67 ++++ NMEA0183.CPP | 303 +++++++++++++++++ NMEA0183.H | 145 +++++++++ NMEA0183.HPP | 267 +++++++++++++++ NMEA0183.sln | 20 ++ NMEA0183.vcxproj | 428 ++++++++++++++++++++++++ NMEA0183.vcxproj.filters | 630 ++++++++++++++++++++++++++++++++++++ NMEA0183.vcxproj.user | 4 + OLN.CPP | 115 +++++++ OLN.HPP | 65 ++++ OMEGAPAR.CPP | 78 +++++ OMEGAPAR.HPP | 65 ++++ OSD.CPP | 145 +++++++++ OSD.HPP | 71 ++++ P.CPP | 94 ++++++ P.HPP | 67 ++++ RADARDAT.CPP | 82 +++++ RADARDAT.HPP | 66 ++++ RATIOPLS.CPP | 74 +++++ RATIOPLS.HPP | 64 ++++ README.md | 2 + RESPONSE.CPP | 90 ++++++ RESPONSE.HPP | 69 ++++ RMA.CPP | 151 +++++++++ RMA.HPP | 70 ++++ RMB.CPP | 162 ++++++++++ RMB.HPP | 72 +++++ RMC.CPP | 177 ++++++++++ RMC.HPP | 72 +++++ ROT.CPP | 145 +++++++++ ROT.HPP | 65 ++++ RPM.CPP | 126 ++++++++ RPM.HPP | 67 ++++ RSA.CPP | 121 +++++++ RSA.HPP | 66 ++++ RSD.CPP | 174 ++++++++++ RSD.HPP | 78 +++++ RTE.CPP | 171 ++++++++++ RTE.HPP | 67 ++++ SATDAT.CPP | 101 ++++++ SATDAT.HPP | 66 ++++ SENTENCE.CPP | 660 ++++++++++++++++++++++++++++++++++++++ SENTENCE.HPP | 89 +++++ SFI.CPP | 168 ++++++++++ SFI.HPP | 65 ++++ STN.CPP | 106 ++++++ STN.HPP | 63 ++++ TALKERID.CPP | 53 +++ TEP.CPP | 126 ++++++++ TEP.HPP | 69 ++++ TEST/TEST.sln | 25 ++ TEST/TEST.vcproj | 174 ++++++++++ TEST/TEST.vcxproj | 259 +++++++++++++++ TEST/TEST.vcxproj.filters | 22 ++ TEST/TEST.vcxproj.user | 4 + TEST/test.cpp | 139 ++++++++ TRF.CPP | 151 +++++++++ TRF.HPP | 72 +++++ TTM.CPP | 206 ++++++++++++ TTM.HPP | 84 +++++ VBW.CPP | 131 ++++++++ VBW.HPP | 68 ++++ VDR.CPP | 122 +++++++ VDR.HPP | 65 ++++ VHW.CPP | 129 ++++++++ VHW.HPP | 66 ++++ VLW.CPP | 115 +++++++ VLW.HPP | 64 ++++ VPW.CPP | 115 +++++++ VPW.HPP | 64 ++++ VTG.CPP | 129 ++++++++ VTG.HPP | 66 ++++ VWE.CPP | 111 +++++++ VWE.HPP | 63 ++++ WAYPTLOC.CPP | 139 ++++++++ WAYPTLOC.HPP | 72 +++++ WCV.CPP | 112 +++++++ WCV.HPP | 64 ++++ WDC.CPP | 117 +++++++ WDC.HPP | 69 ++++ WDR.CPP | 117 +++++++ WDR.HPP | 70 ++++ WNC.CPP | 125 ++++++++ WNC.HPP | 66 ++++ WPL.CPP | 111 +++++++ WPL.HPP | 64 ++++ XDR.CPP | 158 +++++++++ XDR.HPP | 80 +++++ XTE.CPP | 132 ++++++++ XTE.HPP | 67 ++++ XTR.CPP | 113 +++++++ XTR.HPP | 64 ++++ ZDA.CPP | 151 +++++++++ ZDA.HPP | 69 ++++ ZFI.CPP | 170 ++++++++++ ZFI.HPP | 72 +++++ ZFO.CPP | 118 +++++++ ZFO.HPP | 66 ++++ ZLZ.CPP | 171 ++++++++++ ZLZ.HPP | 72 +++++ ZPI.CPP | 170 ++++++++++ ZPI.HPP | 72 +++++ ZTA.CPP | 170 ++++++++++ ZTA.HPP | 72 +++++ ZTE.CPP | 170 ++++++++++ ZTE.HPP | 72 +++++ ZTG.CPP | 118 +++++++ ZTG.HPP | 66 ++++ ZTI.CPP | 170 ++++++++++ ZTI.HPP | 72 +++++ ZWP.CPP | 170 ++++++++++ ZWP.HPP | 72 +++++ ZZU.CPP | 140 ++++++++ ZZU.HPP | 69 ++++ 215 files changed, 22726 insertions(+), 1 deletion(-) create mode 100644 AAM.CPP create mode 100644 AAM.HPP create mode 100644 ALM.CPP create mode 100644 ALM.HPP create mode 100644 APB.CPP create mode 100644 APB.HPP create mode 100644 ASD.CPP create mode 100644 ASD.HPP create mode 100644 BEC.CPP create mode 100644 BEC.HPP create mode 100644 BOD.CPP create mode 100644 BOD.HPP create mode 100644 BWC.CPP create mode 100644 BWC.HPP create mode 100644 BWR.CPP create mode 100644 BWR.HPP create mode 100644 BWW.CPP create mode 100644 BWW.HPP create mode 100644 DBT.CPP create mode 100644 DBT.HPP create mode 100644 DCN.CPP create mode 100644 DCN.HPP create mode 100644 DECCALOP.CPP create mode 100644 DECCALOP.HPP create mode 100644 DPT.CPP create mode 100644 DPT.HPP create mode 100644 EXPID.CPP create mode 100644 FREQMODE.CPP create mode 100644 FREQMODE.HPP create mode 100644 FSI.CPP create mode 100644 FSI.HPP create mode 100644 GDA.CPP create mode 100644 GDA.HPP create mode 100644 GDF.CPP create mode 100644 GDF.HPP create mode 100644 GDP.CPP create mode 100644 GDP.HPP create mode 100644 GGA.CPP create mode 100644 GGA.HPP create mode 100644 GLA.CPP create mode 100644 GLA.HPP create mode 100644 GLC.CPP create mode 100644 GLC.HPP create mode 100644 GLF.CPP create mode 100644 GLF.HPP create mode 100644 GLL.CPP create mode 100644 GLL.HPP create mode 100644 GLP.CPP create mode 100644 GLP.HPP create mode 100644 GOA.CPP create mode 100644 GOA.HPP create mode 100644 GOF.CPP create mode 100644 GOF.HPP create mode 100644 GOP.CPP create mode 100644 GOP.HPP create mode 100644 GSA.CPP create mode 100644 GSA.HPP create mode 100644 GSV.CPP create mode 100644 GSV.HPP create mode 100644 GTD.CPP create mode 100644 GTD.HPP create mode 100644 GXA.CPP create mode 100644 GXA.HPP create mode 100644 GXF.CPP create mode 100644 GXF.HPP create mode 100644 GXP.CPP create mode 100644 GXP.HPP create mode 100644 HCC.CPP create mode 100644 HCC.hpp create mode 100644 HDG.CPP create mode 100644 HDG.HPP create mode 100644 HDM.CPP create mode 100644 HDM.hpp create mode 100644 HDT.CPP create mode 100644 HDT.HPP create mode 100644 HEX.CPP create mode 100644 HEXVALUE.CPP create mode 100644 HSC.CPP create mode 100644 HSC.HPP create mode 100644 IMA.cpp create mode 100644 IMA.hpp create mode 100644 LAT.CPP create mode 100644 LATLONG.CPP create mode 100644 LATLONG.HPP create mode 100644 LCD.CPP create mode 100644 LCD.HPP create mode 100644 LONG.CPP create mode 100644 LORANTD.CPP create mode 100644 LORANTD.HPP create mode 100644 MANUFACT.CPP create mode 100644 MANUFACT.HPP create mode 100644 MHU.cpp create mode 100644 MHU.hpp create mode 100644 MLIST.CPP create mode 100644 MLIST.HPP create mode 100644 MTA.CPP create mode 100644 MTA.HPP create mode 100644 MTW.CPP create mode 100644 MTW.HPP create mode 100644 MWV.CPP create mode 100644 MWV.HPP create mode 100644 NMEA0183.CPP create mode 100644 NMEA0183.H create mode 100644 NMEA0183.HPP create mode 100644 NMEA0183.sln create mode 100644 NMEA0183.vcxproj create mode 100644 NMEA0183.vcxproj.filters create mode 100644 NMEA0183.vcxproj.user create mode 100644 OLN.CPP create mode 100644 OLN.HPP create mode 100644 OMEGAPAR.CPP create mode 100644 OMEGAPAR.HPP create mode 100644 OSD.CPP create mode 100644 OSD.HPP create mode 100644 P.CPP create mode 100644 P.HPP create mode 100644 RADARDAT.CPP create mode 100644 RADARDAT.HPP create mode 100644 RATIOPLS.CPP create mode 100644 RATIOPLS.HPP create mode 100644 RESPONSE.CPP create mode 100644 RESPONSE.HPP create mode 100644 RMA.CPP create mode 100644 RMA.HPP create mode 100644 RMB.CPP create mode 100644 RMB.HPP create mode 100644 RMC.CPP create mode 100644 RMC.HPP create mode 100644 ROT.CPP create mode 100644 ROT.HPP create mode 100644 RPM.CPP create mode 100644 RPM.HPP create mode 100644 RSA.CPP create mode 100644 RSA.HPP create mode 100644 RSD.CPP create mode 100644 RSD.HPP create mode 100644 RTE.CPP create mode 100644 RTE.HPP create mode 100644 SATDAT.CPP create mode 100644 SATDAT.HPP create mode 100644 SENTENCE.CPP create mode 100644 SENTENCE.HPP create mode 100644 SFI.CPP create mode 100644 SFI.HPP create mode 100644 STN.CPP create mode 100644 STN.HPP create mode 100644 TALKERID.CPP create mode 100644 TEP.CPP create mode 100644 TEP.HPP create mode 100644 TEST/TEST.sln create mode 100644 TEST/TEST.vcproj create mode 100644 TEST/TEST.vcxproj create mode 100644 TEST/TEST.vcxproj.filters create mode 100644 TEST/TEST.vcxproj.user create mode 100644 TEST/test.cpp create mode 100644 TRF.CPP create mode 100644 TRF.HPP create mode 100644 TTM.CPP create mode 100644 TTM.HPP create mode 100644 VBW.CPP create mode 100644 VBW.HPP create mode 100644 VDR.CPP create mode 100644 VDR.HPP create mode 100644 VHW.CPP create mode 100644 VHW.HPP create mode 100644 VLW.CPP create mode 100644 VLW.HPP create mode 100644 VPW.CPP create mode 100644 VPW.HPP create mode 100644 VTG.CPP create mode 100644 VTG.HPP create mode 100644 VWE.CPP create mode 100644 VWE.HPP create mode 100644 WAYPTLOC.CPP create mode 100644 WAYPTLOC.HPP create mode 100644 WCV.CPP create mode 100644 WCV.HPP create mode 100644 WDC.CPP create mode 100644 WDC.HPP create mode 100644 WDR.CPP create mode 100644 WDR.HPP create mode 100644 WNC.CPP create mode 100644 WNC.HPP create mode 100644 WPL.CPP create mode 100644 WPL.HPP create mode 100644 XDR.CPP create mode 100644 XDR.HPP create mode 100644 XTE.CPP create mode 100644 XTE.HPP create mode 100644 XTR.CPP create mode 100644 XTR.HPP create mode 100644 ZDA.CPP create mode 100644 ZDA.HPP create mode 100644 ZFI.CPP create mode 100644 ZFI.HPP create mode 100644 ZFO.CPP create mode 100644 ZFO.HPP create mode 100644 ZLZ.CPP create mode 100644 ZLZ.HPP create mode 100644 ZPI.CPP create mode 100644 ZPI.HPP create mode 100644 ZTA.CPP create mode 100644 ZTA.HPP create mode 100644 ZTE.CPP create mode 100644 ZTE.HPP create mode 100644 ZTG.CPP create mode 100644 ZTG.HPP create mode 100644 ZTI.CPP create mode 100644 ZTI.HPP create mode 100644 ZWP.CPP create mode 100644 ZWP.HPP create mode 100644 ZZU.CPP create mode 100644 ZZU.HPP diff --git a/AAM.CPP b/AAM.CPP new file mode 100644 index 0000000..cc787a5 --- /dev/null +++ b/AAM.CPP @@ -0,0 +1,126 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + ** + ** 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 ); +} diff --git a/AAM.HPP b/AAM.HPP new file mode 100644 index 0000000..80eafd0 --- /dev/null +++ b/AAM.HPP @@ -0,0 +1,66 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 diff --git a/ALM.CPP b/ALM.CPP new file mode 100644 index 0000000..a254ada --- /dev/null +++ b/ALM.CPP @@ -0,0 +1,175 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + ** + ** 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, cshannon@imtn.tpd.dsccc.com + sentence += Hex( MessageNumber ); // Thanks to Chuck Shannon, cshannon@imtn.tpd.dsccc.com + sentence += Hex( PRNNumber ); // Thanks to Chuck Shannon, cshannon@imtn.tpd.dsccc.com + sentence += Hex( WeekNumber ); // Thanks to Chuck Shannon, cshannon@imtn.tpd.dsccc.com + 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 ); +} diff --git a/ALM.HPP b/ALM.HPP new file mode 100644 index 0000000..2a00457 --- /dev/null +++ b/ALM.HPP @@ -0,0 +1,77 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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( ALM_CLASS_HEADER ) + +#define ALM_CLASS_HEADER + +class ALM : public RESPONSE +{ + public: + + ALM(); + virtual ~ALM(); + + /* + ** Data + */ + + uint16_t NumberOfMessages; + uint16_t MessageNumber; + uint16_t PRNNumber; + uint16_t WeekNumber; + uint16_t SVHealth; + uint16_t Eccentricity; + uint16_t AlmanacReferenceTime; + uint16_t InclinationAngle; + uint16_t RateOfRightAscension; + uint32_t RootOfSemiMajorAxis; + uint32_t ArgumentOfPerigee; + uint32_t LongitudeOfAscensionNode; + uint32_t MeanAnomaly; + uint16_t F0ClockParameter; + uint16_t F1ClockParameter; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + const ALM& operator = ( const ALM& source ); +}; + +#endif // ALM_CLASS_HEADER diff --git a/APB.CPP b/APB.CPP new file mode 100644 index 0000000..689bb24 --- /dev/null +++ b/APB.CPP @@ -0,0 +1,173 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +APB::APB() +{ + Mnemonic = "APB"; + Empty(); +} + +APB::~APB() +{ + Mnemonic.clear(); + Empty(); +} + +void APB::Empty( void ) +{ + CrossTrackErrorMagnitude = 0.0; + DirectionToSteer = LR_Unknown; + CrossTrackUnits.clear(); + To.clear(); + IsArrivalCircleEntered = NMEA_Unknown; + IsPerpendicular = NMEA_Unknown; +} + +bool APB::Parse( const SENTENCE& sentence ) +{ + /* + ** APB - Autopilot Sentence "B" + ** 13 15 + ** 1 2 3 4 5 6 7 8 9 10 11 12| 14| + ** | | | | | | | | | | | | | | | + ** $--APB,A,A,x.x,a,N,A,A,x.x,a,c--c,x.x,a,x.x,a*hh + ** + ** 1) Status + ** V = LORAN-C Blink or SNR warning + ** V = general warning flag or other navigation systems when a reliable + ** fix is not available + ** 2) Status + ** V = Loran-C Cycle Lock warning flag + ** A = OK or not used + ** 3) Cross Track Error Magnitude + ** 4) Direction to steer, L or R + ** 5) Cross Track Units, N = Nautical Miles + ** 6) Status + ** A = Arrival Circle Entered + ** 7) Status + ** A = Perpendicular passed at waypoint + ** 8) Bearing origin to destination + ** 9) M = Magnetic, T = True + ** 10) Destination Waypoint ID + ** 11) Bearing, present position to Destination + ** 12) M = Magnetic, T = True + ** 13) Heading to steer to destination waypoint + ** 14) M = Magnetic, T = True + ** 15) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 15 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + /* + ** Line has already been checked for checksum validity + */ + + IsLoranBlinkOK = sentence.Boolean( 1 ); + IsLoranCCycleLockOK = sentence.Boolean( 2 ); + CrossTrackErrorMagnitude = sentence.Double( 3 ); + DirectionToSteer = sentence.LeftOrRight( 4 ); + CrossTrackUnits = sentence.Field( 5 ); + IsArrivalCircleEntered = sentence.Boolean( 6 ); + IsPerpendicular = sentence.Boolean( 7 ); + BearingOriginToDestination = sentence.Double( 8 ); + BearingOriginToDestinationUnits = sentence.Field( 9 ); + To = sentence.Field( 10 ); + BearingPresentPositionToDestination = sentence.Double( 11 ); + BearingPresentPositionToDestinationUnits = sentence.Field( 12 ); + HeadingToSteer = sentence.Double( 13 ); + HeadingToSteerUnits = sentence.Field( 14 ); + + return( true ); +} + +bool APB::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += IsLoranBlinkOK; + sentence += IsLoranCCycleLockOK; + sentence += CrossTrackErrorMagnitude; + sentence += DirectionToSteer; + sentence += CrossTrackUnits; + sentence += IsArrivalCircleEntered; + sentence += IsPerpendicular; + sentence += BearingOriginToDestination; + sentence += BearingOriginToDestinationUnits; + sentence += To; + sentence += BearingPresentPositionToDestination; + sentence += BearingPresentPositionToDestinationUnits; + sentence += HeadingToSteer; + sentence += HeadingToSteerUnits; + + sentence.Finish(); + + return( true ); +} + +const APB& APB::operator = ( const APB& source ) +{ + IsLoranBlinkOK = source.IsLoranBlinkOK; + IsLoranCCycleLockOK = source.IsLoranCCycleLockOK; + CrossTrackErrorMagnitude = source.CrossTrackErrorMagnitude; + DirectionToSteer = source.DirectionToSteer; + CrossTrackUnits = source.CrossTrackUnits; + IsArrivalCircleEntered = source.IsArrivalCircleEntered; + IsPerpendicular = source.IsPerpendicular; + BearingOriginToDestination = source.BearingOriginToDestination; + BearingOriginToDestinationUnits = source.BearingOriginToDestinationUnits; + To = source.To; + BearingPresentPositionToDestination = source.BearingPresentPositionToDestination; + BearingPresentPositionToDestinationUnits = source.BearingPresentPositionToDestinationUnits; + HeadingToSteer = source.HeadingToSteer; + HeadingToSteerUnits = source.HeadingToSteerUnits; + + return( *this ); +} diff --git a/APB.HPP b/APB.HPP new file mode 100644 index 0000000..2cc1c16 --- /dev/null +++ b/APB.HPP @@ -0,0 +1,76 @@ +#if ! defined( APB_CLASS_HEADER ) + +#define APB_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class APB : public RESPONSE +{ + public: + + APB(); + virtual ~APB(); + + /* + ** Data + */ + + NMEA0183_BOOLEAN IsLoranBlinkOK; + NMEA0183_BOOLEAN IsLoranCCycleLockOK; + double CrossTrackErrorMagnitude; + LEFTRIGHT DirectionToSteer; + std::string CrossTrackUnits; + NMEA0183_BOOLEAN IsArrivalCircleEntered; + NMEA0183_BOOLEAN IsPerpendicular; + double BearingOriginToDestination; + std::string BearingOriginToDestinationUnits; + std::string To; + double BearingPresentPositionToDestination; + std::string BearingPresentPositionToDestinationUnits; + double HeadingToSteer; + std::string HeadingToSteerUnits; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const APB& operator = ( const APB& source ); +}; + +#endif // APB_CLASS_HEADER diff --git a/ASD.CPP b/ASD.CPP new file mode 100644 index 0000000..fd7ac40 --- /dev/null +++ b/ASD.CPP @@ -0,0 +1,82 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +ASD::ASD() +{ + Mnemonic = "ASD"; +} + +ASD::~ASD() +{ + Mnemonic.clear(); +} + +#pragma warning( disable : 4100 ) + +bool ASD::Parse( const SENTENCE& sentence ) +{ + /* + ** ASD - Autopilot System Data + ** + ** FORMAT TO BE DETERMINED + ** + ** As soon as NMEA makes up their mind and publishes this we can't do anything but return TRUE + */ + + return( true ); +} + +void ASD::Empty(void) +{ +} + +#pragma warning( default : 4100 ) + +bool ASD::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence.Finish(); + + return( true ); +} diff --git a/ASD.HPP b/ASD.HPP new file mode 100644 index 0000000..28f83a8 --- /dev/null +++ b/ASD.HPP @@ -0,0 +1,47 @@ +#if ! defined( ASD_CLASS_HEADER ) + +#define ASD_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class ASD : public RESPONSE +{ + public: + + ASD(); + virtual ~ASD(); + + virtual void Empty(void) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; +}; + +#endif // ASD_CLASS_HEADER diff --git a/BEC.CPP b/BEC.CPP new file mode 100644 index 0000000..c7992cf --- /dev/null +++ b/BEC.CPP @@ -0,0 +1,126 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +BEC::BEC() +{ + Mnemonic = "BEC"; + Empty(); +} + +BEC::~BEC() +{ + Mnemonic.clear(); + Empty(); +} + +void BEC::Empty( void ) +{ + UTCTime.clear(); + BearingTrue = 0.0; + BearingMagnetic = 0.0; + DistanceNauticalMiles = 0.0; + To.clear(); +} + +bool BEC::Parse( const SENTENCE& sentence ) +{ + /* + ** BEC - Bearing & Distance to Waypoint - Dead Reckoning + ** 12 + ** 1 2 3 4 5 6 7 8 9 10 11| 13 + ** | | | | | | | | | | | | | + ** $--BEC,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x.x,T,x.x,M,x.x,N,c--c*hh + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 13 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + UTCTime = sentence.Field( 1 ); + Time = sentence.Time( 1 ); + Position.Parse( 2, 3, 4, 5, sentence ); + BearingTrue = sentence.Double( 6 ); + BearingMagnetic = sentence.Double( 8 ); + DistanceNauticalMiles = sentence.Double( 10 ); + To = sentence.Field( 12 ); + + return( true ); +} + +bool BEC::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += UTCTime; + sentence += Position; + sentence += BearingTrue; + sentence += "T"; + sentence += BearingMagnetic; + sentence += "M"; + sentence += DistanceNauticalMiles; + sentence += "N"; + sentence += To; + + sentence.Finish(); + + return( true ); +} + +const BEC& BEC::operator = ( const BEC& source ) +{ + UTCTime = source.UTCTime; + Time = source.Time; + Position = source.Position; + BearingTrue = source.BearingTrue; + BearingMagnetic = source.BearingMagnetic; + DistanceNauticalMiles = source.DistanceNauticalMiles; + To = source.To; + + return( *this ); +} diff --git a/BEC.HPP b/BEC.HPP new file mode 100644 index 0000000..62bf0b2 --- /dev/null +++ b/BEC.HPP @@ -0,0 +1,69 @@ +#if ! defined( BEC_CLASS_HEADER ) + +#define BEC_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class BEC : public RESPONSE +{ + public: + + BEC(); + virtual ~BEC(); + + /* + ** Data + */ + + std::string UTCTime; + time_t Time; + LATLONG Position; + double BearingTrue; + double BearingMagnetic; + double DistanceNauticalMiles; + std::string To; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + const BEC& operator = ( const BEC& source ); +}; + +#endif // BEC_CLASS_HEADER diff --git a/BOD.CPP b/BOD.CPP new file mode 100644 index 0000000..f0660b3 --- /dev/null +++ b/BOD.CPP @@ -0,0 +1,144 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +BOD::BOD() +{ + Mnemonic = "BOD"; + Empty(); +} + +BOD::~BOD() +{ + Mnemonic.clear(); + Empty(); +} + +void BOD::Empty( void ) +{ + BearingTrue = 0.0; + BearingMagnetic = 0.0; + To.clear(); + From.clear(); +} + +bool BOD::Parse( const SENTENCE& sentence ) +{ + /* + ** BOD - Bearing - Origin Waypoint to Destination Waypoint + ** + ** 1 2 3 4 5 6 7 + ** | | | | | | | + ** $--BOD,x.x,T,x.x,M,c--c,c--c*hh + ** + ** Field Number: + ** 1) Bearing Degrees, TRUE + ** 2) T = True + ** 3) Bearing Degrees, Magnetic + ** 4) M = Magnetic + ** 5) TO Waypoint + ** 6) FROM Waypoint + ** 7) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 7 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + BearingTrue = sentence.Double( 1 ); + BearingMagnetic = sentence.Double( 3 ); + To = sentence.Field( 5 ); + From = sentence.Field( 6 ); + + return( true ); +} + +std::string BOD::PlainEnglish(void) const +{ + std::string return_string( "You are bearing " ); + + char temp_string [ 22 ]; + + ::sprintf( temp_string, "%5.2f", BearingTrue ); + + return_string += temp_string; + return_string += " degrees true ("; + + ::sprintf( temp_string, "%5.2f", BearingMagnetic ); + + return_string += temp_string; + return_string += " degrees magnetic)."; + + return( return_string ); +} + +bool BOD::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += BearingTrue; + sentence += "T"; + sentence += BearingMagnetic; + sentence += "M"; + sentence += To; + sentence += From; + + sentence.Finish(); + + return( true ); +} + +const BOD& BOD::operator = ( const BOD& source ) +{ + BearingTrue = source.BearingTrue; + BearingMagnetic = source.BearingMagnetic; + To = source.To; + From = source.From; + + return( *this ); +} diff --git a/BOD.HPP b/BOD.HPP new file mode 100644 index 0000000..c93e1b0 --- /dev/null +++ b/BOD.HPP @@ -0,0 +1,67 @@ +#if ! defined( BOD_CLASS_HEADER ) + +#define BOD_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class BOD : public RESPONSE +{ + public: + + BOD(); + virtual ~BOD(); + + /* + ** Data + */ + + double BearingTrue; + double BearingMagnetic; + std::string To; + std::string From; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual std::string PlainEnglish( void ) const override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const BOD& operator = ( const BOD& source ); +}; + +#endif // BOD_CLASS_HEADER diff --git a/BWC.CPP b/BWC.CPP new file mode 100644 index 0000000..8125abc --- /dev/null +++ b/BWC.CPP @@ -0,0 +1,141 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +BWC::BWC() +{ + Mnemonic = "BWC"; + Empty(); +} + +BWC::~BWC() +{ + Mnemonic.clear(); + Empty(); +} + +void BWC::Empty( void ) +{ + UTCTime.clear(); + BearingTrue = 0.0; + BearingMagnetic = 0.0; + NauticalMiles = 0.0; + To.clear(); +} + +bool BWC::Parse( const SENTENCE& sentence ) +{ + /* + ** BWC - Bearing and Distance to Waypoint + ** Latitude, N/S, Longitude, E/W, UTC, Status + ** 11 + ** 1 2 3 4 5 6 7 8 9 10 | 12 13 + ** | | | | | | | | | | | | | + ** $--BWC,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x.x,T,x.x,M,x.x,N,c--c*hh + ** + ** 1) UTCTime + ** 2) Waypoint Latitude + ** 3) N = North, S = South + ** 4) Waypoint Longitude + ** 5) E = East, W = West + ** 6) Bearing, True + ** 7) T = True + ** 8) Bearing, Magnetic + ** 9) M = Magnetic + ** 10) Nautical Miles + ** 11) N = Nautical Miles + ** 12) Waypoint ID + ** 13) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 13 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + UTCTime = sentence.Field( 1 ); + Time = sentence.Time( 1 ); + Position.Parse( 2, 3, 4, 5, sentence ); + BearingTrue = sentence.Double( 6 ); + BearingMagnetic = sentence.Double( 8 ); + NauticalMiles = sentence.Double( 10 ); + To = sentence.Field( 12 ); + + return( true ); +} + +bool BWC::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += UTCTime; + sentence += Position; + sentence += BearingTrue; + sentence += "T"; + sentence += BearingMagnetic; + sentence += "M"; + sentence += NauticalMiles; + sentence += "N"; + sentence += To; + + sentence.Finish(); + + return( true ); +} + +const BWC& BWC::operator = ( const BWC& source ) +{ + UTCTime = source.UTCTime; + Time = source.Time; + Position = source.Position; + BearingTrue = source.BearingTrue; + BearingMagnetic = source.BearingMagnetic; + NauticalMiles = source.NauticalMiles; + To = source.To; + + return( *this ); +} diff --git a/BWC.HPP b/BWC.HPP new file mode 100644 index 0000000..dab669e --- /dev/null +++ b/BWC.HPP @@ -0,0 +1,69 @@ +#if ! defined( BWC_CLASS_HEADER ) + +#define BWC_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class BWC : public RESPONSE +{ + public: + + BWC(); + virtual ~BWC(); + + /* + ** Data + */ + + std::string UTCTime; + time_t Time; + double BearingTrue; + double BearingMagnetic; + double NauticalMiles; + std::string To; + LATLONG Position; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + const BWC& operator = ( const BWC& source ); +}; + +#endif // BWC_CLASS_HEADER diff --git a/BWR.CPP b/BWR.CPP new file mode 100644 index 0000000..548b805 --- /dev/null +++ b/BWR.CPP @@ -0,0 +1,141 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +BWR::BWR() +{ + Mnemonic = "BWR"; + Empty(); +} + +BWR::~BWR() +{ + Mnemonic.clear(); + Empty(); +} + +void BWR::Empty( void ) +{ + UTCTime.clear(); + BearingTrue = 0.0; + BearingMagnetic = 0.0; + NauticalMiles = 0.0; + To.clear(); +} + +bool BWR::Parse( const SENTENCE& sentence ) +{ + /* + ** BWR - Bearing and Distance to Waypoint - Rhumb Line + ** Latitude, N/S, Longitude, E/W, UTC, Status + ** 11 + ** 1 2 3 4 5 6 7 8 9 10 | 12 13 + ** | | | | | | | | | | | | | + ** $--BWR,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x.x,T,x.x,M,x.x,N,c--c*hh + ** + ** 1) UTCTime + ** 2) Waypoint Latitude + ** 3) N = North, S = South + ** 4) Waypoint Longitude + ** 5) E = East, W = West + ** 6) Bearing, True + ** 7) T = True + ** 8) Bearing, Magnetic + ** 9) M = Magnetic + ** 10) Nautical Miles + ** 11) N = Nautical Miles + ** 12) Waypoint ID + ** 13) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 13 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + UTCTime = sentence.Field( 1 ); + Time = sentence.Time( 1 ); + Position.Parse( 2, 3, 4, 5, sentence ); + BearingTrue = sentence.Double( 6 ); + BearingMagnetic = sentence.Double( 8 ); + NauticalMiles = sentence.Double( 10 ); + To = sentence.Field( 12 ); + + return( true ); +} + +bool BWR::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += UTCTime; + sentence += Position; + sentence += BearingTrue; + sentence += "T"; + sentence += BearingMagnetic; + sentence += "M"; + sentence += NauticalMiles; + sentence += "N"; + sentence += To; + + sentence.Finish(); + + return( true ); +} + +const BWR& BWR::operator = ( const BWR& source ) +{ + UTCTime = source.UTCTime; + Time = source.Time; + Position = source.Position; + BearingTrue = source.BearingTrue; + BearingMagnetic = source.BearingMagnetic; + NauticalMiles = source.NauticalMiles; + To = source.To; + + return( *this ); +} diff --git a/BWR.HPP b/BWR.HPP new file mode 100644 index 0000000..288c1d1 --- /dev/null +++ b/BWR.HPP @@ -0,0 +1,69 @@ +#if ! defined( BWR_CLASS_HEADER ) + +#define BWR_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class BWR : public RESPONSE +{ + public: + + BWR(); + virtual ~BWR(); + + /* + ** Data + */ + + std::string UTCTime; + time_t Time; + double BearingTrue; + double BearingMagnetic; + double NauticalMiles; + std::string To; + LATLONG Position; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const BWR& operator = ( const BWR& source ); +}; + +#endif // BWR_CLASS_HEADER diff --git a/BWW.CPP b/BWW.CPP new file mode 100644 index 0000000..b68bf6a --- /dev/null +++ b/BWW.CPP @@ -0,0 +1,125 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +BWW::BWW() +{ + Mnemonic = "BWW"; + Empty(); +} + +BWW::~BWW() +{ + Mnemonic.clear(); + Empty(); +} + +void BWW::Empty( void ) +{ + BearingTrue = 0.0; + BearingMagnetic = 0.0; + To.clear(); + From.clear(); +} + +bool BWW::Parse( const SENTENCE& sentence ) +{ + /* + ** BWW - Bearing - Waypoint to Waypoint + ** + ** 1 2 3 4 5 6 7 + ** | | | | | | | + ** $--BWW,x.x,T,x.x,M,c--c,c--c*hh + ** + ** Field Number: + ** 1) Bearing Degrees, TRUE + ** 2) T = True + ** 3) Bearing Degrees, Magnetic + ** 4) M = Magnetic + ** 5) TO Waypoint + ** 6) FROM Waypoint + ** 7) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 7 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + BearingTrue = sentence.Double( 1 ); + BearingMagnetic = sentence.Double( 3 ); + To = sentence.Field( 5 ); + From = sentence.Field( 6 ); + + return( true ); +} + +bool BWW::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += BearingTrue; + sentence += "T"; + sentence += BearingMagnetic; + sentence += "M"; + sentence += To; + sentence += From; + + sentence.Finish(); + + return( true ); +} + +const BWW& BWW::operator = ( const BWW& source ) +{ + BearingTrue = source.BearingTrue; + BearingMagnetic = source.BearingMagnetic; + To = source.To; + From = source.From; + + return( *this ); +} diff --git a/BWW.HPP b/BWW.HPP new file mode 100644 index 0000000..ac3f36e --- /dev/null +++ b/BWW.HPP @@ -0,0 +1,66 @@ +#if ! defined( BWW_CLASS_HEADER ) + +#define BWW_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class BWW : public RESPONSE +{ + public: + + BWW(); + virtual ~BWW(); + + /* + ** Data + */ + + double BearingTrue; + double BearingMagnetic; + std::string To; + std::string From; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const BWW& operator = ( const BWW& source ); +}; + +#endif // BWW_CLASS_HEADER diff --git a/DBT.CPP b/DBT.CPP new file mode 100644 index 0000000..a49bd0d --- /dev/null +++ b/DBT.CPP @@ -0,0 +1,122 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +DBT::DBT() +{ + Mnemonic = "DBT"; + Empty(); +} + +DBT::~DBT() +{ + Mnemonic.clear(); + Empty(); +} + +void DBT::Empty( void ) +{ + DepthFeet = 0.0; + DepthMeters = 0.0; + DepthFathoms = 0.0; +} + +bool DBT::Parse( const SENTENCE& sentence ) +{ + /* + ** DBT - Depth below transducer + ** + ** 1 2 3 4 5 6 7 + ** | | | | | | | + ** $--DBT,x.x,f,x.x,M,x.x,F*hh + ** + ** Field Number: + ** 1) Depth, feet + ** 2) f = feet + ** 3) Depth, meters + ** 4) M = meters + ** 5) Depth, Fathoms + ** 6) F = Fathoms + ** 7) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 7 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + DepthFeet = sentence.Double( 1 ); + DepthMeters = sentence.Double( 3 ); + DepthFathoms = sentence.Double( 5 ); + + return( true ); +} + +bool DBT::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += DepthFeet; + sentence += "f"; + sentence += DepthMeters; + sentence += "M"; + sentence += DepthFathoms; + sentence += "F"; + + sentence.Finish(); + + return( true ); +} + +const DBT& DBT::operator = ( const DBT& source ) +{ + DepthFeet = source.DepthFeet; + DepthMeters = source.DepthMeters; + DepthFathoms = source.DepthFathoms; + + return( *this ); +} diff --git a/DBT.HPP b/DBT.HPP new file mode 100644 index 0000000..41ab5bc --- /dev/null +++ b/DBT.HPP @@ -0,0 +1,65 @@ +#if ! defined( DBT_CLASS_HEADER ) + +#define DBT_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class DBT : public RESPONSE +{ + public: + + DBT(); + virtual ~DBT(); + + /* + ** Data + */ + + double DepthFeet; + double DepthMeters; + double DepthFathoms; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + const DBT& operator = ( const DBT& source ); +}; + +#endif // DBT_CLASS_HEADER diff --git a/DCN.CPP b/DCN.CPP new file mode 100644 index 0000000..ebf0763 --- /dev/null +++ b/DCN.CPP @@ -0,0 +1,202 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +DCN::DCN() +{ + Mnemonic = "DCN"; + Empty(); +} + +DCN::~DCN() +{ + Mnemonic.clear(); + Empty(); +} + +void DCN::Empty( void ) +{ + DeccaChainID = 0; + Red.Empty(); + Green.Empty(); + Purple.Empty(); + RedLineNavigationUse = NMEA_Unknown; + GreenLineNavigationUse = NMEA_Unknown; + PurpleLineNavigationUse = NMEA_Unknown; + PositionUncertaintyNauticalMiles = 0.0; + Basis = BasisUnknown; +} + +bool DCN::Parse( const SENTENCE& sentence ) +{ + /* + ** DCN - Decca Position + ** 11 13 16 + ** 1 2 3 4 5 6 7 8 9 10| 12| 14 15| 17 + ** | | | | | | | | | | | | | | | | | + ** $--DCN,xx,cc,x.x,A,cc,x.x,A,cc,x.x,A,A,A,A,x.x,N,x*hh + ** + ** 1) Decca chain identifier + ** 2) Red Zone Identifier + ** 3) Red Line Of Position + ** 4) Red Master Line Status + ** 5) Green Zone Identifier + ** 6) Green Line Of Position + ** 7) Green Master Line Status + ** 8) Purple Zone Identifier + ** 9) Purple Line Of Position + ** 10) Purple Master Line Status + ** 11) Red Line Navigation Use + ** 12) Green Line Navigation Use + ** 13) Purple Line Navigation Use + ** 14) Position Uncertainity + ** 15) N = Nautical Miles + ** 16) Fix Data Basis + ** 1 = Normal Pattern + ** 2 = Lane Identification Pattern + ** 3 = Lane Identification Transmissions + ** 17) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 17 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + DeccaChainID = sentence.Integer( 1 ); + Red.Parse( 2, sentence ); + Green.Parse( 5, sentence ); + Purple.Parse( 8, sentence ); + RedLineNavigationUse = sentence.Boolean( 11 ); + GreenLineNavigationUse = sentence.Boolean( 12 ); + PurpleLineNavigationUse = sentence.Boolean( 13 ); + PositionUncertaintyNauticalMiles = sentence.Double( 14 ); + + int temp_integer = sentence.Integer( 16 ); + + switch( temp_integer ) + { + case 1: + + Basis = NormalPatternBasis; + break; + + case 2: + + Basis = LaneIdentificationPatternBasis; + break; + + case 3: + + Basis = LaneIdentificationTransmissionsBasis; + break; + + default: + + Basis = BasisUnknown; + break; + } + + return( true ); +} + +bool DCN::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += DeccaChainID; + Red.Write( sentence ); + Green.Write( sentence ); + Purple.Write( sentence ); + sentence += RedLineNavigationUse; + sentence += GreenLineNavigationUse; + sentence += PurpleLineNavigationUse; + sentence += PositionUncertaintyNauticalMiles; + sentence += "N"; + + switch( Basis ) + { + case NormalPatternBasis: + + sentence += 1; + break; + + case LaneIdentificationPatternBasis: + + sentence += 2; + break; + + case LaneIdentificationTransmissionsBasis: + + sentence += 3; + break; + + default: + + sentence += ""; + break; + } + + sentence.Finish(); + + return( true ); +} + +const DCN& DCN::operator = ( const DCN& source ) +{ + DeccaChainID = source.DeccaChainID; + Red = source.Red; + Green = source.Green; + Purple = source.Purple; + RedLineNavigationUse = source.RedLineNavigationUse; + GreenLineNavigationUse = source.GreenLineNavigationUse; + PurpleLineNavigationUse = source.PurpleLineNavigationUse; + PositionUncertaintyNauticalMiles = source.PositionUncertaintyNauticalMiles; + Basis = source.Basis; + + return( *this ); +} diff --git a/DCN.HPP b/DCN.HPP new file mode 100644 index 0000000..72b1c43 --- /dev/null +++ b/DCN.HPP @@ -0,0 +1,80 @@ +#if ! defined( DCN_CLASS_HEADER ) + +#define DCN_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +typedef enum +{ + BasisUnknown = 0, + NormalPatternBasis, + LaneIdentificationPatternBasis, + LaneIdentificationTransmissionsBasis +} +FIX_DATA_BASIS; + +class DCN : public RESPONSE +{ + public: + + DCN(); + virtual ~DCN(); + + /* + ** Data + */ + + int DeccaChainID; + LINE_OF_POSITION Red; + LINE_OF_POSITION Green; + LINE_OF_POSITION Purple; + NMEA0183_BOOLEAN RedLineNavigationUse; + NMEA0183_BOOLEAN GreenLineNavigationUse; + NMEA0183_BOOLEAN PurpleLineNavigationUse; + double PositionUncertaintyNauticalMiles; + FIX_DATA_BASIS Basis; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const DCN& operator = ( const DCN& source ); +}; + +#endif // DCN_CLASS_HEADER diff --git a/DECCALOP.CPP b/DECCALOP.CPP new file mode 100644 index 0000000..de7490e --- /dev/null +++ b/DECCALOP.CPP @@ -0,0 +1,78 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +LINE_OF_POSITION::LINE_OF_POSITION() +{ + Empty(); +} + +LINE_OF_POSITION::~LINE_OF_POSITION() +{ + Empty(); +} + +void LINE_OF_POSITION::Empty( void ) +{ + ZoneID.clear(); + LineOfPosition = 0.0; + MasterLine = NMEA_Unknown; +} + +void LINE_OF_POSITION::Parse( int first_field_number, const SENTENCE& sentence ) +{ + ZoneID = sentence.Field( first_field_number ); + LineOfPosition = sentence.Double( first_field_number + 1 ); + MasterLine = sentence.Boolean( first_field_number + 2 ); +} + +void LINE_OF_POSITION::Write( SENTENCE& sentence ) +{ + sentence += ZoneID; + sentence += LineOfPosition; + sentence += MasterLine; +} + +const LINE_OF_POSITION& LINE_OF_POSITION::operator = ( const LINE_OF_POSITION& source ) +{ + ZoneID = source.ZoneID; + LineOfPosition = source.LineOfPosition; + MasterLine = source.MasterLine; + + return( *this ); +} diff --git a/DECCALOP.HPP b/DECCALOP.HPP new file mode 100644 index 0000000..1d23fb4 --- /dev/null +++ b/DECCALOP.HPP @@ -0,0 +1,65 @@ +#if ! defined( LINE_OF_POSITION_CLASS_HEADER ) + +#define LINE_OF_POSITION_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class LINE_OF_POSITION +{ + public: + + LINE_OF_POSITION(); + virtual ~LINE_OF_POSITION(); + + /* + ** Data + */ + + std::string ZoneID; + double LineOfPosition; + NMEA0183_BOOLEAN MasterLine; + + /* + ** Methods + */ + + virtual void Empty( void ); + virtual void Parse( int field_number, const SENTENCE& sentence ); + virtual void Write( SENTENCE& sentence ); + + /* + ** Operators + */ + + virtual const LINE_OF_POSITION& operator = ( const LINE_OF_POSITION& source ); +}; + +#endif // LINE_OF_POSITION_CLASS_HEADER diff --git a/DPT.CPP b/DPT.CPP new file mode 100644 index 0000000..9b45e1d --- /dev/null +++ b/DPT.CPP @@ -0,0 +1,113 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +DPT::DPT() +{ + Mnemonic = "DPT"; + Empty(); +} + +DPT::~DPT() +{ + Mnemonic.clear(); + Empty(); +} + +void DPT::Empty( void ) +{ + DepthMeters = 0.0; + OffsetFromTransducerMeters = 0.0; +} + +bool DPT::Parse( const SENTENCE& sentence ) +{ + /* + ** DPT - Heading - Deviation & Variation + ** + ** 1 2 3 + ** | | | + ** $--DPT,x.x,x.x*hh + ** + ** Field Number: + ** 1) Depth, meters + ** 2) Offset from transducer, + ** positive means distance from tansducer to water line + ** negative means distance from transducer to keel + ** 3) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 3 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + DepthMeters = sentence.Double( 1 ); + OffsetFromTransducerMeters = sentence.Double( 2 ); + + return( true ); +} + +bool DPT::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += DepthMeters; + sentence += OffsetFromTransducerMeters; + + sentence.Finish(); + + return( true ); +} + +const DPT& DPT::operator = ( const DPT& source ) +{ + DepthMeters = source.DepthMeters; + OffsetFromTransducerMeters = source.OffsetFromTransducerMeters; + + return( *this ); +} diff --git a/DPT.HPP b/DPT.HPP new file mode 100644 index 0000000..aa5e7a1 --- /dev/null +++ b/DPT.HPP @@ -0,0 +1,64 @@ +#if ! defined( DPT_CLASS_HEADER ) + +#define DPT_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class DPT : public RESPONSE +{ + public: + + DPT(); + virtual ~DPT(); + + /* + ** Data + */ + + double DepthMeters; + double OffsetFromTransducerMeters; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const DPT& operator = ( const DPT& source ); +}; + +#endif // DPT_CLASS_HEADER diff --git a/EXPID.CPP b/EXPID.CPP new file mode 100644 index 0000000..87055f8 --- /dev/null +++ b/EXPID.CPP @@ -0,0 +1,426 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +std::string expand_talker_id( const std::string &identifier ) +{ + std::string expanded_identifier; + + char first_character = 0x00; + char second_character = 0x00; + + first_character = identifier[ 0 ]; + second_character = identifier[ 1 ]; + + /* + ** Set up our default return value + */ + + expanded_identifier = "Unknown - "; + expanded_identifier += identifier; + + switch( first_character ) + { + case 'A': // AG, AP + + switch( second_character ) + { + case 'G': // AG + + expanded_identifier = "Autopilot - General"; + break; + + case 'P': // AP + + expanded_identifier = "Autopilot - Magnetic"; + break; + } + + break; + + case 'C': // CD, CS, CT, CV, CX and CC,CM + + switch( second_character ) + { + case 'C': // CC + + expanded_identifier = "Commputer - Programmed Calculator (outdated)"; + break; + + case 'D': // CD + + expanded_identifier = "Communications - Digital Selective Calling (DSC)"; + break; + + case 'M': // CM + + expanded_identifier = "Computer - Memory Data (outdated)"; + break; + + case 'S': // CS + + expanded_identifier = "Communications - Satellite"; + break; + + case 'T': // CT + + expanded_identifier = "Communications - Radio-Telephone (MF/HF)"; + break; + + case 'V': // CV + + expanded_identifier = "Communications - Radio-Telephone (VHF)"; + break; + + case 'X': // CX + + expanded_identifier = "Communications - Scanning Receiver"; + break; + } + + break; + + case 'D': // DE, DF + + switch( second_character ) + { + case 'E': // DE + + expanded_identifier = "DECCA Navigation"; + break; + + case 'F': // DF + + expanded_identifier = "Direction Finder"; + break; + } + + break; + + case 'E': // EC, EP, ER + + switch( second_character ) + { + case 'C': // EC + + expanded_identifier = "Electronic Chart Display & Information System (ECDIS)"; + break; + + case 'P': // EP + + expanded_identifier = "Emergency Position Indicating Beacon (EPIRB)"; + break; + + case 'R': // ER + + expanded_identifier = "Engine Room Monitoring Systems"; + break; + } + + break; + + case 'G': // GP + + switch( second_character ) + { + case 'P': // GP + + expanded_identifier = "Global Positioning System (GPS)"; + break; + } + + break; + + case 'H': // HC, HE, HN + + switch( second_character ) + { + case 'C': // HC + + expanded_identifier = "Heading - Magnetic Compass"; + break; + + case 'E': // HE + + expanded_identifier = "Heading - North Seeking Gyro"; + break; + + case 'N': // HN + + expanded_identifier = "Heading - Non North Seeking Gyro"; + break; + } + + break; + + case 'I': // II, IN + + switch( second_character ) + { + case 'I': // II + + expanded_identifier = "Integrated Instrumentation"; + break; + + case 'N': // IN + + expanded_identifier = "Integrated Navigation"; + break; + } + + break; + + case 'L': // LA, LC + + switch( second_character ) + { + case 'A': // LA + + expanded_identifier = "Loran A"; + break; + + case 'C': // LC + + expanded_identifier = "Loran C"; + break; + } + + break; + + case 'M': // MP + + switch( second_character ) + { + case 'P': // MP + + expanded_identifier = "Microwave Positioning System (outdated)"; + break; + } + + break; + + case 'O': // OM, OS + + switch( second_character ) + { + case 'M': // OM + + expanded_identifier = "OMEGA Navigation System"; + break; + + case 'S': // OS + + expanded_identifier = "Distress Alarm System (outdated)"; + break; + } + + break; + + case 'P': // P + + break; + + case 'R': // RA + + switch( second_character ) + { + case 'A': // RA + + expanded_identifier = "RADAR and/or ARPA"; + break; + } + + break; + + case 'S': // SD, SN, SS + + switch( second_character ) + { + case 'D': // SD + + expanded_identifier = "Sounder, Depth"; + break; + + case 'N': // SN + + expanded_identifier = "Electronic Positioning System, other/general"; + break; + + case 'S': // SS + + expanded_identifier = "Sounder, Scanning"; + break; + } + + break; + + case 'T': // TI, TR + + switch( second_character ) + { + case 'I': // TI + + expanded_identifier = "Turn Rate Indicator"; + break; + + case 'R': // TR + + expanded_identifier = "TRANSIT Navigation System"; + break; + } + + break; + + case 'V': // VD, VM, VW + + switch( second_character ) + { + case 'D': // VD + + expanded_identifier = "Velocity Sensor, Doppler, other/general"; + break; + + case 'M': // VM + + expanded_identifier = "Velocity Sensor, Speed Log, Water, Magnetic"; + break; + + case 'W': // VW + + expanded_identifier = "Velocity Sensor, Speed Log, Water, Mechanical"; + break; + } + + break; + + + case 'W': // WI + + switch( second_character ) + { + case 'I': // WI + + expanded_identifier = "Weather Instruments"; + break; + } + + break; + + case 'Y': // YC, YD, YF, YL, YP, YR, YT, YV, YX + + switch( second_character ) + { + case 'C': // YC + + expanded_identifier = "Transducer - Temperature (outdated)"; + break; + + case 'D': // YD + + expanded_identifier = "Transducer - Displacement, Angular or Linear (outdated)"; + break; + + case 'F': // YF + + expanded_identifier = "Transducer - Frequency (outdated)"; + break; + + case 'L': // YL + + expanded_identifier = "Transducer - Level (outdated)"; + break; + + case 'P': // YP + + expanded_identifier = "Transducer - Pressure (outdated)"; + break; + + case 'R': // YR + + expanded_identifier = "Transducer - Flow Rate (outdated)"; + break; + + case 'T': // YT + + expanded_identifier = "Transducer - Tachometer (outdated)"; + break; + + case 'V': // YV + + expanded_identifier = "Transducer - Volume (outdated)"; + break; + + case 'X': // YX + + expanded_identifier = "Transducer"; + break; + + } + + break; + + case 'Z': // ZA, ZC, ZQ, ZV + + switch( second_character ) + { + case 'A': // ZA + + expanded_identifier = "Timekeeper - Atomic Clock"; + break; + + case 'C': // ZC + + expanded_identifier = "Timekeeper - Chronometer"; + break; + + case 'Q': // ZQ + + expanded_identifier = "Timekeeper - Quartz"; + break; + + case 'V': // ZV + + expanded_identifier = "Timekeeper - Radio Update, WWV or WWVH"; + break; + } + + break; + } + + return( expanded_identifier ); +} diff --git a/FREQMODE.CPP b/FREQMODE.CPP new file mode 100644 index 0000000..bf8cf4a --- /dev/null +++ b/FREQMODE.CPP @@ -0,0 +1,74 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +FREQUENCY_AND_MODE::FREQUENCY_AND_MODE() +{ + Empty(); +} + +FREQUENCY_AND_MODE::~FREQUENCY_AND_MODE() +{ + Empty(); +} + +void FREQUENCY_AND_MODE::Empty( void ) +{ + Frequency = 0.0; + Mode = CommunicationsModeUnknown; +} + +void FREQUENCY_AND_MODE::Parse( int first_field_number, const SENTENCE& sentence ) +{ + Frequency = sentence.Double( first_field_number ); + Mode = sentence.CommunicationsMode( first_field_number + 1 ); +} + +void FREQUENCY_AND_MODE::Write( SENTENCE& sentence ) +{ + sentence += Frequency; + sentence += Mode; +} + +const FREQUENCY_AND_MODE& FREQUENCY_AND_MODE::operator = ( const FREQUENCY_AND_MODE& source ) +{ + Frequency = source.Frequency; + Mode = source.Mode; + + return( *this ); +} diff --git a/FREQMODE.HPP b/FREQMODE.HPP new file mode 100644 index 0000000..d8aded8 --- /dev/null +++ b/FREQMODE.HPP @@ -0,0 +1,64 @@ +#if ! defined( FREQUENCY_AND_MODE_CLASS_HEADER ) + +#define FREQUENCY_AND_MODE_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class FREQUENCY_AND_MODE +{ + public: + + FREQUENCY_AND_MODE(); + virtual ~FREQUENCY_AND_MODE(); + + /* + ** Data + */ + + double Frequency; + COMMUNICATIONS_MODE Mode; + + /* + ** Methods + */ + + virtual void Empty( void ); + virtual void Parse( int field_number, const SENTENCE& sentence ); + virtual void Write( SENTENCE& sentence ); + + /* + ** Operators + */ + + virtual const FREQUENCY_AND_MODE& FREQUENCY_AND_MODE::operator = ( const FREQUENCY_AND_MODE& source ); +}; + +#endif // FREQUENCY_AND_MODE_CLASS_HEADER diff --git a/FSI.CPP b/FSI.CPP new file mode 100644 index 0000000..60acd60 --- /dev/null +++ b/FSI.CPP @@ -0,0 +1,121 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +FSI::FSI() +{ + Mnemonic = "FSI"; + Empty(); +} + +FSI::~FSI() +{ + Mnemonic.clear(); + Empty(); +} + +void FSI::Empty( void ) +{ + TransmittingFrequency = 0.0; + ReceivingFrequency = 0.0; + Mode = CommunicationsModeUnknown; + PowerLevel = 0; +} + +bool FSI::Parse( const SENTENCE& sentence ) +{ + /* + ** FSI - Frequency Set Information + ** + ** 1 2 3 4 5 + ** | | | | | + ** $--FSI,xxxxxx,xxxxxx,c,x*hh + ** + ** Field Number: + ** 1) Transmitting Frequency + ** 2) Receiving Frequency + ** 3) Communications Mode + ** 4) Power Level + ** 5) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 5 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + TransmittingFrequency = sentence.Double( 1 ); + ReceivingFrequency = sentence.Double( 2 ); + Mode = sentence.CommunicationsMode( 3 ); + PowerLevel = (short) sentence.Integer( 4 ); + + return( true ); +} + +bool FSI::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += TransmittingFrequency; + sentence += ReceivingFrequency; + sentence += Mode; + sentence += PowerLevel; + + sentence.Finish(); + + return( true ); +} + +const FSI& FSI::operator = ( const FSI& source ) +{ + TransmittingFrequency = source.TransmittingFrequency; + ReceivingFrequency = source.ReceivingFrequency; + Mode = source.Mode; + PowerLevel = source.PowerLevel; + + return( *this ); +} diff --git a/FSI.HPP b/FSI.HPP new file mode 100644 index 0000000..f2ab095 --- /dev/null +++ b/FSI.HPP @@ -0,0 +1,66 @@ +#if ! defined( FSI_CLASS_HEADER ) + +#define FSI_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class FSI : public RESPONSE +{ + public: + + FSI(); + virtual ~FSI(); + + /* + ** Data + */ + + double TransmittingFrequency; + double ReceivingFrequency; + COMMUNICATIONS_MODE Mode; + uint16_t PowerLevel; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const FSI& operator = ( const FSI& source ); +}; + +#endif // FSI_CLASS_HEADER diff --git a/GDA.CPP b/GDA.CPP new file mode 100644 index 0000000..bc739a7 --- /dev/null +++ b/GDA.CPP @@ -0,0 +1,53 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +#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 + +GDA::GDA() +{ + Mnemonic = "GDA"; +} + +GDA::~GDA() +{ + Mnemonic.clear(); +} diff --git a/GDA.HPP b/GDA.HPP new file mode 100644 index 0000000..ce7db87 --- /dev/null +++ b/GDA.HPP @@ -0,0 +1,48 @@ +#if ! defined( GDA_CLASS_HEADER ) + +#define GDA_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +class GDA : public WAYPOINT_LOCATION +{ + public: + + GDA(); + virtual ~GDA(); +}; + +#endif // GDA_CLASS_HEADER diff --git a/GDF.CPP b/GDF.CPP new file mode 100644 index 0000000..0515094 --- /dev/null +++ b/GDF.CPP @@ -0,0 +1,53 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +#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 + +GDF::GDF() +{ + Mnemonic = "GDF"; +} + +GDF::~GDF() +{ + Mnemonic.clear(); +} diff --git a/GDF.HPP b/GDF.HPP new file mode 100644 index 0000000..fdd080a --- /dev/null +++ b/GDF.HPP @@ -0,0 +1,48 @@ +#if ! defined( GDF_CLASS_HEADER ) + +#define GDF_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +class GDF : public WAYPOINT_LOCATION +{ + public: + + GDF(); + virtual ~GDF(); +}; + +#endif // GDF_CLASS_HEADER diff --git a/GDP.CPP b/GDP.CPP new file mode 100644 index 0000000..d924095 --- /dev/null +++ b/GDP.CPP @@ -0,0 +1,53 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +#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 + +GDP::GDP() +{ + Mnemonic = "GDP"; +} + +GDP::~GDP() +{ + Mnemonic.clear(); +} diff --git a/GDP.HPP b/GDP.HPP new file mode 100644 index 0000000..3eeafca --- /dev/null +++ b/GDP.HPP @@ -0,0 +1,48 @@ +#if ! defined( GDP_CLASS_HEADER ) + +#define GDP_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +class GDP : public WAYPOINT_LOCATION +{ + public: + + GDP(); + virtual ~GDP(); +}; + +#endif // GDP_CLASS_HEADER diff --git a/GGA.CPP b/GGA.CPP new file mode 100644 index 0000000..41fc0b1 --- /dev/null +++ b/GGA.CPP @@ -0,0 +1,198 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +GGA::GGA() +{ + Mnemonic = "GGA"; + Empty(); +} + +GGA::~GGA() +{ + Mnemonic.clear(); + Empty(); +} + +void GGA::Empty( void ) +{ + UTCTime.clear(); + Position.Empty(); + GPSQuality = 0; + NumberOfSatellitesInUse = 0; + HorizontalDilutionOfPrecision = 0.0; + AntennaAltitudeMeters = 0.0; + GeoidalSeparationMeters = 0.0; + AgeOfDifferentialGPSDataSeconds = 0.0; + DifferentialReferenceStationID = 0; +} + +bool GGA::Parse( const SENTENCE& sentence ) +{ + /* + ** GGA - Global Positioning System Fix Data + ** Time, Position and fix related data fora GPS receiver. + ** + ** 11 + ** 1 2 3 4 5 6 7 8 9 10 | 12 13 14 15 + ** | | | | | | | | | | | | | | | + ** $--GGA,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx*hh + ** + ** Field Number: + ** 1) Universal Time Coordinated (UTC) + ** 2) Latitude + ** 3) N or S (North or South) + ** 4) Longitude + ** 5) E or W (East or West) + ** 6) GPS Quality Indicator, + ** 0 - fix not available, + ** 1 - GPS fix, + ** 2 - Differential GPS fix + ** 7) Number of satellites in view, 00 - 12 + ** 8) Horizontal Dilution of precision + ** 9) Antenna Altitude above/below mean-sea-level (geoid) + ** 10) Units of antenna altitude, meters + ** 11) Geoidal separation, the difference between the WGS-84 earth + ** ellipsoid and mean-sea-level (geoid), "-" means mean-sea-level + ** below ellipsoid + ** 12) Units of geoidal separation, meters + ** 13) Age of differential GPS data, time in seconds since last SC104 + ** type 1 or 9 update, null field when DGPS is not used + ** 14) Differential reference station ID, 0000-1023 + ** 15) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 15 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + UTCTime = sentence.Field( 1 ); + Time = sentence.Time( 1 ); + Position.Parse( 2, 3, 4, 5, sentence ); + GPSQuality = sentence.Integer( 6 ); + NumberOfSatellitesInUse = sentence.Integer( 7 ); + HorizontalDilutionOfPrecision = sentence.Double( 8 ); + AntennaAltitudeMeters = sentence.Double( 9 ); + GeoidalSeparationMeters = sentence.Double( 11 ); + AgeOfDifferentialGPSDataSeconds = sentence.Double( 13 ); + DifferentialReferenceStationID = sentence.Integer( 14 ); + + return( true ); +} + +std::string GGA::PlainEnglish( void ) const +{ + std::string return_string( "At " ); + std::string time_string = ctime( &Time ); + return_string += time_string.substr(0, time_string.length() - 1); + return_string += " UTC, you were at "; + return_string += Position.PlainEnglish(); + return_string += ", "; + + switch( GPSQuality ) + { + case 1: + + return_string += "based upon a GPS fix"; + break; + + case 2: + + return_string += "based upon a differential GPS fix"; + break; + + default: + + return_string += "a GPS fix was not available"; + break; + } + + char temp_string[ 128 ]; + + ::sprintf( temp_string, ", %d satellites are in use.", NumberOfSatellitesInUse ); + return_string += temp_string; + + return( return_string ); +} + +bool GGA::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += UTCTime; + sentence += Position; + sentence += GPSQuality; + sentence += NumberOfSatellitesInUse; + sentence += HorizontalDilutionOfPrecision; + sentence += AntennaAltitudeMeters; + sentence += "M"; + sentence += GeoidalSeparationMeters; + sentence += "M"; + sentence += AgeOfDifferentialGPSDataSeconds; + sentence += DifferentialReferenceStationID; + + sentence.Finish(); + + return( true ); +} + +const GGA& GGA::operator = ( const GGA& source ) +{ + UTCTime = source.UTCTime; + Time = source.Time; + Position = source.Position; + GPSQuality = source.GPSQuality; + NumberOfSatellitesInUse = source.NumberOfSatellitesInUse; + HorizontalDilutionOfPrecision = source.HorizontalDilutionOfPrecision; + AntennaAltitudeMeters = source.AntennaAltitudeMeters; + GeoidalSeparationMeters = source.GeoidalSeparationMeters; + AgeOfDifferentialGPSDataSeconds = source.AgeOfDifferentialGPSDataSeconds; + DifferentialReferenceStationID = source.DifferentialReferenceStationID; + + return( *this ); +} diff --git a/GGA.HPP b/GGA.HPP new file mode 100644 index 0000000..ab155dd --- /dev/null +++ b/GGA.HPP @@ -0,0 +1,73 @@ +#if ! defined( GGA_CLASS_HEADER ) + +#define GGA_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class GGA : public RESPONSE +{ + public: + + GGA(); + virtual ~GGA(); + + /* + ** Data + */ + + std::string UTCTime; + time_t Time; + LATLONG Position; + int GPSQuality; + int NumberOfSatellitesInUse; + double HorizontalDilutionOfPrecision; + double AntennaAltitudeMeters; + double GeoidalSeparationMeters; + double AgeOfDifferentialGPSDataSeconds; + int DifferentialReferenceStationID; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual std::string PlainEnglish( void ) const override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const GGA& GGA::operator = ( const GGA& source ); +}; + +#endif // GGA_CLASS_HEADER diff --git a/GLA.CPP b/GLA.CPP new file mode 100644 index 0000000..995d5a6 --- /dev/null +++ b/GLA.CPP @@ -0,0 +1,53 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +#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 + +GLA::GLA() +{ + Mnemonic = "GLA"; +} + +GLA::~GLA() +{ + Mnemonic.clear(); +} diff --git a/GLA.HPP b/GLA.HPP new file mode 100644 index 0000000..f64f9d2 --- /dev/null +++ b/GLA.HPP @@ -0,0 +1,48 @@ +#if ! defined( GLA_CLASS_HEADER ) + +#define GLA_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +class GLA : public WAYPOINT_LOCATION +{ + public: + + GLA(); + virtual ~GLA(); +}; + +#endif // GLA_CLASS_HEADER diff --git a/GLC.CPP b/GLC.CPP new file mode 100644 index 0000000..3b18c75 --- /dev/null +++ b/GLC.CPP @@ -0,0 +1,141 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +GLC::GLC() +{ + Mnemonic = "GLC"; + Empty(); +} + +GLC::~GLC() +{ + Mnemonic.clear(); + Empty(); +} + +void GLC::Empty( void ) +{ + GroupRepetitionInterval = 0; + MasterTOA.Empty(); + TimeDifference1.Empty(); + TimeDifference2.Empty(); + TimeDifference3.Empty(); + TimeDifference4.Empty(); + TimeDifference5.Empty(); +} + +bool GLC::Parse( const SENTENCE& sentence ) +{ + /* + ** GLC - Geographic Position, Loran-C + ** 12 14 + ** 1 2 3 4 5 6 7 8 9 10 11| 13| + ** | | | | | | | | | | | | | | + ** $--GLC,xxxx,x.x,a,x.x,a,x.x,a.x,x,a,x.x,a,x.x,a*hh + ** + ** 1) Group Repetition Interval (GRI) Microseconds/10 + ** 2) Master TOA Microseconds + ** 3) Master TOA Signal Status + ** 4) Time Difference 1 Microseconds + ** 5) Time Difference 1 Signal Status + ** 6) Time Difference 2 Microseconds + ** 7) Time Difference 2 Signal Status + ** 8) Time Difference 3 Microseconds + ** 9) Time Difference 3 Signal Status + ** 10) Time Difference 4 Microseconds + ** 11) Time Difference 4 Signal Status + ** 12) Time Difference 5 Microseconds + ** 13) Time Difference 5 Signal Status + ** 14) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 14 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + GroupRepetitionInterval = sentence.Integer( 1 ); + MasterTOA.Parse( 2, sentence ); + TimeDifference1.Parse( 4, sentence ); + TimeDifference2.Parse( 6, sentence ); + TimeDifference3.Parse( 8, sentence ); + TimeDifference4.Parse( 10, sentence ); + TimeDifference5.Parse( 12, sentence ); + + return( true ); +} + +bool GLC::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += GroupRepetitionInterval; + MasterTOA.Write( sentence ); + TimeDifference1.Write( sentence ); + TimeDifference2.Write( sentence ); + TimeDifference3.Write( sentence ); + TimeDifference4.Write( sentence ); + TimeDifference5.Write( sentence ); + + sentence.Finish(); + + return( true ); +} + +const GLC& GLC::operator = ( const GLC& source ) +{ + GroupRepetitionInterval = source.GroupRepetitionInterval; + MasterTOA = source.MasterTOA; + TimeDifference1 = source.TimeDifference1; + TimeDifference2 = source.TimeDifference2; + TimeDifference3 = source.TimeDifference3; + TimeDifference4 = source.TimeDifference4; + TimeDifference5 = source.TimeDifference5; + + return( *this ); +} diff --git a/GLC.HPP b/GLC.HPP new file mode 100644 index 0000000..29bd37a --- /dev/null +++ b/GLC.HPP @@ -0,0 +1,69 @@ +#if ! defined( GLC_CLASS_HEADER ) + +#define GLC_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class GLC : public RESPONSE +{ + public: + + GLC(); + virtual ~GLC(); + + /* + ** Data + */ + + int GroupRepetitionInterval; + LORAN_TIME_DIFFERENCE MasterTOA; + LORAN_TIME_DIFFERENCE TimeDifference1; + LORAN_TIME_DIFFERENCE TimeDifference2; + LORAN_TIME_DIFFERENCE TimeDifference3; + LORAN_TIME_DIFFERENCE TimeDifference4; + LORAN_TIME_DIFFERENCE TimeDifference5; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const GLC& operator = ( const GLC& source ); +}; + +#endif // GLC_CLASS_HEADER diff --git a/GLF.CPP b/GLF.CPP new file mode 100644 index 0000000..fc999d0 --- /dev/null +++ b/GLF.CPP @@ -0,0 +1,53 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +#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 + +GLF::GLF() +{ + Mnemonic = "GLF"; +} + +GLF::~GLF() +{ + Mnemonic.clear(); +} diff --git a/GLF.HPP b/GLF.HPP new file mode 100644 index 0000000..65c4746 --- /dev/null +++ b/GLF.HPP @@ -0,0 +1,48 @@ +#if ! defined( GLF_CLASS_HEADER ) + +#define GLF_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +class GLF : public WAYPOINT_LOCATION +{ + public: + + GLF(); + virtual ~GLF(); +}; + +#endif // GLF_CLASS_HEADER diff --git a/GLL.CPP b/GLL.CPP new file mode 100644 index 0000000..af746fd --- /dev/null +++ b/GLL.CPP @@ -0,0 +1,134 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +GLL::GLL() +{ + Mnemonic = "GLL"; + Empty(); +} + +GLL::~GLL() +{ + Mnemonic.clear(); + Empty(); +} + +void GLL::Empty( void ) +{ + Position.Empty(); + UTCTime.clear(); + IsDataValid = NMEA_Unknown; +} + +bool GLL::Parse( const SENTENCE& sentence ) +{ + /* + ** GLL - Geographic Position - Latitude/Longitude + ** Latitude, N/S, Longitude, E/W, UTC, Status + ** + ** 1 2 3 4 5 6 7 + ** | | | | | | | + ** $--GLL,llll.ll,a,yyyyy.yy,a,hhmmss.ss,A*hh + ** + ** Field Number: + ** 1) Latitude + ** 2) N or S (North or South) + ** 3) Longitude + ** 4) E or W (East or West) + ** 5) Universal Time Coordinated (UTC) + ** 6) Status A - Data Valid, V - Data Invalid + ** 7) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 7 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + Position.Parse( 1, 2, 3, 4, sentence ); + UTCTime = sentence.Field( 5 ); + Time = sentence.Time( 5 ); + IsDataValid = sentence.Boolean( 6 ); + + return( true ); +} + +std::string GLL::PlainEnglish( void ) const +{ + std::string return_string( "At " ); + std::string time_string = ctime(&Time); + return_string += time_string.substr(0, time_string.length() - 1); + return_string += " you were at "; + return_string += Position.PlainEnglish(); + return_string += "."; + + return( return_string ); +} + +bool GLL::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += Position; + sentence += UTCTime; + sentence += IsDataValid; + + sentence.Finish(); + + return( true ); +} + +const GLL& GLL::operator = ( const GLL& source ) +{ + Position = source.Position; + UTCTime = source.UTCTime; + Time = source.Time; + IsDataValid = source.IsDataValid; + + return( *this ); +} diff --git a/GLL.HPP b/GLL.HPP new file mode 100644 index 0000000..b089009 --- /dev/null +++ b/GLL.HPP @@ -0,0 +1,67 @@ +#if ! defined( GLL_CLASS_HEADER ) + +#define GLL_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class GLL : public RESPONSE +{ + public: + + GLL(); + virtual ~GLL(); + + /* + ** Data + */ + + std::string UTCTime; + time_t Time; + NMEA0183_BOOLEAN IsDataValid; + LATLONG Position; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual std::string PlainEnglish( void ) const override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const GLL& operator = ( const GLL& source ); +}; + +#endif // GLL_CLASS_HEADER diff --git a/GLP.CPP b/GLP.CPP new file mode 100644 index 0000000..8a09c26 --- /dev/null +++ b/GLP.CPP @@ -0,0 +1,53 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +#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 + +GLP::GLP() +{ + Mnemonic = "GLP"; +} + +GLP::~GLP() +{ + Mnemonic.clear(); +} diff --git a/GLP.HPP b/GLP.HPP new file mode 100644 index 0000000..a5ce56c --- /dev/null +++ b/GLP.HPP @@ -0,0 +1,48 @@ +#if ! defined( GLP_CLASS_HEADER ) + +#define GLP_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +class GLP : public WAYPOINT_LOCATION +{ + public: + + GLP(); + virtual ~GLP(); +}; + +#endif // GLP_CLASS_HEADER diff --git a/GOA.CPP b/GOA.CPP new file mode 100644 index 0000000..c5197ad --- /dev/null +++ b/GOA.CPP @@ -0,0 +1,53 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +#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 + +GOA::GOA() +{ + Mnemonic = "GOA"; +} + +GOA::~GOA() +{ + Mnemonic.clear(); +} diff --git a/GOA.HPP b/GOA.HPP new file mode 100644 index 0000000..3b1628a --- /dev/null +++ b/GOA.HPP @@ -0,0 +1,48 @@ +#if ! defined( GOA_CLASS_HEADER ) + +#define GOA_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +class GOA : public WAYPOINT_LOCATION +{ + public: + + GOA(); + virtual ~GOA(); +}; + +#endif // GOA_CLASS_HEADER diff --git a/GOF.CPP b/GOF.CPP new file mode 100644 index 0000000..9af7762 --- /dev/null +++ b/GOF.CPP @@ -0,0 +1,53 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +#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 + +GOF::GOF() +{ + Mnemonic = "GOF"; +} + +GOF::~GOF() +{ + Mnemonic.clear(); +} diff --git a/GOF.HPP b/GOF.HPP new file mode 100644 index 0000000..36fba19 --- /dev/null +++ b/GOF.HPP @@ -0,0 +1,48 @@ +#if ! defined( GOF_CLASS_HEADER ) + +#define GOF_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +class GOF : public WAYPOINT_LOCATION +{ + public: + + GOF(); + virtual ~GOF(); +}; + +#endif // GOF_CLASS_HEADER diff --git a/GOP.CPP b/GOP.CPP new file mode 100644 index 0000000..c09ba00 --- /dev/null +++ b/GOP.CPP @@ -0,0 +1,53 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +#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 + +GOP::GOP() +{ + Mnemonic = "GOP"; +} + +GOP::~GOP() +{ + Mnemonic.clear(); +} diff --git a/GOP.HPP b/GOP.HPP new file mode 100644 index 0000000..ca3ed6c --- /dev/null +++ b/GOP.HPP @@ -0,0 +1,48 @@ +#if ! defined( GOP_CLASS_HEADER ) + +#define GOP_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +class GOP : public WAYPOINT_LOCATION +{ + public: + + GOP(); + virtual ~GOP(); +}; + +#endif // GOP_CLASS_HEADER diff --git a/GSA.CPP b/GSA.CPP new file mode 100644 index 0000000..3ae05ff --- /dev/null +++ b/GSA.CPP @@ -0,0 +1,257 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +GSA::GSA() +{ + Mnemonic = "GSA"; + Empty(); +} + +GSA::~GSA() +{ + Mnemonic.clear(); + Empty(); +} + +void GSA::Empty( void ) +{ + OperatingMode = UnknownOperatingMode; + FixMode = FixUnknown; + + int index = 0; + + while( index < 12 ) + { + SatelliteNumber[ index ] = 0; + index++; + } + + PDOP = 0.0; + HDOP = 0.0; + VDOP = 0.0; +} + +bool GSA::Parse( const SENTENCE& sentence ) +{ + /* + ** GSA - GPS DOP and Active Satellites + ** + ** 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 + ** | | | | | | | | | | | | | | | | | | + ** $--GSA,a,x,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,x.x,x.x,x.x*hh + ** + ** Field Number: + ** 1) Operating Mode, A = Automatic, M = Manual + ** 2) Fix Mode, 1 = Fix not available, 2 = 2D, 3 = 3D + ** 3) Satellite PRN #1 + ** 4) Satellite PRN #2 + ** 5) Satellite PRN #3 + ** 6) Satellite PRN #4 + ** 7) Satellite PRN #5 + ** 8) Satellite PRN #6 + ** 9) Satellite PRN #7 + ** 10) Satellite PRN #8 + ** 11) Satellite PRN #9 + ** 12) Satellite PRN #10 + ** 13) Satellite PRN #11 + ** 14) Satellite PRN #12 + ** 15) PDOP + ** 16) HDOP + ** 17) VDOP + ** 18) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 18 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + std::string field_data = sentence.Field( 1 ); + + if ( field_data == "A" ) + { + OperatingMode = Automatic; + } + else if ( field_data == "M" ) + { + OperatingMode = Manual; + } + else + { + OperatingMode = UnknownOperatingMode; + } + + int index = sentence.Integer( 2 ); + + switch( index ) + { + case 1: + + FixMode = FixUnavailable; + break; + + case 2: + + FixMode = TwoDimensional; + break; + + case 3: + + FixMode = ThreeDimensional; + break; + + default: + + FixMode = FixUnknown; + break; + } + + index = 0; + + while( index < 12 ) + { + SatelliteNumber[ index ] = sentence.Integer( index + 3 ); + index++; + } + + PDOP = sentence.Double( 15 ); + HDOP = sentence.Double( 16 ); + VDOP = sentence.Double( 17 ); + + return( true ); +} + +bool GSA::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + switch( OperatingMode ) + { + case Manual: + + sentence += "M"; + break; + + case Automatic: + + sentence += "A"; + break; + + default: + + sentence += ""; + break; + } + + switch( FixMode ) + { + case FixUnavailable: + + sentence += "1"; + break; + + case TwoDimensional: + + sentence += "2"; + break; + + case ThreeDimensional: + + sentence += "3"; + break; + + default: + + sentence += ""; + break; + } + + int index = 0; + + while( index < 12 ) + { + if ( SatelliteNumber[ index ] != 0 ) + { + sentence += SatelliteNumber[ index ]; + } + else + { + sentence += ""; + } + + index++; + } + + sentence += PDOP; + sentence += HDOP; + sentence += VDOP; + + sentence.Finish(); + + return( true ); +} + +const GSA& GSA::operator = ( const GSA& source ) +{ + OperatingMode = source.OperatingMode; + FixMode = source.FixMode; + + int index = 0; + + while( index < 12 ) + { + SatelliteNumber[ index ] = source.SatelliteNumber[ index ]; + index++; + } + + PDOP = source.PDOP; + HDOP = source.HDOP; + VDOP = source.VDOP; + + return( *this ); +} diff --git a/GSA.HPP b/GSA.HPP new file mode 100644 index 0000000..c5bdb5f --- /dev/null +++ b/GSA.HPP @@ -0,0 +1,85 @@ +#if ! defined( GSA_CLASS_HEADER ) + +#define GSA_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class GSA : public RESPONSE +{ + public: + + GSA(); + virtual ~GSA(); + + /* + ** Data + */ + + typedef enum + { + UnknownOperatingMode = 0, + Manual, + Automatic + } + OPERATING_MODE; + + typedef enum + { + FixUnknown = 0, + FixUnavailable, + TwoDimensional, + ThreeDimensional + } + FIX_MODE; + + OPERATING_MODE OperatingMode; + FIX_MODE FixMode; + int SatelliteNumber[ 12 ]; + double PDOP; + double HDOP; + double VDOP; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const GSA& operator = ( const GSA& source ); +}; + +#endif // GSA_CLASS_HEADER diff --git a/GSV.CPP b/GSV.CPP new file mode 100644 index 0000000..7162f95 --- /dev/null +++ b/GSV.CPP @@ -0,0 +1,153 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +GSV::GSV() +{ + Mnemonic = "GSV"; + Empty(); +} + +GSV::~GSV() +{ + Mnemonic.clear(); + Empty(); +} + +void GSV::Empty( void ) +{ + + NumberOfSatellites = 0; + + int index = 0; + + while( index < 12 ) + { + SatellitesInView[ index ].Empty(); + index++; + } +} + +bool GSV::Parse( const SENTENCE& sentence ) +{ + /* + ** GSV - TRANSIT Position - Latitude/Longitude + ** Location and time of TRANSIT fix at waypoint + ** + ** 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 + ** | | | | | | | | | | | | | | | | | | | | + ** $--GSV,x,x,xx,xx,xx,xxx,xx,xx,xx,xxx,xx,xx,xx,xxx,xx,xx,xx,xxx,xx,*hh + ** + ** 1) Total number of messages, 1-3 + ** 2) Message Number, 1-3 + ** 3) Total number of satellites in view + ** 4) Satellite Number #1 + ** 5) Elevation #1 + ** 6) Azimuth, Degrees True #1 + ** 7) SNR #1, NULL when not tracking + ** 8) Satellite Number #2 + ** 9) Elevation #2 + ** 10) Azimuth, Degrees True #2 + ** 11) SNR #2, NULL when not tracking + ** 12) Satellite Number #3 + ** 13) Elevation #3 + ** 14) Azimuth, Degrees True #3 + ** 15) SNR #3, NULL when not tracking + ** 16) Satellite Number #4 + ** 17) Elevation #4 + ** 18) Azimuth, Degrees True #4 + ** 19) SNR #4, NULL when not tracking + ** 20) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 20 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + int message_number = sentence.Integer( 2 ); + + NumberOfSatellites = sentence.Integer( 3 ); + + int index = 0; + + while( index < 4 ) + { + SatellitesInView[ ( ( message_number - 1 ) * 4 ) + index ].Parse( ( index * 4 ) + 4, sentence ); + index++; + } + + return( true ); +} + +bool GSV::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + /* + ** OK, this is a hack, I'll figure out how to do multiple messages later + */ + + sentence.Finish(); + + return( true ); +} + +const GSV& GSV::operator = ( const GSV& source ) +{ + NumberOfSatellites = source.NumberOfSatellites; + + int index = 0; + + while( index < 12 ) + { + SatellitesInView[ index ] = source.SatellitesInView[ index ]; + index++; + } + + return( *this ); +} diff --git a/GSV.HPP b/GSV.HPP new file mode 100644 index 0000000..35665f9 --- /dev/null +++ b/GSV.HPP @@ -0,0 +1,64 @@ +#if ! defined( GSV_CLASS_HEADER ) + +#define GSV_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class GSV : public RESPONSE +{ + public: + + GSV(); + virtual ~GSV(); + + /* + ** Data + */ + + int NumberOfSatellites; + SATELLITE_DATA SatellitesInView[ 12 ]; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const GSV& operator = ( const GSV& source ); +}; + +#endif // GSV_CLASS_HEADER diff --git a/GTD.CPP b/GTD.CPP new file mode 100644 index 0000000..58be47f --- /dev/null +++ b/GTD.CPP @@ -0,0 +1,125 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +GTD::GTD() +{ + Mnemonic = "GTD"; + Empty(); +} + +GTD::~GTD() +{ + Mnemonic.clear(); + Empty(); +} + +void GTD::Empty( void ) +{ + TimeDifference1.clear(); + TimeDifference2.clear(); + TimeDifference3.clear(); + TimeDifference4.clear(); + TimeDifference5.clear(); +} + +bool GTD::Parse( const SENTENCE& sentence ) +{ + /* + ** GTD - Geographical Position, Loran-C TDs + ** + ** 1 2 3 4 5 6 + ** | | | | | | + ** $--GTD,x.x,x.x,x.x,x,x,x.x*hh + ** + ** 1) Time Difference 1 Microseconds + ** 2) Time Difference 2 Microseconds + ** 3) Time Difference 3 Microseconds + ** 4) Time Difference 4 Microseconds + ** 5) Time Difference 5 Microseconds + ** 6) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 6 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + TimeDifference1 = sentence.Field( 1 ); + TimeDifference2 = sentence.Field( 2 ); + TimeDifference3 = sentence.Field( 3 ); + TimeDifference4 = sentence.Field( 4 ); + TimeDifference5 = sentence.Field( 5 ); + + return( true ); +} + +bool GTD::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += TimeDifference1; + sentence += TimeDifference2; + sentence += TimeDifference3; + sentence += TimeDifference4; + sentence += TimeDifference5; + + sentence.Finish(); + + return( true ); +} + +const GTD& GTD::operator = ( const GTD& source ) +{ + TimeDifference1 = source.TimeDifference1; + TimeDifference2 = source.TimeDifference2; + TimeDifference3 = source.TimeDifference3; + TimeDifference4 = source.TimeDifference4; + TimeDifference5 = source.TimeDifference5; + + return( *this ); +} diff --git a/GTD.HPP b/GTD.HPP new file mode 100644 index 0000000..6a057ef --- /dev/null +++ b/GTD.HPP @@ -0,0 +1,67 @@ +#if ! defined( GTD_CLASS_HEADER ) + +#define GTD_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class GTD : public RESPONSE +{ + public: + + GTD(); + virtual ~GTD(); + + /* + ** Data + */ + + std::string TimeDifference1; + std::string TimeDifference2; + std::string TimeDifference3; + std::string TimeDifference4; + std::string TimeDifference5; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const GTD& operator = ( const GTD& source ); +}; + +#endif // GTD_CLASS_HEADER diff --git a/GXA.CPP b/GXA.CPP new file mode 100644 index 0000000..b8f8ec7 --- /dev/null +++ b/GXA.CPP @@ -0,0 +1,126 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +GXA::GXA() +{ + Mnemonic = "GXA"; + Empty(); +} + +GXA::~GXA() +{ + Mnemonic.clear(); + Empty(); +} + +void GXA::Empty( void ) +{ + UTCTime.clear(); + Position.Empty(); + WaypointID.clear(); + SatelliteNumber = 0; +} + +bool GXA::Parse( const SENTENCE& sentence ) +{ + /* + ** GXA - TRANSIT Position - Latitude/Longitude + ** Location and time of TRANSIT fix at waypoint + ** + ** 1 2 3 4 5 6 7 8 + ** | | | | | | | | + ** $--GXA,hhmmss.ss,llll.ll,a,yyyyy.yy,a,c--c,X*hh + ** + ** 1) UTC of position fix + ** 2) Latitude + ** 3) East or West + ** 4) Longitude + ** 5) North or South + ** 6) Waypoint ID + ** 7) Satelite number + ** 8) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 8 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + UTCTime = sentence.Field( 1 ); + Time = sentence.Time( 1 ); + Position.Parse( 2, 3, 4, 5, sentence ); + WaypointID = sentence.Field( 6 ); + SatelliteNumber = (uint16_t) sentence.Integer( 7 ); + + return( true ); +} + +bool GXA::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += UTCTime; + sentence += Position; + sentence += WaypointID; + sentence += Hex( SatelliteNumber ); // Thanks to Chuck Shannon, cshannon@imtn.tpd.dsccc.com + + sentence.Finish(); + + return( true ); +} + +const GXA& GXA::operator = ( const GXA& source ) +{ + UTCTime = source.UTCTime; + Time = source.Time; + Position = source.Position; + WaypointID = source.WaypointID; + SatelliteNumber = source.SatelliteNumber; + + return( *this ); +} diff --git a/GXA.HPP b/GXA.HPP new file mode 100644 index 0000000..74fbed3 --- /dev/null +++ b/GXA.HPP @@ -0,0 +1,67 @@ +#if ! defined( GXA_CLASS_HEADER ) + +#define GXA_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class GXA : public RESPONSE +{ + public: + + GXA(); + virtual ~GXA(); + + /* + ** Data + */ + + std::string UTCTime; + time_t Time; + LATLONG Position; + std::string WaypointID; + uint16_t SatelliteNumber; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const GXA& operator = ( const GXA& source ); +}; + +#endif // GXA_CLASS_HEADER diff --git a/GXF.CPP b/GXF.CPP new file mode 100644 index 0000000..4e5398c --- /dev/null +++ b/GXF.CPP @@ -0,0 +1,53 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +#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 + +GXF::GXF() +{ + Mnemonic = "GXF"; +} + +GXF::~GXF() +{ + Mnemonic.clear(); +} diff --git a/GXF.HPP b/GXF.HPP new file mode 100644 index 0000000..521dfdb --- /dev/null +++ b/GXF.HPP @@ -0,0 +1,48 @@ +#if ! defined( GXF_CLASS_HEADER ) + +#define GXF_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +class GXF : public WAYPOINT_LOCATION +{ + public: + + GXF(); + virtual ~GXF(); +}; + +#endif // GXF_CLASS_HEADER diff --git a/GXP.CPP b/GXP.CPP new file mode 100644 index 0000000..bb3985f --- /dev/null +++ b/GXP.CPP @@ -0,0 +1,53 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +#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 + +GXP::GXP() +{ + Mnemonic = "GXP"; +} + +GXP::~GXP() +{ + Mnemonic.clear(); +} diff --git a/GXP.HPP b/GXP.HPP new file mode 100644 index 0000000..4d925e7 --- /dev/null +++ b/GXP.HPP @@ -0,0 +1,48 @@ +#if ! defined( GXP_CLASS_HEADER ) + +#define GXP_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +class GXP : public WAYPOINT_LOCATION +{ + public: + + GXP(); + virtual ~GXP(); +}; + +#endif // GXP_CLASS_HEADER diff --git a/HCC.CPP b/HCC.CPP new file mode 100644 index 0000000..9eface3 --- /dev/null +++ b/HCC.CPP @@ -0,0 +1,126 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** Use of HDG is recommended. +*/ + +#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 + +HCC::HCC() +{ + Mnemonic = "HCC"; + Empty(); +} + +HCC::~HCC() +{ + Mnemonic.clear(); + Empty(); +} + +void HCC::Empty( void ) +{ + HeadingDegrees = 0.0; +} + +bool HCC::Parse( const SENTENCE& sentence ) +{ + /* + ** HCC - Compass Heading + ** Vessel compass heading, which differs from magnetic heading by the amount of + ** uncorrected magnetic deviation. + ** + ** 1 2 + ** | | + ** $--HCC,x.x*hh + ** + ** Field Number: + ** 1) Commpass heading, degrees + ** 2) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 2 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + HeadingDegrees = sentence.Double( 1 ); + + return( true ); +} + +std::string HCC::PlainEnglish( void ) const +{ + std::string return_string("The compass heading is "); + + char temp_string[ 80 ]; + + ::sprintf( temp_string, "%6.2lf degrees.", HeadingDegrees ); + + return_string += temp_string; + + return( return_string ); +} + +bool HCC::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += HeadingDegrees; + + sentence.Finish(); + + return( true ); +} + +const HCC& HCC::operator = ( const HCC& source ) +{ + HeadingDegrees = source.HeadingDegrees; + + return( *this ); +} diff --git a/HCC.hpp b/HCC.hpp new file mode 100644 index 0000000..dbb998e --- /dev/null +++ b/HCC.hpp @@ -0,0 +1,69 @@ +#if ! defined( HCC_CLASS_HEADER ) + +#define HCC_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** Use of HDG is recommended. +*/ + +class HCC : public RESPONSE +{ + public: + + HCC(); + virtual ~HCC(); + + /* + ** Data + */ + + double HeadingDegrees; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual std::string PlainEnglish( void ) const override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const HCC& operator = ( const HCC& source ); +}; + +#endif // HCC_CLASS_HEADER diff --git a/HDG.CPP b/HDG.CPP new file mode 100644 index 0000000..a36d510 --- /dev/null +++ b/HDG.CPP @@ -0,0 +1,126 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +HDG::HDG() +{ + Mnemonic = "HDG"; + Empty(); +} + +HDG::~HDG() +{ + Mnemonic.clear(); + Empty(); +} + +void HDG::Empty( void ) +{ + MagneticSensorHeadingDegrees = 0.0; + MagneticDeviationDegrees = 0.0; + MagneticDeviationDirection = EW_Unknown; + MagneticVariationDegrees = 0.0; + MagneticVariationDirection = EW_Unknown; +} + +bool HDG::Parse( const SENTENCE& sentence ) +{ + /* + ** HDG - Heading - Deviation & Variation + ** + ** 1 2 3 4 5 6 + ** | | | | | | + ** $--HDG,x.x,x.x,a,x.x,a*hh + ** + ** Field Number: + ** 1) Magnetic Sensor heading in degrees + ** 2) Magnetic Deviation, degrees + ** 3) Magnetic Deviation direction, E = Easterly, W = Westerly + ** 4) Magnetic Variation degrees + ** 5) Magnetic Variation direction, E = Easterly, W = Westerly + ** 6) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 6 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + MagneticSensorHeadingDegrees = sentence.Double( 1 ); + MagneticDeviationDegrees = sentence.Double( 2 ); + MagneticDeviationDirection = sentence.EastOrWest( 3 ); + MagneticVariationDegrees = sentence.Double( 4 ); + MagneticVariationDirection = sentence.EastOrWest( 5 ); + + return( true ); +} + +bool HDG::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += MagneticSensorHeadingDegrees; + sentence += MagneticDeviationDegrees; + sentence += MagneticDeviationDirection; + sentence += MagneticVariationDegrees; + sentence += MagneticVariationDirection; + + sentence.Finish(); + + return( true ); +} + +const HDG& HDG::operator = ( const HDG& source ) +{ + MagneticSensorHeadingDegrees = source.MagneticSensorHeadingDegrees; + MagneticDeviationDegrees = source.MagneticDeviationDegrees; + MagneticDeviationDirection = source.MagneticDeviationDirection; + MagneticVariationDegrees = source.MagneticVariationDegrees; + MagneticVariationDirection = source.MagneticVariationDirection; + + return( *this ); +} diff --git a/HDG.HPP b/HDG.HPP new file mode 100644 index 0000000..25c7054 --- /dev/null +++ b/HDG.HPP @@ -0,0 +1,67 @@ +#if ! defined( HDG_CLASS_HEADER ) + +#define HDG_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class HDG : public RESPONSE +{ + public: + + HDG(); + virtual ~HDG(); + + /* + ** Data + */ + + double MagneticSensorHeadingDegrees; + double MagneticDeviationDegrees; + EASTWEST MagneticDeviationDirection; + double MagneticVariationDegrees; + EASTWEST MagneticVariationDirection; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const HDG& operator = ( const HDG& source ); +}; + +#endif // HDG_CLASS_HEADER diff --git a/HDM.CPP b/HDM.CPP new file mode 100644 index 0000000..d12cc48 --- /dev/null +++ b/HDM.CPP @@ -0,0 +1,126 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** Use of HDG is recommended. +*/ + +#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 + +HDM::HDM() +{ + Mnemonic = "HDM"; + Empty(); +} + +HDM::~HDM() +{ + Mnemonic.clear(); + Empty(); +} + +void HDM::Empty( void ) +{ + HeadingDegrees = 0.0; +} + +bool HDM::Parse( const SENTENCE& sentence ) +{ + /* + ** HDM - Heading - Deviation & Variation + ** + ** 1 2 3 + ** | | | + ** $--HDM,x.x,M*hh + ** + ** Field Number: + ** 1) Heading in degrees + ** 2) M, Magnetic Deviation + ** 3) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 3 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + HeadingDegrees = sentence.Double( 1 ); + + return( true ); +} + +std::string HDM::PlainEnglish( void ) const +{ + std::string return_string = "The Magnetic heading is "; + + char temp_string[ 80 ]; + + ::sprintf( temp_string, "%6.2lf degrees.", HeadingDegrees ); + + return_string += temp_string; + + return( return_string ); +} + +bool HDM::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += HeadingDegrees; + sentence += "M"; + + sentence.Finish(); + + return( true ); +} + +const HDM& HDM::operator = ( const HDM& source ) +{ + HeadingDegrees = source.HeadingDegrees; + + return( *this ); +} diff --git a/HDM.hpp b/HDM.hpp new file mode 100644 index 0000000..6f8ec16 --- /dev/null +++ b/HDM.hpp @@ -0,0 +1,69 @@ +#if ! defined( HDM_CLASS_HEADER ) + +#define HDM_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** Use of HDG is recommended. +*/ + +class HDM : public RESPONSE +{ + public: + + HDM(); + virtual ~HDM(); + + /* + ** Data + */ + + double HeadingDegrees; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual std::string PlainEnglish( void ) const override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const HDM& operator = ( const HDM& source ); +}; + +#endif // HDM_CLASS_HEADER diff --git a/HDT.CPP b/HDT.CPP new file mode 100644 index 0000000..730ec05 --- /dev/null +++ b/HDT.CPP @@ -0,0 +1,121 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +HDT::HDT() +{ + Mnemonic = "HDT"; + Empty(); +} + +HDT::~HDT() +{ + Mnemonic.clear(); + Empty(); +} + +void HDT::Empty( void ) +{ + DegreesTrue = 0.0; +} + +bool HDT::Parse( const SENTENCE& sentence ) +{ + /* + ** HDT - Heading - True + ** + ** 1 2 3 + ** | | | + ** $--HDT,x.x,T*hh + ** + ** Field Number: + ** 1) Heading Degrees, TRUE + ** 2) T = True + ** 3) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 3 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + DegreesTrue = sentence.Double( 1 ); + + return( true ); +} + +std::string HDT::PlainEnglish( void ) const +{ + std::string return_string("Your true heading is "); + + char temp_string[65]; + + sprintf( temp_string, "%6.2lf degrees.", DegreesTrue ); + + return_string += temp_string; + + return( return_string ); +} + +bool HDT::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += DegreesTrue; + sentence += "T"; + + sentence.Finish(); + + return( true ); +} + +const HDT& HDT::operator = ( const HDT& source ) +{ + DegreesTrue = source.DegreesTrue; + + return( *this ); +} diff --git a/HDT.HPP b/HDT.HPP new file mode 100644 index 0000000..b7bb408 --- /dev/null +++ b/HDT.HPP @@ -0,0 +1,64 @@ +#if ! defined( HDT_CLASS_HEADER ) + +#define HDT_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class HDT : public RESPONSE +{ + public: + + HDT(); + virtual ~HDT(); + + /* + ** Data + */ + + double DegreesTrue; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual std::string PlainEnglish( void ) const override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const HDT& operator = ( const HDT& source ); +}; + +#endif // HDT_CLASS_HEADER diff --git a/HEX.CPP b/HEX.CPP new file mode 100644 index 0000000..f8b2c5f --- /dev/null +++ b/HEX.CPP @@ -0,0 +1,47 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +std::string Hex( const uint32_t value ) +{ + char temp_string[ 65 ]; + + sprintf( temp_string, "%04lX", value ); + + return( std::string(temp_string) ); +} diff --git a/HEXVALUE.CPP b/HEXVALUE.CPP new file mode 100644 index 0000000..3c0054a --- /dev/null +++ b/HEXVALUE.CPP @@ -0,0 +1,47 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +uint32_t HexValue( const char *hex_string ) +{ + uint32_t return_value = 0; + + sscanf( hex_string, "%lx", (uint32_t *) &return_value ); + + return( return_value ); +} diff --git a/HSC.CPP b/HSC.CPP new file mode 100644 index 0000000..6a4f684 --- /dev/null +++ b/HSC.CPP @@ -0,0 +1,115 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +HSC::HSC() +{ + Mnemonic = "HSC"; + Empty(); +} + +HSC::~HSC() +{ + Mnemonic.clear(); + Empty(); +} + +void HSC::Empty( void ) +{ + DegreesTrue = 0.0; + DegreesMagnetic = 0.0; +} + +bool HSC::Parse( const SENTENCE& sentence ) +{ + /* + ** HSC - Heading Steering Command + ** + ** 1 2 3 4 5 + ** | | | | | + ** $--HSC,x.x,T,x.x,M,*hh + ** + ** Field Number: + ** 1) Heading Degrees, True + ** 2) T = True + ** 3) Heading Degrees, Magnetic + ** 4) M = Magnetic + ** 5) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 5 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + DegreesTrue = sentence.Double( 1 ); + DegreesMagnetic = sentence.Double( 3 ); + + return( true ); +} + +bool HSC::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += DegreesTrue; + sentence += "T"; + sentence += DegreesMagnetic; + sentence += "M"; + + sentence.Finish(); + + return( true ); +} + +const HSC& HSC::operator = ( const HSC& source ) +{ + DegreesTrue = source.DegreesTrue; + DegreesMagnetic = source.DegreesMagnetic; + + return( *this ); +} diff --git a/HSC.HPP b/HSC.HPP new file mode 100644 index 0000000..827206b --- /dev/null +++ b/HSC.HPP @@ -0,0 +1,64 @@ +#if ! defined( HSC_CLASS_HEADER ) + +#define HSC_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class HSC : public RESPONSE +{ + public: + + HSC(); + virtual ~HSC(); + + /* + ** Data + */ + + double DegreesMagnetic; + double DegreesTrue; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const HSC& operator = ( const HSC& source ); +}; + +#endif // HSC_CLASS_HEADER diff --git a/IMA.cpp b/IMA.cpp new file mode 100644 index 0000000..15d1d36 --- /dev/null +++ b/IMA.cpp @@ -0,0 +1,143 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** There is no recommended replacement. +*/ + +#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 + +IMA::IMA() +{ + Mnemonic = "IMA"; + Empty(); +} + +IMA::~IMA() +{ + Mnemonic.clear(); + Empty(); +} + +void IMA::Empty( void ) +{ + VesselName.clear(); + Callsign.clear(); + HeadingDegreesTrue = 0.0; + HeadingDegreesMagnetic = 0.0; + SpeedKnots = 0.0; +} + +bool IMA::Parse( const SENTENCE& sentence ) +{ + /* + ** IMA - Vessel Identification + ** 11 13 + ** 1 2 3 4 5 6 7 8 9 10| 12| + ** | | | | | | | | | | | | | + ** $--IMA,aaaaaaaaaaaa,aaaxxxx,llll.ll,a,yyyyy.yy,a,x.x,T,x.x,M,x.x,N*hh + ** + ** 1) Twelve character vessel name + ** 2) Radio Call Sign + ** 3) Latitude + ** 4) North/South + ** 5) Longitude + ** 6) East/West + ** 7) Heading, degrees true + ** 8) T = True + ** 9) Heading, degrees magnetic + ** 10) M = Magnetic + ** 11) Speed + ** 12) N = Knots + ** 13) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 13 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + VesselName = sentence.Field( 1 ); + Callsign = sentence.Field( 2 ); + Position.Parse( 3, 4, 5, 6, sentence ); + HeadingDegreesTrue = sentence.Double( 7 ); + HeadingDegreesMagnetic = sentence.Double( 9 ); + SpeedKnots = sentence.Double( 11 ); + + return( true ); +} + +bool IMA::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += VesselName; + sentence += Callsign; + sentence += Position; + sentence += HeadingDegreesTrue; + sentence += "T"; + sentence += HeadingDegreesMagnetic; + sentence += "M"; + sentence += SpeedKnots; + sentence += "N"; + + sentence.Finish(); + + return( true ); +} + +const IMA& IMA::operator = ( const IMA& source ) +{ + VesselName = source.VesselName; + Callsign = source.Callsign; + Position = source.Position; + HeadingDegreesTrue = source.HeadingDegreesTrue; + HeadingDegreesMagnetic = source.HeadingDegreesMagnetic; + SpeedKnots = source.SpeedKnots; + + return( *this ); +} diff --git a/IMA.hpp b/IMA.hpp new file mode 100644 index 0000000..88b1c23 --- /dev/null +++ b/IMA.hpp @@ -0,0 +1,73 @@ +#if ! defined( IMA_CLASS_HEADER ) + +#define IMA_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** There is no recommended replacement. +*/ + +class IMA : public RESPONSE +{ + public: + + IMA(); + virtual ~IMA(); + + /* + ** Data + */ + + std::string VesselName; + std::string Callsign; + LATLONG Position; + double HeadingDegreesTrue; + double HeadingDegreesMagnetic; + double SpeedKnots; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const IMA& operator = ( const IMA& source ); +}; + +#endif // IMA_CLASS_HEADER diff --git a/LAT.CPP b/LAT.CPP new file mode 100644 index 0000000..4063db0 --- /dev/null +++ b/LAT.CPP @@ -0,0 +1,207 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +LATITUDE::LATITUDE() +{ + Empty(); +} + +LATITUDE::~LATITUDE() +{ + Empty(); +} + +void LATITUDE::Empty( void ) +{ + Latitude = 0.0; + Northing = NS_Unknown; +} + +bool LATITUDE::IsDataValid( void ) +{ + if ( Northing != North && Northing != South ) + { + return( false ); + } + + return( true ); +} + +void LATITUDE::Parse( int position_field_number, int north_or_south_field_number, const SENTENCE& sentence ) +{ + // Thanks go to Eric Parsonage (ericpa@mpx.com.au) for finding a nasty + // little bug that used to live here. + + double position = 0.0; + + position = sentence.Double( position_field_number ); + + std::string north_or_south = sentence.Field( north_or_south_field_number ); + + Set( position, north_or_south.c_str() ); +} + +void LATITUDE::Set( double position, const char *north_or_south ) +{ + Latitude = position; + Coordinate = position; + + if ( north_or_south[ 0 ] == 'N' ) + { + Northing = North; + } + else if ( north_or_south[ 0 ] == 'S' ) + { + Northing = South; + } + else + { + Northing = NS_Unknown; + } +} + +void LATITUDE::Write( SENTENCE& sentence ) +{ + char temp_string[ 80 ]; + + ::sprintf( temp_string, "%07.2f", Latitude ); + sentence += temp_string; + + if ( Northing == North ) + { + sentence += "N"; + } + else if ( Northing == South ) + { + sentence += "S"; + } + else + { + /* + ** Thanks to Jan-Erik Eriksson (Jan-Erik.Eriksson@st.se) for + ** finding and fixing a bug here + */ + + sentence += ""; + } +} + +const LATITUDE& LATITUDE::operator = ( const LATITUDE& source ) +{ + Latitude = source.Latitude; + Northing = source.Northing; + + return( *this ); +} + +// COORDINATE stuff + +// Coordinates are in the format dddmm.ddd +// For example, 76 degrees 46.887 minutes would be 7646.887 + +double COORDINATE::GetDecimalDegrees( void ) const +{ + double return_value = 0.0; + + int degrees = (int) ::floor( Coordinate ); + int minutes = degrees % 100; + + double fractional_minutes = 0.0; + double throw_away = 0.0; + + fractional_minutes = ::modf( Coordinate, &throw_away ); + + degrees -= minutes; + degrees /= 100; + + return_value = degrees; + return_value += (double) ( (double) minutes / (double) 60.0 ); + return_value += (double) ( (double) fractional_minutes / (double) 60.0 ); + + return( return_value ); +} + +double COORDINATE::GetDecimalMinutes( void ) const +{ + double return_value = 0.0; + + int degrees = (int) ::floor( Coordinate ); + int minutes = degrees % 100; + + double fractional_minutes = 0.0; + double throw_away = 0.0; + + fractional_minutes = ::modf( Coordinate, &throw_away ); + + return_value = (double) ( (double) minutes ); + return_value += fractional_minutes; + + return( return_value ); +} + +double COORDINATE::GetDecimalSeconds( void ) const +{ + double return_value = 0.0; + + double minutes = GetDecimalMinutes(); + + double fractional_minutes = 0.0; + double throw_away = 0.0; + + fractional_minutes = ::modf( minutes, &throw_away ); + + return_value = (double) ( (double) fractional_minutes * (double) 60.0 ); + + return( return_value ); +} + +int COORDINATE::GetWholeDegrees( void ) const +{ + return( (int) ::floor( GetDecimalDegrees() ) ); +} + +int COORDINATE::GetWholeMinutes( void ) const +{ + return( (int) ::floor( GetDecimalMinutes() ) ); +} + +int COORDINATE::GetWholeSeconds( void ) const +{ + return( (int) ::floor( GetDecimalSeconds() ) ); +} diff --git a/LATLONG.CPP b/LATLONG.CPP new file mode 100644 index 0000000..833f8de --- /dev/null +++ b/LATLONG.CPP @@ -0,0 +1,116 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +LATLONG::LATLONG() +{ + Empty(); +} + +LATLONG::~LATLONG() +{ + Empty(); +} + +void LATLONG::Empty( void ) +{ + Latitude.Empty(); + Longitude.Empty(); +} + +bool LATLONG::Parse( int LatitudePositionFieldNumber, int NorthingFieldNumber, int LongitudePositionFieldNumber, int EastingFieldNumber, const SENTENCE& LineToParse ) +{ + Latitude.Parse( LatitudePositionFieldNumber, NorthingFieldNumber, LineToParse ); + Longitude.Parse( LongitudePositionFieldNumber, EastingFieldNumber, LineToParse ); + + if ( Latitude.IsDataValid() && Longitude.IsDataValid() ) + { + return( true ); + } + else + { + return( false ); + } +} + +std::string LATLONG::PlainEnglish( void ) const +{ + char temp_string[256]; + + sprintf( temp_string, "Latitude %d %8.5lf", Latitude.GetWholeDegrees(), Latitude.GetDecimalMinutes() ); + + std::string return_string( temp_string ); + + if ( Latitude.Northing == North ) + { + return_string += " North, Longitude "; + } + else + { + return_string += " South, Longitude "; + } + + ::sprintf( temp_string, "%d %8.5lf", Longitude.GetWholeDegrees(), Longitude.GetDecimalMinutes() ); + + return_string += temp_string; + + if ( Longitude.Easting == East ) + { + return_string += " East"; + } + else + { + return_string += " West"; + } + + return( return_string ); +} + +void LATLONG::Write( SENTENCE& sentence ) +{ + Latitude.Write( sentence ); + Longitude.Write( sentence ); +} + +const LATLONG& LATLONG::operator = ( const LATLONG& source ) +{ + Latitude = source.Latitude; + Longitude = source.Longitude; + + return( *this ); +} diff --git a/LATLONG.HPP b/LATLONG.HPP new file mode 100644 index 0000000..feb7c21 --- /dev/null +++ b/LATLONG.HPP @@ -0,0 +1,148 @@ +#if ! defined( LATLONG_CLASS_HEADER ) + +#define LATLONG_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class SENTENCE; + +class COORDINATE +{ + public: + + COORDINATE() { Coordinate = 0.0; } + ~COORDINATE() { Coordinate = 0.0; } + + double Coordinate; + + double GetDecimalDegrees( void ) const; + double GetDecimalMinutes( void ) const; + double GetDecimalSeconds( void ) const; + int GetWholeDegrees( void ) const; + int GetWholeMinutes( void ) const; + int GetWholeSeconds( void ) const; +}; + +class LATITUDE : public COORDINATE +{ + public: + + LATITUDE(); + virtual ~LATITUDE(); + + /* + ** Data + */ + + double Latitude; + + NORTHSOUTH Northing; + + /* + ** Methods + */ + + virtual void Empty( void ); + virtual bool IsDataValid( void ); + virtual void Parse( int PositionFieldNumber, int NorthingFieldNumber, const SENTENCE& LineToParse ); + virtual void Set( double Position, const char *Northing ); + virtual void Write( SENTENCE& sentence ); + + /* + ** Operators + */ + + virtual const LATITUDE& operator = ( const LATITUDE& source ); +}; + +class LONGITUDE : public COORDINATE +{ + public: + + LONGITUDE(); + virtual ~LONGITUDE(); + + /* + ** Data + */ + + double Longitude; + + EASTWEST Easting; + + /* + ** Methods + */ + + virtual void Empty( void ); + virtual bool IsDataValid( void ); + virtual void Parse( int PositionFieldNumber, int EastingFieldNumber, const SENTENCE& LineToParse ); + virtual void Set( double Position, const char *Easting ); + virtual void Write( SENTENCE& sentence ); + + /* + ** Operators + */ + + virtual const LONGITUDE& operator = ( const LONGITUDE& source ); +}; + +class LATLONG +{ + public: + + LATLONG(); + virtual ~LATLONG(); + + /* + ** Data + */ + + LATITUDE Latitude; + LONGITUDE Longitude; + + /* + ** Methods + */ + + virtual void Empty( void ); + virtual bool Parse( int LatitudePostionFieldNumber, int NorthingFieldNumber, int LongitudePositionFieldNumber, int EastingFieldNumber, const SENTENCE& LineToParse ); + virtual std::string PlainEnglish( void ) const; + virtual void Write( SENTENCE& sentence ); + + /* + ** Operators + */ + + virtual const LATLONG& operator = ( const LATLONG& source ); +}; + +#endif // LATLONG_CLASS_HEADER diff --git a/LCD.CPP b/LCD.CPP new file mode 100644 index 0000000..f732d42 --- /dev/null +++ b/LCD.CPP @@ -0,0 +1,141 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +LCD::LCD() +{ + Mnemonic = "LCD"; + Empty(); +} + +LCD::~LCD() +{ + Mnemonic.clear(); + Empty(); +} + +void LCD::Empty( void ) +{ + GroupRepetitionInterval = 0; + Master.Empty(); + Secondary1.Empty(); + Secondary2.Empty(); + Secondary3.Empty(); + Secondary4.Empty(); + Secondary5.Empty(); +} + +bool LCD::Parse( const SENTENCE& sentence ) +{ + /* + ** LCD - Loran-C Signal Data + ** + ** 1 2 3 4 5 6 7 8 9 10 11 12 13 14 + ** | | | | | | | | | | | | | | + ** $--LCD,xxxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx,xxx*hh + ** + ** 1) Group Repetition Interval (GRI) Microseconds/10 + ** 2) Master Relative SNR + ** 3) Master Relative ECD + ** 4) Time Difference 1 Microseconds + ** 5) Time Difference 1 Signal Status + ** 6) Time Difference 2 Microseconds + ** 7) Time Difference 2 Signal Status + ** 8) Time Difference 3 Microseconds + ** 9) Time Difference 3 Signal Status + ** 10) Time Difference 4 Microseconds + ** 11) Time Difference 4 Signal Status + ** 12) Time Difference 5 Microseconds + ** 13) Time Difference 5 Signal Status + ** 14) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 14 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + GroupRepetitionInterval = sentence.Integer( 1 ); + Master.Parse( 2, sentence ); + Secondary1.Parse( 4, sentence ); + Secondary2.Parse( 6, sentence ); + Secondary3.Parse( 8, sentence ); + Secondary4.Parse( 10, sentence ); + Secondary5.Parse( 12, sentence ); + + return( true ); +} + +bool LCD::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += GroupRepetitionInterval; + Master.Write( sentence ); + Secondary1.Write( sentence ); + Secondary2.Write( sentence ); + Secondary3.Write( sentence ); + Secondary4.Write( sentence ); + Secondary5.Write( sentence ); + + sentence.Finish(); + + return( true ); +} + +const LCD& LCD::operator = ( const LCD& source ) +{ + GroupRepetitionInterval = source.GroupRepetitionInterval; + Master = source.Master; + Secondary1 = source.Secondary1; + Secondary2 = source.Secondary2; + Secondary3 = source.Secondary3; + Secondary4 = source.Secondary4; + Secondary5 = source.Secondary5; + + return( *this ); +} diff --git a/LCD.HPP b/LCD.HPP new file mode 100644 index 0000000..a4c25fe --- /dev/null +++ b/LCD.HPP @@ -0,0 +1,69 @@ +#if ! defined( LCD_CLASS_HEADER ) + +#define LCD_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class LCD : public RESPONSE +{ + public: + + LCD(); + virtual ~LCD(); + + /* + ** Data + */ + + int GroupRepetitionInterval; + RATIO_AND_PULSE Master; + RATIO_AND_PULSE Secondary1; + RATIO_AND_PULSE Secondary2; + RATIO_AND_PULSE Secondary3; + RATIO_AND_PULSE Secondary4; + RATIO_AND_PULSE Secondary5; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const LCD& operator = ( const LCD& source ); +}; + +#endif // LCD_CLASS_HEADER diff --git a/LICENSE b/LICENSE index e1a7ed6..60fef41 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015 Sam Blackburn +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 diff --git a/LONG.CPP b/LONG.CPP new file mode 100644 index 0000000..387e5a0 --- /dev/null +++ b/LONG.CPP @@ -0,0 +1,131 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +LONGITUDE::LONGITUDE() +{ + Empty(); +} + +LONGITUDE::~LONGITUDE() +{ + Empty(); +} + +void LONGITUDE::Empty( void ) +{ + Longitude = 0.0; + Easting = EW_Unknown; +} + +bool LONGITUDE::IsDataValid( void ) +{ + if ( Easting != East && Easting != West ) + { + return( false ); + } + + return( true ); +} + +void LONGITUDE::Parse( int position_field_number, int east_or_west_field_number, const SENTENCE& sentence ) +{ + // Thanks go to Eric Parsonage (ericpa@mpx.com.au) for finding a nasty + // little bug that used to live here. + + double position = 0.0; + + position = sentence.Double( position_field_number ); + + std::string east_or_west = sentence.Field( east_or_west_field_number ); + + Set( position, east_or_west.c_str() ); +} + +void LONGITUDE::Set( double position, const char *east_or_west ) +{ + Longitude = position; + Coordinate = position; + + if ( east_or_west[ 0 ] == 'E' ) + { + Easting = East; + } + else if ( east_or_west[ 0 ] == 'W' ) + { + Easting = West; + } + else + { + Easting = EW_Unknown; + } +} + +void LONGITUDE::Write( SENTENCE& sentence ) +{ + char temp_string[ 80 ]; + + ::sprintf( temp_string, "%08.2f", Longitude ); + sentence += temp_string; + + if ( Easting == East ) + { + sentence += "E"; + } + else if ( Easting == West ) + { + sentence += "W"; + } + else + { + /* + ** Thanks to Jan-Erik Eriksson (Jan-Erik.Eriksson@st.se) for + ** finding and fixing a bug here + */ + + sentence += ""; + } +} + +const LONGITUDE& LONGITUDE::operator = ( const LONGITUDE& source ) +{ + Longitude = source.Longitude; + Easting = source.Easting; + + return( *this ); +} diff --git a/LORANTD.CPP b/LORANTD.CPP new file mode 100644 index 0000000..f546b39 --- /dev/null +++ b/LORANTD.CPP @@ -0,0 +1,122 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +LORAN_TIME_DIFFERENCE::LORAN_TIME_DIFFERENCE() +{ + Empty(); +} + +LORAN_TIME_DIFFERENCE::~LORAN_TIME_DIFFERENCE() +{ + Empty(); +} + +void LORAN_TIME_DIFFERENCE::Empty( void ) +{ + Microseconds = 0.0; + SignalStatus = LoranUnknown; +} + +void LORAN_TIME_DIFFERENCE::Parse( int first_field_number, const SENTENCE& sentence ) +{ + Microseconds = sentence.Double( first_field_number ); + + std::string field_data = sentence.Field( first_field_number + 1 ); + + if ( field_data == "B" ) + { + SignalStatus = LoranBlinkWarning; + } + else if ( field_data == "C" ) + { + SignalStatus = LoranCycleWarning; + } + else if ( field_data == "S" ) + { + SignalStatus = LoranSignalToNoiseRatioWarning; + } + else if ( field_data == "A" ) + { + SignalStatus = LoranValid; + } + else + { + SignalStatus = LoranUnknown; + } +} + +void LORAN_TIME_DIFFERENCE::Write( SENTENCE& sentence ) +{ + sentence += Microseconds; + + switch( SignalStatus ) + { + case LoranValid: + + sentence += "A"; + break; + + case LoranBlinkWarning: + + sentence += "B"; + break; + + case LoranCycleWarning: + + sentence += "C"; + break; + + case LoranSignalToNoiseRatioWarning: + + sentence += "S"; + break; + + default: + + sentence += ""; + } +} + +const LORAN_TIME_DIFFERENCE& LORAN_TIME_DIFFERENCE::operator = ( const LORAN_TIME_DIFFERENCE& source ) +{ + Microseconds = source.Microseconds; + SignalStatus = source.SignalStatus; + + return( *this ); +} diff --git a/LORANTD.HPP b/LORANTD.HPP new file mode 100644 index 0000000..2f3a564 --- /dev/null +++ b/LORANTD.HPP @@ -0,0 +1,74 @@ +#if ! defined( LORAN_TIME_DIFFERENCE_CLASS_HEADER ) + +#define LORAN_TIME_DIFFERENCE_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +typedef enum +{ + LoranUnknown = 0, + LoranValid, + LoranBlinkWarning, + LoranCycleWarning, + LoranSignalToNoiseRatioWarning +} +LORAN_SIGNAL_STATUS; + +class LORAN_TIME_DIFFERENCE +{ + public: + + LORAN_TIME_DIFFERENCE(); + virtual ~LORAN_TIME_DIFFERENCE(); + + /* + ** Data + */ + + double Microseconds; + LORAN_SIGNAL_STATUS SignalStatus; + + /* + ** Methods + */ + + virtual void Empty( void ); + virtual void Parse( int field_number, const SENTENCE& sentence ); + virtual void Write( SENTENCE& sentence ); + + /* + ** Operators + */ + + virtual const LORAN_TIME_DIFFERENCE& LORAN_TIME_DIFFERENCE::operator = ( const LORAN_TIME_DIFFERENCE& source ); +}; + +#endif // LORAN_TIME_DIFFERENCE_CLASS_HEADER diff --git a/MANUFACT.CPP b/MANUFACT.CPP new file mode 100644 index 0000000..e3cbe2c --- /dev/null +++ b/MANUFACT.CPP @@ -0,0 +1,56 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +MANUFACTURER::MANUFACTURER() +{ + Mnemonic.clear(); + CompanyName.clear(); +} + +MANUFACTURER::MANUFACTURER( const char *mnemonic, const char *company_name ) +{ + Mnemonic = mnemonic; + CompanyName = company_name; +} + +MANUFACTURER::~MANUFACTURER() +{ + Mnemonic.clear(); + CompanyName.clear(); +} diff --git a/MANUFACT.HPP b/MANUFACT.HPP new file mode 100644 index 0000000..8cc52d2 --- /dev/null +++ b/MANUFACT.HPP @@ -0,0 +1,47 @@ +#if ! defined( MANUFACTURER_CLASS_HEADER ) + +#define MANUFACTURER_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class MANUFACTURER +{ + public: + + MANUFACTURER(); + MANUFACTURER( const char *mnemonic, const char *company_name ); + virtual ~MANUFACTURER(); + + std::string Mnemonic; + std::string CompanyName; +}; + +#endif // MANUFACTURER_CLASS_HEADER diff --git a/MHU.cpp b/MHU.cpp new file mode 100644 index 0000000..9f7fffc --- /dev/null +++ b/MHU.cpp @@ -0,0 +1,123 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** XDR is recommended. +*/ + +#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 + +MHU::MHU() +{ + Mnemonic = "MHU"; + Empty(); +} + +MHU::~MHU() +{ + Mnemonic.clear(); + Empty(); +} + +void MHU::Empty( void ) +{ + RelativeHumidityPercent = 0.0; + AbsoluteHumidityPercent = 0.0; + DewPointDegreesCelcius = 0.0; +} + +bool MHU::Parse( const SENTENCE& sentence ) +{ + /* + ** MHU - Humidity + ** + ** 1 2 3 4 5 + ** | | | | | + ** $--MHU,x.x,x.x,x.x,C*hh + ** + ** Field Number: + ** 1) Relative Humidity Percent + ** 2) Absolute humidity percent + ** 3) Dew Point + ** 4) C = Degrees Celsius + ** 5) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 5 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + RelativeHumidityPercent = sentence.Double( 1 ); + AbsoluteHumidityPercent = sentence.Double( 2 ); + DewPointDegreesCelcius = sentence.Double( 3 ); + + return( false ); +} + +bool MHU::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += RelativeHumidityPercent; + sentence += AbsoluteHumidityPercent; + sentence += DewPointDegreesCelcius; + sentence += "C"; + + sentence.Finish(); + + return( true ); +} + +const MHU& MHU::operator = ( const MHU& source ) +{ + RelativeHumidityPercent = source.RelativeHumidityPercent; + AbsoluteHumidityPercent = source.AbsoluteHumidityPercent; + DewPointDegreesCelcius = source.DewPointDegreesCelcius; + + return( *this ); +} diff --git a/MHU.hpp b/MHU.hpp new file mode 100644 index 0000000..195cd41 --- /dev/null +++ b/MHU.hpp @@ -0,0 +1,70 @@ +#if ! defined( MHU_CLASS_HEADER ) + +#define MHU_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** XDR is recommended. +*/ + +class MHU : public RESPONSE +{ + public: + + MHU(); + virtual ~MHU(); + + /* + ** Data + */ + + double RelativeHumidityPercent; + double AbsoluteHumidityPercent; + double DewPointDegreesCelcius; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const MHU& operator = ( const MHU& source ); +}; + +#endif // MHU_CLASS_HEADER diff --git a/MLIST.CPP b/MLIST.CPP new file mode 100644 index 0000000..afff9f1 --- /dev/null +++ b/MLIST.CPP @@ -0,0 +1,430 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +MANUFACTURER_LIST::MANUFACTURER_LIST() +{ + ManufacturerTable.clear(); +} + +MANUFACTURER_LIST::~MANUFACTURER_LIST() +{ + Empty(); +} + +void MANUFACTURER_LIST::Empty( void ) +{ + ManufacturerTable.clear(); +} + +static bool is_less_than(__in const MANUFACTURER& left, __in const MANUFACTURER& right) +{ + return(left.Mnemonic < right.Mnemonic); +} + +void MANUFACTURER_LIST::Fill( void ) +{ + ManufacturerTable.push_back( MANUFACTURER( "AAR", "Asian American Resources" ) ); + ManufacturerTable.push_back( MANUFACTURER( "ACE", "Auto-Comm Engineering Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "ACR", "ACR Electronics, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "ACS", "Arco Solar, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "ACT", "Advanced Control Technology" ) ); + ManufacturerTable.push_back( MANUFACTURER( "AGI", "Airguide Instrument Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "AHA", "Autohelm of America" ) ); + ManufacturerTable.push_back( MANUFACTURER( "AIP", "Aiphone Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "ALD", "Alden Electronics, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "AMR", "AMR Systems" ) ); + ManufacturerTable.push_back( MANUFACTURER( "AMT", "Airmar Technology" ) ); + ManufacturerTable.push_back( MANUFACTURER( "ANS", "Antenna Specialists" ) ); + ManufacturerTable.push_back( MANUFACTURER( "ANX", "Analytyx Electronic Systems" ) ); + ManufacturerTable.push_back( MANUFACTURER( "ANZ", "Anschutz of America" ) ); + ManufacturerTable.push_back( MANUFACTURER( "APC", "Apelco" ) ); + ManufacturerTable.push_back( MANUFACTURER( "APN", "American Pioneer, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "APX", "Amperex, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "AQC", "Aqua-Chem, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "AQD", "Aquadynamics, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "AQM", "Aqua Meter Instrument Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "ASP", "American Solar Power" ) ); + ManufacturerTable.push_back( MANUFACTURER( "ATE", "Aetna Engineering" ) ); + ManufacturerTable.push_back( MANUFACTURER( "ATM", "Atlantic Marketing Company, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "ATR", "Airtron" ) ); + ManufacturerTable.push_back( MANUFACTURER( "ATV", "Activation, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "AVN", "Advanced Navigation, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "AWA", "Awa New Zealand, Limited" ) ); + ManufacturerTable.push_back( MANUFACTURER( "BBL", "BBL Industries, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "BBR", "BBR and Associates" ) ); + ManufacturerTable.push_back( MANUFACTURER( "BDV", "Brisson Development, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "BEC", "Boat Electric Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "BGS", "Barringer Geoservice" ) ); + ManufacturerTable.push_back( MANUFACTURER( "BGT", "Brookes and Gatehouse, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "BHE", "BH Electronics" ) ); + ManufacturerTable.push_back( MANUFACTURER( "BHR", "Bahr Technologies, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "BLB", "Bay Laboratories" ) ); + ManufacturerTable.push_back( MANUFACTURER( "BMC", "BMC" ) ); + ManufacturerTable.push_back( MANUFACTURER( "BME", "Bartel Marine Electronics" ) ); + ManufacturerTable.push_back( MANUFACTURER( "BNI", "Neil Brown Instrument Systems" ) ); + ManufacturerTable.push_back( MANUFACTURER( "BNS", "Bowditch Navigation Systems" ) ); + ManufacturerTable.push_back( MANUFACTURER( "BRM", "Mel Barr Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "BRY", "Byrd Industries" ) ); + ManufacturerTable.push_back( MANUFACTURER( "BTH", "Benthos, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "BTK", "Baltek Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "BTS", "Boat Sentry, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "BXA", "Bendix-Avalex, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "CAT", "Catel" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CBN", "Cybernet Marine Products" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CCA", "Copal Corporation of America" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CCC", "Coastal Communications Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CCL", "Coastal Climate Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CCM", "Coastal Communications" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CDC", "Cordic Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CEC", "Ceco Communications, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "CHI", "Charles Industries, Limited" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CKM", "Cinkel Marine Electronics Industries" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CMA", "Societe Nouvelle D'Equiment du Calvados" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CMC", "Coe Manufacturing Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CME", "Cushman Electronics, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "CMP", "C-Map, s.r.l." ) ); + ManufacturerTable.push_back( MANUFACTURER( "CMS", "Coastal Marine Sales Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CMV", "CourseMaster USA, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "CNV", "Coastal Navigator" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CNX", "Cynex Manufactoring Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CPL", "Computrol, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "CPN", "Compunav" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CPS", "Columbus Positioning, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "CPT", "CPT, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "CRE", "Crystal Electronics, Limited" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CRO", "The Caro Group" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CRY", "Crystek Crystals Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CSM", "Comsat Maritime Services" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CST", "Cast, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "CSV", "Combined Services" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CTA", "Current Alternatives" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CTB", "Cetec Benmar" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CTC", "Cell-tech Communications" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CTE", "Castle Electronics" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CTL", "C-Tech, Limited" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CNI", "Continental Instruments" ) ); // Possible error in NMEA0183 docs + ManufacturerTable.push_back( MANUFACTURER( "CWD", "Cubic Western Data" ) ); + ManufacturerTable.push_back( MANUFACTURER( "CWV", "Celwave R.F., Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "CYZ", "cYz, Incorporated" ) ); + ManufacturerTable.push_back( MANUFACTURER( "DCC", "Dolphin Components Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "DEB", "Debeg Gmbh" ) ); + ManufacturerTable.push_back( MANUFACTURER( "DFI", "Defender Industries, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "DGC", "Digicourse, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "DME", "Digital Marine Electronics Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "DMI", "Datamarine International, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "DNS", "Dornier System Gmbh" ) ); + ManufacturerTable.push_back( MANUFACTURER( "DNT", "Del Norte Technology, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "DPS", "Danaplus, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "DRL", "R.L. Drake Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "DSC", "Dynascan Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "DYN", "Dynamote Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "DYT", "Dytek Laboratories, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "EBC", "Emergency Beacon, Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "ECT", "Echotec, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "EEV", "EEV, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "EFC", "Efcom Communication Systems" ) ); + ManufacturerTable.push_back( MANUFACTURER( "ELD", "Electronic Devices, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "EMC", "Electric Motion Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "EMS", "Electro Marine Systems, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "ENA", "Energy Analysts, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "ENC", "Encron, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "EPM", "Epsco Marine" ) ); + ManufacturerTable.push_back( MANUFACTURER( "EPT", "Eastprint, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "ERC", "The Ericsson Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "ESA", "European Space Agency" ) ); + ManufacturerTable.push_back( MANUFACTURER( "FDN", "Fluiddyne" ) ); + ManufacturerTable.push_back( MANUFACTURER( "FHE", "Fish Hawk Electronics" ) ); + ManufacturerTable.push_back( MANUFACTURER( "FJN", "Jon Fluke Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "FMM", "First Mate Marine Autopilots" ) ); + ManufacturerTable.push_back( MANUFACTURER( "FNT", "Franklin Net and Twine, Limited" ) ); // Compiler Die Here + ManufacturerTable.push_back( MANUFACTURER( "FRC", "The Fredericks Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "FTG", "T.G. Faria Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "FUJ", "Fujitsu Ten Corporation of America" ) ); + ManufacturerTable.push_back( MANUFACTURER( "FEC", "Furuno Electric Company" ) ); // Possible NMEA document error + ManufacturerTable.push_back( MANUFACTURER( "FUR", "Furuno, USA Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "GAM", "GRE America, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "GCA", "Gulf Cellular Associates" ) ); + ManufacturerTable.push_back( MANUFACTURER( "GES", "Geostar Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "GFC", "Graphic Controls, Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "GIS", "Galax Integrated Systems" ) ); + ManufacturerTable.push_back( MANUFACTURER( "GPI", "Global Positioning Instrument Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "GRM", "Garmin Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "GSC", "Gold Star Company, Limited" ) ); + ManufacturerTable.push_back( MANUFACTURER( "GTO", "Gro Electronics" ) ); + ManufacturerTable.push_back( MANUFACTURER( "GVE", "Guest Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "GVT", "Great Valley Technology" ) ); + ManufacturerTable.push_back( MANUFACTURER( "HAL", "HAL Communications Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "HAR", "Harris Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "HIG", "Hy-Gain" ) ); + ManufacturerTable.push_back( MANUFACTURER( "HIT", "Hi-Tec" ) ); + ManufacturerTable.push_back( MANUFACTURER( "HPK", "Hewlett-Packard" ) ); + ManufacturerTable.push_back( MANUFACTURER( "HRC", "Harco Manufacturing Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "HRT", "Hart Systems, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "HTI", "Heart Interface, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "HUL", "Hull Electronics Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "HWM", "Honeywell Marine Systems" ) ); + ManufacturerTable.push_back( MANUFACTURER( "ICO", "Icom of America, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "IFD", "International Fishing Devices" ) ); + ManufacturerTable.push_back( MANUFACTURER( "IFI", "Instruments for Industry" ) ); + ManufacturerTable.push_back( MANUFACTURER( "IME", "Imperial Marine Equipment" ) ); + ManufacturerTable.push_back( MANUFACTURER( "IMI", "I.M.I." ) ); + ManufacturerTable.push_back( MANUFACTURER( "IMM", "ITT MacKay Marine" ) ); + ManufacturerTable.push_back( MANUFACTURER( "IMP", "Impulse Manufacturing, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "IMT", "International Marketing and Trading, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "INM", "Inmar Electronic and Sales, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "INT", "Intech, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "IRT", "Intera Technologies, Limited" ) ); + ManufacturerTable.push_back( MANUFACTURER( "IST", "Innerspace Technology, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "ITM", "Intermarine Electronics, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "ITR", "Itera, Limited" ) ); + ManufacturerTable.push_back( MANUFACTURER( "JAN", "Jan Crystals" ) ); + ManufacturerTable.push_back( MANUFACTURER( "JFR", "Ray Jefferson" ) ); + ManufacturerTable.push_back( MANUFACTURER( "JMT", "Japan Marine Telecommunications" ) ); + ManufacturerTable.push_back( MANUFACTURER( "JRC", "Japan Radio Company, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "JRI", "J-R Industries, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "JTC", "J-Tech Associates, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "JTR", "Jotron Radiosearch, Limited" ) ); + ManufacturerTable.push_back( MANUFACTURER( "KBE", "KB Electronics, Limited" ) ); + ManufacturerTable.push_back( MANUFACTURER( "KBM", "Kennebec Marine Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "KLA", "Klein Associates, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "KMR", "King Marine Radio Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "KNG", "King Radio Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "KOD", "Koden Electronics Company, Limited" ) ); + ManufacturerTable.push_back( MANUFACTURER( "KRP", "Krupp International, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "KVH", "KVH Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "KYI", "Kyocera International, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "LAT", "Latitude Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "LEC", "Lorain Electronics Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "LMM", "Lamarche Manufacturing Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "LRD", "Lorad" ) ); + ManufacturerTable.push_back( MANUFACTURER( "LSE", "Littlemore Scientific Engineering" ) ); + ManufacturerTable.push_back( MANUFACTURER( "LSP", "Laser Plot, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "LTF", "Littlefuse, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "LWR", "Lowrance Electronics Corportation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MCL", "Micrologic, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "MDL", "Medallion Instruments, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "MEC", "Marine Engine Center, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "MEG", "Maritec Engineering GmbH" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MFR", "Modern Products, Limited" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MFW", "Frank W. Murphy Manufacturing" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MGM", "Magellan Systems Corporation" ) ); // Thanks to Chuck Shannon, cshannon@imtn.tpd.dsccc.com + ManufacturerTable.push_back( MANUFACTURER( "MGS", "MG Electronic Sales Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MIE", "Mieco, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "MIM", "Marconi International Marine Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MLE", "Martha Lake Electronics" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MLN", "Matlin Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MLP", "Marlin Products" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MLT", "Miller Technologies" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MMB", "Marsh-McBirney, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "MME", "Marks Marine Engineering" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MMP", "Metal Marine Pilot, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "MMS", "Mars Marine Systems" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MNI", "Micro-Now Instrument Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MNT", "Marine Technology" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MNX", "Marinex" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MOT", "Motorola Communications and Electronics" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MPN", "Memphis Net and Twine Company, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "MQS", "Marquis Industries, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "MRC", "Marinecomp, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "MRE", "Morad Electronics Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MRP", "Mooring Products of New England" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MRR", "II Morrow, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "MRS", "Marine Radio Service" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MSB", "Mitsubishi Electric Company, Limited" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MSE", "Master Electronics" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MSM", "Master Mariner, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "MST", "Mesotech Systems, Limited" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MTA", "Marine Technical Associates" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MTG", "Narine Technical Assistance Group" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MTK", "Martech, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "MTR", "Mitre Corporation, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "MTS", "Mets, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "MUR", "Murata Erie North America" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MVX", "Magnavox Advanced Products and Systems Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MXX", "Maxxima Marine" ) ); + ManufacturerTable.push_back( MANUFACTURER( "MES", "Marine Electronics Service, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "NAT", "Nautech, Limited" ) ); + ManufacturerTable.push_back( MANUFACTURER( "NEF", "New England Fishing Gear, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "NMR", "Newmar" ) ); + ManufacturerTable.push_back( MANUFACTURER( "NGS", "Navigation Sciences, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "NOM", "Nav-Com, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "NOV", "NovAtel Communications, Limited" ) ); + ManufacturerTable.push_back( MANUFACTURER( "NSM", "Northstar Marine" ) ); + ManufacturerTable.push_back( MANUFACTURER( "NTK", "Novatech Designs, Limited" ) ); + ManufacturerTable.push_back( MANUFACTURER( "NVC", "Navico" ) ); + ManufacturerTable.push_back( MANUFACTURER( "NVS", "Navstar" ) ); + ManufacturerTable.push_back( MANUFACTURER( "NVO", "Navionics, s.p.a." ) ); + ManufacturerTable.push_back( MANUFACTURER( "OAR", "O.A.R. Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "ODE", "Ocean Data Equipment Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "ODN", "Odin Electronics, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "OIN", "Ocean instruments, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "OKI", "Oki Electronic Industry Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "OLY", "Navstar Limited (Polytechnic Electronics)" ) ); + ManufacturerTable.push_back( MANUFACTURER( "OMN", "Omnetics" ) ); + ManufacturerTable.push_back( MANUFACTURER( "ORE", "Ocean Research" ) ); + ManufacturerTable.push_back( MANUFACTURER( "OTK", "Ocean Technology" ) ); + ManufacturerTable.push_back( MANUFACTURER( "PCE", "Pace" ) ); + ManufacturerTable.push_back( MANUFACTURER( "PDM", "Prodelco Marine Systems" ) ); + ManufacturerTable.push_back( MANUFACTURER( "PLA", "Plath, C. Division of Litton" ) ); + ManufacturerTable.push_back( MANUFACTURER( "PLI", "Pilot Instruments" ) ); + ManufacturerTable.push_back( MANUFACTURER( "PMI", "Pernicka Marine Products" ) ); + ManufacturerTable.push_back( MANUFACTURER( "PMP", "Pacific Marine Products" ) ); + ManufacturerTable.push_back( MANUFACTURER( "PRK", "Perko, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "PSM", "Pearce-Simpson" ) ); + ManufacturerTable.push_back( MANUFACTURER( "PTC", "Petro-Com" ) ); + ManufacturerTable.push_back( MANUFACTURER( "PTG", "P.T.I./Guest" ) ); + ManufacturerTable.push_back( MANUFACTURER( "PTH", "Pathcom, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "RAC", "Racal Marine, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "RAE", "RCA Astro-Electronics" ) ); + ManufacturerTable.push_back( MANUFACTURER( "RAY", "Raytheon Marine Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "RCA", "RCA Service Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "RCH", "Roach Engineering" ) ); + ManufacturerTable.push_back( MANUFACTURER( "RCI", "Rochester Instruments, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "RDI", "Radar Devices" ) ); + ManufacturerTable.push_back( MANUFACTURER( "RDM", "Ray-Dar Manufacturing Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "REC", "Ross Engineering Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "RFP", "Rolfite Products, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "RGC", "RCS Global Communications, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "RGY", "Regency Electronics, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "RMR", "RCA Missile and Surface Radar" ) ); + ManufacturerTable.push_back( MANUFACTURER( "RSL", "Ross Laboratories, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "RSM", "Robertson-Shipmate, USA" ) ); + ManufacturerTable.push_back( MANUFACTURER( "RWI", "Rockwell International" ) ); + ManufacturerTable.push_back( MANUFACTURER( "RME", "Racal Marine Electronics" ) ); + ManufacturerTable.push_back( MANUFACTURER( "RTN", "Robertson Tritech Nyaskaien A/S" ) ); + ManufacturerTable.push_back( MANUFACTURER( "SAI", "SAIT, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "SBR", "Sea-Bird electronics, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "SCR", "Signalcrafters, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "SEA", "SEA" ) ); + ManufacturerTable.push_back( MANUFACTURER( "SEC", "Sercel Electronics of Canada" ) ); + ManufacturerTable.push_back( MANUFACTURER( "SEP", "Steel and Engine Products, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "SFN", "Seafarer Navigation International, Limited" ) ); + ManufacturerTable.push_back( MANUFACTURER( "SGC", "SGC, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "SIG", "Signet, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "SIM", "Simrad,Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "SKA", "Skantek Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "SKP", "Skipper Electronics A/S" ) ); + ManufacturerTable.push_back( MANUFACTURER( "SME", "Shakespeare Marine Electronics" ) ); + ManufacturerTable.push_back( MANUFACTURER( "SMF", "Seattle Marine and Fishing Supply Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "SML", "Simerl Instruments" ) ); + ManufacturerTable.push_back( MANUFACTURER( "SMI", "Sperry Marine, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "SNV", "Starnav Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "SOM", "Sound Marine Electronics, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "SOV", "Sell Overseas America" ) ); + ManufacturerTable.push_back( MANUFACTURER( "SPL", "Spelmar" ) ); + ManufacturerTable.push_back( MANUFACTURER( "SPT", "Sound Powered Telephone" ) ); + ManufacturerTable.push_back( MANUFACTURER( "SRD", "SRD Labs" ) ); + ManufacturerTable.push_back( MANUFACTURER( "SRS", "Scientific Radio Systems, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "SRT", "Standard Radio and Telefon AB" ) ); + ManufacturerTable.push_back( MANUFACTURER( "SSI", "Sea Scout Industries" ) ); + ManufacturerTable.push_back( MANUFACTURER( "STC", "Standard Communications" ) ); + ManufacturerTable.push_back( MANUFACTURER( "STI", "Sea-Temp Instrument Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "STM", "Si-Tex Marine Electronics" ) ); + ManufacturerTable.push_back( MANUFACTURER( "SVY", "Savoy Electronics" ) ); + ManufacturerTable.push_back( MANUFACTURER( "SWI", "Swoffer Marine Instruments, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "SRS", "Shipmate, Rauff & Sorensen, A/S" ) ); + ManufacturerTable.push_back( MANUFACTURER( "TBB", "Thompson Brothers Boat Manufacturing Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "TCN", "Trade Commission of Norway (THE)" ) ); + ManufacturerTable.push_back( MANUFACTURER( "TDL", "Tideland Signal" ) ); + ManufacturerTable.push_back( MANUFACTURER( "THR", "Thrane and Thrane A/A" ) ); + ManufacturerTable.push_back( MANUFACTURER( "TLS", "Telesystems" ) ); + ManufacturerTable.push_back( MANUFACTURER( "TMT", "Tamtech, Limited" ) ); + ManufacturerTable.push_back( MANUFACTURER( "TNL", "Trimble Navigation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "TRC", "Tracor, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "TSI", "Techsonic Industries, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "TTK", "Talon Technology Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "TTS", "Transtector Systems" ) ); + ManufacturerTable.push_back( MANUFACTURER( "TWC", "Transworld Communications, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "TXI", "Texas Instruments, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "UME", "Umec" ) ); + ManufacturerTable.push_back( MANUFACTURER( "UNI", "Uniden Corporation of America" ) ); + ManufacturerTable.push_back( MANUFACTURER( "UNP", "Unipas, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "UNF", "Uniforce Electronics Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "VAN", "Vanner, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "VAR", "Varian Eimac Associates" ) ); + ManufacturerTable.push_back( MANUFACTURER( "VCM", "Videocom" ) ); + ManufacturerTable.push_back( MANUFACTURER( "VEX", "Vexillar" ) ); + ManufacturerTable.push_back( MANUFACTURER( "VIS", "Vessel Information Systems, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "VMR", "Vast Marketing Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "WAL", "Walport USA" ) ); + ManufacturerTable.push_back( MANUFACTURER( "WBG", "Westberg Manufacturing, Inc." ) ); + ManufacturerTable.push_back( MANUFACTURER( "WEC", "Westinghouse electric Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "WHA", "W-H Autopilots" ) ); + ManufacturerTable.push_back( MANUFACTURER( "WMM", "Wait Manufacturing and Marine Sales Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "WMR", "Wesmar Electronics" ) ); + ManufacturerTable.push_back( MANUFACTURER( "WNG", "Winegard Company" ) ); + ManufacturerTable.push_back( MANUFACTURER( "WSE", "Wilson Electronics Corporation" ) ); + ManufacturerTable.push_back( MANUFACTURER( "WTC", "Watercom" ) ); + ManufacturerTable.push_back( MANUFACTURER( "WST", "West Electronics Limited" ) ); + ManufacturerTable.push_back( MANUFACTURER( "YAS", "Yaesu Electronics" ) ); + + std::sort(ManufacturerTable.begin(), ManufacturerTable.end(), is_less_than); +} + +const std::string& MANUFACTURER_LIST::Find( const std::string& mnemonic ) +{ + static std::string return_value; + + return_value.clear(); + + /* + ** Check to see if the list has been filled + */ + + if ( ManufacturerTable.size() == 0 ) + { + Fill(); + } + + MANUFACTURER needle(mnemonic.c_str(), ""); + + std::vector::iterator iterator = std::lower_bound(ManufacturerTable.begin(), ManufacturerTable.end(), needle, is_less_than); + + if (iterator != ManufacturerTable.end() && iterator->Mnemonic.compare( mnemonic ) == 0) + { + return_value = iterator->CompanyName; + } + + return( return_value ); +} + +const std::string& MANUFACTURER_LIST::operator [] ( const char *mnemonic ) +{ + return( Find( mnemonic ) ); +} diff --git a/MLIST.HPP b/MLIST.HPP new file mode 100644 index 0000000..2e9f901 --- /dev/null +++ b/MLIST.HPP @@ -0,0 +1,63 @@ +#if ! defined( MANUFACTURER_LIST_CLASS_HEADER ) + +#define MANUFACTURER_LIST_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class MANUFACTURER_LIST +{ + public: + + MANUFACTURER_LIST(); + virtual ~MANUFACTURER_LIST(); + + /* + ** Data + */ + + std::vector ManufacturerTable; + + /* + ** Methods + */ + + virtual void Empty( void ); + virtual void Fill( void ); + virtual const std::string& Find( const std::string& mnemonic ); + + /* + ** Operators + */ + + virtual const std::string& operator [] ( const char *mnemonic ); +}; + +#endif // MANUFACTURER_LIST_CLASS_HEADER diff --git a/MTA.CPP b/MTA.CPP new file mode 100644 index 0000000..fc28d3b --- /dev/null +++ b/MTA.CPP @@ -0,0 +1,131 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** XDR is recommended. +*/ + +#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 + +MTA::MTA() +{ + Mnemonic = "MTA"; + Empty(); +} + +MTA::~MTA() +{ + Mnemonic.clear(); + Empty(); +} + +void MTA::Empty(void) +{ + Temperature = 0.0; + UnitOfMeasurement.clear(); +} + +bool MTA::Parse(const SENTENCE& sentence) +{ + /* + ** MTA - Air Temperature + ** + ** 1 2 3 + ** | | | + ** $--MTA,x.x,C*hh + ** + ** Field Number: + ** 1) Degrees + ** 2) Unit of Measurement, Celcius + ** 3) Checksum + */ + + /* + ** First we check the checksum... + */ + + if (sentence.IsChecksumBad(3) == True) + { + SetErrorMessage("Invalid Checksum"); + return(false); + } + + Temperature = sentence.Double(1); + UnitOfMeasurement = sentence.Field(2); + + return(true); +} + +std::string MTA::PlainEnglish(void) const +{ + std::string return_string("The air temperature is "); + + char temp_string[65]; + + sprintf(temp_string, "%3.1lf ", Temperature); + + return_string += temp_string; + return_string += UnitOfMeasurement; + return_string += "."; + + return(return_string); +} + +bool MTA::Write(SENTENCE& sentence) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write(sentence); + + sentence += Temperature; + sentence += UnitOfMeasurement; + + sentence.Finish(); + + return(true); +} + +const MTA& MTA::operator = (const MTA& source) +{ + Temperature = source.Temperature; + UnitOfMeasurement = source.UnitOfMeasurement; + + return(*this); +} diff --git a/MTA.HPP b/MTA.HPP new file mode 100644 index 0000000..f99e9d1 --- /dev/null +++ b/MTA.HPP @@ -0,0 +1,70 @@ +#if ! defined( MTA_CLASS_HEADER ) + +#define MTA_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** ZDA is recommended. +*/ + +class MTA : public RESPONSE +{ + public: + + MTA(); + virtual ~MTA(); + + /* + ** Data + */ + + double Temperature; + std::string UnitOfMeasurement; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual std::string PlainEnglish( void ) const override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const MTA& operator = ( const MTA& source ); +}; + +#endif // MTA_CLASS_HEADER diff --git a/MTW.CPP b/MTW.CPP new file mode 100644 index 0000000..bdc1735 --- /dev/null +++ b/MTW.CPP @@ -0,0 +1,126 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +MTW::MTW() +{ + Mnemonic = "MTW"; + Empty(); +} + +MTW::~MTW() +{ + Mnemonic.clear(); + Empty(); +} + +void MTW::Empty( void ) +{ + Temperature = 0.0; + UnitOfMeasurement.clear(); +} + +bool MTW::Parse( const SENTENCE& sentence ) +{ + /* + ** MTW - Water Temperature + ** + ** 1 2 3 + ** | | | + ** $--MTW,x.x,C*hh + ** + ** Field Number: + ** 1) Degrees + ** 2) Unit of Measurement, Celcius + ** 3) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 3 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + Temperature = sentence.Double( 1 ); + UnitOfMeasurement = sentence.Field( 2 ); + + return( true ); +} + +std::string MTW::PlainEnglish( void ) const +{ + std::string return_string("The water temperature is "); + + char temp_string[65]; + + sprintf( temp_string, "%3.1lf ", Temperature ); + + return_string += temp_string; + return_string += UnitOfMeasurement; + return_string += "."; + + return( return_string ); +} + +bool MTW::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += Temperature; + sentence += UnitOfMeasurement; + + sentence.Finish(); + + return( true ); +} + +const MTW& MTW::operator = ( const MTW& source ) +{ + Temperature = source.Temperature; + UnitOfMeasurement = source.UnitOfMeasurement; + + return( *this ); +} diff --git a/MTW.HPP b/MTW.HPP new file mode 100644 index 0000000..e96808a --- /dev/null +++ b/MTW.HPP @@ -0,0 +1,65 @@ +#if ! defined( MTW_CLASS_HEADER ) + +#define MTW_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class MTW : public RESPONSE +{ + public: + + MTW(); + virtual ~MTW(); + + /* + ** Data + */ + + double Temperature; + std::string UnitOfMeasurement; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual std::string PlainEnglish( void ) const override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const MTW& operator = ( const MTW& source ); +}; + +#endif // MTW_CLASS_HEADER diff --git a/MWV.CPP b/MWV.CPP new file mode 100644 index 0000000..e3aeae5 --- /dev/null +++ b/MWV.CPP @@ -0,0 +1,126 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +MWV::MWV() +{ + Mnemonic = "MWV"; + Empty(); +} + +MWV::~MWV() +{ + Mnemonic.clear(); + Empty(); +} + +void MWV::Empty( void ) +{ + WindAngle = 0.0; + Reference.clear(); + WindSpeed = 0.0; + WindSpeedUnits.clear(); + IsDataValid = NMEA_Unknown; +} + +bool MWV::Parse( const SENTENCE& sentence ) +{ + /* + ** MWV - Wind Speed and Angle + ** + ** 1 2 3 4 5 + ** | | | | | + ** $--MWV,x.x,a,x.x,a*hh + ** + ** Field Number: + ** 1) Wind Angle, 0 to 360 degrees + ** 2) Reference, R = Relative, T = True + ** 3) Wind Speed + ** 4) Wind Speed Units, K/M/N + ** 5) Status, A = Data Valid + ** 6) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 6 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + WindAngle = sentence.Double( 1 ); + Reference = sentence.Field( 2 ); + WindSpeed = sentence.Double( 3 ); + WindSpeedUnits = sentence.Field( 4 ); + IsDataValid = sentence.Boolean( 5 ); + + return( false ); +} + +bool MWV::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += WindAngle; + sentence += Reference; + sentence += WindSpeed; + sentence += WindSpeedUnits; + sentence += IsDataValid; + + sentence.Finish(); + + return( true ); +} + +const MWV& MWV::operator = ( const MWV& source ) +{ + WindAngle = source.WindAngle; + Reference = source.Reference; + WindSpeed = source.WindSpeed; + WindSpeedUnits = source.WindSpeedUnits; + IsDataValid = source.IsDataValid; + + return( *this ); +} diff --git a/MWV.HPP b/MWV.HPP new file mode 100644 index 0000000..390484a --- /dev/null +++ b/MWV.HPP @@ -0,0 +1,67 @@ +#if ! defined( MWV_CLASS_HEADER ) + +#define MWV_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class MWV : public RESPONSE +{ + public: + + MWV(); + virtual ~MWV(); + + /* + ** Data + */ + + double WindAngle; + std::string Reference; + double WindSpeed; + std::string WindSpeedUnits; + NMEA0183_BOOLEAN IsDataValid; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const MWV& operator = ( const MWV& source ); +}; + +#endif // MWV_CLASS_HEADER diff --git a/NMEA0183.CPP b/NMEA0183.CPP new file mode 100644 index 0000000..bb680e8 --- /dev/null +++ b/NMEA0183.CPP @@ -0,0 +1,303 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +static bool is_less_than(__in const RESPONSE * left, __in const RESPONSE * right) +{ + return(left->Mnemonic < right->Mnemonic); +} + +NMEA0183::NMEA0183() +{ + m_Initialize(); + + m_ResponseTable.push_back( (RESPONSE *) &Aam ); + m_ResponseTable.push_back( (RESPONSE *) &Alm ); + m_ResponseTable.push_back( (RESPONSE *) &Apb ); + m_ResponseTable.push_back( (RESPONSE *) &Asd ); + m_ResponseTable.push_back( (RESPONSE *) &Bec ); + m_ResponseTable.push_back( (RESPONSE *) &Bod ); + m_ResponseTable.push_back( (RESPONSE *) &Bwc ); + m_ResponseTable.push_back( (RESPONSE *) &Bwr ); + m_ResponseTable.push_back( (RESPONSE *) &Bww ); + m_ResponseTable.push_back( (RESPONSE *) &Dbt ); + m_ResponseTable.push_back( (RESPONSE *) &Dcn ); + m_ResponseTable.push_back( (RESPONSE *) &Dpt ); + m_ResponseTable.push_back( (RESPONSE *) &Fsi ); + m_ResponseTable.push_back( (RESPONSE *) &Gda ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Gdf ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Gdp ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Gga ); + m_ResponseTable.push_back( (RESPONSE *) &Gla ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Glc ); + m_ResponseTable.push_back( (RESPONSE *) &Glf ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Gll ); + m_ResponseTable.push_back( (RESPONSE *) &Glp ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Gsa ); + m_ResponseTable.push_back( (RESPONSE *) &Gsv ); + m_ResponseTable.push_back( (RESPONSE *) &Gtd ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Gxa ); + m_ResponseTable.push_back( (RESPONSE *) &Gxf ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Gxp ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Hcc ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Hdg ); + m_ResponseTable.push_back( (RESPONSE *) &Hdm ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Hdt ); + m_ResponseTable.push_back( (RESPONSE *) &Hsc ); + m_ResponseTable.push_back( (RESPONSE *) &Ima ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Lcd ); + m_ResponseTable.push_back( (RESPONSE *) &Mhu ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Mta ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Mtw ); + m_ResponseTable.push_back( (RESPONSE *) &Mwv ); + m_ResponseTable.push_back( (RESPONSE *) &Oln ); + m_ResponseTable.push_back( (RESPONSE *) &Osd ); + m_ResponseTable.push_back( (RESPONSE *) &Proprietary ); + m_ResponseTable.push_back( (RESPONSE *) &Rma ); + m_ResponseTable.push_back( (RESPONSE *) &Rmb ); + m_ResponseTable.push_back( (RESPONSE *) &Rmc ); + m_ResponseTable.push_back( (RESPONSE *) &Rot ); + m_ResponseTable.push_back( (RESPONSE *) &Rpm ); + m_ResponseTable.push_back( (RESPONSE *) &Rsa ); + m_ResponseTable.push_back( (RESPONSE *) &Rsd ); + m_ResponseTable.push_back( (RESPONSE *) &Rte ); + m_ResponseTable.push_back( (RESPONSE *) &Sfi ); + m_ResponseTable.push_back( (RESPONSE *) &Stn ); + m_ResponseTable.push_back( (RESPONSE *) &Tep ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Trf ); + m_ResponseTable.push_back( (RESPONSE *) &Ttm ); + m_ResponseTable.push_back( (RESPONSE *) &Vbw ); + m_ResponseTable.push_back( (RESPONSE *) &Vhw ); + m_ResponseTable.push_back( (RESPONSE *) &Vdr ); + m_ResponseTable.push_back( (RESPONSE *) &Vlw ); + m_ResponseTable.push_back( (RESPONSE *) &Vpw ); + m_ResponseTable.push_back( (RESPONSE *) &Vtg ); + m_ResponseTable.push_back( (RESPONSE *) &Vwe ); + m_ResponseTable.push_back( (RESPONSE *) &Wcv ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Wdc ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Wdr ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Wnc ); + m_ResponseTable.push_back( (RESPONSE *) &Wpl ); + m_ResponseTable.push_back( (RESPONSE *) &Xdr ); + m_ResponseTable.push_back( (RESPONSE *) &Xte ); + m_ResponseTable.push_back( (RESPONSE *) &Xtr ); + m_ResponseTable.push_back( (RESPONSE *) &Zda ); + m_ResponseTable.push_back( (RESPONSE *) &Zfi ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Zfo ); + m_ResponseTable.push_back( (RESPONSE *) &Zlz ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Zpi ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Zta ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Zte ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Ztg ); + m_ResponseTable.push_back( (RESPONSE *) &Zti ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Zwp ); // Sentence Not Recommended For New Designs + m_ResponseTable.push_back( (RESPONSE *) &Zzu ); // Sentence Not Recommended For New Designs + + std::sort(m_ResponseTable.begin(), m_ResponseTable.end(), is_less_than); + + m_SetContainerPointers(); +} + +NMEA0183::~NMEA0183() +{ + m_Initialize(); +} + +void NMEA0183::m_Initialize( void ) +{ + ErrorMessage.clear(); +} + +void NMEA0183::m_SetContainerPointers( void ) +{ + size_t index = 0; + const size_t number_of_entries_in_table = m_ResponseTable.size(); + + while( index < number_of_entries_in_table ) + { + m_ResponseTable[ index ]->SetContainer( this ); + + index++; + } +} + +/* +** Public Interface +*/ + +bool NMEA0183::IsGood( void ) const +{ + /* + ** NMEA 0183 sentences begin with $ and and with CR LF + */ + + if ( m_Sentence.Sentence[ 0 ] != '$' ) + { + return( false ); + } + + /* + ** Next to last character must be a CR + */ + + if ( m_Sentence.Sentence[ m_Sentence.Sentence.length() - 2 ] != CARRIAGE_RETURN ) + { + return( false ); + } + + if ( m_Sentence.Sentence[m_Sentence.Sentence.length() - 1 ] != LINE_FEED ) + { + return( false ); + } + + return( true ); +} + +bool NMEA0183::Parse( void ) +{ + bool return_value = false; + + if (IsGood()) + { + std::string mnemonic = m_Sentence.Field(0); + + /* + ** See if this is a proprietary field + */ + + if (mnemonic[0] == 'P') + { + mnemonic = "P"; + } + else + { + mnemonic = mnemonic.substr(mnemonic.length() - 3, 3); + } + + /* + ** Set up our default error message + */ + + ErrorMessage = mnemonic; + ErrorMessage += " is an unknown type of sentence"; + + LastSentenceIDReceived = mnemonic; + + /* + ** Do a Binary Search to call the appropriate function + */ + + GLA needle; + + needle.Mnemonic = mnemonic; + + std::vector::iterator iterator = std::lower_bound(m_ResponseTable.begin(), m_ResponseTable.end(), &needle, is_less_than); + + if (iterator != m_ResponseTable.end() && (*iterator)->Mnemonic.compare(mnemonic) == 0) + { + return_value = (*iterator)->Parse(m_Sentence); + + /* + ** Set your ErrorMessage + */ + + if (return_value == true) + { + /* + ** Now that we sucessfully parsed a sentence, record stuff *about* the transaction + */ + + ErrorMessage = "No Error"; + LastSentenceIDParsed = (*iterator)->Mnemonic; + TalkerID = talker_id(m_Sentence); + ExpandedTalkerID = expand_talker_id(TalkerID); + PlainText = (*iterator)->PlainEnglish(); + } + else + { + ErrorMessage = (*iterator)->ErrorMessage; + } + } + else + { + return_value = false; + } + } + + return( return_value ); +} + +void NMEA0183::SetSentence(const char *source) +{ + m_Sentence = source; +} + +void NMEA0183::GetSentence(std::string& destination) const +{ + destination = m_Sentence; +} + +NMEA0183& NMEA0183::operator << ( const char *source ) +{ + SetSentence(source); + return( *this ); +} + +NMEA0183& NMEA0183::operator >> ( std::string& destination ) +{ + GetSentence(destination); + return( *this ); +} + +time_t ctime(const int year, const int month, const int day, const int hour, const int minute, const int second) +{ + struct tm gtime; + + gtime.tm_sec = second; + gtime.tm_min = minute; + gtime.tm_hour = hour; + gtime.tm_mday = day; + gtime.tm_mon = month; + gtime.tm_year = year - 1900; + gtime.tm_wday = 0; + gtime.tm_yday = 0; + gtime.tm_isdst = 0; + + return(_mkgmtime(>ime)); +} + diff --git a/NMEA0183.H b/NMEA0183.H new file mode 100644 index 0000000..e054724 --- /dev/null +++ b/NMEA0183.H @@ -0,0 +1,145 @@ +#if ! defined( NMEA_0183_HEADER ) + +#define NMEA_0183_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** Now include the math stuff for some calculations in the COORDINATE class +*/ + +#define _CRT_SECURE_NO_WARNINGS +#include +#include +#include +#include +#include + +/* +** Turn off the warning about precompiled headers, it is rather annoying +*/ + +#pragma warning( disable : 4699 ) + +#if ! defined( CARRIAGE_RETURN ) +#define CARRIAGE_RETURN (0x0D) +#endif + +#if ! defined( LINE_FEED ) +#define LINE_FEED (0x0A) +#endif + +typedef enum _NMEA0183_BOOLEAN +{ + NMEA_Unknown = 0, + True, + False +} NMEA0183_BOOLEAN; + +typedef enum _leftright +{ + LR_Unknown = 0, + Left, + Right +} LEFTRIGHT; + +typedef enum _eastwest +{ + EW_Unknown = 0, + East, + West +} EASTWEST; + +typedef enum +{ + NS_Unknown = 0, + North, + South +} NORTHSOUTH; + +typedef enum +{ + ReferenceUnknown = 0, + BottomTrackingLog, + ManuallyEntered, + WaterReferenced, + RadarTrackingOfFixedTarget, + PositioningSystemGroundReference +} REFERENCE; + +typedef enum +{ + CommunicationsModeUnknown = 0, + F3E_G3E_SimplexTelephone = 'd', + F3E_G3E_DuplexTelephone = 'e', + J3E_Telephone = 'm', + H3E_Telephone = 'o', + F1B_J2B_FEC_NBDP_TelexTeleprinter = 'q', + F1B_J2B_ARQ_NBDP_TelexTeleprinter = 's', + F1B_J2B_ReceiveOnlyTeleprinterDSC = 'w', + A1A_MorseTapeRecorder = 'x', + A1A_MorseKeyHeadset = '{', + F1C_F2C_F3C_FaxMachine = '|' +} COMMUNICATIONS_MODE; + +typedef enum +{ + TransducerUnknown = 0, + AngularDisplacementTransducer = 'A', + TemperatureTransducer = 'C', + LinearDisplacementTransducer = 'D', + FrequencyTransducer = 'F', + HumidityTransducer = 'H', + ForceTransducer = 'N', + PressureTransducer = 'P', + FlowRateTransducer = 'R', + TachometerTransducer = 'T', + VolumeTransducer = 'V' +} TRANSDUCER_TYPE; + +/* +** Misc Function Prototypes +*/ + +uint32_t HexValue( const char *hex_string ); +inline uint32_t HexValue(const std::string& hex_string) +{ + return(HexValue(hex_string.c_str())); +} + +std::string expand_talker_id( const std::string & ); +std::string Hex( const uint32_t value ); +std::string talker_id( const std::string& sentence ); +time_t ctime( const int year, const int month, const int day, const int hour, const int minute, const int second); + +#include "nmea0183.hpp" + +#endif // NMEA0183_HEADER diff --git a/NMEA0183.HPP b/NMEA0183.HPP new file mode 100644 index 0000000..e686d66 --- /dev/null +++ b/NMEA0183.HPP @@ -0,0 +1,267 @@ +#if ! defined( NMEA_0183_CLASS_HEADER ) + +#define NMEA_0183_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** General Purpose Classes +*/ + +#include "Sentence.hpp" +#include "Response.hpp" +#include "LatLong.hpp" +#include "LoranTD.hpp" +#include "Manufact.hpp" +#include "MList.hpp" +#include "OmegaPar.hpp" +#include "DeccaLOP.hpp" +#include "RatioPls.hpp" +#include "RadarDat.hpp" +#include "SatDat.hpp" +#include "FreqMode.hpp" +#include "WayptLoc.hpp" // Sentence Not Recommended For New Designs + +/* +** Response Classes +*/ + +#include "AAM.hpp" +#include "ALM.hpp" +#include "APB.hpp" +#include "ASD.hpp" +#include "BEC.hpp" +#include "BOD.hpp" +#include "BWC.hpp" +#include "BWR.hpp" +#include "BWW.hpp" +#include "DBT.hpp" +#include "DCN.hpp" +#include "DPT.hpp" +#include "FSI.hpp" +#include "GDA.hpp" // Sentence Not Recommended For New Designs +#include "GDF.hpp" // Sentence Not Recommended For New Designs +#include "GDP.hpp" // Sentence Not Recommended For New Designs +#include "GGA.hpp" +#include "GLA.hpp" // Sentence Not Recommended For New Designs +#include "GLC.hpp" +#include "GLF.hpp" // Sentence Not Recommended For New Designs +#include "GLL.hpp" +#include "GLP.hpp" // Sentence Not Recommended For New Designs +#include "GOA.hpp" // Sentence Not Recommended For New Designs +#include "GOF.hpp" // Sentence Not Recommended For New Designs +#include "GOP.hpp" // Sentence Not Recommended For New Designs +#include "GSA.hpp" +#include "GSV.hpp" +#include "GTD.hpp" // Sentence Not Recommended For New Designs +#include "GXA.hpp" +#include "GXF.hpp" // Sentence Not Recommended For New Designs +#include "GXP.hpp" // Sentence Not Recommended For New Designs +#include "HCC.hpp" // Sentence Not Recommended For New Designs +#include "HDG.hpp" +#include "HDM.hpp" // Sentence Not Recommended For New Designs +#include "HDT.hpp" +#include "HSC.hpp" +#include "IMA.hpp" // Sentence Not Recommended For New Designs +#include "LCD.hpp" +#include "MHU.hpp" // Sentence Not Recommended For New Designs +#include "MTA.hpp" // Sentence Not Recommended For New Designs +#include "MTW.hpp" +#include "MWV.hpp" +#include "OLN.hpp" +#include "OSD.hpp" +#include "P.hpp" +#include "RMA.hpp" +#include "RMB.hpp" +#include "RMC.hpp" +#include "ROT.hpp" +#include "RPM.hpp" +#include "RSA.hpp" +#include "RSD.hpp" +#include "RTE.hpp" +#include "SFI.hpp" +#include "STN.hpp" +#include "TEP.hpp" // Sentence Not Recommended For New Designs +#include "TRF.hpp" +#include "TTM.hpp" +#include "VBW.hpp" +#include "VDR.hpp" +#include "VHW.hpp" +#include "VLW.hpp" +#include "VPW.hpp" +#include "VTG.hpp" +#include "VWE.hpp" // Sentence Not Recommended For New Designs +#include "WCV.hpp" +#include "WDC.hpp" // Sentence Not Recommended For New Designs +#include "WDR.hpp" // Sentence Not Recommended For New Designs +#include "WNC.hpp" +#include "WPL.hpp" +#include "XDR.hpp" +#include "XTE.hpp" +#include "XTR.hpp" +#include "ZDA.hpp" +#include "ZFI.hpp" // Sentence Not Recommended For New Designs +#include "ZFO.hpp" +#include "ZLZ.hpp" // Sentence Not Recommended For New Designs +#include "ZPI.hpp" // Sentence Not Recommended For New Designs +#include "ZTA.hpp" // Sentence Not Recommended For New Designs +#include "ZTE.hpp" // Sentence Not Recommended For New Designs +#include "ZTG.hpp" +#include "ZTI.hpp" // Sentence Not Recommended For New Designs +#include "ZWP.hpp" // Sentence Not Recommended For New Designs +#include "ZZU.hpp" // Sentence Not Recommended For New Designs + +class NMEA0183 +{ + private: + + SENTENCE m_Sentence; + + void m_Initialize( void ); + + protected: + + std::vector m_ResponseTable; + + void m_SetContainerPointers( void ); + + public: + + NMEA0183(); + virtual ~NMEA0183(); + + /* + ** NMEA 0183 Sentences we understand + */ + + AAM Aam; + ALM Alm; + APB Apb; + ASD Asd; + BEC Bec; + BOD Bod; + BWC Bwc; + BWR Bwr; + BWW Bww; + DBT Dbt; + DCN Dcn; + DPT Dpt; + FSI Fsi; + GDA Gda; // Sentence Not Recommended For New Designs + GDF Gdf; // Sentence Not Recommended For New Designs + GDP Gdp; // Sentence Not Recommended For New Designs + GGA Gga; + GLA Gla; // Sentence Not Recommended For New Designs + GLC Glc; + GLF Glf; // Sentence Not Recommended For New Designs + GLL Gll; + GLP Glp; // Sentence Not Recommended For New Designs + GOA Goa; // Sentence Not Recommended For New Designs + GOF Gof; // Sentence Not Recommended For New Designs + GOP Gop; // Sentence Not Recommended For New Designs + GSA Gsa; + GSV Gsv; + GTD Gtd; // Sentence Not Recommended For New Designs + GXA Gxa; + GXF Gxf; // Sentence Not Recommended For New Designs + GXP Gxp; // Sentence Not Recommended For New Designs + HCC Hcc; // Sentence Not Recommended For New Designs + HDG Hdg; + HDM Hdm; // Sentence Not Recommended For New Designs + HDT Hdt; + HSC Hsc; + IMA Ima; // Sentence Not Recommended For New Designs + LCD Lcd; + MHU Mhu; // Sentence Not Recommended For New Designs + MTA Mta; // Sentence Not Recommended For New Designs + MTW Mtw; + MWV Mwv; + OLN Oln; + OSD Osd; + P Proprietary; + RMA Rma; + RMB Rmb; + RMC Rmc; + ROT Rot; + RPM Rpm; + RSA Rsa; + RSD Rsd; + RTE Rte; + SFI Sfi; + STN Stn; + TEP Tep; // Sentence Not Recommended For New Designs + TRF Trf; + TTM Ttm; + VBW Vbw; + VDR Vdr; + VHW Vhw; + VLW Vlw; + VPW Vpw; + VTG Vtg; + VWE Vwe; // Sentence Not Recommended For New Designs + WCV Wcv; + WDC Wdc; // Sentence Not Recommended For New Designs + WDR Wdr; // Sentence Not Recommended For New Designs + WNC Wnc; + WPL Wpl; + XDR Xdr; + XTE Xte; + XTR Xtr; + ZDA Zda; + ZFI Zfi; // Sentence Not Recommended For New Designs + ZFO Zfo; + ZLZ Zlz; // Sentence Not Recommended For New Designs + ZPI Zpi; // Sentence Not Recommended For New Designs + ZTA Zta; // Sentence Not Recommended For New Designs + ZTE Zte; // Sentence Not Recommended For New Designs + ZTI Zti; // Sentence Not Recommended For New Designs + ZTG Ztg; + ZWP Zwp; // Sentence Not Recommended For New Designs + ZZU Zzu; // Sentence Not Recommended For New Designs + + std::string ErrorMessage; // Filled when Parse returns FALSE + std::string LastSentenceIDParsed; // ID of the lst sentence successfully parsed + std::string LastSentenceIDReceived; // ID of the last sentence received, may not have parsed successfully + std::string PlainText; // A human-readable string of text that explains what just happened + + std::string TalkerID; + std::string ExpandedTalkerID; + + virtual bool IsGood( void ) const; + virtual bool Parse( void ); + virtual void SetSentence(const char * source); + virtual void GetSentence(std::string& destination) const; + + NMEA0183& operator << ( const char *source ); + NMEA0183& operator >> ( std::string& destination ); +}; + +#endif // NMEA_0183_CLASS_HEADER diff --git a/NMEA0183.sln b/NMEA0183.sln new file mode 100644 index 0000000..e3da6ec --- /dev/null +++ b/NMEA0183.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NMEA0183", "NMEA0183.vcxproj", "{2CAFD3FF-B5D4-48D2-BE8E-A5945C6E70AF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2CAFD3FF-B5D4-48D2-BE8E-A5945C6E70AF}.Debug|x64.ActiveCfg = Debug|x64 + {2CAFD3FF-B5D4-48D2-BE8E-A5945C6E70AF}.Release|x64.ActiveCfg = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/NMEA0183.vcxproj b/NMEA0183.vcxproj new file mode 100644 index 0000000..1a6b449 --- /dev/null +++ b/NMEA0183.vcxproj @@ -0,0 +1,428 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + MFCProj + {2CAFD3FF-B5D4-48D2-BE8E-A5945C6E70AF} + 8.1 + + + + StaticLibrary + v140 + Dynamic + MultiByte + + + StaticLibrary + v140 + Dynamic + MultiByte + + + StaticLibrary + v140 + Dynamic + MultiByte + + + StaticLibrary + v140 + Dynamic + MultiByte + + + + + + + + + + + + + + + + + + + + + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + + + + MultiThreadedDebugDLL + Default + false + Disabled + true + Level4 + EditAndContinue + WIN32;_DEBUG;_WINDOWS;_X86_;%(PreprocessorDefinitions) + $(IntDir) + $(IntDir)$(TargetName).pch + $(IntDir) + $(IntDir)$(ProjectName).pdb + Use + nmea0183.h + + + 0x0409 + _AFXDLL;%(PreprocessorDefinitions) + + + true + .\Debug\NMEA0183.bsc + + + true + $(OutDir)$(TargetName)$(TargetExt) + + + + + MultiThreadedDebugDLL + Default + false + Disabled + true + Level4 + EditAndContinue + WIN32;_DEBUG;_WINDOWS;_X86_;%(PreprocessorDefinitions) + .\Debug\ + $(IntDir)$(TargetName).pch + .\Debug\ + .\Debug\ + Use + nmea0183.h + + + 0x0409 + _AFXDLL;%(PreprocessorDefinitions) + + + true + .\Debug\NMEA0183.bsc + + + true + $(OutDir)$(TargetName)$(TargetExt) + + + + + MultiThreadedDLL + Default + true + true + MaxSpeed + true + Level4 + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + $(IntDir) + $(IntDir)$(TargetName).pch + $(IntDir) + $(IntDir)$(ProjectName).pdb + Use + nmea0183.h + + + 0x0409 + _AFXDLL;%(PreprocessorDefinitions) + + + true + .\Release\NMEA0183.bsc + + + true + $(OutDir)$(TargetName)$(TargetExt) + + + + + MultiThreadedDLL + Default + true + true + MaxSpeed + true + Level4 + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + .\Release\ + $(IntDir)$(TargetName).pch + .\Release\ + .\Release\ + Use + nmea0183.h + + + 0x0409 + _AFXDLL;%(PreprocessorDefinitions) + + + true + .\Release\NMEA0183.bsc + + + true + $(OutDir)$(TargetName)$(TargetExt) + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/NMEA0183.vcxproj.filters b/NMEA0183.vcxproj.filters new file mode 100644 index 0000000..3f215c2 --- /dev/null +++ b/NMEA0183.vcxproj.filters @@ -0,0 +1,630 @@ + + + + + {30e4c22e-fcad-483f-915f-e5e4eceacbeb} + cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90 + + + {ccec6097-368c-4997-849d-fdc862037546} + h;hpp;hxx;hm;inl;fi;fd + + + {3e6f5a2d-c33b-46ff-8a1c-e9886aec8dd5} + ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/NMEA0183.vcxproj.user b/NMEA0183.vcxproj.user new file mode 100644 index 0000000..abe8dd8 --- /dev/null +++ b/NMEA0183.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/OLN.CPP b/OLN.CPP new file mode 100644 index 0000000..78d289d --- /dev/null +++ b/OLN.CPP @@ -0,0 +1,115 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +OLN::OLN() +{ + Mnemonic = "OLN"; + Empty(); +} + +OLN::~OLN() +{ + Mnemonic.clear(); + Empty(); +} + +void OLN::Empty( void ) +{ + Pair1.Empty(); + Pair2.Empty(); + Pair3.Empty(); +} + +bool OLN::Parse( const SENTENCE& sentence ) +{ + /* + ** OLN - Omega Lane Numbers + ** + ** 1 2 3 4 + ** |--------+ |--------+ |--------+ | + ** $--OLN,aa,xxx,xxx,aa,xxx,xxx,aa,xxx,xxx*hh + ** + ** 1) Omega Pair 1 + ** 2) Omega Pair 1 + ** 3) Omega Pair 1 + ** 4) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 10 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + Pair1.Parse( 1, sentence ); + Pair2.Parse( 4, sentence ); + Pair3.Parse( 7, sentence ); + + return( true ); +} + +bool OLN::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + Pair1.Write( sentence ); + Pair2.Write( sentence ); + Pair3.Write( sentence ); + + sentence.Finish(); + + return( true ); +} + +const OLN& OLN::operator = ( const OLN& source ) +{ + Pair1 = source.Pair1; + Pair2 = source.Pair2; + Pair3 = source.Pair3; + + return( *this ); +} diff --git a/OLN.HPP b/OLN.HPP new file mode 100644 index 0000000..d37ca1d --- /dev/null +++ b/OLN.HPP @@ -0,0 +1,65 @@ +#if ! defined( OLN_CLASS_HEADER ) + +#define OLN_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class OLN : public RESPONSE +{ + public: + + OLN(); + virtual ~OLN(); + + /* + ** Data + */ + + OMEGA_PAIR Pair1; + OMEGA_PAIR Pair2; + OMEGA_PAIR Pair3; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const OLN& operator = ( const OLN& source ); +}; + +#endif // OLN_CLASS_HEADER diff --git a/OMEGAPAR.CPP b/OMEGAPAR.CPP new file mode 100644 index 0000000..ccf693b --- /dev/null +++ b/OMEGAPAR.CPP @@ -0,0 +1,78 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +OMEGA_PAIR::OMEGA_PAIR() +{ + Empty(); +} + +OMEGA_PAIR::~OMEGA_PAIR() +{ + Empty(); +} + +void OMEGA_PAIR::Empty( void ) +{ + Name.clear(); + LaneNumber = 0; + CentilaneNumber = 0; +} + +void OMEGA_PAIR::Parse( int first_field_number, const SENTENCE& sentence ) +{ + Name = sentence.Field( first_field_number ); + LaneNumber = sentence.Integer( first_field_number + 1 ); + CentilaneNumber = sentence.Integer( first_field_number + 2 ); +} + +void OMEGA_PAIR::Write( SENTENCE& sentence ) +{ + sentence += Name; + sentence += LaneNumber; + sentence += CentilaneNumber; +} + +const OMEGA_PAIR& OMEGA_PAIR::operator = ( const OMEGA_PAIR& source ) +{ + Name = source.Name; + LaneNumber = source.LaneNumber; + CentilaneNumber = source.CentilaneNumber; + + return( *this ); +} diff --git a/OMEGAPAR.HPP b/OMEGAPAR.HPP new file mode 100644 index 0000000..71e84b3 --- /dev/null +++ b/OMEGAPAR.HPP @@ -0,0 +1,65 @@ +#if ! defined( OMEGA_PAIR_CLASS_HEADER ) + +#define OMEGA_PAIR_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class OMEGA_PAIR +{ + public: + + OMEGA_PAIR(); + virtual ~OMEGA_PAIR(); + + /* + ** Data + */ + + std::string Name; + int LaneNumber; + int CentilaneNumber; + + /* + ** Methods + */ + + virtual void Empty( void ); + virtual void Parse( int field_number, const SENTENCE& sentence ); + virtual void Write( SENTENCE& sentence ); + + /* + ** Operators + */ + + virtual const OMEGA_PAIR& operator = ( const OMEGA_PAIR& source ); +}; + +#endif // OMEGA_PAIR_CLASS_HEADER diff --git a/OSD.CPP b/OSD.CPP new file mode 100644 index 0000000..375c3f5 --- /dev/null +++ b/OSD.CPP @@ -0,0 +1,145 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +OSD::OSD() +{ + Mnemonic = "OSD"; + Empty(); +} + +OSD::~OSD() +{ + Mnemonic.clear(); + Empty(); +} + +void OSD::Empty( void ) +{ + HeadingDegreesTrue = 0.0; + IsHeadingValid = NMEA_Unknown; + VesselCourseDegreesTrue = 0.0; + VesselCourseReference = ReferenceUnknown; + VesselSpeed = 0.0; + VesselSpeedReference = ReferenceUnknown; + VesselSetDegreesTrue = 0.0; + VesselDriftSpeed = 0.0; + VesselDriftSpeedUnits.clear(); +} + +bool OSD::Parse( const SENTENCE& sentence ) +{ + /* + ** OSD - Own Ship Data + ** + ** 1 2 3 4 5 6 7 8 9 10 + ** | | | | | | | | | | + ** $--OSD,x.x,A,x.x,a,x.x,a,x.x,x.x,a*hh + ** + ** 1) Heading, degrees true + ** 2) Status, A = Data Valid + ** 3) Vessel Course, degrees True + ** 4) Course Reference + ** 5) Vessel Speed + ** 6) Speed Reference + ** 7) Vessel Set, degrees True + ** 8) Vessel drift (speed) + ** 9) Speed Units + ** 10) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 10 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + HeadingDegreesTrue = sentence.Double( 1 ); + IsHeadingValid = sentence.Boolean( 2 ); + VesselCourseDegreesTrue = sentence.Double( 3 ); + VesselCourseReference = sentence.Reference( 4 ); + VesselSpeed = sentence.Double( 5 ); + VesselSpeedReference = sentence.Reference( 6 ); + VesselSetDegreesTrue = sentence.Double( 7 ); + VesselDriftSpeed = sentence.Double( 8 ); + VesselDriftSpeedUnits = sentence.Field( 9 ); + + return( true ); +} + +bool OSD::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += HeadingDegreesTrue; + sentence += IsHeadingValid; + sentence += VesselCourseDegreesTrue; + sentence += VesselCourseReference; + sentence += VesselSpeed; + sentence += VesselSpeedReference; + sentence += VesselSetDegreesTrue; + sentence += VesselDriftSpeed; + sentence += VesselDriftSpeedUnits; + + sentence.Finish(); + + return( true ); +} + +const OSD& OSD::operator = ( const OSD& source ) +{ + HeadingDegreesTrue = source.HeadingDegreesTrue; + IsHeadingValid = source.IsHeadingValid; + VesselCourseDegreesTrue = source.VesselCourseDegreesTrue; + VesselCourseReference = source.VesselCourseReference; + VesselSpeed = source.VesselSpeed; + VesselSpeedReference = source.VesselSpeedReference; + VesselSetDegreesTrue = source.VesselSetDegreesTrue; + VesselDriftSpeed = source.VesselDriftSpeed; + VesselDriftSpeedUnits = source.VesselDriftSpeedUnits; + + return( *this ); +} diff --git a/OSD.HPP b/OSD.HPP new file mode 100644 index 0000000..cc032c9 --- /dev/null +++ b/OSD.HPP @@ -0,0 +1,71 @@ +#if ! defined( OSD_CLASS_HEADER ) + +#define OSD_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class OSD : public RESPONSE +{ + public: + + OSD(); + virtual ~OSD(); + + /* + ** Data + */ + + double HeadingDegreesTrue; + NMEA0183_BOOLEAN IsHeadingValid; + double VesselCourseDegreesTrue; + REFERENCE VesselCourseReference; + double VesselSpeed; + REFERENCE VesselSpeedReference; + double VesselSetDegreesTrue; + double VesselDriftSpeed; + std::string VesselDriftSpeedUnits; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const OSD& operator = ( const OSD& source ); +}; + +#endif // OSD_CLASS_HEADER diff --git a/P.CPP b/P.CPP new file mode 100644 index 0000000..6d87e73 --- /dev/null +++ b/P.CPP @@ -0,0 +1,94 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +P::P() +{ + Mnemonic = "P"; + Empty(); +} + +P::~P() +{ + Mnemonic.clear(); + Empty(); +} + +void P::Empty( void ) +{ + Sentence.clear(); + Source.clear(); +} + +bool P::Parse( const SENTENCE& sentence ) +{ + /* + ** This is where parsing of proprietary sentences will go... + */ + + Sentence = sentence; + + std::string temp_string = sentence.Field( 0 ); + + Source = temp_string.substr( 1, 3 ); + CompanyName = Manufacturers.Find( Source ); + + return( true ); +} + +bool P::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += Sentence; + + sentence.Finish(); + + return( true ); +} + +const P& P::operator = ( const P& source ) +{ + Sentence = source.Sentence; + + return( *this ); +} diff --git a/P.HPP b/P.HPP new file mode 100644 index 0000000..430bc85 --- /dev/null +++ b/P.HPP @@ -0,0 +1,67 @@ +#if ! defined( P_CLASS_HEADER ) + +#define P_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class P : public RESPONSE +{ + public: + + P(); + virtual ~P(); + + /* + ** Data + */ + + MANUFACTURER_LIST Manufacturers; + + std::string Sentence; + std::string Source; + std::string CompanyName; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const P& operator = ( const P& source ); +}; + +#endif // P_CLASS_HEADER diff --git a/RADARDAT.CPP b/RADARDAT.CPP new file mode 100644 index 0000000..0e5213a --- /dev/null +++ b/RADARDAT.CPP @@ -0,0 +1,82 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +RADAR_DATA::RADAR_DATA() +{ + Empty(); +} + +RADAR_DATA::~RADAR_DATA() +{ + Empty(); +} + +void RADAR_DATA::Empty( void ) +{ + OriginRangeFromOwnShip = 0.0; + OriginBearingDegreesFromZero = 0.0; + VariableRangeMarkerRange = 0.0; + BearingLineDegreesFromZero = 0.0; +} + +void RADAR_DATA::Parse( int first_field_number, const SENTENCE& sentence ) +{ + OriginRangeFromOwnShip = sentence.Double( first_field_number ); + OriginBearingDegreesFromZero = sentence.Double( first_field_number + 1 ); + VariableRangeMarkerRange = sentence.Double( first_field_number + 2 ); + BearingLineDegreesFromZero = sentence.Double( first_field_number + 3 ); +} + +void RADAR_DATA::Write( SENTENCE& sentence ) +{ + sentence += OriginRangeFromOwnShip; + sentence += OriginBearingDegreesFromZero; + sentence += VariableRangeMarkerRange; + sentence += BearingLineDegreesFromZero; +} + +const RADAR_DATA& RADAR_DATA::operator = ( const RADAR_DATA& source ) +{ + OriginRangeFromOwnShip = source.OriginRangeFromOwnShip; + OriginBearingDegreesFromZero = source.OriginBearingDegreesFromZero; + VariableRangeMarkerRange = source.VariableRangeMarkerRange; + BearingLineDegreesFromZero = source.BearingLineDegreesFromZero; + + return( *this ); +} diff --git a/RADARDAT.HPP b/RADARDAT.HPP new file mode 100644 index 0000000..8651586 --- /dev/null +++ b/RADARDAT.HPP @@ -0,0 +1,66 @@ +#if ! defined( RADAR_DATA_CLASS_HEADER ) + +#define RADAR_DATA_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class RADAR_DATA +{ + public: + + RADAR_DATA(); + virtual ~RADAR_DATA(); + + /* + ** Data + */ + + double OriginRangeFromOwnShip; + double OriginBearingDegreesFromZero; + double VariableRangeMarkerRange; + double BearingLineDegreesFromZero; + + /* + ** Methods + */ + + virtual void Empty( void ); + virtual void Parse( int field_number, const SENTENCE& sentence ); + virtual void Write( SENTENCE& sentence ); + + /* + ** Operators + */ + + virtual const RADAR_DATA& operator = ( const RADAR_DATA& source ); +}; + +#endif // RADAR_DATA_CLASS_HEADER diff --git a/RATIOPLS.CPP b/RATIOPLS.CPP new file mode 100644 index 0000000..fd4e1cf --- /dev/null +++ b/RATIOPLS.CPP @@ -0,0 +1,74 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +RATIO_AND_PULSE::RATIO_AND_PULSE() +{ + Empty(); +} + +RATIO_AND_PULSE::~RATIO_AND_PULSE() +{ + Empty(); +} + +void RATIO_AND_PULSE::Empty( void ) +{ + SignalToNoiseRatio = 0; + PulseShapeECD = 0; +} + +void RATIO_AND_PULSE::Parse( int first_field_number, const SENTENCE& sentence ) +{ + SignalToNoiseRatio = sentence.Integer( first_field_number ); + PulseShapeECD = sentence.Integer( first_field_number + 1 ); +} + +void RATIO_AND_PULSE::Write( SENTENCE& sentence ) +{ + sentence += SignalToNoiseRatio; + sentence += PulseShapeECD; +} + +const RATIO_AND_PULSE& RATIO_AND_PULSE::operator = ( const RATIO_AND_PULSE& source ) +{ + SignalToNoiseRatio = source.SignalToNoiseRatio; + PulseShapeECD = source.PulseShapeECD; + + return( *this ); +} diff --git a/RATIOPLS.HPP b/RATIOPLS.HPP new file mode 100644 index 0000000..156d5a8 --- /dev/null +++ b/RATIOPLS.HPP @@ -0,0 +1,64 @@ +#if ! defined( RATIO_AND_PULSE_CLASS_HEADER ) + +#define RATIO_AND_PULSE_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class RATIO_AND_PULSE +{ + public: + + RATIO_AND_PULSE(); + virtual ~RATIO_AND_PULSE(); + + /* + ** Data + */ + + int SignalToNoiseRatio; + int PulseShapeECD; + + /* + ** Methods + */ + + virtual void Empty( void ); + virtual void Parse( int field_number, const SENTENCE& sentence ); + virtual void Write( SENTENCE& sentence ); + + /* + ** Operators + */ + + virtual const RATIO_AND_PULSE& operator = ( const RATIO_AND_PULSE& source ); +}; + +#endif // RATIO_AND_PULSE_CLASS_HEADER diff --git a/README.md b/README.md index a549aab..b8da50d 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # NMEA0183 C++ class to parse NMEA0183 sentences + +Written many years ago... Designed to be easy to reuse. Simply delete the sentence objects you don't want to parse. diff --git a/RESPONSE.CPP b/RESPONSE.CPP new file mode 100644 index 0000000..ad2cce6 --- /dev/null +++ b/RESPONSE.CPP @@ -0,0 +1,90 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +RESPONSE::RESPONSE() +{ + DataSource = "--"; // Default to an unknown source + Mnemonic.clear(); + Talker.clear(); + + // 15 Jan 98 - Thanks go to Craig Miller (Craig.Miller@Bigfoot.com) for + // finding a bug here. I had left off the () after Empty + ErrorMessage.clear(); +} + +RESPONSE::~RESPONSE() +{ + DataSource.clear(); + Mnemonic.clear(); + Talker.clear(); + ErrorMessage.clear(); +} + +void RESPONSE::SetContainer( NMEA0183 *container ) +{ + container_p = container; +} + +void RESPONSE::SetErrorMessage(const std::string &error_message) +{ + ErrorMessage = Mnemonic; + ErrorMessage += ", "; + ErrorMessage += error_message; +} + +bool RESPONSE::Write( SENTENCE& sentence ) +{ + /* + ** All NMEA0183 sentences begin with the mnemonic... + ** + ** Thanks to Jan-Erik Eriksson (Jan-Erik.Eriksson@st.se) for + ** finding and fixing a bug here + */ + + sentence = "$" + DataSource + Mnemonic; + + return( true ); +} + +std::string RESPONSE::PlainEnglish( void ) const +{ + std::string return_string; + + return( return_string ); +} diff --git a/RESPONSE.HPP b/RESPONSE.HPP new file mode 100644 index 0000000..750969d --- /dev/null +++ b/RESPONSE.HPP @@ -0,0 +1,69 @@ +#if ! defined( RESPONSE_CLASS_HEADER ) + +#define RESPONSE_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class NMEA0183; + +class RESPONSE +{ + private: + + NMEA0183 *container_p; + + public: + + RESPONSE(); + virtual ~RESPONSE(); + + /* + ** Data + */ + + std::string DataSource; + std::string ErrorMessage; + std::string Mnemonic; + std::string Talker; + + /* + ** Methods + */ + + virtual void Empty( void ) = 0; + virtual bool Parse( const SENTENCE& sentence ) = 0; + virtual std::string PlainEnglish( void ) const; + virtual void SetErrorMessage( const std::string& message ); + virtual void SetContainer( NMEA0183 *container ); + virtual bool Write( SENTENCE& sentence ); +}; + +#endif // RESPONSE_CLASS_HEADER diff --git a/RMA.CPP b/RMA.CPP new file mode 100644 index 0000000..4efa4fb --- /dev/null +++ b/RMA.CPP @@ -0,0 +1,151 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +RMA::RMA() +{ + Mnemonic = "RMA"; + Empty(); +} + +RMA::~RMA() +{ + Mnemonic.clear(); + Empty(); +} + +void RMA::Empty( void ) +{ + IsDataValid = NMEA_Unknown; + TimeDifferenceA = 0.0; + TimeDifferenceB = 0.0; + SpeedOverGroundKnots = 0.0; + TrackMadeGoodDegreesTrue = 0.0; + MagneticVariation = 0.0; + MagneticVariationDirection = EW_Unknown; +} + +bool RMA::Parse( const SENTENCE& sentence ) +{ + /* + ** RMA - Recommended Minimum Navigation Information + ** 12 + ** 1 2 3 4 5 6 7 8 9 10 11| + ** | | | | | | | | | | | | + ** $--RMA,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,x.x,x.x,x.x,a*hh + ** + ** Field Number: + ** 1) Blink Warning + ** 2) Latitude + ** 3) N or S + ** 4) Longitude + ** 5) E or W + ** 6) Time Difference A, uS + ** 7) Time Difference B, uS + ** 8) Speed Over Ground, Knots + ** 9) Track Made Good, degrees true + ** 10) Magnetic Variation, degrees + ** 11) E or W + ** 12) Checksum + */ + + /* + ** First we check the checksum... + */ + + NMEA0183_BOOLEAN check = sentence.IsChecksumBad( 12 ); + + if ( check == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + if ( check == NMEA_Unknown ) + { + SetErrorMessage( "Missing Checksum" ); + return( false ); + } + + IsDataValid = sentence.Boolean( 1 ); + Position.Parse( 2, 3, 4, 5, sentence ); + TimeDifferenceA = sentence.Double( 6 ); + TimeDifferenceB = sentence.Double( 7 ); + SpeedOverGroundKnots = sentence.Double( 8 ); + TrackMadeGoodDegreesTrue = sentence.Double( 9 ); + MagneticVariation = sentence.Double( 10 ); + MagneticVariationDirection = sentence.EastOrWest( 11 ); + + return( true ); +} + +bool RMA::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += IsDataValid; + sentence += Position; + sentence += TimeDifferenceA; + sentence += TimeDifferenceB; + sentence += SpeedOverGroundKnots; + sentence += TrackMadeGoodDegreesTrue; + sentence += MagneticVariation; + sentence += MagneticVariationDirection; + + sentence.Finish(); + + return( true ); +} + +const RMA& RMA::operator = ( const RMA& source ) +{ + IsDataValid = source.IsDataValid; + Position = source.Position; + TimeDifferenceA = source.TimeDifferenceA; + TimeDifferenceB = source.TimeDifferenceB; + SpeedOverGroundKnots = source.SpeedOverGroundKnots; + TrackMadeGoodDegreesTrue = source.TrackMadeGoodDegreesTrue; + MagneticVariation = source.MagneticVariation; + MagneticVariationDirection = source.MagneticVariationDirection; + + return( *this ); +} diff --git a/RMA.HPP b/RMA.HPP new file mode 100644 index 0000000..8519b10 --- /dev/null +++ b/RMA.HPP @@ -0,0 +1,70 @@ +#if ! defined( RMA_CLASS_HEADER ) + +#define RMA_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class RMA : public RESPONSE +{ + public: + + RMA(); + virtual ~RMA(); + + /* + ** Data + */ + + NMEA0183_BOOLEAN IsDataValid; + LATLONG Position; + double TimeDifferenceA; + double TimeDifferenceB; + double SpeedOverGroundKnots; + double TrackMadeGoodDegreesTrue; + double MagneticVariation; + EASTWEST MagneticVariationDirection; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const RMA& operator = ( const RMA& source ); +}; + +#endif // RMA_CLASS_HEADER diff --git a/RMB.CPP b/RMB.CPP new file mode 100644 index 0000000..4dcfa1d --- /dev/null +++ b/RMB.CPP @@ -0,0 +1,162 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +RMB::RMB() +{ + Mnemonic = "RMB"; + Empty(); +} + +RMB::~RMB() +{ + Mnemonic.clear(); + Empty(); +} + +void RMB::Empty( void ) +{ + IsDataValid = NMEA_Unknown; + CrossTrackError = 0.0; + DirectionToSteer = LR_Unknown; + To.clear(); + From.clear(); + DestinationPosition; + RangeToDestinationNauticalMiles = 0.0; + BearingToDestinationDegreesTrue = 0.0; + DestinationClosingVelocityKnots = 0.0; + IsArrivalCircleEntered = NMEA_Unknown; +} + +bool RMB::Parse( const SENTENCE& sentence ) +{ + /* + ** RMB - Recommended Minimum Navigation Information + ** 14 + ** 1 2 3 4 5 6 7 8 9 10 11 12 13| + ** | | | | | | | | | | | | | | + ** $--RMB,A,x.x,a,c--c,c--c,llll.ll,a,yyyyy.yy,a,x.x,x.x,x.x,A*hh + ** + ** Field Number: + ** 1) Status, V = Navigation receiver warning + ** 2) Cross Track error - nautical miles + ** 3) Direction to Steer, Left or Right + ** 4) TO Waypoint ID + ** 5) FROM Waypoint ID + ** 6) Destination Waypoint Latitude + ** 7) N or S + ** 8) Destination Waypoint Longitude + ** 9) E or W + ** 10) Range to destination in nautical miles + ** 11) Bearing to destination in degrees True + ** 12) Destination closing velocity in knots + ** 13) Arrival Status, A = Arrival Circle Entered + ** 14) Checksum + */ + + /* + ** First we check the checksum... + */ + + NMEA0183_BOOLEAN check = sentence.IsChecksumBad( 14 ); + + if ( check == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + if ( check == NMEA_Unknown ) + { + SetErrorMessage( "Missing Checksum" ); + return( false ); + } + + IsDataValid = sentence.Boolean( 1 ); + CrossTrackError = sentence.Double( 2 ); + DirectionToSteer = sentence.LeftOrRight( 3 ); + From = sentence.Field( 4 ); + To = sentence.Field( 5 ); + DestinationPosition.Parse( 6, 7, 8, 9, sentence ); + RangeToDestinationNauticalMiles = sentence.Double( 10 ); + BearingToDestinationDegreesTrue = sentence.Double( 11 ); + DestinationClosingVelocityKnots = sentence.Double( 12 ); + IsArrivalCircleEntered = sentence.Boolean( 13 ); + + return( true ); +} + +bool RMB::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += IsDataValid; + sentence += CrossTrackError; + sentence += DirectionToSteer; + sentence += From; + sentence += To; + sentence += DestinationPosition; + sentence += RangeToDestinationNauticalMiles; + sentence += BearingToDestinationDegreesTrue; + sentence += DestinationClosingVelocityKnots; + sentence += IsArrivalCircleEntered; + + sentence.Finish(); + + return( true ); +} + +const RMB& RMB::operator = ( const RMB& source ) +{ + IsDataValid = source.IsDataValid; + CrossTrackError = source.CrossTrackError; + DirectionToSteer = source.DirectionToSteer; + From = source.From; + To = source.To; + DestinationPosition = source.DestinationPosition; + RangeToDestinationNauticalMiles = source.RangeToDestinationNauticalMiles; + BearingToDestinationDegreesTrue = source.BearingToDestinationDegreesTrue; + DestinationClosingVelocityKnots = source.DestinationClosingVelocityKnots; + IsArrivalCircleEntered = source.IsArrivalCircleEntered; + + return( *this ); +} diff --git a/RMB.HPP b/RMB.HPP new file mode 100644 index 0000000..48cf725 --- /dev/null +++ b/RMB.HPP @@ -0,0 +1,72 @@ +#if ! defined( RMB_CLASS_HEADER ) + +#define RMB_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class RMB : public RESPONSE +{ + public: + + RMB(); + virtual ~RMB(); + + /* + ** Data + */ + + NMEA0183_BOOLEAN IsDataValid; + double CrossTrackError; + LEFTRIGHT DirectionToSteer; + std::string To; + std::string From; + LATLONG DestinationPosition; + double RangeToDestinationNauticalMiles; + double BearingToDestinationDegreesTrue; + double DestinationClosingVelocityKnots; + NMEA0183_BOOLEAN IsArrivalCircleEntered; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const RMB& operator = ( const RMB& source ); +}; + +#endif // RMB_CLASS_HEADER diff --git a/RMC.CPP b/RMC.CPP new file mode 100644 index 0000000..1d585b8 --- /dev/null +++ b/RMC.CPP @@ -0,0 +1,177 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +RMC::RMC() +{ + Mnemonic = "RMC"; + Empty(); +} + +RMC::~RMC() +{ + Mnemonic.clear(); + Empty(); +} + +void RMC::Empty( void ) +{ + UTCTime.clear(); + IsDataValid = NMEA_Unknown; + SpeedOverGroundKnots = 0.0; + Position.Empty(); + TrackMadeGoodDegreesTrue = 0.0; + Date.clear(); + MagneticVariation = 0.0; + MagneticVariationDirection = EW_Unknown; +} + +bool RMC::Parse( const SENTENCE& sentence ) +{ + /* + ** RMC - Recommended Minimum Navigation Information + ** 12 + ** 1 2 3 4 5 6 7 8 9 10 11| + ** | | | | | | | | | | | | + ** $--RMC,hhmmss.ss,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,xxxx,x.x,a*hh + ** + ** Field Number: + ** 1) UTC Time + ** 2) Status, V = Navigation receiver warning + ** 3) Latitude + ** 4) N or S + ** 5) Longitude + ** 6) E or W + ** 7) Speed over ground, knots + ** 8) Track made good, degrees true + ** 9) Date, ddmmyy + ** 10) Magnetic Variation, degrees + ** 11) E or W + ** 12) Checksum + */ + + /* + ** First we check the checksum... + */ + + NMEA0183_BOOLEAN check = sentence.IsChecksumBad( 12 ); + + if ( check == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + if ( check == NMEA_Unknown ) + { + SetErrorMessage( "Missing Checksum" ); + return( false ); + } + + UTCTime = sentence.Field( 1 ); + Time = sentence.Time( 1 ); + IsDataValid = sentence.Boolean( 2 ); + Position.Parse( 3, 4, 5, 6, sentence ); + SpeedOverGroundKnots = sentence.Double( 7 ); + TrackMadeGoodDegreesTrue = sentence.Double( 8 ); + Date = sentence.Field( 9 ); + MagneticVariation = sentence.Double( 10 ); + MagneticVariationDirection = sentence.EastOrWest( 11 ); + + return( true ); +} + +std::string RMC::PlainEnglish( void ) const +{ + std::string return_string( "At " ); + std::string time_string = ctime(&Time); + return_string += time_string.substr(0, time_string.length() - 1); + return_string += " you were at "; + return_string += Position.PlainEnglish(); + return_string += ", making "; + + char temp_string[ 128 ]; + + sprintf( temp_string, "%lf", SpeedOverGroundKnots ); + + return_string += temp_string; + return_string += " knots, track made good "; + + sprintf(temp_string, "%lf", TrackMadeGoodDegreesTrue ); + return_string += temp_string; + return_string += " degrees true."; + + return( return_string ); +} + +bool RMC::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += UTCTime; + sentence += IsDataValid; + sentence += Position; + sentence += SpeedOverGroundKnots; + sentence += TrackMadeGoodDegreesTrue; + sentence += Date; + sentence += MagneticVariation; + sentence += MagneticVariationDirection; + + sentence.Finish(); + + return( true ); +} + +const RMC& RMC::operator = ( const RMC& source ) +{ + UTCTime = source.UTCTime; + Time = source.Time; + IsDataValid = source.IsDataValid; + Position = source.Position; + SpeedOverGroundKnots = source.SpeedOverGroundKnots; + TrackMadeGoodDegreesTrue = source.TrackMadeGoodDegreesTrue; + Date = source.Date; + MagneticVariation = source.MagneticVariation; + MagneticVariationDirection = source.MagneticVariationDirection; + + return( *this ); +} diff --git a/RMC.HPP b/RMC.HPP new file mode 100644 index 0000000..6edc9ec --- /dev/null +++ b/RMC.HPP @@ -0,0 +1,72 @@ +#if ! defined( RMC_CLASS_HEADER ) + +#define RMC_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class RMC : public RESPONSE +{ + public: + + RMC(); + virtual ~RMC(); + + /* + ** Data + */ + + std::string UTCTime; + time_t Time; + NMEA0183_BOOLEAN IsDataValid; + LATLONG Position; + double SpeedOverGroundKnots; + double TrackMadeGoodDegreesTrue; + std::string Date; + double MagneticVariation; + EASTWEST MagneticVariationDirection; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual std::string PlainEnglish( void ) const override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const RMC& operator = ( const RMC& source ); +}; + +#endif // RMC_CLASS_HEADER diff --git a/ROT.CPP b/ROT.CPP new file mode 100644 index 0000000..15949ec --- /dev/null +++ b/ROT.CPP @@ -0,0 +1,145 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +ROT::ROT() +{ + Mnemonic = "ROT"; + Empty(); +} + +ROT::~ROT() +{ + Mnemonic.clear(); + Empty(); +} + +void ROT::Empty( void ) +{ + RateOfTurn = 0.0; + IsDataValid = NMEA_Unknown; +} + +bool ROT::Parse( const SENTENCE& sentence ) +{ + /* + ** ROT - Rate Of Turn + ** + ** 1 2 3 + ** | | | + ** $--ROT,x.x,A*hh + ** + ** Field Number: + ** 1) Rate Of Turn, degrees per minute, "-" means bow turns to port + ** 2) Status, A means data is valid + ** 3) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 3 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + RateOfTurn = sentence.Double( 1 ); + IsDataValid = sentence.Boolean( 2 ); + + return( true ); +} + +std::string ROT::PlainEnglish( void ) const +{ + std::string return_string; + + return_string = "The bow is turning to "; + + char temp_string[ 80 ]; + + if ( RateOfTurn < 0 ) + { + ::sprintf( temp_string, "Port at a rate of %4.1lf degrees per minute.", (double) (RateOfTurn * -1.0) ); + } + else + { + ::sprintf( temp_string, "Starboard at a rate of %4.1lf degrees per minute.", RateOfTurn ); + } + + return_string += temp_string; + + if ( IsDataValid != True ) + { + if ( IsDataValid == False ) + { + return_string += " However, this data is not valid."; + } + else + { + return_string += " However, this data cannot be confirmed."; + } + } + + return( return_string ); +} + +bool ROT::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += RateOfTurn; + sentence += IsDataValid; + + sentence.Finish(); + + return( true ); +} + +const ROT& ROT::operator = ( const ROT& source ) +{ + RateOfTurn = source.RateOfTurn; + IsDataValid = source.IsDataValid; + + return( *this ); +} diff --git a/ROT.HPP b/ROT.HPP new file mode 100644 index 0000000..0c5849f --- /dev/null +++ b/ROT.HPP @@ -0,0 +1,65 @@ +#if ! defined( ROT_CLASS_HEADER ) + +#define ROT_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class ROT : public RESPONSE +{ + public: + + ROT(); + virtual ~ROT(); + + /* + ** Data + */ + + double RateOfTurn; + NMEA0183_BOOLEAN IsDataValid; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual std::string PlainEnglish( void ) const override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const ROT& operator = ( const ROT& source ); +}; + +#endif // ROT_CLASS_HEADER diff --git a/RPM.CPP b/RPM.CPP new file mode 100644 index 0000000..d3668f8 --- /dev/null +++ b/RPM.CPP @@ -0,0 +1,126 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +RPM::RPM() +{ + Mnemonic = "RPM"; + Empty(); +} + +RPM::~RPM() +{ + Mnemonic.clear(); + Empty(); +} + +void RPM::Empty( void ) +{ + Source.clear(); + SourceNumber = 0; + RevolutionsPerMinute = 0.0; + PropellerPitchPercentage = 0.0; + IsDataValid = NMEA_Unknown; +} + +bool RPM::Parse( const SENTENCE& sentence ) +{ + /* + ** RPM - Revolutions + ** + ** 1 2 3 4 5 6 + ** | | | | | | + ** $--RPM,a,x,x.x,x.x,A*hh + ** + ** Field Number: + ** 1) Sourse, S = Shaft, E = Engine + ** 2) Engine or shaft number + ** 3) Speed, Revolutions per minute + ** 4) Propeller pitch, % of maximum, "-" means astern + ** 5) Status, A means data is valid + ** 6) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 6 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + Source = sentence.Field( 1 ); + SourceNumber = sentence.Integer( 2 ); + RevolutionsPerMinute = sentence.Double( 3 ); + PropellerPitchPercentage = sentence.Double( 4 ); + IsDataValid = sentence.Boolean( 5 ); + + return( true ); +} + +bool RPM::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += Source; + sentence += SourceNumber; + sentence += RevolutionsPerMinute; + sentence += PropellerPitchPercentage; + sentence += IsDataValid; + + sentence.Finish(); + + return( true ); +} + +const RPM& RPM::operator = ( const RPM& source ) +{ + Source = source.Source; + SourceNumber = source.SourceNumber; + RevolutionsPerMinute = source.RevolutionsPerMinute; + PropellerPitchPercentage = source.PropellerPitchPercentage; + IsDataValid = source.IsDataValid; + + return( *this ); +} diff --git a/RPM.HPP b/RPM.HPP new file mode 100644 index 0000000..706cc2c --- /dev/null +++ b/RPM.HPP @@ -0,0 +1,67 @@ +#if ! defined( RPM_CLASS_HEADER ) + +#define RPM_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class RPM : public RESPONSE +{ + public: + + RPM(); + virtual ~RPM(); + + /* + ** Data + */ + + std::string Source; + int SourceNumber; + double RevolutionsPerMinute; + double PropellerPitchPercentage; + NMEA0183_BOOLEAN IsDataValid; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const RPM& operator = ( const RPM& source ); +}; + +#endif // RPM_CLASS_HEADER diff --git a/RSA.CPP b/RSA.CPP new file mode 100644 index 0000000..f6f13cf --- /dev/null +++ b/RSA.CPP @@ -0,0 +1,121 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +RSA::RSA() +{ + Mnemonic = "RSA"; + Empty(); +} + +RSA::~RSA() +{ + Mnemonic.clear(); + Empty(); +} + +void RSA::Empty( void ) +{ + Starboard = 0.0; + IsStarboardDataValid = NMEA_Unknown; + Port = 0.0; + IsPortDataValid = NMEA_Unknown; +} + +bool RSA::Parse( const SENTENCE& sentence ) +{ + /* + ** RSA - Rudder Sensor Angle + ** + ** 1 2 3 4 5 + ** | | | | | + ** $--RSA,x.x,A,x.x,A*hh + ** + ** Field Number: + ** 1) Starboard (or single) rudder sensor, "-" means Turn To Port + ** 2) Status, A means data is valid + ** 3) Port rudder sensor + ** 4) Status, A means data is valid + ** 5) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 5 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + Starboard = sentence.Double( 1 ); + IsStarboardDataValid = sentence.Boolean( 2 ); + Port = sentence.Double( 3 ); + IsPortDataValid = sentence.Boolean( 4 ); + + return( true ); +} + +bool RSA::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += Starboard; + sentence += IsStarboardDataValid; + sentence += Port; + sentence += IsPortDataValid; + + sentence.Finish(); + + return( true ); +} + +const RSA& RSA::operator = ( const RSA& source ) +{ + Starboard = source.Starboard; + IsStarboardDataValid = source.IsStarboardDataValid; + Port = source.Port; + IsPortDataValid = source.IsPortDataValid; + + return( *this ); +} diff --git a/RSA.HPP b/RSA.HPP new file mode 100644 index 0000000..5d17b38 --- /dev/null +++ b/RSA.HPP @@ -0,0 +1,66 @@ +#if ! defined( RSA_CLASS_HEADER ) + +#define RSA_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class RSA : public RESPONSE +{ + public: + + RSA(); + virtual ~RSA(); + + /* + ** Data + */ + + double Starboard; + NMEA0183_BOOLEAN IsStarboardDataValid; + double Port; + NMEA0183_BOOLEAN IsPortDataValid; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const RSA& operator = ( const RSA& source ); +}; + +#endif // RSA_CLASS_HEADER diff --git a/RSD.CPP b/RSD.CPP new file mode 100644 index 0000000..13dcca3 --- /dev/null +++ b/RSD.CPP @@ -0,0 +1,174 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +RSD::RSD() +{ + Mnemonic = "RSD"; + Empty(); +} + +RSD::~RSD() +{ + Mnemonic.clear(); + Empty(); +} + +void RSD::Empty( void ) +{ + Data1.Empty(); + Data2.Empty(); + CursorRangeFromOwnShip = 0.0; + CursorBearingDegreesClockwiseFromZero = 0.0; + RangeScale = 0.0; + RangeUnits.clear(); + DisplayRotation = RotationUnknown; +} + +bool RSD::Parse( const SENTENCE& sentence ) +{ + /* + ** RSD - RADAR System Data + ** 14 + ** 1 2 3 4 5 6 7 8 9 10 11 12 13| + ** | | | | | | | | | | | | | | + ** $--RSD,x.x,x.x,x.x,x.x,x.x,x.x,x.x,x.x,x.x,x.x,x.x,a,a*hh + ** + ** 14) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 14 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + Data1.Parse( 1, sentence ); + Data2.Parse( 5, sentence ); + CursorRangeFromOwnShip = sentence.Double( 9 ); + CursorBearingDegreesClockwiseFromZero = sentence.Double( 10 ); + RangeScale = sentence.Double( 11 ); + RangeUnits = sentence.Field( 12 ); + + int temp_integer = sentence.Integer( 13 ); + + switch( temp_integer ) + { + case 'C': + + DisplayRotation = CourseUpRotation; + break; + + case 'H': + + DisplayRotation = HeadUpRotation; + break; + + case 'N': + + DisplayRotation = NorthUpRotation; + break; + + default: + + DisplayRotation = RotationUnknown; + break; + } + + return( true ); +} + +bool RSD::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + Data1.Write( sentence ); + Data2.Write( sentence ); + sentence += CursorRangeFromOwnShip; + sentence += CursorBearingDegreesClockwiseFromZero; + sentence += RangeScale; + sentence += RangeUnits; + + switch( DisplayRotation ) + { + case CourseUpRotation: + + sentence += "C"; + break; + + case HeadUpRotation: + + sentence += "H"; + break; + + case NorthUpRotation: + + sentence += "N"; + break; + + default: + + sentence += ""; + break; + } + + sentence.Finish(); + + return( true ); +} + +const RSD& RSD::operator = ( const RSD& source ) +{ + Data1 = source.Data1; + Data2 = source.Data2; + CursorRangeFromOwnShip = source.CursorRangeFromOwnShip; + CursorBearingDegreesClockwiseFromZero = source.CursorBearingDegreesClockwiseFromZero; + RangeScale = source.RangeScale; + RangeUnits = source.RangeUnits; + DisplayRotation = source.DisplayRotation; + + return( *this ); +} diff --git a/RSD.HPP b/RSD.HPP new file mode 100644 index 0000000..900a7a5 --- /dev/null +++ b/RSD.HPP @@ -0,0 +1,78 @@ +#if ! defined( RSD_CLASS_HEADER ) + +#define RSD_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +typedef enum +{ + RotationUnknown = 0, + CourseUpRotation, + HeadUpRotation, + NorthUpRotation +} +ROTATION; + +class RSD : public RESPONSE +{ + public: + + RSD(); + virtual ~RSD(); + + /* + ** Data + */ + + RADAR_DATA Data1; + RADAR_DATA Data2; + double CursorRangeFromOwnShip; + double CursorBearingDegreesClockwiseFromZero; + double RangeScale; + std::string RangeUnits; + ROTATION DisplayRotation; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const RSD& operator = ( const RSD& source ); +}; + +#endif // RSD_CLASS_HEADER diff --git a/RTE.CPP b/RTE.CPP new file mode 100644 index 0000000..e70d132 --- /dev/null +++ b/RTE.CPP @@ -0,0 +1,171 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +RTE::RTE() +{ + Mnemonic = "RTE"; + Empty(); +} + +RTE::~RTE() +{ + Mnemonic.clear(); + Empty(); +} + +void RTE::Empty( void ) +{ + m_TotalNumberOfMessages = 0.0; + m_LastMessageNumberReceived = 0.0; + m_MessageNumber = 0.0; + m_LastWaypointNumberWritten = 0; + + TypeOfRoute = RouteUnknown; + RouteName.clear(); + Waypoints.clear(); +} + +bool RTE::Parse( const SENTENCE& sentence ) +{ + /* + ** RTE - Routes + ** + ** 1 2 3 4 5 x n + ** | | | | | | | + ** $--RTE,x.x,x.x,a,c--c,c--c, ..... c--c*hh + ** + ** Field Number: + ** 1) Total number of messages being transmitted + ** 2) Message Number + ** 3) Message mode + ** c = complete route, all waypoints + ** w = working route, the waypoint you just left, the waypoint you're heading to then all the rest + ** 4) Waypoint ID + ** x) More Waypoints + ** n) Checksum + */ + + Waypoints.clear(); + + int field_number = 1; + + m_TotalNumberOfMessages = sentence.Double( 1 ); + + double this_message_number = sentence.Double( 2 ); + + if ( this_message_number == 1.0 ) + { + /* + ** Make sure we've got a clean list + */ + + Waypoints.clear(); + } + + std::string field_data = sentence.Field( 3 ); + + if ( field_data == "c" ) + { + TypeOfRoute = CompleteRoute; + } + else if ( field_data == "w" ) + { + TypeOfRoute = WorkingRoute; + } + else + { + TypeOfRoute = RouteUnknown; + } + + RouteName = sentence.Field( 4 ); + + int number_of_data_fields = sentence.GetNumberOfDataFields(); + field_number = 5; + + std::string string_to_add; + + while( field_number < number_of_data_fields ) + { + Waypoints.push_back(sentence.Field(field_number)); + field_number++; + } + + return( true ); +} + +bool RTE::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += m_TotalNumberOfMessages; + sentence += m_MessageNumber; + + switch( TypeOfRoute ) + { + case CompleteRoute: + + sentence += "c"; + break; + + case WorkingRoute: + + sentence += "w"; + break; + + default: + + sentence += ""; + break; + } + + sentence += RouteName; + + /* + ** To Be done + ** Take the number of entries in the list and write them out until we're done + */ + + sentence.Finish(); + + return( true ); +} diff --git a/RTE.HPP b/RTE.HPP new file mode 100644 index 0000000..6b0c19f --- /dev/null +++ b/RTE.HPP @@ -0,0 +1,67 @@ +#if ! defined( RTE_CLASS_HEADER ) + +#define RTE_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class RTE : public RESPONSE +{ + private: + + double m_TotalNumberOfMessages; + double m_LastMessageNumberReceived; + double m_MessageNumber; + + int m_LastWaypointNumberWritten; + + public: + + RTE(); + virtual ~RTE(); + + typedef enum + { + RouteUnknown = 0, + CompleteRoute, + WorkingRoute + } + ROUTE_TYPE; + + ROUTE_TYPE TypeOfRoute; + std::string RouteName; + std::vector Waypoints; + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; +}; + +#endif // RTE_CLASS_HEADER diff --git a/SATDAT.CPP b/SATDAT.CPP new file mode 100644 index 0000000..31b6478 --- /dev/null +++ b/SATDAT.CPP @@ -0,0 +1,101 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +SATELLITE_DATA::SATELLITE_DATA() +{ + Empty(); +} + +SATELLITE_DATA::~SATELLITE_DATA() +{ + Empty(); +} + +void SATELLITE_DATA::Empty( void ) +{ + SatelliteNumber = 0; + ElevationDegrees = 0; + AzimuthDegreesTrue = 0; + SignalToNoiseRatio = (-1); +} + +void SATELLITE_DATA::Parse( int first_field_number, const SENTENCE& sentence ) +{ + SatelliteNumber = sentence.Integer( first_field_number ); + ElevationDegrees = sentence.Integer( first_field_number + 1 ); + AzimuthDegreesTrue = sentence.Integer( first_field_number + 2 ); + + std::string field_data = sentence.Field( first_field_number + 3 ); + + if ( field_data == "" ) + { + SignalToNoiseRatio = (-1); + } + else + { + SignalToNoiseRatio = sentence.Integer( first_field_number + 3 ); + } + +} + +void SATELLITE_DATA::Write( SENTENCE& sentence ) +{ + sentence += SatelliteNumber; + sentence += ElevationDegrees; + sentence += AzimuthDegreesTrue; + + if ( SignalToNoiseRatio == (-1) ) + { + sentence += ""; + } + else + { + sentence += SignalToNoiseRatio; + } +} + +const SATELLITE_DATA& SATELLITE_DATA::operator = ( const SATELLITE_DATA& source ) +{ + SatelliteNumber = source.SatelliteNumber; + ElevationDegrees = source.ElevationDegrees; + AzimuthDegreesTrue = source.AzimuthDegreesTrue; + SignalToNoiseRatio = source.SignalToNoiseRatio; + + return( *this ); +} diff --git a/SATDAT.HPP b/SATDAT.HPP new file mode 100644 index 0000000..5994c2e --- /dev/null +++ b/SATDAT.HPP @@ -0,0 +1,66 @@ +#if ! defined( SATELLITE_DATA_CLASS_HEADER ) + +#define SATELLITE_DATA_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class SATELLITE_DATA +{ + public: + + SATELLITE_DATA(); + virtual ~SATELLITE_DATA(); + + /* + ** Data + */ + + int SatelliteNumber; + int ElevationDegrees; + int AzimuthDegreesTrue; + int SignalToNoiseRatio; + + /* + ** Methods + */ + + virtual void Empty( void ); + virtual void Parse( int field_number, const SENTENCE& sentence ); + virtual void Write( SENTENCE& sentence ); + + /* + ** Operators + */ + + virtual const SATELLITE_DATA& operator = ( const SATELLITE_DATA& source ); +}; + +#endif // SATELLITE_DATA_CLASS_HEADER diff --git a/SENTENCE.CPP b/SENTENCE.CPP new file mode 100644 index 0000000..61ba468 --- /dev/null +++ b/SENTENCE.CPP @@ -0,0 +1,660 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +SENTENCE::SENTENCE() +{ + Sentence.clear(); +} + +SENTENCE::~SENTENCE() +{ + Sentence.clear(); +} + +NMEA0183_BOOLEAN SENTENCE::Boolean( int field_number ) const +{ + std::string field_data = Field( field_number ); + + if ( field_data == "A" ) + { + return( True ); + } + else if ( field_data == "V" ) + { + return( False ); + } + else + { + return( NMEA_Unknown ); + } +} + +COMMUNICATIONS_MODE SENTENCE::CommunicationsMode( int field_number ) const +{ + std::string field_data = Field( field_number ); + + if ( field_data == "d" ) + { + return( F3E_G3E_SimplexTelephone ); + } + else if ( field_data == "e" ) + { + return( F3E_G3E_DuplexTelephone ); + } + else if ( field_data == "m" ) + { + return( J3E_Telephone ); + } + else if ( field_data == "o" ) + { + return( H3E_Telephone ); + } + else if ( field_data == "q" ) + { + return( F1B_J2B_FEC_NBDP_TelexTeleprinter ); + } + else if ( field_data == "s" ) + { + return( F1B_J2B_ARQ_NBDP_TelexTeleprinter ); + } + else if ( field_data == "w" ) + { + return( F1B_J2B_ReceiveOnlyTeleprinterDSC ); + } + else if ( field_data == "x" ) + { + return( A1A_MorseTapeRecorder ); + } + else if ( field_data == "{" ) + { + return( A1A_MorseKeyHeadset ); + } + else if ( field_data == "|" ) + { + return( F1C_F2C_F3C_FaxMachine ); + } + else + { + return( CommunicationsModeUnknown ); + } +} + +uint8_t SENTENCE::ComputeChecksum( void ) const +{ + uint8_t checksum_value = 0; + + size_t string_length = Sentence.length(); + size_t index = 1; // Skip over the $ at the begining of the sentence + + while( index < string_length && + Sentence[ index ] != '*' && + Sentence[ index ] != CARRIAGE_RETURN && + Sentence[ index ] != LINE_FEED ) + { + checksum_value ^= Sentence[ index ]; + index++; + } + + return( checksum_value ); +} + +double SENTENCE::Double( int field_number ) const +{ + std::string field_data = Field( field_number ); + + return( ::atof( field_data.c_str() ) ); +} + +EASTWEST SENTENCE::EastOrWest( int field_number ) const +{ + std::string field_data = Field( field_number ); + + if ( field_data == "E" ) + { + return( East ); + } + else if ( field_data == "W" ) + { + return( West ); + } + else + { + return( EW_Unknown ); + } +} + +const std::string SENTENCE::Field( int desired_field_number ) const +{ + // Thanks to Vilhelm Persson (vilhelm.persson@st.se) for finding a + // bug that lived here. + + std::string return_string; + + size_t index = 1; // Skip over the $ at the begining of the sentence + int current_field_number = 0; + + const size_t string_length = Sentence.length(); + + while( current_field_number < desired_field_number && index < string_length ) + { + if ( Sentence[ index ] == ',' || Sentence[ index ] == '*' ) + { + current_field_number++; + } + + index++; + } + + if ( current_field_number == desired_field_number ) + { + while( index < string_length && + Sentence[ index ] != ',' && + Sentence[ index ] != '*' && + Sentence[ index ] != 0x00 ) + { + return_string += Sentence[ index ]; + index++; + } + } + + return( return_string ); +} + +uint16_t SENTENCE::GetNumberOfDataFields( void ) const +{ + int index = 1; // Skip over the $ at the begining of the sentence + int current_field_number = 0; + + const size_t string_length = Sentence.length(); + + while( index < string_length ) + { + if ( Sentence[ index ] == '*' ) + { + return( (uint16_t) current_field_number ); + } + + if ( Sentence[ index ] == ',' ) + { + current_field_number++; + } + + index++; + } + + return( (uint16_t) current_field_number ); +} + +void SENTENCE::Finish( void ) +{ + const uint8_t checksum = ComputeChecksum(); + + char temp_string[ 10 ]; + + ::sprintf( temp_string, "*%02X%c%c", (int) checksum, CARRIAGE_RETURN, LINE_FEED ); + + Sentence += temp_string; +} + +int SENTENCE::Integer( int field_number ) const +{ + std::string integer_string = Field( field_number ); + + return( ::atoi( integer_string.c_str() ) ); +} + +NMEA0183_BOOLEAN SENTENCE::IsChecksumBad( int checksum_field_number ) const +{ + /* + ** Checksums are optional, return TRUE if an existing checksum is known to be bad + */ + + std::string checksum_in_sentence = Field( checksum_field_number ); + + if ( checksum_in_sentence == "" ) + { + return( NMEA_Unknown ); + } + + if ( ComputeChecksum() != HexValue( checksum_in_sentence ) ) + { + return( True ); + } + + return( False ); +} + +LEFTRIGHT SENTENCE::LeftOrRight( int field_number ) const +{ + std::string field_data = Field( field_number ); + + if ( field_data == "L" ) + { + return( Left ); + } + else if ( field_data == "R" ) + { + return( Right ); + } + else + { + return( LR_Unknown ); + } +} + +NORTHSOUTH SENTENCE::NorthOrSouth( int field_number ) const +{ + std::string field_data = Field( field_number ); + + if ( field_data == "N" ) + { + return( North ); + } + else if ( field_data == "S" ) + { + return( South ); + } + else + { + return( NS_Unknown ); + } +} + +REFERENCE SENTENCE::Reference( int field_number ) const +{ + std::string field_data = Field( field_number ); + + if ( field_data == "B" ) + { + return( BottomTrackingLog ); + } + else if ( field_data == "M" ) + { + return( ManuallyEntered ); + } + else if ( field_data == "W" ) + { + return( WaterReferenced ); + } + else if ( field_data == "R" ) + { + return( RadarTrackingOfFixedTarget ); + } + else if ( field_data == "P" ) + { + return( PositioningSystemGroundReference ); + } + else + { + return( ReferenceUnknown ); + } +} + +const time_t SENTENCE::Time( int field_number ) const +{ + time_t return_value = time(nullptr); + + std::string temp_string = Field( field_number ); + + if ( temp_string.length() >= 6 ) + { + char temp_number[ 3 ]; + + temp_number[ 2 ] = 0x00; + + temp_number[ 0 ] = temp_string[ 0 ]; + temp_number[ 1 ] = temp_string[ 1 ]; + + int hours = ::atoi( temp_number ); + + temp_number[ 0 ] = temp_string[ 2 ]; + temp_number[ 1 ] = temp_string[ 3 ]; + + int minutes = ::atoi( temp_number ); + + temp_number[ 0 ] = temp_string[ 4 ]; + temp_number[ 1 ] = temp_string[ 5 ]; + + int seconds = ::atoi( temp_number ); + + struct tm * tm_p = gmtime(&return_value); + + int year = tm_p->tm_year + 1900; + int month = tm_p->tm_mon; + int day = tm_p->tm_mday; + + return_value = ctime( year, month, day, hours, minutes, seconds ); + } + + return( return_value ); +} + +TRANSDUCER_TYPE SENTENCE::TransducerType( int field_number ) const +{ + std::string field_data = Field( field_number ); + + if ( field_data == "A" ) + { + return( AngularDisplacementTransducer ); + } + else if ( field_data == "D" ) + { + return( LinearDisplacementTransducer ); + } + else if ( field_data == "C" ) + { + return( TemperatureTransducer ); + } + else if ( field_data == "F" ) + { + return( FrequencyTransducer ); + } + else if ( field_data == "N" ) + { + return( ForceTransducer ); + } + else if ( field_data == "P" ) + { + return( PressureTransducer ); + } + else if ( field_data == "R" ) + { + return( FlowRateTransducer ); + } + else if ( field_data == "T" ) + { + return( TachometerTransducer ); + } + else if ( field_data == "H" ) + { + return( HumidityTransducer ); + } + else if ( field_data == "V" ) + { + return( VolumeTransducer ); + } + else + { + return( TransducerUnknown ); + } +} + +/* +** Operators +*/ + +SENTENCE::operator std::string() const +{ + return( Sentence ); +} + +const SENTENCE& SENTENCE::operator = ( const SENTENCE& source ) +{ + Sentence = source.Sentence; + + return( *this ); +} + +const SENTENCE& SENTENCE::operator = ( const std::string& source ) +{ + Sentence = source; + + return( *this ); +} + +const SENTENCE& SENTENCE::operator += ( const std::string& source ) +{ + Sentence += ","; + Sentence += source; + + return( *this ); +} + +const SENTENCE& SENTENCE::operator += ( double value ) +{ + char temp_string[ 80 ]; + + ::sprintf( temp_string, "%.3f", value ); + + Sentence += ","; + Sentence += temp_string; + + return( *this ); +} + +const SENTENCE& SENTENCE::operator += ( COMMUNICATIONS_MODE mode ) +{ + Sentence += ","; + + switch( mode ) + { + case F3E_G3E_SimplexTelephone: + + Sentence += "d"; + break; + + case F3E_G3E_DuplexTelephone: + + Sentence += "e"; + break; + + case J3E_Telephone: + + Sentence += "m"; + break; + + case H3E_Telephone: + + Sentence += "o"; + break; + + case F1B_J2B_FEC_NBDP_TelexTeleprinter: + + Sentence += "q"; + break; + + case F1B_J2B_ARQ_NBDP_TelexTeleprinter: + + Sentence += "s"; + break; + + case F1B_J2B_ReceiveOnlyTeleprinterDSC: + + Sentence += "w"; + break; + + case A1A_MorseTapeRecorder: + + Sentence += "x"; + break; + + case A1A_MorseKeyHeadset: + + Sentence += "{"; + break; + + case F1C_F2C_F3C_FaxMachine: + + Sentence += "|"; + break; + } + + return( *this ); +} + +const SENTENCE& SENTENCE::operator += ( TRANSDUCER_TYPE transducer ) +{ + Sentence += ","; + + switch( transducer ) + { + case TemperatureTransducer: + + Sentence += "C"; + break; + + case AngularDisplacementTransducer: + + Sentence += "A"; + break; + + case LinearDisplacementTransducer: + + Sentence += "D"; + break; + + case FrequencyTransducer: + + Sentence += "F"; + break; + + case ForceTransducer: + + Sentence += "N"; + break; + + case PressureTransducer: + + Sentence += "P"; + break; + + case FlowRateTransducer: + + Sentence += "R"; + break; + + case TachometerTransducer: + + Sentence += "T"; + break; + + case HumidityTransducer: + + Sentence += "H"; + break; + + case VolumeTransducer: + + Sentence += "V"; + break; + } + + return( *this ); +} + +const SENTENCE& SENTENCE::operator += ( NORTHSOUTH northing ) +{ + Sentence += ","; + + if ( northing == North ) + { + Sentence += "N"; + } + else if ( northing == South ) + { + Sentence += "S"; + } + + return( *this ); +} + +const SENTENCE& SENTENCE::operator += ( int value ) +{ + char temp_string[ 80 ]; + + ::sprintf( temp_string, "%d", value ); + + Sentence += ","; + Sentence += temp_string; + + return( *this ); +} + +const SENTENCE& SENTENCE::operator += ( EASTWEST easting ) +{ + Sentence += ","; + + if ( easting == East ) + { + Sentence += "E"; + } + else if ( easting == West ) + { + Sentence += "W"; + } + + return( *this ); +} + +const SENTENCE& SENTENCE::operator += ( NMEA0183_BOOLEAN boolean ) +{ + Sentence += ","; + + if ( boolean == True ) + { + Sentence += "A"; + } + else if ( boolean == False ) + { + Sentence += "V"; + } + + return( *this ); +} + +const SENTENCE& SENTENCE::operator += ( LATLONG& source ) +{ + source.Write( *this ); + + return( *this ); +} + +const SENTENCE& SENTENCE::operator += ( const time_t time_value ) +{ + struct tm * tm_p = gmtime(&time_value); + + char temp_string[65]; + + sprintf( temp_string, "%02d%02d%02d", tm_p->tm_hour, tm_p->tm_min, tm_p->tm_sec ); + + Sentence += ","; + Sentence += temp_string; + + return( *this ); +} diff --git a/SENTENCE.HPP b/SENTENCE.HPP new file mode 100644 index 0000000..b30b44d --- /dev/null +++ b/SENTENCE.HPP @@ -0,0 +1,89 @@ +#if ! defined( SENTENCE_CLASS_HEADER ) + +#define SENTENCE_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class LATLONG; + +class SENTENCE +{ + public: + + SENTENCE(); + virtual ~SENTENCE(); + + /* + ** Data + */ + + std::string Sentence; + + /* + ** Methods + */ + + virtual NMEA0183_BOOLEAN Boolean( int field_number ) const; + virtual uint8_t ComputeChecksum( void ) const; + virtual COMMUNICATIONS_MODE CommunicationsMode( int field_number ) const; + virtual double Double( int field_number ) const; + virtual EASTWEST EastOrWest( int field_number ) const; + virtual const std::string Field( int field_number ) const; + virtual void Finish( void ); + virtual uint16_t GetNumberOfDataFields( void ) const; + virtual int Integer( int field_number ) const; + virtual NMEA0183_BOOLEAN IsChecksumBad( int checksum_field_number ) const; + virtual LEFTRIGHT LeftOrRight( int field_number ) const; + virtual NORTHSOUTH NorthOrSouth( int field_number ) const; + virtual REFERENCE Reference( int field_number ) const; + virtual const time_t Time( int field_number ) const; + virtual TRANSDUCER_TYPE TransducerType( int field_number ) const; + + /* + ** Operators + */ + + operator std::string() const; + virtual const SENTENCE& operator = ( const SENTENCE& source ); + virtual const SENTENCE& operator = ( const std::string& source ); + virtual const SENTENCE& operator += ( const std::string& source ); + virtual const SENTENCE& operator += ( double value ); + virtual const SENTENCE& operator += ( int value ); + virtual const SENTENCE& operator += ( COMMUNICATIONS_MODE mode ); + virtual const SENTENCE& operator += ( EASTWEST easting ); + virtual const SENTENCE& operator += ( LATLONG& source ); + virtual const SENTENCE& operator += ( NMEA0183_BOOLEAN boolean ); + virtual const SENTENCE& operator += ( NORTHSOUTH northing ); + virtual const SENTENCE& operator += ( const time_t time ); + virtual const SENTENCE& operator += ( TRANSDUCER_TYPE transducer ); +}; + +#endif // SENTENCE_CLASS_HEADER diff --git a/SFI.CPP b/SFI.CPP new file mode 100644 index 0000000..deb0694 --- /dev/null +++ b/SFI.CPP @@ -0,0 +1,168 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +SFI::SFI() +{ + Mnemonic = "SFI"; + Empty(); +} + +SFI::~SFI() +{ + Mnemonic.clear(); + Empty(); +} + +void SFI::Empty( void ) +{ + TotalMessages = 0.0; + MessageNumber = 0.0; + + int index = 0; + + while( index < 6 ) + { + Frequencies[ index ].Empty(); + index++; + } + +} + +bool SFI::Parse( const SENTENCE& sentence ) +{ + /* + ** SFI - Scanning Frequency Information + ** + ** 1 2 3 4 x + ** | | | | | + ** $--SFI,x.x,x.x,xxxxxx,c .......... xxxxxx,c*hh + ** + ** 1) Total Number Of Messages + ** 2) Message Number + ** 3) Frequency 1 + ** 4) Mode 1 + ** x) Checksum + */ + + /* + ** First we check the checksum... + */ + + int number_of_data_fields = sentence.GetNumberOfDataFields(); + + if ( sentence.IsChecksumBad( number_of_data_fields + 1 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + TotalMessages = sentence.Double( 1 ); + MessageNumber = sentence.Double( 2 ); + + /* + ** Clear out any old data + */ + + int index = 0; + + while( index < 6 ) + { + Frequencies[ index ].Empty(); + index++; + } + + int number_of_frequencies = ( number_of_data_fields - 2 ) / 2; + int frequency_number = 0; + + /* + ** index is the number of data fields before the frequency/mode + + ** the frequency number times the number of fields in a FREQUENC_AND_MODE + */ + + while( frequency_number < number_of_frequencies ) + { + index = 2 + ( frequency_number * 2 ); + + Frequencies[ frequency_number ].Parse( index, sentence ); + + frequency_number++; + } + + return( true ); +} + +bool SFI::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += TotalMessages; + sentence += MessageNumber; + + int index = 0; + + while( index < 6 ) + { + Frequencies[ index ].Write( sentence ); + index++; + } + + sentence.Finish(); + + return( true ); +} + +const SFI& SFI::operator = ( const SFI& source ) +{ + TotalMessages = source.TotalMessages; + MessageNumber = source.MessageNumber; + + int index = 0; + + while( index < 6 ) + { + Frequencies[ index ] = source.Frequencies[ index ]; + index++; + } + + return( *this ); +} diff --git a/SFI.HPP b/SFI.HPP new file mode 100644 index 0000000..17ca635 --- /dev/null +++ b/SFI.HPP @@ -0,0 +1,65 @@ +#if ! defined( SFI_CLASS_HEADER ) + +#define SFI_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class SFI : public RESPONSE +{ + public: + + SFI(); + virtual ~SFI(); + + /* + ** Data + */ + + double TotalMessages; + double MessageNumber; + FREQUENCY_AND_MODE Frequencies[ 6 ]; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const SFI& operator = ( const SFI& source ); +}; + +#endif // SFI_CLASS_HEADER diff --git a/STN.CPP b/STN.CPP new file mode 100644 index 0000000..5056c04 --- /dev/null +++ b/STN.CPP @@ -0,0 +1,106 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +STN::STN() +{ + Mnemonic = "STN"; + Empty(); +} + +STN::~STN() +{ + Mnemonic.clear(); + Empty(); +} + +void STN::Empty( void ) +{ + TalkerIDNumber = 0; +} + +bool STN::Parse( const SENTENCE& sentence ) +{ + /* + ** STN - Multiple Data ID + ** + ** 1 2 + ** | | + ** $--STN,x.x,*hh + ** + ** Field Number: + ** 1) Talker ID Number + ** 2) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 2 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + TalkerIDNumber = sentence.Integer( 1 ); + + return( true ); +} + +bool STN::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += TalkerIDNumber; + + sentence.Finish(); + + return( true ); +} + +const STN& STN::operator = ( const STN& source ) +{ + TalkerIDNumber = source.TalkerIDNumber; + + return( *this ); +} diff --git a/STN.HPP b/STN.HPP new file mode 100644 index 0000000..64a7c36 --- /dev/null +++ b/STN.HPP @@ -0,0 +1,63 @@ +#if ! defined( STN_CLASS_HEADER ) + +#define STN_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class STN : public RESPONSE +{ + public: + + STN(); + virtual ~STN(); + + /* + ** Data + */ + + int TalkerIDNumber; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const STN& operator = ( const STN& source ); +}; + +#endif // STN_CLASS_HEADER diff --git a/TALKERID.CPP b/TALKERID.CPP new file mode 100644 index 0000000..4f8f8ae --- /dev/null +++ b/TALKERID.CPP @@ -0,0 +1,53 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +std::string talker_id( const std::string &sentence ) +{ + std::string return_string; + + if ( sentence.length() >= 3 ) + { + if ( sentence[ 0 ] == '$' ) + { + return_string = sentence.substr( 1, 2 ); + } + } + + return( return_string ); +} diff --git a/TEP.CPP b/TEP.CPP new file mode 100644 index 0000000..88fb3bc --- /dev/null +++ b/TEP.CPP @@ -0,0 +1,126 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** There is no recommended replacement. +*/ + +#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 + +TEP::TEP() +{ + Mnemonic = "TEP"; + Empty(); +} + +TEP::~TEP() +{ + Mnemonic.clear(); + Empty(); +} + +void TEP::Empty( void ) +{ + ElevationDegrees = 0.0; +} + +bool TEP::Parse( const SENTENCE& sentence ) +{ + /* + ** TEP - TRANSIT Satellite Predicted Elevation + ** + ** 1 2 3 + ** | | | + ** $--TEP,x.x,T*hh + ** + ** Field Number: + ** 1) Elevation degrees + ** 2) D = Degrees + ** 3) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 3 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + ElevationDegrees = sentence.Double( 1 ); + + return( true ); +} + +std::string TEP::PlainEnglish( void ) const +{ + std::string return_string("TRANSIT satellite predicted elevation is "); + + char temp_string[65]; + + sprintf( temp_string, "%6.2lf degrees.", ElevationDegrees ); + + return_string += temp_string; + + return( return_string ); +} + +bool TEP::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += ElevationDegrees; + sentence += "D"; + + sentence.Finish(); + + return( true ); +} + +const TEP& TEP::operator = ( const TEP& source ) +{ + ElevationDegrees = source.ElevationDegrees; + + return( *this ); +} diff --git a/TEP.HPP b/TEP.HPP new file mode 100644 index 0000000..7483564 --- /dev/null +++ b/TEP.HPP @@ -0,0 +1,69 @@ +#if ! defined( TEP_CLASS_HEADER ) + +#define TEP_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** There is no recommended replacement. +*/ + +class TEP : public RESPONSE +{ + public: + + TEP(); + virtual ~TEP(); + + /* + ** Data + */ + + double ElevationDegrees; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual std::string PlainEnglish( void ) const override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const TEP& operator = ( const TEP& source ); +}; + +#endif // TEP_CLASS_HEADER diff --git a/TEST/TEST.sln b/TEST/TEST.sln new file mode 100644 index 0000000..04eab15 --- /dev/null +++ b/TEST/TEST.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TEST", "TEST.vcxproj", "{145D7F6C-EA6A-4366-BF54-EDAD9E386973}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + Template|x64 = Template|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {145D7F6C-EA6A-4366-BF54-EDAD9E386973}.Debug|x64.ActiveCfg = Debug|x64 + {145D7F6C-EA6A-4366-BF54-EDAD9E386973}.Debug|x64.Build.0 = Debug|x64 + {145D7F6C-EA6A-4366-BF54-EDAD9E386973}.Release|x64.ActiveCfg = Release|x64 + {145D7F6C-EA6A-4366-BF54-EDAD9E386973}.Release|x64.Build.0 = Release|x64 + {145D7F6C-EA6A-4366-BF54-EDAD9E386973}.Template|x64.ActiveCfg = Template|x64 + {145D7F6C-EA6A-4366-BF54-EDAD9E386973}.Template|x64.Build.0 = Template|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/TEST/TEST.vcproj b/TEST/TEST.vcproj new file mode 100644 index 0000000..8eb9c60 --- /dev/null +++ b/TEST/TEST.vcproj @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TEST/TEST.vcxproj b/TEST/TEST.vcxproj new file mode 100644 index 0000000..dda3774 --- /dev/null +++ b/TEST/TEST.vcxproj @@ -0,0 +1,259 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + Template + Win32 + + + Template + x64 + + + + + + MFCProj + {145D7F6C-EA6A-4366-BF54-EDAD9E386973} + + + + Application + v140 + + + Application + v140 + + + Application + v140 + Dynamic + MultiByte + + + Application + v140 + Dynamic + MultiByte + + + Application + v140 + Dynamic + MultiByte + + + Application + v140 + Dynamic + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + + + + + + .\WinRel\ + .\WinRel\ + false + + + false + $(VC_IncludePath);$(WindowsSDK_IncludePath);.. + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;..\$(Platform)\$(Configuration)\ + + + .\WinDebug\ + .\WinDebug\ + true + + + true + $(VC_IncludePath);$(WindowsSDK_IncludePath);.. + $(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;..\$(Platform)\$(Configuration)\ + + + + MultiThreadedDLL + Default + true + true + MaxSpeed + true + Level4 + \cpp\nmea0183;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + .\WinRel\ + .\WinRel\TEST.pch + .\WinRel\ + .\WinRel\ + + + .\WinRel\TEST.tlb + + + 0x0409 + \cpp\nmea0183;%(AdditionalIncludeDirectories) + NDEBUG;%(PreprocessorDefinitions) + + + true + .\WinRel\TEST.bsc + + + true + Console + .\WinRel\TEST.exe + + + + + MultiThreadedDLL + Default + true + true + MaxSpeed + true + Level4 + \cpp\nmea0183;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(IntDir) + .\WinRel\TEST.pch + $(IntDir) + $(IntDir)$(ProjectName).pdb + + + .\WinRel\TEST.tlb + + + 0x0409 + \cpp\nmea0183;%(AdditionalIncludeDirectories) + NDEBUG;%(PreprocessorDefinitions) + + + true + .\WinRel\TEST.bsc + + + true + Console + $(OutDir)$(TargetName)$(TargetExt) + + + + + MultiThreadedDebugDLL + Default + false + Disabled + true + Level4 + true + EditAndContinue + \cpp\nmea0183;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + .\WinDebug\ + .\WinDebug\TEST.pch + .\WinDebug\ + .\WinDebug\ + + + .\WinDebug\TEST.tlb + + + 0x0409 + \cpp\nmea0183;%(AdditionalIncludeDirectories) + _DEBUG;%(PreprocessorDefinitions) + + + true + .\WinDebug\TEST.bsc + + + true + true + Console + .\WinDebug\TEST.exe + + + + + MultiThreadedDebugDLL + Default + false + Disabled + true + Level4 + ProgramDatabase + \cpp\nmea0183;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + $(IntDir) + .\WinDebug\TEST.pch + $(IntDir) + $(IntDir)$(ProjectName).pdb + + + .\WinDebug\TEST.tlb + + + 0x0409 + \cpp\nmea0183;%(AdditionalIncludeDirectories) + _DEBUG;%(PreprocessorDefinitions) + + + true + .\WinDebug\TEST.bsc + + + true + true + Console + $(OutDir)$(TargetName)$(TargetExt) + + + + + + + + + \ No newline at end of file diff --git a/TEST/TEST.vcxproj.filters b/TEST/TEST.vcxproj.filters new file mode 100644 index 0000000..bb34360 --- /dev/null +++ b/TEST/TEST.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {72af75bb-ebdb-4dbd-a5b3-a55301c90e53} + cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90 + + + {5a004e6b-1b34-4bca-8d60-ee64e2b779d8} + h;hpp;hxx;hm;inl;fi;fd + + + {f32d6340-13bd-434b-a56a-66b0c247c29f} + ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe + + + + + Source Files + + + \ No newline at end of file diff --git a/TEST/TEST.vcxproj.user b/TEST/TEST.vcxproj.user new file mode 100644 index 0000000..abe8dd8 --- /dev/null +++ b/TEST/TEST.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/TEST/test.cpp b/TEST/test.cpp new file mode 100644 index 0000000..ee31547 --- /dev/null +++ b/TEST/test.cpp @@ -0,0 +1,139 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +#pragma comment( lib, "nmea0183.lib" ) + +/* +** This is the test scenario. Add more sentences to the list to test them +*/ + +class TestingFunctorinator // Dr. Doofenshmirtz naming convention +{ +public: + + NMEA0183 nmea0183; + + // Now turn this mild mannered class into a functor! + void operator () (std::string& item) + { + nmea0183.SetSentence(item.c_str()); + + if (nmea0183.Parse() != true) + { + std::string sentence; + + nmea0183.GetSentence(sentence); + printf("\nCan't parse \"%s\"\n", (const char *)sentence.c_str()); + printf("Failed with \"%s\"\n", (const char *)nmea0183.ErrorMessage.c_str()); + printf("Last Sentence Received is \"%s\"\n", (const char *)nmea0183.LastSentenceIDReceived.c_str()); + printf("Last Sentence Parsed is \"%s\"\n\n", (const char *)nmea0183.LastSentenceIDParsed.c_str()); + } + else + { + printf("%s parsed OK from %s\n", (const char *)nmea0183.LastSentenceIDParsed.c_str(), (const char *)nmea0183.ExpandedTalkerID.c_str()); + + if (nmea0183.PlainText.length() != 0) + { + printf("In plain English, %s\n", (const char *)nmea0183.PlainText.c_str()); + } + } + } +}; + +int main() +{ + std::vector test_sentences; + + /* + ** Load our test sentences and keep track of where they came from + */ +#if 1 + test_sentences.push_back("$PGRMM,NAD27 Canada*2F\r\n"); // Peter Bennett, bennett@triumf.ca + test_sentences.push_back( "$LCAAM,V,A,.15,N,CHAT-N6*56\r\n" ); // NMEA0183 document, pg 39 + test_sentences.push_back( "$GPAPB,A,A,0.0,R,N,V,V,86.8,T,001,86.9,T,86.9,T\r\n" ); // I can't remember + test_sentences.push_back( "$GPAPB,A,A,0.0,R,N,V,V,86.8,T,001,86.9,T,86.9,T\r\n" ); // I can't remember + test_sentences.push_back( "$GPBWC,104432.69,3337.36,N,11154.54,W,86.9,T,74.6,M,3.2,N,001\r\n" ); // I can't remember + test_sentences.push_back( "$GPBWC,104435.12,3337.36,N,11154.54,W,86.9,T,74.6,M,3.2,N,001\r\n" ); // I can't remember + test_sentences.push_back( "$GPBWC,220516,5130.02,N,00046.34,W,213.8,T,218.0,M,0004.6,N,EGLM*11\r\n" ); // pwyld@cix.compulink.co.uk ("Peter Wyld") + test_sentences.push_back( "$GPBWC,225444,4917.24,N,12309.57,W,051.9,T,031.6,M,001.3,N,004*29\r\n" ); // Peter Bennett, bennett@triumf.ca + test_sentences.push_back( "$CTFSI,020230,026140,m,5*11\r\n" ); // NMEA0183 document, pg 41 + test_sentences.push_back( "$CDFSI,900016,,d,9*08\r\n" ); // NMEA0183 document, pg 41 + test_sentences.push_back( "$CTFSI,416193,,s,0*00\r\n" ); // NMEA0183 document, pg 41 + test_sentences.push_back( "$CXFSI,,021875,t,*3A\r\n" ); // NMEA0183 document, pg 41 + test_sentences.push_back( "$GPGGA,104435.12,3337.19,N,11158.43,W,1,06,4.5,,,,,,\r\n" ); // I can't remember + test_sentences.push_back( "$GPGGA,104432.69,3337.19,N,11158.43,W,1,06,5.1,,,,,,\r\n" ); // I can't remember + test_sentences.push_back( "$GPGLL,3337.190,N,11158.430,W,104432.686,A\r\n" ); // I can't remember + test_sentences.push_back( "$GPGLL,3337.190,N,11158.430,W,104435.122,A\r\n" ); // I can't remember + test_sentences.push_back( "$LCGLL,4728.31,N,12254.25,W,091342,A*21\r\n" ); // NMEA0183 document, pg 39 + test_sentences.push_back( "$GPGLL,4916.45,N,12311.12,W*71\r\n" ); // Peter Bennett, bennett@triumf.ca + test_sentences.push_back( "$GPGLL,5133.81,N,00042.25,W*75\r\n" ); // pwyld@cix.compulink.co.uk ("Peter Wyld") + test_sentences.push_back( "$GPR00,MINST,CHATN,CHAT1,CHATW,CHATM,CHATE,003,004,005,006,007,,,*05\r\n" ); // Peter Bennett, bennett@triumf.ca + test_sentences.push_back( "$LCRMA,V,,,,,14162.8,,,,,*0D\r\n" ); // NMEA0183 document, pg 40 + test_sentences.push_back( "$LCRMA,V,,,,,14172.3,26026.7,,,,*2E\r\n" ); // NMEA0183 document, pg 40 + test_sentences.push_back( "$LCRMA,A,,,,,14182.3,26026.7,,,,*36\r\n" ); // NMEA0183 document, pg 40 + test_sentences.push_back( "$LCRMA,A,4226.26,N,07125.89,W,14182.3,26026.7,8.5,275.,14.0,W*68\r\n" ); // NMEA0183 document, pg 40 + test_sentences.push_back( "$LCRMA,V,4226.26,N,07125.89,W,14182.3,26026.7,8.5,275.,14.0,W*7F\r\n" ); // NMEA0183 document, pg 40 + test_sentences.push_back( "$LCRMA,A,4226.265,N,07125.890,W,14172.33,26026.71,8.53,275.,14.0,W*53\r\n" ); // NMEA0183 document, pg 40 + test_sentences.push_back( "$GPRMB,A,0.66,L,003,004,4917.24,N,12309.57,W,001.3,052.5,000.5,V*0B\r\n" ); // Peter Bennett, bennett@triumf.ca + test_sentences.push_back( "$GPRMB,A,4.08,L,EGLL,EGLM,5130.02,N,00046.34,W,004.6,213.9,122.9,A*3D\r\n" ); // pwyld@cix.compulink.co.uk ("Peter Wyld") + test_sentences.push_back( "$GPRMC,225446,A,4916.45,N,12311.12,W,000.5,054.7,191194,020.3,E*68\r\n" ); // Peter Bennett, bennett@triumf.ca + test_sentences.push_back( "$GPRMC,220516,A,5133.82,N,00042.24,W,173.8,231.8,130694,004.2,W*70\r\n" ); // pwyld@cix.compulink.co.uk ("Peter Wyld") + test_sentences.push_back( "$GPVTG,0.0,T,347.6,M,0.0,N,0.0,K\r\n" ); // I can't remember + test_sentences.push_back( "$GPVTG,0.0,T,347.6,M,0.0,N,0.0,K\r\n" ); // I can't remember + test_sentences.push_back( "$GPVTG,054.7,T,034.4,M,000.5,N,000.9,K*47\r\n" ); // Peter Bennett, bennett@triumf.ca + test_sentences.push_back( "$GPWPL,4917.16,N,12310.64,W,003*65\r\n" ); // Peter Bennett, bennett@triumf.ca + test_sentences.push_back( "$GPWPL,5128.62,N,00027.58,W,EGLL*59\r\n" ); // pwyld@cix.compulink.co.uk ("Peter Wyld") + test_sentences.push_back( "$GPXTE,A,A,0.67,L,N*6F\r\n" ); // Peter Bennett, bennett@triumf.ca + test_sentences.push_back( "$GPXTE,A,A,4.07,L,N*6D\r\n" ); // pwyld@cix.compulink.co.uk ("Peter Wyld") +#endif + test_sentences.push_back( "$GPGGA,103050,3912.073,N,07646.887,W,1,08,1.8,2.5,M,-34.0,M,,*72\r\n" ); // Me sitting at home with my Garmin 12XL + + /* + ** Finish up with some proprietary sentences, just for giggles + */ + + test_sentences.push_back( "$PGRMZ,93,f,3*21\r\n" ); // Peter Bennett, bennett@triumf.ca + test_sentences.push_back( "$PGRMZ,201,f,3*18\r\n" ); // pwyld@cix.compulink.co.uk ("Peter Wyld") + test_sentences.push_back( "$PSLIB,,,J*22\r\n" ); // Peter Bennett, bennett@triumf.ca + test_sentences.push_back( "$PSRDA003[470738][1224523]??RST47,3809,A004*47\r\n" ); // NMEA0183 document, pg 40 + + /* + ** Now loop through the list and attempt to parse each sentence + */ + + TestingFunctorinator testerinator; + + std::for_each( test_sentences.begin(), test_sentences.end(), testerinator ); + + return( EXIT_SUCCESS ); +} diff --git a/TRF.CPP b/TRF.CPP new file mode 100644 index 0000000..8bc371d --- /dev/null +++ b/TRF.CPP @@ -0,0 +1,151 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +TRF::TRF() +{ + Mnemonic = "TRF"; + Empty(); +} + +TRF::~TRF() +{ + Mnemonic.clear(); + Empty(); +} + +void TRF::Empty( void ) +{ + UTCTime.clear(); + Date.clear(); + Position.Empty(); + ElevationAngle = 0.0; + NumberOfIterations = 0.0; + NumberOfDopplerIntervals = 0.0; + UpdateDistanceNauticalMiles = 0.0; + SatelliteID = 0; + IsDataValid = NMEA_Unknown; +} + +bool TRF::Parse( const SENTENCE& sentence ) +{ + /* + ** TRF - TRANSIT Fix Data + ** 13 + ** 1 2 3 4 5 6 7 8 9 10 11 12| + ** | | | | | | | | | | | | | + ** $--TRF,hhmmss.ss,xxxxxx,llll.ll,a,yyyyy.yy,a,x.x,x.x,x.x,x.x,xxx,A*hh + ** + ** Field Number: + ** 1) UTC Time + ** 2) Date, ddmmyy + ** 3) Latitude + ** 4) N or S + ** 5) Longitude + ** 6) E or W + ** 7) Elevation Angle + ** 8) Number of iterations + ** 9) Number of Doppler intervals + ** 10) Update distance, nautical miles + ** 11) Satellite ID + ** 12) Data Validity + ** 13) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 13 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + UTCTime = sentence.Field( 1 ); + Time = sentence.Time( 1 ); + Date = sentence.Field( 2 ); + Position.Parse( 3, 4, 5, 6, sentence ); + ElevationAngle = sentence.Double( 7 ); + NumberOfIterations = sentence.Double( 8 ); + NumberOfDopplerIntervals = sentence.Double( 9 ); + UpdateDistanceNauticalMiles = sentence.Double( 10 ); + SatelliteID = sentence.Integer( 11 ); + IsDataValid = sentence.Boolean( 12 ); + + return( true ); +} + +bool TRF::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += UTCTime; + sentence += Date; + sentence += Position; + sentence += ElevationAngle; + sentence += NumberOfIterations; + sentence += NumberOfDopplerIntervals; + sentence += UpdateDistanceNauticalMiles; + sentence += SatelliteID; + sentence += IsDataValid; + + sentence.Finish(); + + return( true ); +} + +const TRF& TRF::operator = ( const TRF& source ) +{ + UTCTime = source.UTCTime; + Time = source.Time; + Date = source.Date; + Position = source.Position; + ElevationAngle = source.ElevationAngle; + NumberOfIterations = source.NumberOfIterations; + NumberOfDopplerIntervals = source.NumberOfDopplerIntervals; + UpdateDistanceNauticalMiles = source.UpdateDistanceNauticalMiles; + SatelliteID = source.SatelliteID; + IsDataValid = source.IsDataValid; + + return( *this ); +} diff --git a/TRF.HPP b/TRF.HPP new file mode 100644 index 0000000..9c70461 --- /dev/null +++ b/TRF.HPP @@ -0,0 +1,72 @@ +#if ! defined( TRF_CLASS_HEADER ) + +#define TRF_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class TRF : public RESPONSE +{ + public: + + TRF(); + virtual ~TRF(); + + /* + ** Data + */ + + std::string UTCTime; + time_t Time; + std::string Date; + LATLONG Position; + double ElevationAngle; + double NumberOfIterations; + double NumberOfDopplerIntervals; + double UpdateDistanceNauticalMiles; + double SatelliteID; + NMEA0183_BOOLEAN IsDataValid; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const TRF& operator = ( const TRF& source ); +}; + +#endif // TRF_CLASS_HEADER diff --git a/TTM.CPP b/TTM.CPP new file mode 100644 index 0000000..dd313b5 --- /dev/null +++ b/TTM.CPP @@ -0,0 +1,206 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +TTM::TTM() +{ + Mnemonic = "TTM"; + Empty(); +} + +TTM::~TTM() +{ + Mnemonic.clear(); + Empty(); +} + +void TTM::Empty( void ) +{ + TargetNumber = 0; + TargetDistance = 0.0; + BearingFromOwnShip = 0.0; + BearingUnits.clear(); + TargetSpeed = 0.0; + TargetCourse = 0.0; + TargetCourseUnits.clear(); + DistanceOfClosestPointOfApproach = 0.0; + NumberOfMinutesToClosestPointOfApproach = 0.0; + Increasing.clear(); + TargetName.clear(); + TargetStatus = TargetUnknown; +} + +bool TTM::Parse( const SENTENCE& sentence ) +{ + /* + ** TTM - Tracked Target Message + ** + ** 11 13 + ** 1 2 3 4 5 6 7 8 9 10| 12| 14 + ** | | | | | | | | | | | | | | + ** $--TTM,xx,x.x,x.x,a,x.x,x.x,a,x.x,x.x,a,c--c,a,a*hh + ** + ** 1) Target Number + ** 2) Target Distance + ** 3) Bearing from own ship + ** 4) Bearing Units + ** 5) Target speed + ** 6) Target Course + ** 7) Course Units + ** 8) Distance of closest-point-of-approach + ** 9) Time until closest-point-of-approach "-" means increasing + ** 10) "-" means increasing + ** 11) Target name + ** 12) Target Status + ** 13) Reference Target + ** 14) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 14 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + TargetNumber = sentence.Integer( 1 ); + TargetDistance = sentence.Double( 2 ); + BearingFromOwnShip = sentence.Double( 3 ); + BearingUnits = sentence.Field( 4 ); + TargetSpeed = sentence.Double( 5 ); + TargetCourse = sentence.Double( 6 ); + TargetCourseUnits = sentence.Field( 7 ); + DistanceOfClosestPointOfApproach = sentence.Double( 8 ); + NumberOfMinutesToClosestPointOfApproach = sentence.Double( 9 ); + Increasing = sentence.Field( 10 ); + TargetName = sentence.Field( 11 ); + + std::string field_data = sentence.Field( 12 ); + + if ( field_data == "L" ) + { + TargetStatus = TargetLost; + } + else if ( field_data == "Q" ) + { + TargetStatus = TargetQuery; + } + else if ( field_data == "T" ) + { + TargetStatus = TargetTracking; + } + else + { + TargetStatus = TargetUnknown; + } + + ReferenceTarget = sentence.Field( 13 ); + + return( true ); +} + +bool TTM::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += TargetNumber; + sentence += TargetDistance; + sentence += BearingFromOwnShip; + sentence += BearingUnits; + sentence += TargetSpeed; + sentence += TargetCourse; + sentence += TargetCourseUnits; + sentence += DistanceOfClosestPointOfApproach; + sentence += NumberOfMinutesToClosestPointOfApproach; + sentence += Increasing; + sentence += TargetName; + + switch( TargetStatus ) + { + case TargetLost: + + sentence += "L"; + break; + + case TargetQuery: + + sentence += "Q"; + break; + + case TargetTracking: + + sentence += "T"; + break; + + default: + + sentence += ""; + break; + } + + sentence += ReferenceTarget; + + sentence.Finish(); + + return( true ); +} + +const TTM& TTM::operator = ( const TTM& source ) +{ + TargetNumber = source.TargetNumber; + TargetDistance = source.TargetDistance; + BearingFromOwnShip = source.BearingFromOwnShip; + BearingUnits = source.BearingUnits; + TargetSpeed = source.TargetSpeed; + TargetCourse = source.TargetCourse; + TargetCourseUnits = source.TargetCourseUnits; + DistanceOfClosestPointOfApproach = source.DistanceOfClosestPointOfApproach; + NumberOfMinutesToClosestPointOfApproach = source.NumberOfMinutesToClosestPointOfApproach; + Increasing = source.Increasing; + TargetName = source.TargetName; + TargetStatus = source.TargetStatus; + + return( *this ); +} diff --git a/TTM.HPP b/TTM.HPP new file mode 100644 index 0000000..11e1d2a --- /dev/null +++ b/TTM.HPP @@ -0,0 +1,84 @@ +#if ! defined( TTM_CLASS_HEADER ) + +#define TTM_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +typedef enum +{ + TargetUnknown = 0, + TargetLost, + TargetQuery, + TargetTracking +} +TARGET_STATUS; + +class TTM : public RESPONSE +{ + public: + + TTM(); + virtual ~TTM(); + + /* + ** Data + */ + + int TargetNumber; + double TargetDistance; + double BearingFromOwnShip; + std::string BearingUnits; + double TargetSpeed; + double TargetCourse; + std::string TargetCourseUnits; + double DistanceOfClosestPointOfApproach; + double NumberOfMinutesToClosestPointOfApproach; + std::string Increasing; + std::string TargetName; + TARGET_STATUS TargetStatus; + std::string ReferenceTarget; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const TTM& operator = ( const TTM& source ); +}; + +#endif // TTM_CLASS_HEADER diff --git a/VBW.CPP b/VBW.CPP new file mode 100644 index 0000000..a9d97e4 --- /dev/null +++ b/VBW.CPP @@ -0,0 +1,131 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +VBW::VBW() +{ + Mnemonic = "VBW"; + Empty(); +} + +VBW::~VBW() +{ + Mnemonic.clear(); + Empty(); +} + +void VBW::Empty( void ) +{ + LongitudinalWaterSpeed = 0.0; + TransverseWaterSpeed = 0.0; + IsWaterSpeedValid = NMEA_Unknown; + LongitudinalGroundSpeed = 0.0; + TransverseGroundSpeed = 0.0; + IsGroundSpeedValid = NMEA_Unknown; +} + +bool VBW::Parse( const SENTENCE& sentence ) +{ + /* + ** VBW - Dual Ground/Water Speed + ** + ** 1 2 3 4 5 6 7 + ** | | | | | | | + ** $--VBW,x.x,x.x,A,x.x,x.x,A*hh + ** + ** Field Number: + ** 1) Longitudinal water speed, "-" means astern + ** 2) Transverse water speed, "-" means port + ** 3) Status, A = Data Valid + ** 4) Longitudinal ground speed, "-" means astern + ** 5) Transverse ground speed, "-" means port + ** 6) Status, A = Data Valid + ** 7) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 7 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + LongitudinalWaterSpeed = sentence.Double( 1 ); + TransverseWaterSpeed = sentence.Double( 2 ); + IsWaterSpeedValid = sentence.Boolean( 3 ); + LongitudinalGroundSpeed = sentence.Double( 4 ); + TransverseGroundSpeed = sentence.Double( 5 ); + IsGroundSpeedValid = sentence.Boolean( 6 ); + + return( true ); +} + +bool VBW::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += LongitudinalWaterSpeed; + sentence += TransverseWaterSpeed; + sentence += IsWaterSpeedValid; + sentence += LongitudinalGroundSpeed; + sentence += TransverseGroundSpeed; + sentence += IsGroundSpeedValid; + + sentence.Finish(); + + return( true ); +} + +const VBW& VBW::operator = ( const VBW& source ) +{ + LongitudinalWaterSpeed = source.LongitudinalWaterSpeed; + TransverseWaterSpeed = source.TransverseWaterSpeed; + IsWaterSpeedValid = source.IsWaterSpeedValid; + LongitudinalGroundSpeed = source.LongitudinalGroundSpeed; + TransverseGroundSpeed = source.TransverseGroundSpeed; + IsGroundSpeedValid = source.IsGroundSpeedValid; + + return( *this ); +} diff --git a/VBW.HPP b/VBW.HPP new file mode 100644 index 0000000..6a213f2 --- /dev/null +++ b/VBW.HPP @@ -0,0 +1,68 @@ +#if ! defined( VBW_CLASS_HEADER ) + +#define VBW_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class VBW : public RESPONSE +{ + public: + + VBW(); + virtual ~VBW(); + + /* + ** Data + */ + + double LongitudinalWaterSpeed; + double TransverseWaterSpeed; + NMEA0183_BOOLEAN IsWaterSpeedValid; + double LongitudinalGroundSpeed; + double TransverseGroundSpeed; + NMEA0183_BOOLEAN IsGroundSpeedValid; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const VBW& operator = ( const VBW& source ); +}; + +#endif // VBW_CLASS_HEADER diff --git a/VDR.CPP b/VDR.CPP new file mode 100644 index 0000000..844c7ae --- /dev/null +++ b/VDR.CPP @@ -0,0 +1,122 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +VDR::VDR() +{ + Mnemonic = "VDR"; + Empty(); +} + +VDR::~VDR() +{ + Mnemonic.clear(); + Empty(); +} + +void VDR::Empty( void ) +{ + DegreesTrue = 0.0; + DegreesMagnetic = 0.0; + Knots = 0.0; +} + +bool VDR::Parse( const SENTENCE& sentence ) +{ + /* + ** VDR - Set and Drift + ** + ** 1 2 3 4 5 6 7 + ** | | | | | | | + ** $--VDR,x.x,T,x.x,M,x.x,N*hh + ** + ** Field Number: + ** 1) Degress True + ** 2) T = True + ** 3) Degrees Magnetic + ** 4) M = Magnetic + ** 5) Knots (speed of current) + ** 6) N = Knots + ** 7) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 7 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + DegreesTrue = sentence.Double( 1 ); + DegreesMagnetic = sentence.Double( 3 ); + Knots = sentence.Double( 5 ); + + return( true ); +} + +bool VDR::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += DegreesTrue; + sentence += "T"; + sentence += DegreesMagnetic; + sentence += "M"; + sentence += Knots; + sentence += "N"; + + sentence.Finish(); + + return( true ); +} + +const VDR& VDR::operator = ( const VDR& source ) +{ + DegreesTrue = source.DegreesTrue; + DegreesMagnetic = source.DegreesMagnetic; + Knots = source.Knots; + + return( *this ); +} diff --git a/VDR.HPP b/VDR.HPP new file mode 100644 index 0000000..e112213 --- /dev/null +++ b/VDR.HPP @@ -0,0 +1,65 @@ +#if ! defined( VDR_CLASS_HEADER ) + +#define VDR_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class VDR : public RESPONSE +{ + public: + + VDR(); + virtual ~VDR(); + + /* + ** Data + */ + + double DegreesTrue; + double DegreesMagnetic; + double Knots; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const VDR& operator = ( const VDR& source ); +}; + +#endif // VDR_CLASS_HEADER diff --git a/VHW.CPP b/VHW.CPP new file mode 100644 index 0000000..d7d7c33 --- /dev/null +++ b/VHW.CPP @@ -0,0 +1,129 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +VHW::VHW() +{ + Mnemonic = "VHW"; + Empty(); +} + +VHW::~VHW() +{ + Mnemonic.clear(); + Empty(); +} + +void VHW::Empty( void ) +{ + DegreesTrue = 0.0; + DegreesMagnetic = 0.0; + Knots = 0.0; + KilometersPerHour = 0.0; +} + +bool VHW::Parse( const SENTENCE& sentence ) +{ + /* + ** VHW - Water speed and heading + ** + ** 1 2 3 4 5 6 7 8 9 + ** | | | | | | | | | + ** $--VHW,x.x,T,x.x,M,x.x,N,x.x,K*hh + ** + ** Field Number: + ** 1) Degress True + ** 2) T = True + ** 3) Degrees Magnetic + ** 4) M = Magnetic + ** 5) Knots (speed of vessel relative to the water) + ** 6) N = Knots + ** 7) Kilometers (speed of vessel relative to the water) + ** 8) K = Kilometers + ** 9) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 9 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + DegreesTrue = sentence.Double( 1 ); + DegreesMagnetic = sentence.Double( 3 ); + Knots = sentence.Double( 5 ); + KilometersPerHour = sentence.Double( 7 ); + + return( true ); +} + +bool VHW::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += DegreesTrue; + sentence += "T"; + sentence += DegreesMagnetic; + sentence += "M"; + sentence += Knots; + sentence += "N"; + sentence += KilometersPerHour; + sentence += "K"; + + sentence.Finish(); + + return( true ); +} + +const VHW& VHW::operator = ( const VHW& source ) +{ + DegreesTrue = source.DegreesTrue; + DegreesMagnetic = source.DegreesMagnetic; + Knots = source.Knots; + KilometersPerHour = source.KilometersPerHour; + + return( *this ); +} diff --git a/VHW.HPP b/VHW.HPP new file mode 100644 index 0000000..14cfa48 --- /dev/null +++ b/VHW.HPP @@ -0,0 +1,66 @@ +#if ! defined( VHW_CLASS_HEADER ) + +#define VHW_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class VHW : public RESPONSE +{ + public: + + VHW(); + virtual ~VHW(); + + /* + ** Data + */ + + double DegreesTrue; + double DegreesMagnetic; + double Knots; + double KilometersPerHour; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const VHW& operator = ( const VHW& source ); +}; + +#endif // VHW_CLASS_HEADER diff --git a/VLW.CPP b/VLW.CPP new file mode 100644 index 0000000..5901d48 --- /dev/null +++ b/VLW.CPP @@ -0,0 +1,115 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +VLW::VLW() +{ + Mnemonic = "VLW"; + Empty(); +} + +VLW::~VLW() +{ + Mnemonic.clear(); + Empty(); +} + +void VLW::Empty( void ) +{ + TotalDistanceNauticalMiles = 0.0; + DistanceSinceResetNauticalMiles = 0.0; +} + +bool VLW::Parse( const SENTENCE& sentence ) +{ + /* + ** VLW - Distance Traveled through Water + ** + ** 1 2 3 4 5 + ** | | | | | + ** $--VLW,x.x,N,x.x,N*hh + ** + ** Field Number: + ** 1) Total cumulative distance + ** 2) N = Nautical Miles + ** 3) Distance since Reset + ** 4) N = Nautical Miles + ** 5) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 5 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + TotalDistanceNauticalMiles = sentence.Double( 1 ); + DistanceSinceResetNauticalMiles = sentence.Double( 3 ); + + return( true ); +} + +bool VLW::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += TotalDistanceNauticalMiles; + sentence += "N"; + sentence += DistanceSinceResetNauticalMiles; + sentence += "N"; + + sentence.Finish(); + + return( true ); +} + +const VLW& VLW::operator = ( const VLW& source ) +{ + TotalDistanceNauticalMiles = source.TotalDistanceNauticalMiles; + DistanceSinceResetNauticalMiles = source.DistanceSinceResetNauticalMiles; + + return( *this ); +} diff --git a/VLW.HPP b/VLW.HPP new file mode 100644 index 0000000..08d6534 --- /dev/null +++ b/VLW.HPP @@ -0,0 +1,64 @@ +#if ! defined( VLW_CLASS_HEADER ) + +#define VLW_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class VLW : public RESPONSE +{ + public: + + VLW(); + virtual ~VLW(); + + /* + ** Data + */ + + double TotalDistanceNauticalMiles; + double DistanceSinceResetNauticalMiles; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const VLW& operator = ( const VLW& source ); +}; + +#endif // VLW_CLASS_HEADER diff --git a/VPW.CPP b/VPW.CPP new file mode 100644 index 0000000..5dc32f6 --- /dev/null +++ b/VPW.CPP @@ -0,0 +1,115 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +VPW::VPW() +{ + Mnemonic = "VPW"; + Empty(); +} + +VPW::~VPW() +{ + Mnemonic.clear(); + Empty(); +} + +void VPW::Empty( void ) +{ + Knots = 0.0; + MetersPerSecond = 0.0; +} + +bool VPW::Parse( const SENTENCE& sentence ) +{ + /* + ** VPW - Speed - Measured Parallel to Wind + ** + ** 1 2 3 4 5 + ** | | | | | + ** $--VPW,x.x,N,x.x,M*hh + ** + ** Field Number: + ** 1) Speed, "-" means downwind + ** 2) N = Knots + ** 3) Speed, "-" means downwind + ** 4) M = Meters per second + ** 5) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 5 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + Knots = sentence.Double( 1 ); + MetersPerSecond = sentence.Double( 3 ); + + return( true ); +} + +bool VPW::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += Knots; + sentence += "N"; + sentence += MetersPerSecond; + sentence += "M"; + + sentence.Finish(); + + return( true ); +} + +const VPW& VPW::operator = ( const VPW& source ) +{ + Knots = source.Knots; + MetersPerSecond = source.MetersPerSecond; + + return( *this ); +} diff --git a/VPW.HPP b/VPW.HPP new file mode 100644 index 0000000..d090240 --- /dev/null +++ b/VPW.HPP @@ -0,0 +1,64 @@ +#if ! defined( VPW_CLASS_HEADER ) + +#define VPW_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class VPW : public RESPONSE +{ + public: + + VPW(); + virtual ~VPW(); + + /* + ** Data + */ + + double Knots; + double MetersPerSecond; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const VPW& operator = ( const VPW& source ); +}; + +#endif // VPW_CLASS_HEADER diff --git a/VTG.CPP b/VTG.CPP new file mode 100644 index 0000000..42885a6 --- /dev/null +++ b/VTG.CPP @@ -0,0 +1,129 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +VTG::VTG() +{ + Mnemonic = "VTG"; + Empty(); +} + +VTG::~VTG() +{ + Mnemonic.clear(); + Empty(); +} + +void VTG::Empty( void ) +{ + TrackDegreesTrue = 0.0; + TrackDegreesMagnetic = 0.0; + SpeedKnots = 0.0; + SpeedKilometersPerHour = 0.0; +} + +bool VTG::Parse( const SENTENCE& sentence ) +{ + /* + ** VTG - Track made good and Ground speed + ** + ** 1 2 3 4 5 6 7 8 9 + ** | | | | | | | | | + ** $--VTG,x.x,T,x.x,M,x.x,N,x.x,K*hh + ** + ** Field Number: + ** 1) Track Degrees + ** 2) T = True + ** 3) Track Degrees + ** 4) M = Magnetic + ** 5) Speed Knots + ** 6) N = Knots + ** 7) Speed Kilometers Per Hour + ** 8) K = Kilometers Per Hour + ** 9) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 9 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + TrackDegreesTrue = sentence.Double( 1 ); + TrackDegreesMagnetic = sentence.Double( 3 ); + SpeedKnots = sentence.Double( 5 ); + SpeedKilometersPerHour = sentence.Double( 7 ); + + return( true ); +} + +bool VTG::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += TrackDegreesTrue; + sentence += "T"; + sentence += TrackDegreesMagnetic; + sentence += "M"; + sentence += SpeedKnots; + sentence += "N"; + sentence += SpeedKilometersPerHour; + sentence += "K"; + + sentence.Finish(); + + return( true ); +} + +const VTG& VTG::operator = ( const VTG& source ) +{ + TrackDegreesTrue = source.TrackDegreesTrue; + TrackDegreesMagnetic = source.TrackDegreesMagnetic; + SpeedKnots = source.SpeedKnots; + SpeedKilometersPerHour = source.SpeedKilometersPerHour; + + return( *this ); +} diff --git a/VTG.HPP b/VTG.HPP new file mode 100644 index 0000000..65e5b50 --- /dev/null +++ b/VTG.HPP @@ -0,0 +1,66 @@ +#if ! defined( VTG_CLASS_HEADER ) + +#define VTG_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class VTG : public RESPONSE +{ + public: + + VTG(); + virtual ~VTG(); + + /* + ** Data + */ + + double TrackDegreesTrue; + double TrackDegreesMagnetic; + double SpeedKnots; + double SpeedKilometersPerHour; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const VTG& operator = ( const VTG& source ); +}; + +#endif // VTG_CLASS_HEADER diff --git a/VWE.CPP b/VWE.CPP new file mode 100644 index 0000000..126fc3c --- /dev/null +++ b/VWE.CPP @@ -0,0 +1,111 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** There is no recommended replacement. +*/ + +#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 + +VWE::VWE() +{ + Mnemonic = "VWE"; + Empty(); +} + +VWE::~VWE() +{ + Mnemonic.clear(); + Empty(); +} + +void VWE::Empty( void ) +{ + EfficiencyPercent = 0; +} + +bool VWE::Parse( const SENTENCE& sentence ) +{ + /* + ** VWE - Wind Track Efficiency + ** + ** 1 2 + ** | | + ** $--VWE,x.x,*hh + ** + ** Field Number: + ** 1) Efficiency, Percent + ** 2) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 2 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + EfficiencyPercent = sentence.Integer( 1 ); + + return( true ); +} + +bool VWE::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += EfficiencyPercent; + + sentence.Finish(); + + return( true ); +} + +const VWE& VWE::operator = ( const VWE& source ) +{ + EfficiencyPercent = source.EfficiencyPercent; + + return( *this ); +} diff --git a/VWE.HPP b/VWE.HPP new file mode 100644 index 0000000..0ead897 --- /dev/null +++ b/VWE.HPP @@ -0,0 +1,63 @@ +#if ! defined( VWE_CLASS_HEADER ) + +#define VWE_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class VWE : public RESPONSE +{ + public: + + VWE(); + virtual ~VWE(); + + /* + ** Data + */ + + int EfficiencyPercent; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const VWE& operator = ( const VWE& source ); +}; + +#endif // VWE_CLASS_HEADER diff --git a/WAYPTLOC.CPP b/WAYPTLOC.CPP new file mode 100644 index 0000000..ee074ee --- /dev/null +++ b/WAYPTLOC.CPP @@ -0,0 +1,139 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +#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 + +WAYPOINT_LOCATION::WAYPOINT_LOCATION() +{ + Mnemonic.clear(); + Empty(); +} + +WAYPOINT_LOCATION::~WAYPOINT_LOCATION() +{ + Mnemonic.clear(); + Empty(); +} + +void WAYPOINT_LOCATION::Empty( void ) +{ + Position.Empty(); + UTCTime.clear(); +} + +bool WAYPOINT_LOCATION::Parse( const SENTENCE& sentence ) +{ + /* + ** xxx - Waypoint location + ** + ** 1 2 3 4 5 6 7 + ** | | | | | | | + ** $--xxx,hhmmss.ss,llll.ll,a,yyyyy.yy,a,c--c*hh + ** + ** Field Number: + ** 1) UTC Time + ** 2) Latitude + ** 3) N or S (North or South) + ** 4) Longitude + ** 5) E or W (East or West) + ** 6) Waypoint name + ** 7) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 7 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + UTCTime = sentence.Field( 1 ); + Time = sentence.Time( 1 ); + Position.Parse( 2, 3, 4, 5, sentence ); + Waypoint = sentence.Field( 6 ); + + return( true ); +} + +std::string WAYPOINT_LOCATION::PlainEnglish( void ) const +{ + std::string return_string( "At " ); + std::string time_string = ctime(&Time); + return_string += time_string.substr(0, time_string.length() - 1); + return_string += ", you were at waypoint "; + return_string += Waypoint; + return_string += " located at "; + return_string += Position.PlainEnglish(); + return_string += "."; + + return( return_string ); +} + +bool WAYPOINT_LOCATION::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += UTCTime; + sentence += Position; + sentence += Waypoint; + + sentence.Finish(); + + return( true ); +} + +const WAYPOINT_LOCATION& WAYPOINT_LOCATION::operator = ( const WAYPOINT_LOCATION& source ) +{ + UTCTime = source.UTCTime; + Time = source.Time; + Position = source.Position; + Waypoint = source.Waypoint; + + return( *this ); +} diff --git a/WAYPTLOC.HPP b/WAYPTLOC.HPP new file mode 100644 index 0000000..76ce427 --- /dev/null +++ b/WAYPTLOC.HPP @@ -0,0 +1,72 @@ +#if ! defined( WAYPOINT_LOCATION_CLASS_HEADER ) + +#define WAYPOINT_LOCATION_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** A combination of WPL, GLL, ZDA and ZTG is recommended. +*/ + +class WAYPOINT_LOCATION : public RESPONSE +{ + public: + + WAYPOINT_LOCATION(); + virtual ~WAYPOINT_LOCATION(); + + /* + ** Data + */ + + std::string UTCTime; + time_t Time; + LATLONG Position; + std::string Waypoint; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual std::string PlainEnglish( void ) const override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const WAYPOINT_LOCATION& operator = ( const WAYPOINT_LOCATION& source ); +}; + +#endif // WAYPOINT_LOCATION_CLASS_HEADER diff --git a/WCV.CPP b/WCV.CPP new file mode 100644 index 0000000..a9a5dcc --- /dev/null +++ b/WCV.CPP @@ -0,0 +1,112 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +WCV::WCV() +{ + Mnemonic = "WCV"; + Empty(); +} + +WCV::~WCV() +{ + Mnemonic.clear(); + Empty(); +} + +void WCV::Empty( void ) +{ + Velocity = 0.0; + To.clear(); +} + +bool WCV::Parse( const SENTENCE& sentence ) +{ + /* + ** WCV - Waypoint Closure Velocity + ** + ** 1 2 3 4 + ** | | | | + ** $--WCV,x.x,N,c--c*hh + ** + ** Field Number: + ** 1) Velocity + ** 2) N = knots + ** 3) Waypoint ID + ** 4) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 4 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + Velocity = sentence.Double( 1 ); + To = sentence.Field( 3 ); + + return( true ); +} + +bool WCV::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += Velocity; + sentence += "N"; + sentence += To; + + sentence.Finish(); + return( true ); +} + +const WCV& WCV::operator = ( const WCV& source ) +{ + Velocity = source.Velocity; + To = source.To; + + return( *this ); +} diff --git a/WCV.HPP b/WCV.HPP new file mode 100644 index 0000000..9691f12 --- /dev/null +++ b/WCV.HPP @@ -0,0 +1,64 @@ +#if ! defined( WCV_CLASS_HEADER ) + +#define WCV_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class WCV : public RESPONSE +{ + public: + + WCV(); + virtual ~WCV(); + + /* + ** Data + */ + + double Velocity; + std::string To; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const WCV& operator = ( const WCV& source ); +}; + +#endif // WCV_CLASS_HEADER diff --git a/WDC.CPP b/WDC.CPP new file mode 100644 index 0000000..0991e13 --- /dev/null +++ b/WDC.CPP @@ -0,0 +1,117 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** BWC is recommended. +*/ + +#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 + +WDC::WDC() +{ + Mnemonic = "WDC"; + Empty(); +} + +WDC::~WDC() +{ + Mnemonic.clear(); + Empty(); +} + +void WDC::Empty( void ) +{ + NauticalMiles = 0; + To.clear(); +} + +bool WDC::Parse( const SENTENCE& sentence ) +{ + /* + ** WDC - Distance to Waypoint + ** + ** 1 2 3 4 + ** | | | | + ** $--WDC,x.x,N,c--c*hh + ** + ** 1) Distance to waypoint + ** 2) N = Nautical Miles + ** 3) Waypoint ID (To) + ** 4) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 4 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + NauticalMiles = sentence.Double( 1 ); + To = sentence.Field( 3 ); + + return( true ); +} + +bool WDC::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += NauticalMiles; + sentence += "N"; + sentence += To; + + sentence.Finish(); + + return( true ); +} + +const WDC& WDC::operator = ( const WDC& source ) +{ + NauticalMiles = source.NauticalMiles; + To = source.To; + + return( *this ); +} diff --git a/WDC.HPP b/WDC.HPP new file mode 100644 index 0000000..959f3ce --- /dev/null +++ b/WDC.HPP @@ -0,0 +1,69 @@ +#if ! defined( WDC_CLASS_HEADER ) + +#define WDC_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** BWC is recommended. +*/ + +class WDC : public RESPONSE +{ + public: + + WDC(); + virtual ~WDC(); + + /* + ** Data + */ + + double NauticalMiles; + std::string To; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const WDC& operator = ( const WDC& source ); +}; + +#endif // WDC_CLASS_HEADER diff --git a/WDR.CPP b/WDR.CPP new file mode 100644 index 0000000..672ede5 --- /dev/null +++ b/WDR.CPP @@ -0,0 +1,117 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** BWC is recommended. +*/ + +#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 + +WDR::WDR() +{ + Mnemonic = "WDR"; + Empty(); +} + +WDR::~WDR() +{ + Mnemonic.clear(); + Empty(); +} + +void WDR::Empty( void ) +{ + NauticalMiles = 0; + To.clear(); +} + +bool WDR::Parse( const SENTENCE& sentence ) +{ + /* + ** WDR - Distance to Waypoint, Rhumb Line + ** + ** 1 2 3 4 + ** | | | | + ** $--WDR,x.x,N,c--c*hh + ** + ** 1) Distance to waypoint + ** 2) N = Nautical Miles + ** 3) Waypoint ID (To) + ** 4) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 4 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + NauticalMiles = sentence.Double( 1 ); + To = sentence.Field( 3 ); + + return( true ); +} + +bool WDR::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += NauticalMiles; + sentence += "N"; + sentence += To; + + sentence.Finish(); + + return( true ); +} + +const WDR& WDR::operator = ( const WDR& source ) +{ + NauticalMiles = source.NauticalMiles; + To = source.To; + + return( *this ); +} diff --git a/WDR.HPP b/WDR.HPP new file mode 100644 index 0000000..8b8cec6 --- /dev/null +++ b/WDR.HPP @@ -0,0 +1,70 @@ +#if ! defined( WDR_CLASS_HEADER ) + +#define WDR_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** WDR is recommended (yes, WDR is another sentence not recommended for +** new designs but that's what the spec says). +*/ + +class WDR : public RESPONSE +{ + public: + + WDR(); + virtual ~WDR(); + + /* + ** Data + */ + + double NauticalMiles; + std::string To; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const WDR& operator = ( const WDR& source ); +}; + +#endif // WDR_CLASS_HEADER diff --git a/WNC.CPP b/WNC.CPP new file mode 100644 index 0000000..a7ce39e --- /dev/null +++ b/WNC.CPP @@ -0,0 +1,125 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +WNC::WNC() +{ + Mnemonic = "WNC"; + Empty(); +} + +WNC::~WNC() +{ + Mnemonic.clear(); + Empty(); +} + +void WNC::Empty( void ) +{ + MilesDistance = 0.0; + KilometersDistance = 0.0; + To.clear(); + From.clear(); +} + +bool WNC::Parse( const SENTENCE& sentence ) +{ + /* + ** WNC - Distance - Waypoint to Waypoint + ** + ** 1 2 3 4 5 6 7 + ** | | | | | | | + ** $--WNC,x.x,N,x.x,K,c--c,c--c*hh + ** + ** Field Number: + ** 1) Distance, Nautical Miles + ** 2) N = Nautical Miles + ** 3) Distance, Kilometers + ** 4) K = Kilometers + ** 5) TO Waypoint + ** 6) FROM Waypoint + ** 7) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 7 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + MilesDistance = sentence.Double( 1 ); + KilometersDistance = sentence.Double( 3 ); + To = sentence.Field( 5 ); + From = sentence.Field( 6 ); + + return( true ); +} + +bool WNC::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += MilesDistance; + sentence += "N"; + sentence += KilometersDistance; + sentence += "K"; + sentence += To; + sentence += From; + + sentence.Finish(); + + return( true ); +} + +const WNC& WNC::operator = ( const WNC& source ) +{ + MilesDistance = source.MilesDistance; + KilometersDistance = source.KilometersDistance; + To = source.To; + From = source.From; + + return( *this ); +} diff --git a/WNC.HPP b/WNC.HPP new file mode 100644 index 0000000..886a582 --- /dev/null +++ b/WNC.HPP @@ -0,0 +1,66 @@ +#if ! defined( WNC_CLASS_HEADER ) + +#define WNC_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class WNC : public RESPONSE +{ + public: + + WNC(); + virtual ~WNC(); + + /* + ** Data + */ + + double MilesDistance; + double KilometersDistance; + std::string To; + std::string From; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const WNC& operator = ( const WNC& source ); +}; + +#endif // WNC_CLASS_HEADER diff --git a/WPL.CPP b/WPL.CPP new file mode 100644 index 0000000..7ce30a9 --- /dev/null +++ b/WPL.CPP @@ -0,0 +1,111 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +WPL::WPL() +{ + Mnemonic = "WPL"; + Empty(); +} + +WPL::~WPL() +{ + Mnemonic.clear(); + Empty(); +} + +void WPL::Empty( void ) +{ + Position.Empty(); + To.clear(); +} + +bool WPL::Parse( const SENTENCE& sentence ) +{ + /* + ** WPL - Waypoint Location + ** + ** +-------------------------------- 1) Latitude + ** | +------------------------ 2) N or S (North or South) + ** | | +---------------------- 3) Longitude + ** | | | +------------- 4) E or W (East or West) + ** | | | | +----------- 5) Waypoint name + ** | | | | | +-------6) Checksum + ** | | | | | | + ** $--WPL,llll.ll,a,yyyyy.yy,a,c--c*hh + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 6 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + Position.Parse( 1, 2, 3, 4, sentence ); + To = sentence.Field( 5 ); + + return( true ); +} + +bool WPL::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += Position; + sentence += To; + + sentence.Finish(); + + return( true ); +} + +const WPL& WPL::operator = ( const WPL& source ) +{ + Position = source.Position; + To = source.To; + + return( *this ); +} diff --git a/WPL.HPP b/WPL.HPP new file mode 100644 index 0000000..0736e21 --- /dev/null +++ b/WPL.HPP @@ -0,0 +1,64 @@ +#if ! defined( WPL_CLASS_HEADER ) + +#define WPL_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class WPL : public RESPONSE +{ + public: + + WPL(); + virtual ~WPL(); + + /* + ** Data + */ + + LATLONG Position; + std::string To; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const WPL& operator = ( const WPL& source ); +}; + +#endif // WPL_CLASS_HEADER diff --git a/XDR.CPP b/XDR.CPP new file mode 100644 index 0000000..2c76d77 --- /dev/null +++ b/XDR.CPP @@ -0,0 +1,158 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +XDR::XDR() +{ + Mnemonic = "XDR"; + Empty(); +} + +XDR::~XDR() +{ + Mnemonic.clear(); + Empty(); +} + +void XDR::Empty( void ) +{ + Transducers.clear(); +} + +bool XDR::Parse( const SENTENCE& sentence ) +{ + /* + ** XDR - Transducer Reading + ** + ** 1 2 3 4 n + ** | | | | | + ** $--XDR,a,x.x,a,c--c, ..... *hh + ** + ** Field Number: + ** 1) Transducer Type + ** 2) Measurement Data + ** 3) Units of measurement + ** 4) Name of transducer + ** x) More of the same + ** n) Checksum + */ + + Empty(); + + int field_number = 1; + + TRANSDUCER_DATA transducer_data; + + while( sentence.Field( field_number + 1 ) != "" ) + { + transducer_data.Empty(); + + transducer_data.Parse( field_number, sentence ); + Transducers.push_back( transducer_data ); + + field_number += 4; + } + + return( true ); +} + +bool XDR::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + size_t index = 0; + size_t number_of_entries = Transducers.size(); + + while( index < number_of_entries ) + { + Transducers[ index ].Write( sentence ); + index++; + } + + sentence.Finish(); + + return( true ); +} + +TRANSDUCER_DATA::TRANSDUCER_DATA() +{ + Empty(); +} + +TRANSDUCER_DATA::~TRANSDUCER_DATA() +{ + Empty(); +} + +void TRANSDUCER_DATA::Empty( void ) +{ + TransducerType = TransducerUnknown; + MeasurementData = 0.0; + MeasurementUnits.clear(); + TransducerName.clear(); +} + +void TRANSDUCER_DATA::Parse( int first_field_number, const SENTENCE& sentence ) +{ + TransducerType = sentence.TransducerType( first_field_number ); + MeasurementData = sentence.Double( first_field_number + 1 ); + MeasurementUnits = sentence.Field( first_field_number + 2 ); + TransducerName = sentence.Field( first_field_number + 3 ); +} + +void TRANSDUCER_DATA::Write( SENTENCE& sentence ) +{ + sentence += TransducerType; + sentence += MeasurementData; + sentence += MeasurementUnits; + sentence += TransducerName; +} + +const TRANSDUCER_DATA& TRANSDUCER_DATA::operator = ( const TRANSDUCER_DATA& source ) +{ + TransducerType = source.TransducerType; + MeasurementData = source.MeasurementData; + MeasurementUnits = source.MeasurementUnits; + TransducerName = source.TransducerName; + + return( *this ); +} diff --git a/XDR.HPP b/XDR.HPP new file mode 100644 index 0000000..b7db1ab --- /dev/null +++ b/XDR.HPP @@ -0,0 +1,80 @@ +#if ! defined( XDR_CLASS_HEADER ) + +#define XDR_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class TRANSDUCER_DATA +{ + public: + + TRANSDUCER_DATA(); + virtual ~TRANSDUCER_DATA(); + + /* + ** Data + */ + + TRANSDUCER_TYPE TransducerType; + double MeasurementData; + std::string MeasurementUnits; + std::string TransducerName; + + /* + ** Methods + */ + + virtual void Empty( void ); + virtual void Parse( int first_field_number, const SENTENCE& sentence ); + virtual void Write( SENTENCE& sentence ); + + /* + ** Operators + */ + + virtual const TRANSDUCER_DATA& operator = ( const TRANSDUCER_DATA& source ); +}; + +class XDR : public RESPONSE +{ + public: + + XDR(); + ~XDR(); + + std::vector Transducers; + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; +}; + +#endif // XDR_CLASS_HEADER diff --git a/XTE.CPP b/XTE.CPP new file mode 100644 index 0000000..f85d241 --- /dev/null +++ b/XTE.CPP @@ -0,0 +1,132 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +XTE::XTE() +{ + Mnemonic = "XTE"; + Empty(); +} + +XTE::~XTE() +{ + Mnemonic.clear(); + Empty(); +} + +void XTE::Empty( void ) +{ + CrossTrackErrorMagnitude = 0.0; + DirectionToSteer = LR_Unknown; + CrossTrackUnits.clear(); +} + +bool XTE::Parse( const SENTENCE& sentence ) +{ + /* + ** XTE - Cross-Track Error, Measured + ** + ** 1 2 3 4 5 6 + ** | | | | | | + ** $--XTE,A,A,x.x,a,N,*hh + ** + ** 1) Status + ** V = LORAN-C Blink or SNR warning + ** V = general warning flag or other navigation systems when a reliable + ** fix is not available + ** 2) Status + ** V = Loran-C Cycle Lock warning flag + ** A = OK or not used + ** 3) Cross Track Error Magnitude + ** 4) Direction to steer, L or R + ** 5) Cross Track Units, N = Nautical Miles + ** 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 + */ + + IsLoranBlinkOK = sentence.Boolean( 1 ); + IsLoranCCycleLockOK = sentence.Boolean( 2 ); + CrossTrackErrorMagnitude = sentence.Double( 3 ); + DirectionToSteer = sentence.LeftOrRight( 4 ); + CrossTrackUnits = sentence.Field( 5 ); + + return( true ); +} + +bool XTE::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += IsLoranBlinkOK; + sentence += IsLoranCCycleLockOK; + sentence += CrossTrackErrorMagnitude; + sentence += DirectionToSteer; + sentence += CrossTrackUnits; + + sentence.Finish(); + + return( true ); +} + +const XTE& XTE::operator = ( const XTE& source ) +{ + IsLoranBlinkOK = source.IsLoranBlinkOK; + IsLoranCCycleLockOK = source.IsLoranCCycleLockOK; + CrossTrackErrorMagnitude = source.CrossTrackErrorMagnitude; + DirectionToSteer = source.DirectionToSteer; + CrossTrackUnits = source.CrossTrackUnits; + + return( *this ); +} diff --git a/XTE.HPP b/XTE.HPP new file mode 100644 index 0000000..8717d9c --- /dev/null +++ b/XTE.HPP @@ -0,0 +1,67 @@ +#if ! defined( XTE_CLASS_HEADER ) + +#define XTE_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class XTE : public RESPONSE +{ + public: + + XTE(); + virtual ~XTE(); + + /* + ** Data + */ + + NMEA0183_BOOLEAN IsLoranBlinkOK; + NMEA0183_BOOLEAN IsLoranCCycleLockOK; + double CrossTrackErrorMagnitude; + LEFTRIGHT DirectionToSteer; + std::string CrossTrackUnits; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const XTE& operator = ( const XTE& source ); +}; + +#endif // XTE_CLASS_HEADER diff --git a/XTR.CPP b/XTR.CPP new file mode 100644 index 0000000..933aa86 --- /dev/null +++ b/XTR.CPP @@ -0,0 +1,113 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +XTR::XTR() +{ + Mnemonic = "XTR"; + Empty(); +} + +XTR::~XTR() +{ + Mnemonic.clear(); + Empty(); +} + +void XTR::Empty( void ) +{ + Magnitude = 0.0; + DirectionToSteer = LR_Unknown; +} + +bool XTR::Parse( const SENTENCE& sentence ) +{ + /* + ** XTR - Cross Track Error - Dead Reckoning + ** + ** 1 2 3 4 + ** | | | | + ** $--XTR,x.x,a,N*hh + ** + ** Field Number: + ** 1) Magnitude of cross track error + ** 2) Direction to steer, L or R + ** 3) Units, N = Nautical Miles + ** 4) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 4 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + Magnitude = sentence.Double( 1 ); + DirectionToSteer = sentence.LeftOrRight( 2 ); + + return( true ); +} + +bool XTR::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += Magnitude; + sentence += DirectionToSteer; + sentence += "N"; + + sentence.Finish(); + + return( true ); +} + +const XTR& XTR::operator = ( const XTR& source ) +{ + Magnitude = source.Magnitude; + DirectionToSteer = source.DirectionToSteer; + + return( *this ); +} diff --git a/XTR.HPP b/XTR.HPP new file mode 100644 index 0000000..6d75f3f --- /dev/null +++ b/XTR.HPP @@ -0,0 +1,64 @@ +#if ! defined( XTR_CLASS_HEADER ) + +#define XTR_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class XTR : public RESPONSE +{ + public: + + XTR(); + virtual ~XTR(); + + /* + ** Data + */ + + double Magnitude; + LEFTRIGHT DirectionToSteer; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const XTR& operator = ( const XTR& source ); +}; + +#endif // XTR_CLASS_HEADER diff --git a/ZDA.CPP b/ZDA.CPP new file mode 100644 index 0000000..ed67129 --- /dev/null +++ b/ZDA.CPP @@ -0,0 +1,151 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +ZDA::ZDA() +{ + Mnemonic = "ZDA"; + Empty(); +} + +ZDA::~ZDA() +{ + Mnemonic.clear(); + Empty(); +} + +void ZDA::Empty( void ) +{ + UTCTime.clear(); + Day = 0; + Month = 0; + Year = 0; + LocalHourDeviation = 0; + LocalMinutesDeviation = 0; +} + +bool ZDA::Parse( const SENTENCE& sentence ) +{ + /* + ** ZDA - Time & Date + ** UTC, day, month, year and local time zone + ** + ** $--ZDA,hhmmss.ss,xx,xx,xxxx,xx,xx*hh + ** | | | | | | + ** | | | | | +- Local zone minutes description, same sign as local hours + ** | | | | +- Local zone description, 00 to +- 13 hours + ** | | | +- Year + ** | | +- Month, 01 to 12 + ** | +- Day, 01 to 31 + ** +- Universal Time Coordinated (UTC) + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 7 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + UTCTime = sentence.Field( 1 ); + + char temp_number[ 3 ]; + + temp_number[ 2 ] = 0x00; + + temp_number[ 0 ] = UTCTime[ 0 ]; + temp_number[ 1 ] = UTCTime[ 1 ]; + + int hours = ::atoi( temp_number ); + + temp_number[ 0 ] = UTCTime[ 2 ]; + temp_number[ 1 ] = UTCTime[ 3 ]; + + int minutes = ::atoi( temp_number ); + + temp_number[ 0 ] = UTCTime[ 4 ]; + temp_number[ 1 ] = UTCTime[ 5 ]; + + int seconds = ::atoi( temp_number ); + + Day = sentence.Integer( 2 ); + Month = sentence.Integer( 3 ); + Year = sentence.Integer( 4 ); + LocalHourDeviation = sentence.Integer( 5 ); + LocalMinutesDeviation = sentence.Integer( 6 ); + + Time = ctime( Year, Month, Day, hours, minutes, seconds ); + + return( true ); +} + +bool ZDA::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += UTCTime; + sentence += Day; + sentence += Month; + sentence += Year; + sentence += LocalHourDeviation; + sentence += LocalMinutesDeviation; + + sentence.Finish(); + + return( true ); +} + +const ZDA& ZDA::operator = ( const ZDA& source ) +{ + UTCTime = source.UTCTime; + Time = source.Time; + Day = source.Day; + Month = source.Month; + Year = source.Year; + LocalHourDeviation = source.LocalHourDeviation; + LocalMinutesDeviation = source.LocalMinutesDeviation; + + return( *this ); +} diff --git a/ZDA.HPP b/ZDA.HPP new file mode 100644 index 0000000..6ee34a2 --- /dev/null +++ b/ZDA.HPP @@ -0,0 +1,69 @@ +#if ! defined( ZDA_CLASS_HEADER ) + +#define ZDA_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class ZDA : public RESPONSE +{ + public: + + ZDA(); + virtual ~ZDA(); + + /* + ** Data + */ + + std::string UTCTime; + time_t Time; + int Day; + int Month; + int Year; + int LocalHourDeviation; + int LocalMinutesDeviation; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const ZDA& operator = ( const ZDA& source ); +}; + +#endif // ZDA_CLASS_HEADER diff --git a/ZFI.CPP b/ZFI.CPP new file mode 100644 index 0000000..fa0a677 --- /dev/null +++ b/ZFI.CPP @@ -0,0 +1,170 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** ZFO is recommended. +*/ + +#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 + +ZFI::ZFI() +{ + Mnemonic = "ZFI"; + Empty(); +} + +ZFI::~ZFI() +{ + Mnemonic.clear(); + Empty(); +} + +void ZFI::Empty( void ) +{ + UTCTimeString.clear(); + ElapsedTimeString.clear(); + From.clear(); +} + +bool ZFI::Parse( const SENTENCE& sentence ) +{ + /* + ** ZFI - Elapsed time from point of interest + ** + ** 1 2 3 4 + ** | | | | + ** $--ZFI,hhmmss.ss,hhmmss.ss,c--c*hh + ** + ** 1) Universal Time Coordinated (UTC) + ** 2) Elapsed Time + ** 3) Waypoint ID (From) + ** 4) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 4 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + time_t temp_time = time(nullptr); + + struct tm * tm_p = gmtime(&temp_time); + + int year = tm_p->tm_year + 1900; + int month = tm_p->tm_mon; + int day = tm_p->tm_mday; + + UTCTimeString = sentence.Field( 1 ); + + char temp_number[ 3 ]; + + temp_number[ 2 ] = 0x00; + + temp_number[ 0 ] = UTCTimeString[ 0 ]; + temp_number[ 1 ] = UTCTimeString[ 1 ]; + + int hours = ::atoi( temp_number ); + + temp_number[ 0 ] = UTCTimeString[ 2 ]; + temp_number[ 1 ] = UTCTimeString[ 3 ]; + + int minutes = ::atoi( temp_number ); + + temp_number[ 0 ] = UTCTimeString[ 4 ]; + temp_number[ 1 ] = UTCTimeString[ 5 ]; + + int seconds = ::atoi( temp_number ); + + UTCTime = ctime( year, month, day, hours, minutes, seconds ); + + ElapsedTimeString = sentence.Field( 2 ); + + temp_number[ 0 ] = ElapsedTimeString[ 0 ]; + temp_number[ 1 ] = ElapsedTimeString[ 1 ]; + + hours = ::atoi( temp_number ); + + temp_number[ 0 ] = ElapsedTimeString[ 2 ]; + temp_number[ 1 ] = ElapsedTimeString[ 3 ]; + + minutes = ::atoi( temp_number ); + + temp_number[ 0 ] = ElapsedTimeString[ 4 ]; + temp_number[ 1 ] = ElapsedTimeString[ 5 ]; + + seconds = ::atoi( temp_number ); + + ElapsedTime = ctime( year, month, day, hours, minutes, seconds ); + + From = sentence.Field( 3 ); + + return( true ); +} + +bool ZFI::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += UTCTimeString; + sentence += ElapsedTimeString; + sentence += From; + + sentence.Finish(); + + return( true ); +} + +const ZFI& ZFI::operator = ( const ZFI& source ) +{ + UTCTimeString = source.UTCTimeString; + UTCTime = source.UTCTime; + ElapsedTimeString = source.ElapsedTimeString; + ElapsedTime = source.ElapsedTime; + From = source.From; + + return( *this ); +} diff --git a/ZFI.HPP b/ZFI.HPP new file mode 100644 index 0000000..d50ce8a --- /dev/null +++ b/ZFI.HPP @@ -0,0 +1,72 @@ +#if ! defined( ZFI_CLASS_HEADER ) + +#define ZFI_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** ZFO is recommended. +*/ + +class ZFI : public RESPONSE +{ + public: + + ZFI(); + virtual ~ZFI(); + + /* + ** Data + */ + + std::string UTCTimeString; + time_t UTCTime; + std::string ElapsedTimeString; + time_t ElapsedTime; + std::string From; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const ZFI& operator = ( const ZFI& source ); +}; + +#endif // ZFI_CLASS_HEADER diff --git a/ZFO.CPP b/ZFO.CPP new file mode 100644 index 0000000..1638a6c --- /dev/null +++ b/ZFO.CPP @@ -0,0 +1,118 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +ZFO::ZFO() +{ + Mnemonic = "ZFO"; + Empty(); +} + +ZFO::~ZFO() +{ + Mnemonic.clear(); + Empty(); +} + +void ZFO::Empty( void ) +{ + UTCTime.clear(); + ElapsedTime.clear(); + From.clear(); +} + +bool ZFO::Parse( const SENTENCE& sentence ) +{ + /* + ** ZFO - UTC & Time from origin Waypoint + ** + ** 1 2 3 4 + ** | | | | + ** $--ZFO,hhmmss.ss,hhmmss.ss,c--c*hh + ** + ** Fields: + ** 1) Universal Time Coordinated (UTC) + ** 2) Elapsed Time + ** 3) Origin Waypoint ID + ** 4) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 4 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + UTCTime = sentence.Field( 1 ); + Time = sentence.Time( 1 ); + ElapsedTime = sentence.Field( 2 ); + From = sentence.Field( 3 ); + + return( true ); +} + +bool ZFO::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += UTCTime; + sentence += ElapsedTime; + sentence += From; + + sentence.Finish(); + + return( true ); +} + +const ZFO& ZFO::operator = ( const ZFO& source ) +{ + UTCTime = source.UTCTime; + Time = source.Time; + ElapsedTime = source.ElapsedTime; + From = source.From; + + return( *this ); +} diff --git a/ZFO.HPP b/ZFO.HPP new file mode 100644 index 0000000..4519cf9 --- /dev/null +++ b/ZFO.HPP @@ -0,0 +1,66 @@ +#if ! defined( ZFO_CLASS_HEADER ) + +#define ZFO_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class ZFO : public RESPONSE +{ + public: + + ZFO(); + virtual ~ZFO(); + + /* + ** Data + */ + + std::string UTCTime; + time_t Time; + std::string ElapsedTime; + std::string From; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const ZFO& operator = ( const ZFO& source ); +}; + +#endif // ZFO_CLASS_HEADER diff --git a/ZLZ.CPP b/ZLZ.CPP new file mode 100644 index 0000000..0830d6b --- /dev/null +++ b/ZLZ.CPP @@ -0,0 +1,171 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** ZDA is recommended. +*/ + +#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 + +ZLZ::ZLZ() +{ + Mnemonic = "ZLZ"; + Empty(); +} + +ZLZ::~ZLZ() +{ + Mnemonic.clear(); + Empty(); +} + +void ZLZ::Empty( void ) +{ + UTCTimeString.clear(); + LocalTimeString.clear(); + LocalHourDeviation = 0; +} + +bool ZLZ::Parse( const SENTENCE& sentence ) +{ + /* + ** ZLZ - Time of Day + ** UTC, local time, zone + ** + ** 1 2 3 4 + ** | | | | + ** $--ZLZ,hhmmss.ss,hhmmss.ss,xx*hh + ** + ** 1) Universal Time Coordinated (UTC) + ** 2) Local Time + ** 3) Local Zone Description, number of whole hours added to local time to obtain GMT + ** 4) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 4 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + time_t temp_time = time(nullptr); + + struct tm * tm_p = gmtime(&temp_time); + + int year = tm_p->tm_year + 1900; + int month = tm_p->tm_mon; + int day = tm_p->tm_mday; + + UTCTimeString = sentence.Field( 1 ); + + char temp_number[ 3 ]; + + temp_number[ 2 ] = 0x00; + + temp_number[ 0 ] = UTCTimeString[ 0 ]; + temp_number[ 1 ] = UTCTimeString[ 1 ]; + + int hours = ::atoi( temp_number ); + + temp_number[ 0 ] = UTCTimeString[ 2 ]; + temp_number[ 1 ] = UTCTimeString[ 3 ]; + + int minutes = ::atoi( temp_number ); + + temp_number[ 0 ] = UTCTimeString[ 4 ]; + temp_number[ 1 ] = UTCTimeString[ 5 ]; + + int seconds = ::atoi( temp_number ); + + UTCTime = ctime( year, month, day, hours, minutes, seconds ); + + LocalTimeString = sentence.Field( 2 ); + + temp_number[ 0 ] = LocalTimeString[ 0 ]; + temp_number[ 1 ] = LocalTimeString[ 1 ]; + + hours = ::atoi( temp_number ); + + temp_number[ 0 ] = LocalTimeString[ 2 ]; + temp_number[ 1 ] = LocalTimeString[ 3 ]; + + minutes = ::atoi( temp_number ); + + temp_number[ 0 ] = LocalTimeString[ 4 ]; + temp_number[ 1 ] = LocalTimeString[ 5 ]; + + seconds = ::atoi( temp_number ); + + LocalTime = ctime( year, month, day, hours, minutes, seconds ); + + LocalHourDeviation = sentence.Integer( 3 ); + + return( true ); +} + +bool ZLZ::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += UTCTimeString; + sentence += LocalTimeString; + sentence += LocalHourDeviation; + + sentence.Finish(); + + return( true ); +} + +const ZLZ& ZLZ::operator = ( const ZLZ& source ) +{ + UTCTimeString = source.UTCTimeString; + UTCTime = source.UTCTime; + LocalTimeString = source.LocalTimeString; + LocalTime = source.LocalTime; + LocalHourDeviation = source.LocalHourDeviation; + + return( *this ); +} diff --git a/ZLZ.HPP b/ZLZ.HPP new file mode 100644 index 0000000..0de87a0 --- /dev/null +++ b/ZLZ.HPP @@ -0,0 +1,72 @@ +#if ! defined( ZLZ_CLASS_HEADER ) + +#define ZLZ_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** ZDA is recommended. +*/ + +class ZLZ : public RESPONSE +{ + public: + + ZLZ(); + virtual ~ZLZ(); + + /* + ** Data + */ + + std::string UTCTimeString; + time_t UTCTime; + std::string LocalTimeString; + time_t LocalTime; + int LocalHourDeviation; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const ZLZ& operator = ( const ZLZ& source ); +}; + +#endif // ZLZ_CLASS_HEADER diff --git a/ZPI.CPP b/ZPI.CPP new file mode 100644 index 0000000..1096151 --- /dev/null +++ b/ZPI.CPP @@ -0,0 +1,170 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** ZTG is recommended. +*/ + +#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 + +ZPI::ZPI() +{ + Mnemonic = "ZPI"; + Empty(); +} + +ZPI::~ZPI() +{ + Mnemonic.clear(); + Empty(); +} + +void ZPI::Empty( void ) +{ + UTCTimeString.clear(); + ArrivalTimeString.clear(); + To.clear(); +} + +bool ZPI::Parse( const SENTENCE& sentence ) +{ + /* + ** ZPI - Arrival time at point of interest + ** + ** 1 2 3 4 + ** | | | | + ** $--ZPI,hhmmss.ss,hhmmss.ss,c--c*hh + ** + ** 1) Universal Time Coordinated (UTC) + ** 2) Arrival Time + ** 3) Waypoint ID (To) + ** 4) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 4 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + time_t temp_time = time(nullptr); + + struct tm * tm_p = gmtime(&temp_time); + + int year = tm_p->tm_year + 1900; + int month = tm_p->tm_mon; + int day = tm_p->tm_mday; + + UTCTimeString = sentence.Field( 1 ); + + char temp_number[ 3 ]; + + temp_number[ 2 ] = 0x00; + + temp_number[ 0 ] = UTCTimeString[ 0 ]; + temp_number[ 1 ] = UTCTimeString[ 1 ]; + + int hours = ::atoi( temp_number ); + + temp_number[ 0 ] = UTCTimeString[ 2 ]; + temp_number[ 1 ] = UTCTimeString[ 3 ]; + + int minutes = ::atoi( temp_number ); + + temp_number[ 0 ] = UTCTimeString[ 4 ]; + temp_number[ 1 ] = UTCTimeString[ 5 ]; + + int seconds = ::atoi( temp_number ); + + UTCTime = ctime( year, month, day, hours, minutes, seconds ); + + ArrivalTimeString = sentence.Field( 2 ); + + temp_number[ 0 ] = ArrivalTimeString[ 0 ]; + temp_number[ 1 ] = ArrivalTimeString[ 1 ]; + + hours = ::atoi( temp_number ); + + temp_number[ 0 ] = ArrivalTimeString[ 2 ]; + temp_number[ 1 ] = ArrivalTimeString[ 3 ]; + + minutes = ::atoi( temp_number ); + + temp_number[ 0 ] = ArrivalTimeString[ 4 ]; + temp_number[ 1 ] = ArrivalTimeString[ 5 ]; + + seconds = ::atoi( temp_number ); + + ArrivalTime = ctime( year, month, day, hours, minutes, seconds ); + + To = sentence.Field( 3 ); + + return( true ); +} + +bool ZPI::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += UTCTimeString; + sentence += ArrivalTimeString; + sentence += To; + + sentence.Finish(); + + return( true ); +} + +const ZPI& ZPI::operator = ( const ZPI& source ) +{ + UTCTimeString = source.UTCTimeString; + UTCTime = source.UTCTime; + ArrivalTimeString = source.ArrivalTimeString; + ArrivalTime = source.ArrivalTime; + To = source.To; + + return( *this ); +} diff --git a/ZPI.HPP b/ZPI.HPP new file mode 100644 index 0000000..20bec62 --- /dev/null +++ b/ZPI.HPP @@ -0,0 +1,72 @@ +#if ! defined( ZPI_CLASS_HEADER ) + +#define ZPI_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** ZTG is recommended. +*/ + +class ZPI : public RESPONSE +{ + public: + + ZPI(); + virtual ~ZPI(); + + /* + ** Data + */ + + std::string UTCTimeString; + time_t UTCTime; + std::string ArrivalTimeString; + time_t ArrivalTime; + std::string To; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const ZPI& operator = ( const ZPI& source ); +}; + +#endif // ZPI_CLASS_HEADER diff --git a/ZTA.CPP b/ZTA.CPP new file mode 100644 index 0000000..2f9823d --- /dev/null +++ b/ZTA.CPP @@ -0,0 +1,170 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** ZTG is recommended. +*/ + +#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 + +ZTA::ZTA() +{ + Mnemonic = "ZTA"; + Empty(); +} + +ZTA::~ZTA() +{ + Mnemonic.clear(); + Empty(); +} + +void ZTA::Empty( void ) +{ + UTCTimeString.clear(); + ArrivalTimeString.clear(); + To.clear(); +} + +bool ZTA::Parse( const SENTENCE& sentence ) +{ + /* + ** ZTA - Estimated Arrival time at point of interest + ** + ** 1 2 3 4 + ** | | | | + ** $--ZTA,hhmmss.ss,hhmmss.ss,c--c*hh + ** + ** 1) Universal Time Coordinated (UTC) + ** 2) Arrival Time + ** 3) Waypoint ID (To) + ** 4) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 4 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + time_t temp_time = time(nullptr); + + struct tm * tm_p = gmtime(&temp_time); + + int year = tm_p->tm_year + 1900; + int month = tm_p->tm_mon; + int day = tm_p->tm_mday; + + UTCTimeString = sentence.Field( 1 ); + + char temp_number[ 3 ]; + + temp_number[ 2 ] = 0x00; + + temp_number[ 0 ] = UTCTimeString[ 0 ]; + temp_number[ 1 ] = UTCTimeString[ 1 ]; + + int hours = ::atoi( temp_number ); + + temp_number[ 0 ] = UTCTimeString[ 2 ]; + temp_number[ 1 ] = UTCTimeString[ 3 ]; + + int minutes = ::atoi( temp_number ); + + temp_number[ 0 ] = UTCTimeString[ 4 ]; + temp_number[ 1 ] = UTCTimeString[ 5 ]; + + int seconds = ::atoi( temp_number ); + + UTCTime = ctime( year, month, day, hours, minutes, seconds ); + + ArrivalTimeString = sentence.Field( 2 ); + + temp_number[ 0 ] = ArrivalTimeString[ 0 ]; + temp_number[ 1 ] = ArrivalTimeString[ 1 ]; + + hours = ::atoi( temp_number ); + + temp_number[ 0 ] = ArrivalTimeString[ 2 ]; + temp_number[ 1 ] = ArrivalTimeString[ 3 ]; + + minutes = ::atoi( temp_number ); + + temp_number[ 0 ] = ArrivalTimeString[ 4 ]; + temp_number[ 1 ] = ArrivalTimeString[ 5 ]; + + seconds = ::atoi( temp_number ); + + ArrivalTime = ctime( year, month, day, hours, minutes, seconds ); + + To = sentence.Field( 3 ); + + return( true ); +} + +bool ZTA::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += UTCTimeString; + sentence += ArrivalTimeString; + sentence += To; + + sentence.Finish(); + + return( true ); +} + +const ZTA& ZTA::operator = ( const ZTA& source ) +{ + UTCTimeString = source.UTCTimeString; + UTCTime = source.UTCTime; + ArrivalTimeString = source.ArrivalTimeString; + ArrivalTime = source.ArrivalTime; + To = source.To; + + return( *this ); +} diff --git a/ZTA.HPP b/ZTA.HPP new file mode 100644 index 0000000..092ed98 --- /dev/null +++ b/ZTA.HPP @@ -0,0 +1,72 @@ +#if ! defined( ZTA_CLASS_HEADER ) + +#define ZTA_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** ZTG is recommended. +*/ + +class ZTA : public RESPONSE +{ + public: + + ZTA(); + virtual ~ZTA(); + + /* + ** Data + */ + + std::string UTCTimeString; + time_t UTCTime; + std::string ArrivalTimeString; + time_t ArrivalTime; + std::string To; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const ZTA& operator = ( const ZTA& source ); +}; + +#endif // ZTA_CLASS_HEADER diff --git a/ZTE.CPP b/ZTE.CPP new file mode 100644 index 0000000..ae0405b --- /dev/null +++ b/ZTE.CPP @@ -0,0 +1,170 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** ZTG is recommended. +*/ + +#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 + +ZTE::ZTE() +{ + Mnemonic = "ZTE"; + Empty(); +} + +ZTE::~ZTE() +{ + Mnemonic.clear(); + Empty(); +} + +void ZTE::Empty( void ) +{ + UTCTimeString.clear(); + TimeToGoString.clear(); + To.clear(); +} + +bool ZTE::Parse( const SENTENCE& sentence ) +{ + /* + ** ZTE - Estimated time to event + ** + ** 1 2 3 4 + ** | | | | + ** $--ZTE,hhmmss.ss,hhmmss.ss,c--c*hh + ** + ** 1) Universal Time Coordinated (UTC) + ** 2) Arrival Time + ** 3) Waypoint ID (To) + ** 4) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 4 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + time_t temp_time = time(nullptr); + + struct tm * tm_p = gmtime(&temp_time); + + int year = tm_p->tm_year + 1900; + int month = tm_p->tm_mon; + int day = tm_p->tm_mday; + + UTCTimeString = sentence.Field( 1 ); + + char temp_number[ 3 ]; + + temp_number[ 2 ] = 0x00; + + temp_number[ 0 ] = UTCTimeString[ 0 ]; + temp_number[ 1 ] = UTCTimeString[ 1 ]; + + int hours = ::atoi( temp_number ); + + temp_number[ 0 ] = UTCTimeString[ 2 ]; + temp_number[ 1 ] = UTCTimeString[ 3 ]; + + int minutes = ::atoi( temp_number ); + + temp_number[ 0 ] = UTCTimeString[ 4 ]; + temp_number[ 1 ] = UTCTimeString[ 5 ]; + + int seconds = ::atoi( temp_number ); + + UTCTime = ctime( year, month, day, hours, minutes, seconds ); + + TimeToGoString = sentence.Field( 2 ); + + temp_number[ 0 ] = TimeToGoString[ 0 ]; + temp_number[ 1 ] = TimeToGoString[ 1 ]; + + hours = ::atoi( temp_number ); + + temp_number[ 0 ] = TimeToGoString[ 2 ]; + temp_number[ 1 ] = TimeToGoString[ 3 ]; + + minutes = ::atoi( temp_number ); + + temp_number[ 0 ] = TimeToGoString[ 4 ]; + temp_number[ 1 ] = TimeToGoString[ 5 ]; + + seconds = ::atoi( temp_number ); + + TimeToGo = ctime( year, month, day, hours, minutes, seconds ); + + To = sentence.Field( 3 ); + + return( true ); +} + +bool ZTE::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += UTCTimeString; + sentence += TimeToGoString; + sentence += To; + + sentence.Finish(); + + return( true ); +} + +const ZTE& ZTE::operator = ( const ZTE& source ) +{ + UTCTimeString = source.UTCTimeString; + UTCTime = source.UTCTime; + TimeToGoString = source.TimeToGoString; + TimeToGo = source.TimeToGo; + To = source.To; + + return( *this ); +} diff --git a/ZTE.HPP b/ZTE.HPP new file mode 100644 index 0000000..09a565b --- /dev/null +++ b/ZTE.HPP @@ -0,0 +1,72 @@ +#if ! defined( ZTE_CLASS_HEADER ) + +#define ZTE_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** ZTG is recommended. +*/ + +class ZTE : public RESPONSE +{ + public: + + ZTE(); + virtual ~ZTE(); + + /* + ** Data + */ + + std::string UTCTimeString; + time_t UTCTime; + std::string TimeToGoString; + time_t TimeToGo; + std::string To; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const ZTE& operator = ( const ZTE& source ); +}; + +#endif // ZTE_CLASS_HEADER diff --git a/ZTG.CPP b/ZTG.CPP new file mode 100644 index 0000000..39b4f92 --- /dev/null +++ b/ZTG.CPP @@ -0,0 +1,118 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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 + +ZTG::ZTG() +{ + Mnemonic = "ZTG"; + Empty(); +} + +ZTG::~ZTG() +{ + Mnemonic.clear(); + Empty(); +} + +void ZTG::Empty( void ) +{ + UTCTime.clear(); + TimeRemaining.clear(); + To.clear(); +} + +bool ZTG::Parse( const SENTENCE& sentence ) +{ + /* + ** ZTG - UTC & Time to Destination Waypoint + ** + ** 1 2 3 4 + ** | | | | + ** $--ZTG,hhmmss.ss,hhmmss.ss,c--c*hh + ** + ** Fields: + ** 1) Universal Time Coordinated (UTC) + ** 2) Time Remaining + ** 3) Destination Waypoint ID + ** 4) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 4 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + UTCTime = sentence.Field( 1 ); + Time = sentence.Time( 1 ); + TimeRemaining = sentence.Field( 2 ); + To = sentence.Field( 3 ); + + return( true ); +} + +bool ZTG::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += UTCTime; + sentence += TimeRemaining; + sentence += To; + + sentence.Finish(); + + return( true ); +} + +const ZTG& ZTG::operator = ( const ZTG& source ) +{ + UTCTime = source.UTCTime; + Time = source.Time; + TimeRemaining = source.TimeRemaining; + To = source.To; + + return( *this ); +} diff --git a/ZTG.HPP b/ZTG.HPP new file mode 100644 index 0000000..70a2793 --- /dev/null +++ b/ZTG.HPP @@ -0,0 +1,66 @@ +#if ! defined( ZTG_CLASS_HEADER ) + +#define ZTG_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +class ZTG : public RESPONSE +{ + public: + + ZTG(); + virtual ~ZTG(); + + /* + ** Data + */ + + std::string UTCTime; + time_t Time; + std::string TimeRemaining; + std::string To; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const ZTG& operator = ( const ZTG& source ); +}; + +#endif // ZTG_CLASS_HEADER diff --git a/ZTI.CPP b/ZTI.CPP new file mode 100644 index 0000000..93c440d --- /dev/null +++ b/ZTI.CPP @@ -0,0 +1,170 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** ZTG is recommended. +*/ + +#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 + +ZTI::ZTI() +{ + Mnemonic = "ZTI"; + Empty(); +} + +ZTI::~ZTI() +{ + Mnemonic.clear(); + Empty(); +} + +void ZTI::Empty( void ) +{ + UTCTimeString.clear(); + TimeToGoString.clear(); + To.clear(); +} + +bool ZTI::Parse( const SENTENCE& sentence ) +{ + /* + ** ZTI - Estimated time to point of interest + ** + ** 1 2 3 4 + ** | | | | + ** $--ZTI,hhmmss.ss,hhmmss.ss,c--c*hh + ** + ** 1) Universal Time Coordinated (UTC) + ** 2) Arrival Time + ** 3) Waypoint ID (To) + ** 4) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 4 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + time_t temp_time = time(nullptr); + + struct tm * tm_p = gmtime(&temp_time); + + int year = tm_p->tm_year + 1900; + int month = tm_p->tm_mon; + int day = tm_p->tm_mday; + + UTCTimeString = sentence.Field( 1 ); + + char temp_number[ 3 ]; + + temp_number[ 2 ] = 0x00; + + temp_number[ 0 ] = UTCTimeString[ 0 ]; + temp_number[ 1 ] = UTCTimeString[ 1 ]; + + int hours = ::atoi( temp_number ); + + temp_number[ 0 ] = UTCTimeString[ 2 ]; + temp_number[ 1 ] = UTCTimeString[ 3 ]; + + int minutes = ::atoi( temp_number ); + + temp_number[ 0 ] = UTCTimeString[ 4 ]; + temp_number[ 1 ] = UTCTimeString[ 5 ]; + + int seconds = ::atoi( temp_number ); + + UTCTime = ctime( year, month, day, hours, minutes, seconds ); + + TimeToGoString = sentence.Field( 2 ); + + temp_number[ 0 ] = TimeToGoString[ 0 ]; + temp_number[ 1 ] = TimeToGoString[ 1 ]; + + hours = ::atoi( temp_number ); + + temp_number[ 0 ] = TimeToGoString[ 2 ]; + temp_number[ 1 ] = TimeToGoString[ 3 ]; + + minutes = ::atoi( temp_number ); + + temp_number[ 0 ] = TimeToGoString[ 4 ]; + temp_number[ 1 ] = TimeToGoString[ 5 ]; + + seconds = ::atoi( temp_number ); + + TimeToGo = ctime( year, month, day, hours, minutes, seconds ); + + To = sentence.Field( 3 ); + + return( true ); +} + +bool ZTI::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += UTCTimeString; + sentence += TimeToGoString; + sentence += To; + + sentence.Finish(); + + return( true ); +} + +const ZTI& ZTI::operator = ( const ZTI& source ) +{ + UTCTimeString = source.UTCTimeString; + UTCTime = source.UTCTime; + TimeToGoString = source.TimeToGoString; + TimeToGo = source.TimeToGo; + To = source.To; + + return( *this ); +} diff --git a/ZTI.HPP b/ZTI.HPP new file mode 100644 index 0000000..0fa64bc --- /dev/null +++ b/ZTI.HPP @@ -0,0 +1,72 @@ +#if ! defined( ZTI_CLASS_HEADER ) + +#define ZTI_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** ZTG is recommended. +*/ + +class ZTI : public RESPONSE +{ + public: + + ZTI(); + virtual ~ZTI(); + + /* + ** Data + */ + + std::string UTCTimeString; + time_t UTCTime; + std::string TimeToGoString; + time_t TimeToGo; + std::string To; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const ZTI& operator = ( const ZTI& source ); +}; + +#endif // ZTI_CLASS_HEADER diff --git a/ZWP.CPP b/ZWP.CPP new file mode 100644 index 0000000..a9d045f --- /dev/null +++ b/ZWP.CPP @@ -0,0 +1,170 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** ZTG is recommended. +*/ + +#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 + +ZWP::ZWP() +{ + Mnemonic = "ZWP"; + Empty(); +} + +ZWP::~ZWP() +{ + Mnemonic.clear(); + Empty(); +} + +void ZWP::Empty( void ) +{ + UTCTimeString.clear(); + ArrivalTimeString.clear(); + To.clear(); +} + +bool ZWP::Parse( const SENTENCE& sentence ) +{ + /* + ** ZWP - Arrival time at waypoint + ** + ** 1 2 3 4 + ** | | | | + ** $--ZWP,hhmmss.ss,hhmmss.ss,c--c*hh + ** + ** 1) Universal Time Coordinated (UTC) + ** 2) Arrival Time + ** 3) Waypoint ID (To) + ** 4) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 4 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + time_t temp_time = time(nullptr); + + struct tm * tm_p = gmtime(&temp_time); + + int year = tm_p->tm_year + 1900; + int month = tm_p->tm_mon; + int day = tm_p->tm_mday; + + UTCTimeString = sentence.Field( 1 ); + + char temp_number[ 3 ]; + + temp_number[ 2 ] = 0x00; + + temp_number[ 0 ] = UTCTimeString[ 0 ]; + temp_number[ 1 ] = UTCTimeString[ 1 ]; + + int hours = ::atoi( temp_number ); + + temp_number[ 0 ] = UTCTimeString[ 2 ]; + temp_number[ 1 ] = UTCTimeString[ 3 ]; + + int minutes = ::atoi( temp_number ); + + temp_number[ 0 ] = UTCTimeString[ 4 ]; + temp_number[ 1 ] = UTCTimeString[ 5 ]; + + int seconds = ::atoi( temp_number ); + + UTCTime = ctime( year, month, day, hours, minutes, seconds ); + + ArrivalTimeString = sentence.Field( 2 ); + + temp_number[ 0 ] = ArrivalTimeString[ 0 ]; + temp_number[ 1 ] = ArrivalTimeString[ 1 ]; + + hours = ::atoi( temp_number ); + + temp_number[ 0 ] = ArrivalTimeString[ 2 ]; + temp_number[ 1 ] = ArrivalTimeString[ 3 ]; + + minutes = ::atoi( temp_number ); + + temp_number[ 0 ] = ArrivalTimeString[ 4 ]; + temp_number[ 1 ] = ArrivalTimeString[ 5 ]; + + seconds = ::atoi( temp_number ); + + ArrivalTime = ctime( year, month, day, hours, minutes, seconds ); + + To = sentence.Field( 3 ); + + return( true ); +} + +bool ZWP::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += UTCTimeString; + sentence += ArrivalTimeString; + sentence += To; + + sentence.Finish(); + + return( true ); +} + +const ZWP& ZWP::operator = ( const ZWP& source ) +{ + UTCTimeString = source.UTCTimeString; + UTCTime = source.UTCTime; + ArrivalTimeString = source.ArrivalTimeString; + ArrivalTime = source.ArrivalTime; + To = source.To; + + return( *this ); +} diff --git a/ZWP.HPP b/ZWP.HPP new file mode 100644 index 0000000..a4b431c --- /dev/null +++ b/ZWP.HPP @@ -0,0 +1,72 @@ +#if ! defined( ZWP_CLASS_HEADER ) + +#define ZWP_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** ZTG is recommended. +*/ + +class ZWP : public RESPONSE +{ + public: + + ZWP(); + virtual ~ZWP(); + + /* + ** Data + */ + + std::string UTCTimeString; + time_t UTCTime; + std::string ArrivalTimeString; + time_t ArrivalTime; + std::string To; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const ZWP& operator = ( const ZWP& source ); +}; + +#endif // ZWP_CLASS_HEADER diff --git a/ZZU.CPP b/ZZU.CPP new file mode 100644 index 0000000..3a3c08f --- /dev/null +++ b/ZZU.CPP @@ -0,0 +1,140 @@ +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** ZDA is recommended. +*/ + +#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 + +ZZU::ZZU() +{ + Mnemonic = "ZZU"; + Empty(); +} + +ZZU::~ZZU() +{ + Mnemonic.clear(); + Empty(); +} + +void ZZU::Empty( void ) +{ + UTCTimeString.clear(); +} + +bool ZZU::Parse( const SENTENCE& sentence ) +{ + /* + ** ZZU - Time UTC + ** + ** 1 2 + ** | | + ** $--ZZU,hhmmss.ss,*hh + ** + ** 1) Universal Time Coordinated (UTC) + ** 2) Checksum + */ + + /* + ** First we check the checksum... + */ + + if ( sentence.IsChecksumBad( 2 ) == True ) + { + SetErrorMessage( "Invalid Checksum" ); + return( false ); + } + + time_t temp_time = time(nullptr); + + struct tm * tm_p = gmtime(&temp_time); + + int year = tm_p->tm_year + 1900; + int month = tm_p->tm_mon; + int day = tm_p->tm_mday; + + UTCTimeString = sentence.Field( 1 ); + + char temp_number[ 3 ]; + + temp_number[ 2 ] = 0x00; + + temp_number[ 0 ] = UTCTimeString[ 0 ]; + temp_number[ 1 ] = UTCTimeString[ 1 ]; + + int hours = ::atoi( temp_number ); + + temp_number[ 0 ] = UTCTimeString[ 2 ]; + temp_number[ 1 ] = UTCTimeString[ 3 ]; + + int minutes = ::atoi( temp_number ); + + temp_number[ 0 ] = UTCTimeString[ 4 ]; + temp_number[ 1 ] = UTCTimeString[ 5 ]; + + int seconds = ::atoi( temp_number ); + + UTCTime = ctime( year, month, day, hours, minutes, seconds ); + + return( true ); +} + +bool ZZU::Write( SENTENCE& sentence ) +{ + /* + ** Let the parent do its thing + */ + + RESPONSE::Write( sentence ); + + sentence += UTCTimeString; + + sentence.Finish(); + + return( true ); +} + +const ZZU& ZZU::operator = ( const ZZU& source ) +{ + UTCTimeString = source.UTCTimeString; + UTCTime = source.UTCTime; + + return( *this ); +} diff --git a/ZZU.HPP b/ZZU.HPP new file mode 100644 index 0000000..0bfa0e2 --- /dev/null +++ b/ZZU.HPP @@ -0,0 +1,69 @@ +#if ! defined( ZZU_CLASS_HEADER ) + +#define ZZU_CLASS_HEADER + +/* +Author: Samuel R. Blackburn +Internet: wfc@pobox.com + +"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. +*/ + +/* +** This Sentence Not Recommended For New Designs +** ZDA is recommended. +*/ + +class ZZU : public RESPONSE +{ + public: + + ZZU(); + virtual ~ZZU(); + + /* + ** Data + */ + + std::string UTCTimeString; + time_t UTCTime; + + /* + ** Methods + */ + + virtual void Empty( void ) override; + virtual bool Parse( const SENTENCE& sentence ) override; + virtual bool Write( SENTENCE& sentence ) override; + + /* + ** Operators + */ + + virtual const ZZU& operator = ( const ZZU& source ); +}; + +#endif // ZZU_CLASS_HEADER