2020-05-04 17:39:57 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "GPS.h"
|
|
|
|
|
#include "Observer.h"
|
|
|
|
|
#include "TinyGPS++.h"
|
|
|
|
|
|
|
|
|
|
/**
|
2020-09-16 09:22:03 -07:00
|
|
|
* A gps class thatreads from a NMEA GPS stream (and FIXME - eventually keeps the gps powered down except when reading)
|
2020-05-04 17:39:57 -07:00
|
|
|
*
|
|
|
|
|
* When new data is available it will notify observers.
|
|
|
|
|
*/
|
2020-09-16 09:22:03 -07:00
|
|
|
class NMEAGPS : public GPS
|
2020-05-04 17:39:57 -07:00
|
|
|
{
|
|
|
|
|
TinyGPSPlus reader;
|
2020-09-16 09:22:03 -07:00
|
|
|
|
2020-05-04 17:39:57 -07:00
|
|
|
public:
|
2020-10-05 15:29:26 +08:00
|
|
|
virtual bool setupGPS();
|
2020-09-25 09:14:00 -07:00
|
|
|
|
2020-10-01 09:11:54 -07:00
|
|
|
protected:
|
|
|
|
|
/** Subclasses should look for serial rx characters here and feed it to their GPS parser
|
|
|
|
|
*
|
|
|
|
|
* Return true if we received a valid message from the GPS
|
|
|
|
|
*/
|
|
|
|
|
virtual bool whileIdle();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Perform any processing that should be done only while the GPS is awake and looking for a fix.
|
|
|
|
|
* Override this method to check for new locations
|
|
|
|
|
*
|
|
|
|
|
* @return true if we've acquired a time
|
|
|
|
|
*/
|
|
|
|
|
virtual bool lookForTime();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Perform any processing that should be done only while the GPS is awake and looking for a fix.
|
|
|
|
|
* Override this method to check for new locations
|
|
|
|
|
*
|
|
|
|
|
* @return true if we've acquired a new location
|
|
|
|
|
*/
|
|
|
|
|
virtual bool lookForLocation();
|
2020-05-04 17:39:57 -07:00
|
|
|
};
|