refactoring ntripClient

This commit is contained in:
2024-07-12 22:57:37 +02:00
parent c866bc0d60
commit 87743c8e67
7 changed files with 96 additions and 41 deletions
+11 -8
View File
@@ -27,10 +27,10 @@
*/
enum NTRIPClientStates
{
openConnection,
pushData,
closeConnection,
wait,
openingConnection,
pushingData,
closingConnection,
waiting,
notAvailable
};
@@ -47,21 +47,21 @@ public:
/**
* @brief Construct a new NTRIPClient object
*
* @param gps The Gnss module
* @param gnss The Gnss module
* @param host
* @param port
* @param mountPoint
* @param user
* @param password
*/
NTRIPClient(SFE_UBLOX_GNSS *gps, const char *host, uint16_t port, const char *mountPoint, const char *user, const char *password);
NTRIPClient(SFE_UBLOX_GNSS *gnss, const char *host, uint16_t port, const char *mountPoint, const char *user = nullptr, const char *password = nullptr);
~NTRIPClient();
/**
* @brief Configure the Gnss module to accept correction data
*
*/
void gpsConfiguration();
void gnssConfiguration();
/**
* @brief Activate or deactivate the location transmission
@@ -82,6 +82,7 @@ public:
*/
bool setActivated(bool state);
void setAutoReconnect(bool state);
void useOutdatedNtripRev1 (bool rev1 = false ) { this->useNtripRev1 = rev1; }
bool isConnected();
@@ -103,13 +104,14 @@ private:
bool processConnection();
void checkAutoReconnect();
SFE_UBLOX_GNSS *gps;
SFE_UBLOX_GNSS *gnss;
WiFiClient *ntripClient;
NTRIPClientStates state = NTRIPClientStates::notAvailable;
bool transmitLocation = false;
bool activated = true;
bool autoReconnect = false;
bool useNtripRev1 = false;
uint8_t reconnectAttemps = 0;
uint16_t port;
@@ -126,6 +128,7 @@ private:
const uint16_t reconnectDelayTime = 1000;
const uint16_t timeOut = 10000;
const uint16_t bufferSize = 512;
const uint16_t bufferSizePushGPGGA = 128;
const uint16_t pushGPGGATime = 10000;
static constexpr uint8_t loopDelay = 20;