feat(provisioning): add mini-program BLE Wi-Fi setup
This commit is contained in:
@@ -113,6 +113,7 @@ typedef enum {
|
||||
DOMAIN_EXPRESSION_IDLE = 0,
|
||||
DOMAIN_EXPRESSION_SERVER_ERROR,
|
||||
DOMAIN_EXPRESSION_SLOT_REELS,
|
||||
DOMAIN_EXPRESSION_WIFI_CONNECTING,
|
||||
DOMAIN_EXPRESSION_WIFI_DISCONNECTED,
|
||||
DOMAIN_EXPRESSION_WEALTH_SPIN,
|
||||
DOMAIN_EXPRESSION_WEALTH_DIRECTION,
|
||||
@@ -127,6 +128,7 @@ typedef enum {
|
||||
DOMAIN_EXPRESSION_TRIGGER_SERVER_TASK_FAILED,
|
||||
DOMAIN_EXPRESSION_TRIGGER_SERVER_OUTPUT_ERROR,
|
||||
DOMAIN_EXPRESSION_TRIGGER_SLOT_SWITCH,
|
||||
DOMAIN_EXPRESSION_TRIGGER_WIFI_BOOTSTRAP,
|
||||
DOMAIN_EXPRESSION_TRIGGER_WIFI_DISCONNECTED,
|
||||
DOMAIN_EXPRESSION_TRIGGER_WIFI_RECONNECTED,
|
||||
DOMAIN_EXPRESSION_TRIGGER_MODEL_DIRECTION,
|
||||
@@ -430,11 +432,64 @@ bool domain_runtime_wifi_connect_error_keeps_credentials(esp_err_t err);
|
||||
* - Returns explicit failure on timeout/connection error.
|
||||
*/
|
||||
esp_err_t domain_runtime_wifi_portal_connect_sta(int timeout_ms);
|
||||
/**
|
||||
* @brief Validate candidate credentials before replacing persisted Wi-Fi state.
|
||||
*
|
||||
* The previous credentials remain available when the bounded connection trial
|
||||
* fails. A successful trial commits only the new credentials.
|
||||
*/
|
||||
esp_err_t domain_runtime_wifi_portal_connect_sta_with_credentials(
|
||||
const char *ssid,
|
||||
const char *password,
|
||||
int timeout_ms);
|
||||
esp_err_t domain_runtime_wifi_portal_reconnect_sta(int timeout_ms);
|
||||
esp_err_t domain_runtime_wifi_portal_stop_sta(void);
|
||||
bool domain_runtime_is_network_connect_error(esp_err_t err);
|
||||
esp_err_t domain_runtime_wifi_portal_save_credentials(const char *ssid, const char *password);
|
||||
esp_err_t domain_runtime_wifi_portal_clear_saved_credentials(void);
|
||||
|
||||
#define DOMAIN_WIFI_PROVISIONING_SSID_MAX_LEN 33
|
||||
#define DOMAIN_WIFI_PROVISIONING_PASSWORD_MAX_LEN 65
|
||||
|
||||
typedef struct {
|
||||
char ssid[DOMAIN_WIFI_PROVISIONING_SSID_MAX_LEN];
|
||||
char password[DOMAIN_WIFI_PROVISIONING_PASSWORD_MAX_LEN];
|
||||
} domain_wifi_provisioning_credentials_t;
|
||||
|
||||
typedef enum {
|
||||
DOMAIN_WIFI_PROVISIONING_EVENT_CREDENTIALS = 0,
|
||||
DOMAIN_WIFI_PROVISIONING_EVENT_BAD_JSON,
|
||||
DOMAIN_WIFI_PROVISIONING_EVENT_EMPTY_SSID,
|
||||
} domain_wifi_provisioning_event_type_t;
|
||||
|
||||
typedef struct {
|
||||
domain_wifi_provisioning_event_type_t type;
|
||||
domain_wifi_provisioning_credentials_t credentials;
|
||||
} domain_wifi_provisioning_event_t;
|
||||
|
||||
typedef void (*domain_wifi_provisioning_event_callback_t)(
|
||||
const domain_wifi_provisioning_event_t *event,
|
||||
void *user_data);
|
||||
|
||||
typedef enum {
|
||||
DOMAIN_WIFI_PROVISIONING_STATUS_WIFI_CONNECTING = 0,
|
||||
DOMAIN_WIFI_PROVISIONING_STATUS_WIFI_GOT_IP,
|
||||
DOMAIN_WIFI_PROVISIONING_STATUS_SAVING_WIFI,
|
||||
DOMAIN_WIFI_PROVISIONING_STATUS_READY,
|
||||
DOMAIN_WIFI_PROVISIONING_STATUS_FAIL_BAD_JSON,
|
||||
DOMAIN_WIFI_PROVISIONING_STATUS_FAIL_EMPTY_SSID,
|
||||
DOMAIN_WIFI_PROVISIONING_STATUS_FAIL_TIMEOUT,
|
||||
DOMAIN_WIFI_PROVISIONING_STATUS_FAIL_CONNECT,
|
||||
} domain_wifi_provisioning_status_t;
|
||||
|
||||
/** Start the fixed TalkingQ mini-program BLE provisioning protocol. */
|
||||
esp_err_t domain_runtime_mini_program_provisioning_start(
|
||||
domain_wifi_provisioning_event_callback_t callback,
|
||||
void *user_data);
|
||||
esp_err_t domain_runtime_mini_program_provisioning_notify(
|
||||
domain_wifi_provisioning_status_t status);
|
||||
esp_err_t domain_runtime_mini_program_provisioning_stop(int timeout_ms);
|
||||
|
||||
esp_err_t domain_runtime_init_lcd_device(void);
|
||||
void domain_runtime_start_lcd_render_loop(void);
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user