22 #ifndef ESP_IOT_FRAMEWORK_CORE_EXT_H
23 #define ESP_IOT_FRAMEWORK_CORE_EXT_H
66 #define EIF_WIFI_SSID_DEFAULT "ESP32_SETUP"
68 #define EIF_WIFI_SSID_MIN_LEN 1U
70 #define EIF_WIFI_SSID_MAX_LEN 32U
73 #define EIF_WIFI_PASS_DEFAULT "12345678"
75 #define EIF_WIFI_PASS_MIN_LEN 8U
77 #define EIF_WIFI_PASS_MAX_LEN 64U
85 #define EIF_BASIC_AUTH_LINE_MIN_LEN 14U
87 #define EIF_BASIC_AUTH_LINE_MAX_LEN 59U
89 #define EIF_BASIC_AUTH_PASS_MIN_LEN 0U
91 #define EIF_BASIC_AUTH_PASS_MAX_LEN 33U
99 #define EIF_NVS_KEY_TLS_CERT "eif_tls_cert"
101 #define EIF_NVS_KEY_TLS_PRIV_KEY "eif_tls_key"
149 return ((str == NULL) || (str[0] ==
'\0'));
186 static inline size_t eif_strnlen(
const char *
const str,
size_t max_allowed) {
187 size_t search_limit = 0U;
189 if (max_allowed < SIZE_MAX) {
190 search_limit = max_allowed + 1U;
192 search_limit = max_allowed;
198 #if defined(__GNUC__) && (__GNUC__ >= 11)
199 #pragma GCC diagnostic push
200 #pragma GCC diagnostic ignored "-Wstringop-overread"
208 return strnlen(str, search_limit);
209 #if defined(__GNUC__) && (__GNUC__ >= 11)
210 #pragma GCC diagnostic pop
565 const char *
const key,
const char *
const value,
566 size_t min_len,
size_t max_len,
bool it_can_be_empty
621 const char *
const key,
char *
const value_out,
size_t max_len
686 const char * key,
char **
const value_out,
size_t *
const value_out_len
749 uint8_t index,
const char *
const ssid,
const char *
const pass
800 uint8_t index,
char *
const ssid_out,
char *
const pass_out
1036 TaskHandle_t *
const p_handle,
const TaskFunction_t f_worker,
1037 const char *
const p_name,
const uint32_t u32_stack,
1038 const UBaseType_t u_prio
1076 #if (defined(CONFIG_EIF_ENABLE_TLS) || defined(DOXYGEN))
1121 #ifdef CONFIG_EIF_LOG_ENABLE_REMOTE_DEBUG
1135 size_t eif_core_log_pop_chunk(
char *dest_buf,
size_t max_size);
uint8_t eif_wifi_get_current_profile_index(void)
Gets the index of the currently active Wi-Fi profile.
esp_err_t eif_wifi_get_test_result(uint8_t index, eif_wifi_test_result *const out_result)
Gets the network availability test result for a specific Wi-Fi profile.
uint8_t eif_wifi_get_profiles_count(void)
Gets the total number of Wi-Fi profiles.
esp_err_t(* eif_handler_ip_t)(void)
Prototype for network IP lifecycle event handlers.
Definition: esp_iot_framework_core_ext.h:397
esp_err_t eif_register_handler_ip_got(eif_handler_ip_t handler)
Register a handler for the IP_EVENT_STA_GOT_IP.
esp_err_t eif_register_handler_ip_lost(eif_handler_ip_t handler)
Register a handler for the IP_EVENT_STA_LOST_IP.
esp_err_t eif_nvs_wifi_profile_load(uint8_t index, char *const ssid_out, char *const pass_out)
Loads Wi-Fi network credentials for a specific profile index.
esp_err_t eif_nvs_value_load(const char *const key, char *const value_out, size_t max_len)
Loads a string from NVS into a pre-allocated buffer.
esp_err_t eif_nvs_basic_auth_line_save(const unsigned char *const pass)
Encodes and saves the HTTP Basic Auth credentials to NVS.
esp_err_t eif_nvs_value_save(const char *const key, const char *const value, size_t min_len, size_t max_len, bool it_can_be_empty)
Validates string length and writes it to NVS.
esp_err_t eif_nvs_basic_auth_line_load(char *const buf_out)
Loads the complete HTTP Basic Auth credentials from NVS.
esp_err_t eif_nvs_value_load_malloc(const char *key, char **const value_out, size_t *const value_out_len)
Dynamically allocates memory and loads a string from NVS.
esp_err_t eif_nvs_wifi_profile_save(uint8_t index, const char *const ssid, const char *const pass)
Saves Wi-Fi network credentials for a specific profile index.
esp_err_t eif_task_reboot_launch(void)
Spawns an asynchronous task to execute a system reboot.
esp_err_t eif_task_rollback_and_reboot_launch(void)
Spawns an asynchronous task to execute a firmware rollback.
esp_err_t eif_task_tls_recreate_launch(void)
Spawns an asynchronous task to regenerate TLS credentials.
esp_err_t eif_task_wifi_test_launch(uint8_t profile_index)
Spawns an asynchronous task to execute a Wi-Fi profile test.
esp_err_t eif_task_common_spawn(TaskHandle_t *const p_handle, const TaskFunction_t f_worker, const char *const p_name, const uint32_t u32_stack, const UBaseType_t u_prio)
Common helper for secure FreeRTOS task spawning.
Wi-Fi profile availability test result.
Definition: esp_iot_framework_core_ext.h:248
bool connected
Network availability status.
Definition: esp_iot_framework_core_ext.h:256
int8_t rssi
Received Signal Strength Indicator (RSSI).
Definition: esp_iot_framework_core_ext.h:263