refactor NetworkDevice interface to work with new esp mqtt lib

This commit is contained in:
technyon
2023-01-28 17:17:46 +01:00
parent a6010a7f49
commit 5853b0dc0e
24 changed files with 493 additions and 287 deletions

View File

@@ -11,8 +11,7 @@
#include <Arduino.h>
#include <Print.h>
#include "MqttClient.h"
#include "MqttClientSetup.h"
#include "../../../networkDevices/NetworkDevice.h"
#define MQTT_MAX_PACKET_SIZE 1024
@@ -30,16 +29,16 @@ private:
uint8_t* buffer;
uint8_t* bufferEnd;
uint16_t bufferCnt = 0, bufferSize = 0;
MqttClientSetup* client;
NetworkDevice* client;
MqttLoggerMode mode;
void sendBuffer();
public:
MqttLogger(MqttLoggerMode mode=MqttLoggerMode::MqttAndSerialFallback);
MqttLogger(MqttClientSetup& client, const char* topic, MqttLoggerMode mode=MqttLoggerMode::MqttAndSerialFallback);
MqttLogger(NetworkDevice* client, const char* topic, MqttLoggerMode mode=MqttLoggerMode::MqttAndSerialFallback);
~MqttLogger();
void setClient(MqttClientSetup& client);
void setClient(NetworkDevice* client);
void setTopic(const char* topic);
void setMode(MqttLoggerMode mode);
void setRetained(boolean retained);