rename folders
This commit is contained in:
parent
1ec8effe90
commit
1815597374
63 changed files with 1 additions and 0 deletions
21
ESPMegaPRO-firmware/lib/ESPMegaPRO/IoTComponent.cpp
Normal file
21
ESPMegaPRO-firmware/lib/ESPMegaPRO/IoTComponent.cpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#include <IoTComponent.hpp>
|
||||
|
||||
void IoTComponent::setMqttClient(PubSubClient *mqtt) {
|
||||
this->mqtt = mqtt;
|
||||
}
|
||||
|
||||
void IoTComponent::publishRelative(const char *topic, const char *payload) {
|
||||
char absolute_topic[100];
|
||||
sprintf(absolute_topic, "%s/%02d/%s", base_topic, card_id, topic);
|
||||
mqtt->publish(absolute_topic, payload);
|
||||
}
|
||||
|
||||
void IoTComponent::subscribeRelative(const char *topic) {
|
||||
char absolute_topic[50];
|
||||
sprintf(absolute_topic, "%s/%02d/%s", base_topic, card_id, topic);
|
||||
mqtt->subscribe(absolute_topic);
|
||||
}
|
||||
|
||||
void IoTComponent::loop() {
|
||||
// Placeholder, Do nothing
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue