2020-05-05 00:39:57 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "GPS.h"
|
|
|
|
#include "Observer.h"
|
|
|
|
#include "TinyGPS++.h"
|
|
|
|
|
|
|
|
/**
|
2020-09-16 16:22:03 +00:00
|
|
|
* A gps class thatreads from a NMEA GPS stream (and FIXME - eventually keeps the gps powered down except when reading)
|
2020-05-05 00:39:57 +00:00
|
|
|
*
|
|
|
|
* When new data is available it will notify observers.
|
|
|
|
*/
|
2020-09-16 16:22:03 +00:00
|
|
|
class NMEAGPS : public GPS
|
2020-05-05 00:39:57 +00:00
|
|
|
{
|
|
|
|
TinyGPSPlus reader;
|
2021-09-08 14:02:13 +00:00
|
|
|
uint8_t fixQual = 0; // fix quality from GPGGA
|
|
|
|
|
|
|
|
#ifndef TINYGPS_OPTION_NO_CUSTOM_FIELDS
|
|
|
|
// (20210908) TinyGps++ can only read the GPGSA "FIX TYPE" field
|
|
|
|
// via optional feature "custom fields", currently disabled (bug #525)
|
|
|
|
TinyGPSCustom gsafixtype; // custom extract fix type from GPGSA
|
|
|
|
TinyGPSCustom gsapdop; // custom extract PDOP from GPGSA
|
|
|
|
uint8_t fixType = 0; // fix type from GPGSA
|
|
|
|
#endif
|
2020-09-16 16:22:03 +00:00
|
|
|
|
2020-05-05 00:39:57 +00:00
|
|
|
public:
|
2022-01-24 17:24:40 +00:00
|
|
|
virtual bool setupGPS() override;
|
2020-09-25 16:14:00 +00:00
|
|
|
|
2020-10-01 16:11:54 +00: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
|
|
|
|
*/
|
2022-01-24 17:24:40 +00:00
|
|
|
virtual bool whileIdle() override;
|
2020-10-01 16:11:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2022-01-24 17:24:40 +00:00
|
|
|
virtual bool lookForTime() override;
|
2020-10-01 16:11:54 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2022-01-24 17:24:40 +00:00
|
|
|
virtual bool lookForLocation() override;
|
2021-09-08 14:02:13 +00:00
|
|
|
|
2022-01-24 17:24:40 +00:00
|
|
|
virtual bool hasLock() override;
|
2020-05-05 00:39:57 +00:00
|
|
|
};
|