#pragma once #include #include #include "esp_err.h" #ifdef __cplusplus extern "C" { #endif // Maximale Längen #define CONFIG_MAX_SSID_LEN 32 #define CONFIG_MAX_PASSWORD_LEN 64 #define CONFIG_MAX_IP_LEN 16 #define CONFIG_MAX_SIP_USER_LEN 64 #define CONFIG_MAX_SIP_SERVER_LEN 128 #define CONFIG_MAX_BT_NAME_LEN 32 #define CONFIG_MAX_BT_ADDR_LEN 18 // "XX:XX:XX:XX:XX:XX" // IP-Konfigurationsmodus typedef enum { IP_MODE_DHCP = 0, IP_MODE_STATIC = 1 } ip_mode_t; // WLAN-Konfiguration typedef struct { char ssid[CONFIG_MAX_SSID_LEN + 1]; char password[CONFIG_MAX_PASSWORD_LEN + 1]; ip_mode_t ip_mode; char static_ip[CONFIG_MAX_IP_LEN + 1]; char gateway[CONFIG_MAX_IP_LEN + 1]; char netmask[CONFIG_MAX_IP_LEN + 1]; char dns[CONFIG_MAX_IP_LEN + 1]; bool configured; // true wenn WLAN-Daten vorhanden } wifi_config_data_t; // SIP-Konfiguration typedef struct { char server[CONFIG_MAX_SIP_SERVER_LEN + 1]; uint16_t port; char username[CONFIG_MAX_SIP_USER_LEN + 1]; char password[CONFIG_MAX_PASSWORD_LEN + 1]; char display_name[CONFIG_MAX_SIP_USER_LEN + 1]; bool configured; } sip_config_data_t; // Bluetooth-Gerät typedef struct { char name[CONFIG_MAX_BT_NAME_LEN + 1]; char address[CONFIG_MAX_BT_ADDR_LEN + 1]; bool paired; bool auto_connect; uint8_t priority; // Niedrigere Zahl = höhere Priorität } bt_device_config_t; // Bluetooth-Konfiguration typedef struct { char device_name[CONFIG_MAX_BT_NAME_LEN + 1]; bt_device_config_t devices[CONFIG_BSC_MAX_BT_DEVICES]; uint8_t device_count; bool discoverable; } bt_config_data_t; // Gesamtkonfiguration typedef struct { wifi_config_data_t wifi; sip_config_data_t sip; bt_config_data_t bluetooth; } device_config_t; /** * Initialisiert den Config-Manager und lädt gespeicherte Konfiguration */ esp_err_t config_manager_init(void); /** * Gibt die aktuelle Konfiguration zurück */ const device_config_t* config_get(void); /** * Speichert die WLAN-Konfiguration */ esp_err_t config_save_wifi(const wifi_config_data_t* wifi_config); /** * Speichert die SIP-Konfiguration */ esp_err_t config_save_sip(const sip_config_data_t* sip_config); /** * Speichert ein Bluetooth-Gerät */ esp_err_t config_save_bt_device(const bt_device_config_t* device); /** * Entfernt ein Bluetooth-Gerät */ esp_err_t config_remove_bt_device(const char* address); /** * Setzt alle Bluetooth-Geräte zurück */ esp_err_t config_clear_bt_devices(void); /** * Setzt die gesamte Konfiguration auf Werkseinstellungen zurück */ esp_err_t config_factory_reset(void); /** * Prüft ob WLAN konfiguriert ist */ bool config_wifi_is_configured(void); /** * Prüft ob SIP konfiguriert ist */ bool config_sip_is_configured(void); #ifdef __cplusplus } #endif