orca-robotics


INTRODUCTION
Overview
Download and Install
Documentation

REPOSITORY
Interfaces
Drivers
Libraries
Utilities
Software Map

DEVELOPER
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

gpsgarmin/driver.h

00001 /*
00002  * Orca-Robotics Project: Components for robotics 
00003  *               http://orca-robotics.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 HYDRO_GPS_GARMIN_H
00012 #define HYDRO_GPS_GARMIN_H
00013 
00014 #include <hydrointerfaces/gps.h>
00015 #include <gbxserialacfr/serial.h>
00016 #include <hydrogpsutil/nmea.h>
00017 #include <memory>
00018 
00019 namespace gpsgarmin {
00020 
00021 //
00022 // Bogus laser driver, useful for testing the rest of the component.
00023 //
00024 class Driver : public hydrointerfaces::Gps
00025 {
00026 
00027 public:
00028 
00029     Driver( const Config &cfg, const hydroutil::Context &context );
00030     virtual ~Driver();
00031 
00032 
00033     // Blocks till new data is available
00034     virtual void read( hydrointerfaces::Gps::Data &data );
00035 
00036 private:
00037 
00038     void init();
00039     void addDataToFrame();
00040     void enableDevice();
00041     void disableDevice();
00042     int  resetDevice();
00043     void extractGGAData();
00044     void extractVTGData();
00045     void extractRMEData();
00046     void clearFrame(){haveGGA_ = false; haveVTG_ = false; haveRME_ =false;};
00047     bool haveCompleteFrame(){return (haveGGA_ & haveVTG_ & haveRME_);};
00048     
00049     void readFrame ( hydrointerfaces::Gps::Data &data);
00050     
00051     std::auto_ptr<gbxserialacfr::Serial> serial_;
00052 
00053     hydrointerfaces::Gps::Data gpsData_;
00054     hydrogpsutil::NmeaMessage nmeaMessage_;
00055 //     IceUtil::Time timeOfRead_;
00056     int timeOfReadSec_;
00057     int timeOfReadUsec_;
00058     
00059     //*** NOTE:- if we change the number of messages in the frame need to change
00060     //The N_MSGS_IN_FRAME in the readFrame fn...
00061     bool haveGGA_;
00062     bool haveVTG_;
00063     bool haveRME_;
00064 
00065     Gps::Config config_;
00066     hydroutil::Context context_;
00067 };
00068 
00069 // Used for dynamically loading driver
00070 class Factory : public hydrointerfaces::GpsFactory
00071 {
00072 public:
00073     hydrointerfaces::Gps *createDriver( 
00074                 const hydrointerfaces::Gps::Config &config,
00075                 const hydroutil::Context &context ) const
00076     {
00077         return new Driver( config, context );
00078     }
00079 };
00080 
00081 } // namespace
00082 
00083 // Used for dynamically loading driver
00084 extern "C" {
00085     hydrointerfaces::GpsFactory *createDriverFactory();
00086 }
00087 
00088 #endif
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5