add digital output pinmap support

This commit is contained in:
Siwat Sirichai 2023-12-28 19:01:37 +07:00
parent 83ed233dd4
commit 2fd37fe66d
7 changed files with 63 additions and 30 deletions

View file

@ -15,8 +15,8 @@ class DigitalOutputIoT : public IoTComponent {
void publishDigitalOutputValue(uint8_t pin);
void setDigitalOutputsPublishEnabled(bool enabled);
void handleValueChange(uint8_t pin, bool state, uint16_t value);
void registerValueChangeCallback(void (*callback)(uint8_t, bool, uint16_t));
void deregisterValueChangeCallback();
void registerChangeCallback(std::function<void(uint8_t, bool, uint16_t)> callback);
void deregisterChangeCallback();
void publishReport();
void subscribe();
void loop();
@ -26,7 +26,7 @@ class DigitalOutputIoT : public IoTComponent {
bool processSetStateMessage(char *topic, char *payload, uint8_t topic_length);
bool processSetValueMessage(char *topic, char *payload, uint8_t topic_length);
bool processRequestStateMessage(char *topic, char *payload, uint8_t topic_length);
void (*value_change_callback)(uint8_t, bool, uint16_t);
std::function<void(uint8_t, bool, uint16_t)> value_change_callback;
DigitalOutputCard *card;
char *state_report_topic;
char *value_report_topic;