21 lines
664 B
C++
21 lines
664 B
C++
#pragma once
|
|
#include <ExpansionCard.hpp>
|
|
#include <PubSubClient.h>
|
|
class IoTComponent {
|
|
public:
|
|
bool begin(uint8_t card_id, ExpansionCard *card, PubSubClient *mqtt, char *base_topic);
|
|
virtual void handleMqttMessage(char *topic, char *payload);
|
|
void setMqttClient(PubSubClient *mqtt);
|
|
virtual void publishReport();
|
|
virtual uint8_t getType();
|
|
virtual void subscribe();
|
|
|
|
void loop();
|
|
protected:
|
|
char *base_topic;
|
|
void publishRelative(const char *topic, const char *payload);
|
|
void subscribeRelative(const char *topic);
|
|
PubSubClient *mqtt;
|
|
uint8_t card_id;
|
|
};
|