move common network code to seperate class

This commit is contained in:
technyon
2022-07-02 12:04:03 +02:00
parent cb35eae2f7
commit beb87a959f
12 changed files with 549 additions and 411 deletions

View File

@@ -11,10 +11,10 @@
#include "NukiOpenerConstants.h"
#include "NetworkLock.h"
class NetworkOpener
class NetworkOpener : public MqttReceiver
{
public:
explicit NetworkOpener(NetworkLock* network, Preferences* preferences);
explicit NetworkOpener(Network* network, Preferences* preferences);
virtual ~NetworkOpener() = default;
void initialize();
@@ -32,9 +32,9 @@ public:
void setLockActionReceivedCallback(bool (*lockActionReceivedCallback)(const char* value));
void setConfigUpdateReceivedCallback(void (*configUpdateReceivedCallback)(const char* path, const char* value));
void onMqttDataReceived(char*& topic, byte*& payload, unsigned int& length) override;
private:
static void onMqttDataReceivedCallback(char* topic, byte* payload, unsigned int length);
void onMqttDataReceived(char*& topic, byte*& payload, unsigned int& length);
bool comparePrefixedPath(const char* fullPath, const char* subPath);
void publishFloat(const char* topic, const float value, const uint8_t precision = 2);
@@ -48,7 +48,7 @@ private:
Preferences* _preferences;
NetworkLock* _network = nullptr;
Network* _network = nullptr;
char _mqttPath[181] = {0};
bool _isConnected = false;