From 79d9d2fd7c38bf7133faf8c8ea1253f7b02bac53 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Sat, 14 Nov 2020 21:39:40 +0100 Subject: [PATCH] public publish method --- cube/User/Src/mqttComm.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cube/User/Src/mqttComm.c b/cube/User/Src/mqttComm.c index 4185303..5f8b674 100644 --- a/cube/User/Src/mqttComm.c +++ b/cube/User/Src/mqttComm.c @@ -117,4 +117,13 @@ void mqttCommHandler(void *handle) { void mqttCommInit() { schAdd(mqttCommHandler, NULL, 0, 100); +} + +void mqttPublish(char *topic, char *message) { + bool res = publish(&mqttClient, topic, message, strlen(message), false); + if (res) { + coloredMsg(LOG_YELLOW, "mqp: %s -> %s successfully published", message, topic); + } else { + coloredMsg(LOG_RED, "mqp: %s -> %s failed to publish", message, topic); + } } \ No newline at end of file