ESPMegaPRO-v3-SDK/Template Project/lib/ESPMegaPRO/IoTComponent.cpp

11 lines
319 B
C++
Raw Normal View History

2023-12-28 05:46:39 +00:00
#include <IoTComponent.hpp>
void IoTComponent::setMqttClient(PubSubClient *mqtt) {
this->mqtt = mqtt;
2023-12-28 07:08:10 +00:00
}
void IoTComponent::publishRelative(char *topic, char *payload) {
char absolute_topic[100];
sprintf(absolute_topic, "%s/%d/%s", base_topic, card_id, topic);
mqtt->publish(absolute_topic, payload);
2023-12-28 05:46:39 +00:00
}