This commit is contained in:
2024-06-11 12:54:28 +03:00
parent 482903cecf
commit fecde83747
2 changed files with 110 additions and 59 deletions

View File

@ -63,6 +63,17 @@
typedef struct // Structure of data exchange between tasks, functions and event handlers.
{
struct
{
bool is_lan_mode; // Ethernet work mode flag.
char ssid_name[32]; // WiFi SSID name.
char ssid_password[64]; // WiFi password.
char mqtt_broker_url[64]; // MQTT broker url.
char mqtt_topic_prefix[32]; // MQTT topic prefix.
char ntp_server_url[64]; // NTP server url.
char ntp_time_zone[12]; // NTP time zone.
char firmware_upgrade_url[64]; // Firmware upgrade url.
} software_config;
uint8_t self_mac[6]; // Gateway MAC address. @note Depends at WiFi operation mode.
bool sntp_is_enable; // SNTP client operation status flag. @note Used to control the SNTP functions when the network connection is established / lost.
bool mqtt_is_enable; // MQTT client operation status flag. @note Used to control the MQTT functions when the network connection is established / lost.
@ -99,21 +110,34 @@ typedef struct // Struct for storing data about available nodes.
extern const uint8_t server_certificate_pem_start[] asm("_binary_certificate_pem_start");
extern const uint8_t server_certificate_pem_end[] asm("_binary_certificate_pem_end");
#ifdef CONFIG_CONNECTION_TYPE_LAN
/**
* @brief Function for loading the gateway configuration from NVS memory.
*
* @param[out] switch_config Pointer to structure of data exchange between tasks, functions and event handlers.
*/
void zh_load_config(gateway_config_t *gateway_config);
/**
* @brief Function for saving the gateway configuration to NVS memory.
*
* @param[in] switch_config Pointer to structure of data exchange between tasks, functions and event handlers.
*/
void zh_save_config(const gateway_config_t *gateway_config);
/**
* @brief Function for LAN event processing.
*
* @param[in,out] arg Pointer to the structure of data exchange between tasks, functions and event handlers.
*/
void zh_eth_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data);
#else
/**
* @brief Function for WiFi event processing.
*
* @param[in,out] arg Pointer to the structure of data exchange between tasks, functions and event handlers.
*/
void zh_wifi_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data);
#endif
/**
* @brief Function for ESP-NOW event processing
*