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

23 lines
750 B
C++
Raw Normal View History

2023-12-27 20:09:41 +00:00
#pragma once
2023-12-28 05:46:39 +00:00
#include <IoTComponent.hpp>
2023-12-27 20:09:41 +00:00
#include <AnalogCard.hpp>
2023-12-28 05:46:39 +00:00
class AnalogIoT : public IoTComponent {
2023-12-27 20:09:41 +00:00
public:
2023-12-28 06:14:18 +00:00
AnalogIoT();
~AnalogIoT();
2023-12-28 07:08:10 +00:00
bool begin(uint8_t card_id, AnalogCard *card, PubSubClient *mqtt, char *base_topic);
2023-12-27 20:09:41 +00:00
void handleMqttMessage(char *topic, char *payload);
void publishADCs();
void setADCsPublishInterval(uint32_t interval);
void setADCsPublishEnabled(bool enabled);
2023-12-28 06:14:18 +00:00
void publishReport();
2023-12-28 07:52:52 +00:00
void subscribe();
2023-12-28 06:14:18 +00:00
uint8_t getType();
2023-12-27 20:09:41 +00:00
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;
};