ESPMegaPRO-v3-SDK/Template Project/lib/ESPMegaPRO/AnalogIoT.hpp

23 lines
750 B
C++

#pragma once
#include <IoTComponent.hpp>
#include <AnalogCard.hpp>
class AnalogIoT : public IoTComponent {
public:
AnalogIoT();
~AnalogIoT();
bool begin(uint8_t card_id, AnalogCard *card, PubSubClient *mqtt, char *base_topic);
void handleMqttMessage(char *topic, char *payload);
void publishADCs();
void setADCsPublishInterval(uint32_t interval);
void setADCsPublishEnabled(bool enabled);
void publishReport();
void subscribe();
uint8_t getType();
private:
char *adc_topic;
char *dac_topic;
uint32_t adc_publish_interval = 1000;
uint32_t last_adc_publish = 0;
bool adc_publish_enabled = false;
AnalogCard *card;
};