|
@ -121,19 +121,22 @@ class MqttSettingsService : public StatefulService<MqttSettings> { |
|
|
FSPersistence<MqttSettings> _fsPersistence; |
|
|
FSPersistence<MqttSettings> _fsPersistence; |
|
|
|
|
|
|
|
|
// Pointers to hold retained copies of the mqtt client connection strings. |
|
|
// Pointers to hold retained copies of the mqtt client connection strings. |
|
|
// Required as AsyncMqttClient holds refrences to the supplied connection strings. |
|
|
|
|
|
char* _retainedHost = nullptr; |
|
|
|
|
|
char* _retainedClientId = nullptr; |
|
|
|
|
|
char* _retainedUsername = nullptr; |
|
|
|
|
|
char* _retainedPassword = nullptr; |
|
|
|
|
|
|
|
|
// This is required as AsyncMqttClient holds refrences to the supplied connection strings. |
|
|
|
|
|
char* _retainedHost; |
|
|
|
|
|
char* _retainedClientId; |
|
|
|
|
|
char* _retainedUsername; |
|
|
|
|
|
char* _retainedPassword; |
|
|
|
|
|
|
|
|
AsyncMqttClient _mqttClient; |
|
|
|
|
|
|
|
|
// variable to help manage connection |
|
|
bool _reconfigureMqtt; |
|
|
bool _reconfigureMqtt; |
|
|
unsigned long _disconnectedAt; |
|
|
unsigned long _disconnectedAt; |
|
|
|
|
|
|
|
|
// connection status |
|
|
// connection status |
|
|
AsyncMqttClientDisconnectReason _disconnectReason; |
|
|
AsyncMqttClientDisconnectReason _disconnectReason; |
|
|
|
|
|
|
|
|
|
|
|
// the MQTT client instance |
|
|
|
|
|
AsyncMqttClient _mqttClient; |
|
|
|
|
|
|
|
|
#ifdef ESP32 |
|
|
#ifdef ESP32 |
|
|
void onStationModeGotIP(WiFiEvent_t event, WiFiEventInfo_t info); |
|
|
void onStationModeGotIP(WiFiEvent_t event, WiFiEventInfo_t info); |
|
|
void onStationModeDisconnected(WiFiEvent_t event, WiFiEventInfo_t info); |
|
|
void onStationModeDisconnected(WiFiEvent_t event, WiFiEventInfo_t info); |
|
|