#ifndef DEBUG_MQTT_H #define DEBUG_MQTT_H #include #include "config.h" enum Loglevel { none, error, warn, info, debug, influx}; class DebugMqtt { public: DebugMqtt(const char* name); void sendMsg(Loglevel loglevel, String topic, String msg); void sendMsg(Loglevel loglevel, String msg); void sendData(Loglevel loglevel, String topic, String data); void sendData(Loglevel loglevel, String data); void writeToInflux(String measurement_name, String field_set, float measurement); void sendTime(); static void init(PubSubClient *client, Loglevel loglevel); static void changeLoglevel(Loglevel loglevel); static void initRealMillis(); static unsigned long long int getUpdatedRealMillis(); private: const char* name; static String enum_to_string(Loglevel loglevel); static PubSubClient* client; static Loglevel loglevel; static bool isInit; static char msg[MQTT_BUFFER_SITE]; static char topic[MQTT_BUFFER_SITE]; static unsigned long long int real_millis; static unsigned long int last_millis; }; #endif // DEBUG_MQTT_H