mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-09 01:09:51 +03:00
show mqtt subscriptions in mqttlog command
This commit is contained in:
18
src/MyESP.h
18
src/MyESP.h
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user