show mqtt subscriptions in mqttlog command

This commit is contained in:
Paul
2019-09-14 10:28:51 +02:00
parent 3f9a3bfc64
commit b709b469fd
2 changed files with 49 additions and 25 deletions

View File

@@ -9,7 +9,7 @@
#ifndef MyESP_h
#define MyESP_h
#define MYESP_VERSION "1.2.0"
#define MYESP_VERSION "1.2.1"
#include <ArduinoJson.h>
#include <ArduinoOTA.h>
@@ -87,7 +87,7 @@ extern struct rst_info resetInfo;
#define MQTT_MAX_PAYLOAD_SIZE 500 // max size of a JSON object. See https://arduinojson.org/v6/assistant/
#define MQTT_MAX_PAYLOAD_SIZE_LARGE 2000 // max size of a large JSON object, like for sending MQTT log
#define MYESP_JSON_MAXSIZE 2000 // for large Dynamic json files
#define MYESP_MQTTLOG_MAX 20 // max number of log entries for MQTT publishes
#define MYESP_MQTTLOG_MAX 40 // max number of log entries for MQTT publishes and subscribes
#define MYESP_JSON_LOG_MAXSIZE 300 // max size of an JSON log entry
// Internal MQTT events
@@ -212,9 +212,10 @@ typedef enum {
// for storing all MQTT publish messages
typedef struct {
char * topic;
char * payload;
time_t timestamp;
uint8_t type; // 0=none, 1=publish, 2=subscribe
char * topic;
char * payload;
time_t timestamp;
} _MQTT_Log;
typedef std::function<void(unsigned int, const char *, const char *)> mqtt_callback_f;
@@ -317,9 +318,10 @@ class MyESP {
char * _mqttTopic(const char * topic);
// mqtt log
_MQTT_Log MQTT_log[MYESP_MQTTLOG_MAX]; // log for publish messages
void _printMQTTLog();
void _addMQTTLog(const char * topic, const char * payload);
_MQTT_Log MQTT_log[MYESP_MQTTLOG_MAX]; // log for publish and subscribe messages
void _printMQTTLog();
void _addMQTTLog(const char * topic, const char * payload, const uint8_t type);
AsyncMqttClient mqttClient; // the MQTT class
uint32_t _mqtt_reconnect_delay;