22 lines
693 B
C++
22 lines
693 B
C++
#pragma once
|
|
#include <ExpansionCard.hpp>
|
|
#include <PubSubClient.h>
|
|
#include <esp_log.h>
|
|
class IoTComponent {
|
|
public:
|
|
virtual 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;
|
|
};
|