public publish method

This commit is contained in:
Wolfgang Hottgenroth 2020-11-14 21:39:40 +01:00
parent e79cc5f54d
commit 79d9d2fd7c
No known key found for this signature in database
GPG Key ID: 656C88C7C1734267

View File

@ -118,3 +118,12 @@ void mqttCommHandler(void *handle) {
void mqttCommInit() { void mqttCommInit() {
schAdd(mqttCommHandler, NULL, 0, 100); 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);
}
}