From 797e5a61849b161b0271e55e255286b16fa41bc4 Mon Sep 17 00:00:00 2001 From: Siwat Sirichai Date: Tue, 19 Mar 2024 01:38:10 +0700 Subject: [PATCH] display iot wrapper --- src/display.hpp | 1 + src/display_iot.hpp | 37 +++++++++++++++++++++++++++++++++++++ src/main.hpp | 1 + 3 files changed, 39 insertions(+) create mode 100644 src/display_iot.hpp 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