removed need of Streaming.h if no debug
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#define TINY_MQTT_DEBUG
|
||||
#include <TinyMqtt.h> // https://github.com/hsaturn/TinyMqtt
|
||||
#include <Streaming.h> // https://github.com/janelia-arduino/Streaming
|
||||
#include <map>
|
||||
@@ -360,7 +361,6 @@ void loop()
|
||||
std::string id=getword(cmd);
|
||||
if (id.length() or clients.find(id)!=clients.end())
|
||||
{
|
||||
|
||||
s=getword(cmd); // broker name
|
||||
if (s=="" or brokers.find(s) != brokers.end())
|
||||
{
|
||||
|
||||
@@ -2,12 +2,6 @@
|
||||
#include <sstream>
|
||||
#include <Streaming.h>
|
||||
|
||||
#if TINY_MQTT_DEBUG
|
||||
#define debug(what) { Serial << __LINE__ << ' ' << what << endl; delay(100); }
|
||||
#else
|
||||
#define debug(what) {}
|
||||
#endif
|
||||
|
||||
void outstring(const char* prefix, const char*p, uint16_t len)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -4,8 +4,11 @@
|
||||
#include <string>
|
||||
#include "StringIndexer.h"
|
||||
|
||||
#ifndef TINY_MQTT_DEBUG
|
||||
#define TINY_MQTT_DEBUG 0
|
||||
#ifdef TINY_MQTT_DEBUG
|
||||
#include <Streaming.h>
|
||||
#define debug(what) { Serial << __LINE__ << ' ' << what << endl; delay(100); }
|
||||
#else
|
||||
#define debug(what) {}
|
||||
#endif
|
||||
|
||||
enum MqttError
|
||||
@@ -145,6 +148,7 @@ class MqttClient
|
||||
// TODO seems to be useless
|
||||
bool isLocal() const { return client == nullptr; }
|
||||
|
||||
#ifdef TINY_MQTT_DEBUG
|
||||
void dump()
|
||||
{
|
||||
Serial << "MqttClient (" << clientId.c_str() << ") p=" << (int32_t) parent
|
||||
@@ -158,7 +162,7 @@ class MqttClient
|
||||
}
|
||||
Serial << "]" << endl;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
friend class MqttBroker;
|
||||
@@ -207,6 +211,7 @@ class MqttBroker
|
||||
void connect(std::string host, uint32_t port=1883);
|
||||
bool connected() const { return state == Connected; }
|
||||
|
||||
#ifdef TINY_MQTT_DEBUG
|
||||
void dump()
|
||||
{
|
||||
Serial << clients.size() << " client/s" << endl;
|
||||
@@ -216,6 +221,7 @@ class MqttBroker
|
||||
client->dump();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
friend class MqttClient;
|
||||
|
||||
Reference in New Issue
Block a user