#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 SIRICHAI 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;
};