diff --git a/src/display.hpp b/src/display.hpp index d71f03e..3cb8bd8 100644 --- a/src/display.hpp +++ b/src/display.hpp @@ -1,3 +1,4 @@ +#pragma once #include #include #include diff --git a/src/display_iot.hpp b/src/display_iot.hpp new file mode 100644 index 0000000..fd11775 --- /dev/null +++ b/src/display_iot.hpp @@ -0,0 +1,37 @@ +#pragma once +/** + * @file display_iot.hpp + * @author Siwat Sirichai (siwat@siwatinc.com) + * @brief IoT Wrapper for the Display + * @version 0.1 + * @date 2024-03-19 + * + * @copyright Copyright (c) Siwat System 2024 + * + */ +#include "display.hpp" + +#define AC_LOCK_STATE_TOPIC "ac/lock" +#define AC_LOCK_SET_TOPIC "ac/lock/set" +#define AC_LOCK_FRAM_ADDR 6000 // 1 byte + +struct cud_display_iot_conf_t +{ + CUDDisplay *display; + ESPMegaIoT *iot; + FRAM *fram; +}; + +class CUDDisplayIoTWrapper +{ + public: + CUDDisplayIoTWrapper(); + void begin(cud_display_conf_t); + void subscribe(); + void publish_lock_state(); + void set_lock_state(bool state); + void get_lock_state(); + private: + void handle_mqtt_message(char *topic, char* payload); + cud_display_iot_conf_t conf; +}; \ No newline at end of file diff --git a/src/main.hpp b/src/main.hpp index 05c5473..472c0ad 100644 --- a/src/main.hpp +++ b/src/main.hpp @@ -1,3 +1,4 @@ +#pragma once #include #include #include