From 838df3a34a005163da321744106aa505b31ad46a 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 2f6f9d0..5b825c2 100644 --- a/examples/tinymqtt-test/tinymqtt-test.ino +++ b/examples/tinymqtt-test/tinymqtt-test.ino @@ -129,7 +129,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) @@ -481,6 +481,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(); @@ -611,7 +615,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;