INTRODUCTION
Overview
Download and Install
Documentation
Publications

REPOSITORY
Libraries

DEVELOPER
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         
gbxgarminacfr/driver.h
00001 /*
00002  * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
00003  *               http://gearbox.sf.net/
00004  * Copyright (c) 2004-2008 Duncan Mercer, Alex Brooks, Alexei Makarenko, Tobias Kaupp
00005  *
00006  * This distribution is licensed to you under the terms described in
00007  * the LICENSE file included in this distribution.
00008  *
00009  */
00010 
00011 #ifndef GBXGARMINACFR_DRIVER_H
00012 #define GBXGARMINACFR_DRIVER_H
00013 
00014 #include <gbxserialacfr/serial.h>
00015 #include <gbxutilacfr/tracer.h>
00016 #include <gbxutilacfr/status.h>
00017 #include <memory>
00018 
00019 namespace gbxgarminacfr {
00020 
00022 class Config
00023 {   
00024 public:
00025     Config() :
00026         readGga(true),
00027         readVtg(true),
00028         readRme(true),
00029         ignoreUnknown(false) {};
00030 
00034     bool isValid() const;
00035 
00037     std::string toString() const;
00038 
00040     std::string device;
00041 
00043     bool readGga;
00045     bool readVtg;
00047     bool readRme;
00048 
00052     bool ignoreUnknown;
00053 };
00054 
00056 enum DataType 
00057 {
00059     GpGga,
00061     GpVtg,
00063     PgRme
00064 };
00065 
00067 class GenericData
00068 {
00069 public:
00070     virtual ~GenericData() {};
00072     virtual DataType type() const=0;
00073 
00074 private:
00075 };
00076 
00078 enum FixType 
00079 {
00081     Invalid,
00084     Autonomous,
00086     Differential
00087 };
00088 std::string toString( const FixType &f );
00089 
00092 struct GgaData : public GenericData
00093 {
00094 public:
00095     DataType type() const { return GpGga; }
00096 
00099     int timeStampSec;
00102     int timeStampUsec;
00103 
00106     int utcTimeHrs;
00109     int utcTimeMin;
00112     double utcTimeSec;
00113 
00115     double latitude;
00117     double longitude;
00119     bool isAltitudeKnown;
00121     double altitude;
00122     
00125     FixType fixType;
00126 
00128     int satellites;
00129 
00131     double horizontalDilutionOfPosition;
00132     
00134     double geoidalSeparation;    
00135 };
00136 std::string toString( const GgaData &d );
00137 inline std::ostream &operator<<( std::ostream &s, const GgaData &d )
00138 { return s << toString(d); }
00139 
00141 class VtgData : public GenericData
00142 {
00143 public:
00144     DataType type() const { return GpVtg; }
00145 
00148     int timeStampSec;
00151     int timeStampUsec;
00152 
00155     bool isValid;
00156     
00158     double headingTrue; 
00160     double headingMagnetic; 
00162     double speed;
00163 };
00164 std::string toString( const VtgData &d );
00165 inline std::ostream &operator<<( std::ostream &s, const VtgData &d )
00166 { return s << toString(d); }
00167 
00169 class RmeData : public GenericData
00170 {
00171 public:
00172     DataType type() const { return PgRme; }
00173 
00176     int timeStampSec;
00179     int timeStampUsec;
00180     
00183     bool isValid;
00184 
00187     bool isVerticalPositionErrorValid;
00188     
00190     double horizontalPositionError;
00192     double verticalPositionError;
00193 
00195     double estimatedPositionError;
00196 };
00197 std::string toString( const RmeData &d );
00198 inline std::ostream &operator<<( std::ostream &s, const RmeData &d )
00199 { return s << toString(d); }
00200 
00222 class Driver
00223 {
00224 
00225 public:
00226 
00232     Driver( const Config& config, 
00233             gbxutilacfr::Tracer& tracer,
00234             gbxutilacfr::Status& status );
00235 
00236     ~Driver();
00237 
00254     std::auto_ptr<GenericData> read();
00255 
00256 private:
00257 
00258     void init();
00259     void enableDevice();
00260     void disableDevice();
00261     
00262     std::auto_ptr<gbxserialacfr::Serial> serial_;
00263 
00264     Config config_;
00265     gbxutilacfr::Tracer& tracer_;
00266     gbxutilacfr::Status& status_;
00267 };
00268 
00269 } // namespace
00270 
00271 #endif
 

Generated for GearBox by  doxygen 1.4.5