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

19 lines
683 B
C++
Raw Normal View History

2023-12-28 05:46:39 +00:00
#pragma once
2023-12-27 20:09:41 +00:00
2023-12-28 05:46:39 +00:00
#include <IoTComponent.hpp>
2023-12-27 20:09:41 +00:00
#include <DigitalInputCard.hpp>
2023-12-28 05:46:39 +00:00
class DigitalInputIoT : public IoTComponent {
2023-12-27 20:09:41 +00:00
public:
2023-12-28 07:08:10 +00:00
bool begin(uint8_t card_id, DigitalInputCard *card, PubSubClient *mqtt, char *base_topic);
2023-12-27 20:09:41 +00:00
void handleMqttMessage(char *topic, char *payload);
void publishDigitalInputs();
void setDigitalInputsPublishEnabled(bool enabled);
void handleValueChange(uint8_t pin, uint8_t value);
void registerValueChangeCallback(void (*callback)(uint8_t, uint8_t));
2023-12-28 06:14:18 +00:00
void publishReport();
uint8_t getType();
2023-12-27 20:09:41 +00:00
private:
bool digital_inputs_publish_enabled = false;
DigitalInputCard *card;
};