2010-10-17 03:06:04 -03:00
|
|
|
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*-
|
|
|
|
//
|
|
|
|
// Auto-detecting pseudo-GPS driver
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef AP_GPS_Auto_h
|
|
|
|
#define AP_GPS_Auto_h
|
|
|
|
|
|
|
|
#include <GPS.h>
|
|
|
|
#include <FastSerial.h>
|
|
|
|
|
2010-10-17 04:22:11 -03:00
|
|
|
class AP_GPS_Auto : public GPS
|
2010-10-17 03:06:04 -03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/// Constructor
|
|
|
|
///
|
|
|
|
/// @note The stream is expected to be set up and configured for the
|
|
|
|
/// correct bitrate before ::init is called.
|
|
|
|
///
|
|
|
|
/// @param port Stream connected to the GPS module.
|
|
|
|
/// @param ptr Pointer to a GPS * that will be fixed up by ::init
|
|
|
|
/// when the GPS type has been detected.
|
|
|
|
///
|
2010-12-24 02:35:09 -04:00
|
|
|
AP_GPS_Auto(FastSerial *port, GPS **gps);
|
2010-10-17 04:22:11 -03:00
|
|
|
|
2010-12-24 02:35:09 -04:00
|
|
|
/// Dummy init routine, does nothing
|
|
|
|
virtual void init(void);
|
2010-10-17 03:06:04 -03:00
|
|
|
|
2010-12-24 02:35:09 -04:00
|
|
|
/// Detect and initialise the attached GPS unit. Updates the
|
|
|
|
/// pointer passed into the constructor when a GPS is detected.
|
2010-10-17 03:06:04 -03:00
|
|
|
///
|
2010-12-24 02:35:09 -04:00
|
|
|
virtual bool read(void);
|
2010-10-17 03:06:04 -03:00
|
|
|
|
|
|
|
private:
|
|
|
|
/// Serial port connected to the GPS.
|
2010-12-24 02:35:09 -04:00
|
|
|
FastSerial *_FSport;
|
2010-10-17 03:06:04 -03:00
|
|
|
|
2010-10-17 04:22:11 -03:00
|
|
|
/// global GPS driver pointer, updated by auto-detection
|
|
|
|
///
|
|
|
|
GPS **_gps;
|
|
|
|
|
2010-10-17 03:06:04 -03:00
|
|
|
/// low-level auto-detect routine
|
|
|
|
///
|
|
|
|
GPS *_detect(void);
|
|
|
|
|
|
|
|
/// fetch a character from the port
|
|
|
|
///
|
|
|
|
int _getc(void);
|
|
|
|
};
|
|
|
|
#endif
|