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:
|
|
|
|
bool begin(DigitalInputCard *card);
|
|
|
|
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;
|
2023-12-28 06:14:18 +00:00
|
|
|
|
2023-12-27 20:09:41 +00:00
|
|
|
DigitalInputCard *card;
|
|
|
|
};
|