• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

AP_GPS_Shim.h

Go to the documentation of this file.
00001 // -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*-
00002 //
00003 //  Shim GPS driver, for use when the actual GPS data is coming from somewhere else.
00004 //  Code by Mike Smith
00005 //
00006 //      This library is free software; you can redistribute it and / or
00007 //      modify it under the terms of the GNU Lesser General Public
00008 //      License as published by the Free Software Foundation; either
00009 //      version 2.1 of the License, or (at your option) any later version.
00010 //
00011 //
00012 #ifndef AP_GPS_Shim_h
00013 #define AP_GPS_Shim_h
00014 
00015 #include <GPS.h>
00016 
00017 class AP_GPS_Shim : public GPS
00018 {
00019 public:
00020         AP_GPS_Shim() : GPS(NULL) {}
00021 
00022         virtual void init(void) {};
00023         virtual bool read(void) {
00024                 bool updated = _updated;
00025                 _updated = false;
00026                 return _updated;
00027         }
00028 
00032 #define __GPS_SHIM_SET(__type, __name) void set_##__name(__type v) { __name = v; _updated = true; }
00033         __GPS_SHIM_SET(long, time);
00034         __GPS_SHIM_SET(long, latitude);
00035         __GPS_SHIM_SET(long, longitude);
00036         __GPS_SHIM_SET(long, altitude);
00037         __GPS_SHIM_SET(long, ground_speed);
00038         __GPS_SHIM_SET(long, ground_course);
00039         __GPS_SHIM_SET(long, speed_3d);
00040         __GPS_SHIM_SET(int, hdop);
00041 #undef __GPS_SHIM_SET
00042 
00043 private:
00044         bool    _updated;               
00045 };
00046 
00047 #endif  // AP_GPS_HIL_H

Generated for ArduPilot Libraries by doxygen