Supports multiple subscriptions
This commit is contained in:
@@ -225,6 +225,8 @@ void loop()
|
||||
last_cmd=cmd;
|
||||
while(cmd.length())
|
||||
{
|
||||
MqttError retval = MqttOk;
|
||||
|
||||
std::string s;
|
||||
MqttBroker* broker = nullptr;
|
||||
MqttClient* client = nullptr;
|
||||
@@ -314,11 +316,7 @@ void loop()
|
||||
}
|
||||
else if (compare(s,"publish"))
|
||||
{
|
||||
auto ok=client->publish(getword(cmd, topic.c_str()));
|
||||
if (ok != MqttOk)
|
||||
{
|
||||
Serial << "## ERROR " << ok << endl;
|
||||
}
|
||||
retval = client->publish(getword(cmd, topic.c_str()));
|
||||
}
|
||||
else if (compare(s,"subscribe"))
|
||||
{
|
||||
@@ -431,6 +429,11 @@ void loop()
|
||||
if (s.length())
|
||||
Serial << "Unknown command (" << s.c_str() << ")" << endl;
|
||||
}
|
||||
|
||||
if (retval != MqttOk)
|
||||
{
|
||||
Serial << "## ERROR " << retval << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user