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

19 lines
716 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 06:34:51 +00:00
bool begin(DigitalInputCard *card, void (*publishRelative)(uint8_t, char *, char *), 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;
};