INTRODUCTION Overview Download and Install Documentation Publications REPOSITORY Libraries DEVELOPER Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
nmeamessages.h00001 /* 00002 * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics 00003 * http://gearbox.sf.net/ 00004 * Copyright (c) 2004-2010 Alex Brooks, Alexei Makarenko, Tobias Kaupp, Duncan Mercer 00005 * 00006 * This distribution is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 #ifndef GBXGPSUTILACFR_NMEAMESSAGES_H 00011 #define GBXGPSUTILACFR_NMEAMESSAGES_H 00012 00013 #include <string> 00014 #include <gbxgarminacfr/nmeasentence.h> 00015 00016 namespace gbxgarminacfr { 00017 00019 enum DataType 00020 { 00022 GpGga, 00024 GpVtg, 00026 PgRme, 00028 GpRmc 00029 }; 00030 00032 class GenericData 00033 { 00034 public: 00035 virtual ~GenericData() {}; 00037 virtual DataType type() const=0; 00038 00039 private: 00040 }; 00041 00043 enum FixType 00044 { 00046 Invalid, 00049 Autonomous, 00051 Differential 00052 }; 00053 std::string toString( const FixType &f ); 00054 00057 struct GgaData : public GenericData 00058 { 00059 public: 00060 DataType type() const { return GpGga; } 00061 00064 int timeStampSec; 00067 int timeStampUsec; 00068 00071 int utcTimeHrs; 00074 int utcTimeMin; 00077 double utcTimeSec; 00078 00080 double latitude; 00082 double longitude; 00084 bool isAltitudeKnown; 00086 double altitude; 00087 00090 FixType fixType; 00091 00093 int satellites; 00094 00096 double horizontalDilutionOfPosition; 00097 00099 double geoidalSeparation; 00100 }; 00101 std::string toString( const GgaData &d ); 00102 inline std::ostream &operator<<( std::ostream &s, const GgaData &d ) 00103 { return s << toString(d); } 00104 GenericData* extractGgaData( const gbxgpsutilacfr::NmeaSentence& sentence, int timeSec, int timeUsec ); 00105 00107 class VtgData : public GenericData 00108 { 00109 public: 00110 DataType type() const { return GpVtg; } 00111 00114 int timeStampSec; 00117 int timeStampUsec; 00118 00121 bool isValid; 00122 00124 double headingTrue; 00126 double headingMagnetic; 00128 double speed; 00129 }; 00130 std::string toString( const VtgData &d ); 00131 inline std::ostream &operator<<( std::ostream &s, const VtgData &d ) 00132 { return s << toString(d); } 00133 GenericData* extractVtgData( const gbxgpsutilacfr::NmeaSentence& sentence, int timeSec, int timeUsec ); 00134 00137 class RmeData : public GenericData 00138 { 00139 public: 00140 DataType type() const { return PgRme; } 00141 00144 int timeStampSec; 00147 int timeStampUsec; 00148 00151 bool isValid; 00152 00155 bool isVerticalPositionErrorValid; 00156 00158 double horizontalPositionError; 00160 double verticalPositionError; 00161 00163 double estimatedPositionError; 00164 }; 00165 std::string toString( const RmeData &d ); 00166 inline std::ostream &operator<<( std::ostream &s, const RmeData &d ) 00167 { return s << toString(d); } 00168 GenericData* extractRmeData( const gbxgpsutilacfr::NmeaSentence& sentence, int timeSec, int timeUsec ); 00169 00171 class RmcData : public GenericData 00172 { 00173 public: 00174 DataType type() const { return GpRmc; } 00175 00178 int timeStampSec; 00181 int timeStampUsec; 00182 00185 int utcTimeHrs; 00188 int utcTimeMin; 00191 double utcTimeSec; 00192 00194 double latitude; 00196 double longitude; 00197 00200 bool isValid; 00201 00203 double headingTrue; 00205 double headingMagnetic; 00207 double speed; 00208 }; 00209 std::string toString( const RmcData &d ); 00210 inline std::ostream &operator<<( std::ostream &s, const RmcData &d ) 00211 { return s << toString(d); } 00212 GenericData* extractRmcData( const gbxgpsutilacfr::NmeaSentence& sentence, int timeSec, int timeUsec ); 00213 00214 } 00215 00216 #endif |