#ifndef __IDEASX_INTERFACE_H__ #define __IDEASX_INTERFACE_H__ #include "esp_common.h" #include "mqtt/mqtt.h" #include "log/esp_log.h" #include "user_config.h" #include "interface/encoder_interface.h" /* Health Packet Topics and Payloads */ typedef void (* ideasX_function_t)(void); typedef struct { uint8_t topic[20]; uint8_t minor; uint8_t major; } hw_ver_t; typedef struct { uint8_t topic[20]; uint8_t minor; uint8_t major; } fw_ver_t; typedef struct { uint8_t topic[20]; bool flag; } alive_t; typedef struct { uint8_t topic[20]; uint32_t value; } vcell_t; typedef struct { uint8_t topic[20]; uint8_t value; } rom_t; typedef struct { uint8_t topic[20]; bool flag; } ota_t; typedef struct { uint8_t topic[20]; int8_t value; } rssi_t; typedef struct { uint8_t topic[20]; uint8_t value[40]; } ssid_t; typedef struct { uint8_t topic[20]; uint8_t value[40]; } bssid_t; typedef struct { uint8_t topic[20]; uint32_t value; } soc_t; typedef struct{ hw_ver_t hw_ver; fw_ver_t fw_ver; alive_t alive; vcell_t vcell; soc_t soc; rom_t rom; ota_t ota; ssid_t ssid; bssid_t bssid; rssi_t rssi; os_timer_t health_timer; uint32_t health_report_rate; } IdeasX_Health_t; typedef struct { uint8_t health_topic[40]; uint8_t command_topic[40]; uint8_t device_id[40]; uint8_t mqtt_host[40]; uint32_t mqtt_port; uint8_t mqtt_user[40]; uint8_t mqtt_pass[40]; uint8_t mqtt_client_id[40]; uint32_t mqtt_keepalive; os_timer_t battery_timer; ideasX_function_t success_cb; ideasX_function_t fail_cb; } IdeasX_Config_t; typedef struct { uint8_t topic[20]; uint32_t* function; } command_ota_t; typedef struct { uint8_t topic[20]; uint32_t* function; } command_shutdown_t; typedef struct { command_ota_t ota; command_shutdown_t shutdown; } IdeasX_Command_t; #define HW_VERSION_HEALTH_TOPIC "hw_ver" #define FW_VERSION_HEALTH_TOPIC "fw_ver" #define ALIVE_HEALTH_TOPIC "alive" #define VCELL_HEALTH_TOPIC "vcell" #define CHARGE_HEALTH_TOPIC "charge" #define LBI_HEALTH_TOPIC "lbi" #define SOC_HEALTH_TOPIC "soc" #define ROM_HEALTH_TOPIC "rom" #define OTA_HEALTH_TOPIC "ota" #define SSID_HEALTH_TOPIC "ssid" #define BSSID_HEALTH_TOPIC "bssid" #define RSSI_HEALTH_TOPIC "rssi" #define AUTH_HEALTH_TOPIC "auth" #define HEALTH_QOS 0 #define HEALTH_RETAIN 0 #define HW_VERSION_MAJOR_DEFAULT 0 #define HW_VERSION_MINOR_DEFAULT 0 #define FW_VERSION_MAJOR_DEFAULT 0 #define FW_VERSION_MINOR_DEFAULT 0 #define HEALTH_REPORT_RATE_DEFAULT 120 // seconds #endif