From d1c7ebe134db5c036dcdcc5891ae677c2490cab7 Mon Sep 17 00:00:00 2001 From: hsaturn Date: Sat, 10 Apr 2021 17:14:57 +0200 Subject: [PATCH] Added unsubscribe to tinytest --- examples/tinymqtt-test/tinymqtt-test.ino | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/tinymqtt-test/tinymqtt-test.ino b/examples/tinymqtt-test/tinymqtt-test.ino index a3310f6..f0b8785 100644 --- a/examples/tinymqtt-test/tinymqtt-test.ino +++ b/examples/tinymqtt-test/tinymqtt-test.ino @@ -138,7 +138,7 @@ std::set commands = { "auto", "broker", "blink", "client", "connect", "create", "delete", "help", "interval", "ls", "ip", "off", "on", "set", - "publish", "reset", "subscribe", "view" + "publish", "reset", "subscribe", "unsubscribe", "view" }; void getCommand(std::string& search) @@ -492,6 +492,10 @@ void loop() { client->subscribe(getword(cmd, topic.c_str())); } + else if (compare(s, "unsubscribe")) + { + client->unsubscribe(getword(cmd, topic.c_str())); + } else if (compare(s, "view")) { client->dump(); @@ -622,7 +626,7 @@ void loop() Serial << " MqttClient:" << endl; Serial << " client {name} {parent broker} : create a client then" << endl; Serial << " name.connect [ip] [port] [alive]" << endl; - Serial << " name.subscribe [topic]" << endl; + Serial << " name.[un]subscribe [topic]" << endl; Serial << " name.publish [topic][payload]" << endl; Serial << " name.view" << endl; Serial << " name.delete" << endl;