35 lines
1.1 KiB
C
35 lines
1.1 KiB
C
#pragma once
|
|
|
|
#include "esp_err.h"
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/event_groups.h"
|
|
|
|
typedef esp_err_t (*esp32_app_base_product_start_fn_t)(void);
|
|
typedef esp_err_t (*esp32_app_base_health_check_fn_t)(void);
|
|
|
|
typedef struct {
|
|
const char *service_prefix;
|
|
int reset_gpio;
|
|
bool reset_active_low;
|
|
uint32_t reset_hold_ms;
|
|
esp32_app_base_product_start_fn_t product_start;
|
|
esp32_app_base_health_check_fn_t health_check;
|
|
const char *ntp_server;
|
|
const char *timezone;
|
|
uint32_t ntp_initial_wait_seconds;
|
|
bool ota_enabled;
|
|
const char *ota_url;
|
|
uint32_t ota_initial_delay_seconds;
|
|
uint32_t ota_check_interval_minutes;
|
|
uint32_t ota_retry_interval_minutes;
|
|
} esp32_app_base_config_t;
|
|
|
|
/** Owns NVS, Wi-Fi browser provisioning, NTP, OTA rollback and reset button. */
|
|
esp_err_t esp32_app_base_start(const esp32_app_base_config_t *config);
|
|
|
|
/** Network readiness event group for optional product services. */
|
|
EventGroupHandle_t esp32_app_base_network_events(void);
|
|
EventBits_t esp32_app_base_network_ready_bit(void);
|