refactor NetworkDevice interface to work with new esp mqtt lib
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "NetworkDevice.h"
|
||||
#include "espMqttClient.h"
|
||||
#include "espMqttClientEthernet.h"
|
||||
#include <Ethernet.h>
|
||||
#include <Preferences.h>
|
||||
|
||||
@@ -22,14 +23,31 @@ public:
|
||||
|
||||
int8_t signalStrength() override;
|
||||
|
||||
virtual MqttClientSetup* mqttClient();
|
||||
void mqttSetClientId(const char *clientId) override;
|
||||
|
||||
void mqttSetCleanSession(bool cleanSession) override;
|
||||
|
||||
uint16_t mqttPublish(const char *topic, uint8_t qos, bool retain, const char *payload) override;
|
||||
|
||||
uint16_t mqttPublish(const char *topic, uint8_t qos, bool retain, const uint8_t *payload, size_t length) override;
|
||||
|
||||
bool mqttConnected() const override;
|
||||
|
||||
void mqttSetServer(const char *host, uint16_t port) override;
|
||||
|
||||
bool mqttConnect() override;
|
||||
|
||||
void mqttSetCredentials(const char *username, const char *password) override;
|
||||
|
||||
void mqttOnMessage(espMqttClientTypes::OnMessageCallback callback) override;
|
||||
|
||||
uint16_t mqttSubscribe(const char *topic, uint8_t qos) override;
|
||||
|
||||
private:
|
||||
void resetDevice();
|
||||
void initializeMacAddress(byte* mac);
|
||||
|
||||
EthernetClient* _ethClient = nullptr;
|
||||
MqttClientSetup* _mqttClient = nullptr;
|
||||
espMqttClientEthernet _mqttClient;
|
||||
Preferences* _preferences = nullptr;
|
||||
|
||||
int _maintainResult = 0;
|
||||
|
||||
Reference in New Issue
Block a user