mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-03-28 02:53:12 +00:00
Continued implementation and changes after testing
This commit is contained in:
@@ -29,21 +29,16 @@ public:
|
||||
#endif
|
||||
this->config = config;
|
||||
config->getMqttConfig(mqttConfig);
|
||||
AmsMqttHandler(mqttConfig, debugger, buf, updater);
|
||||
mqttConfigChanged = true;
|
||||
init(debugger, buf, updater);
|
||||
};
|
||||
#if defined(AMS_REMOTE_DEBUG)
|
||||
AmsMqttHandler(MqttConfig& MqttConfig, RemoteDebug* debugger, char* buf, AmsFirmwareUpdater* updater) {
|
||||
#else
|
||||
AmsMqttHandler(MqttConfig& MqttConfig, Stream* debugger, char* buf, AmsFirmwareUpdater* updater) {
|
||||
#endif
|
||||
this->debugger = debugger;
|
||||
this->json = buf;
|
||||
this->updater = updater;
|
||||
mqtt.dropOverflow(true);
|
||||
|
||||
pubTopic = String(mqttConfig.publishTopic);
|
||||
subTopic = String(mqttConfig.subscribeTopic);
|
||||
if(subTopic.isEmpty()) subTopic = pubTopic+"/command";
|
||||
this->mqttConfig = MqttConfig;
|
||||
init(debugger, buf, updater);
|
||||
}
|
||||
|
||||
void setCaVerification(bool);
|
||||
@@ -88,16 +83,18 @@ protected:
|
||||
#endif
|
||||
AmsConfiguration* config;
|
||||
MqttConfig mqttConfig;
|
||||
bool mqttConfigChanged = false;
|
||||
|
||||
bool mqttConfigChanged = true;
|
||||
#if defined(ESP32)
|
||||
MQTTClient mqtt = MQTTClient(2048);
|
||||
#else
|
||||
MQTTClient mqtt = MQTTClient(256);
|
||||
#endif
|
||||
unsigned long lastMqttRetry = -10000;
|
||||
bool caVerification = true;
|
||||
WiFiClient *mqttClient = NULL;
|
||||
WiFiClientSecure *mqttSecureClient = NULL;
|
||||
boolean _connected = false;
|
||||
char* json;
|
||||
uint16_t BufferSize = 2048;
|
||||
uint64_t lastStateUpdate = 0;
|
||||
uint64_t lastSuccessfulLoop = 0;
|
||||
|
||||
@@ -106,6 +103,22 @@ protected:
|
||||
|
||||
AmsFirmwareUpdater* updater = NULL;
|
||||
bool rebootSuggested = false;
|
||||
|
||||
private:
|
||||
#if defined(AMS_REMOTE_DEBUG)
|
||||
void init(RemoteDebug* debugger, char* buf, AmsFirmwareUpdater* updater) {
|
||||
#else
|
||||
void init(Stream* debugger, char* buf, AmsFirmwareUpdater* updater) {
|
||||
#endif
|
||||
this->debugger = debugger;
|
||||
this->json = buf;
|
||||
this->updater = updater;
|
||||
mqtt.dropOverflow(true);
|
||||
|
||||
pubTopic = String(mqttConfig.publishTopic);
|
||||
subTopic = String(mqttConfig.subscribeTopic);
|
||||
if(subTopic.isEmpty()) subTopic = pubTopic+"/command";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user