feat(voice): improve on-screen dialog text and wifi provisioning hints
This commit is contained in:
@@ -14,10 +14,18 @@ extern "C" {
|
||||
esp_err_t platform_bootstrap_init(void);
|
||||
|
||||
// ---------- wifi_manager ----------
|
||||
typedef enum {
|
||||
WIFI_MANAGER_EVENT_PROVISIONING_STARTED = 0,
|
||||
} wifi_manager_event_t;
|
||||
|
||||
typedef void (*wifi_manager_event_cb_t)(wifi_manager_event_t event, void *user_data);
|
||||
|
||||
esp_err_t wifi_manager_start(void);
|
||||
esp_err_t wifi_manager_stop(void);
|
||||
esp_err_t wifi_manager_set_event_callback(wifi_manager_event_cb_t cb, void *user_data);
|
||||
|
||||
bool wifi_manager_is_ready(void);
|
||||
bool wifi_manager_has_saved_credentials(void);
|
||||
void wifi_manager_get_ip(char *buf, size_t buf_len);
|
||||
|
||||
// ---------- thermal_printer ----------
|
||||
|
||||
@@ -59,12 +59,22 @@ static bool s_ready;
|
||||
static bool s_started;
|
||||
static bool s_sta_reconnect_enabled;
|
||||
static bool s_provisioning_active;
|
||||
static wifi_manager_event_cb_t s_event_cb;
|
||||
static void *s_event_cb_user_data;
|
||||
static esp_netif_t *s_sta_netif;
|
||||
static esp_netif_t *s_ap_netif;
|
||||
static httpd_handle_t s_prov_httpd;
|
||||
static esp_event_handler_instance_t s_wifi_event_inst;
|
||||
static esp_event_handler_instance_t s_ip_event_inst;
|
||||
|
||||
static void wifi_manager_notify_event(wifi_manager_event_t event) {
|
||||
wifi_manager_event_cb_t cb = s_event_cb;
|
||||
if (cb == NULL) {
|
||||
return;
|
||||
}
|
||||
cb(event, s_event_cb_user_data);
|
||||
}
|
||||
|
||||
static void wifi_manager_apply_sta_throughput_profile(void) {
|
||||
const uint8_t protocol = WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N;
|
||||
esp_err_t proto_rc = esp_wifi_set_protocol(WIFI_IF_STA, protocol);
|
||||
@@ -716,6 +726,7 @@ static esp_err_t wifi_manager_start_softap_provisioning(void) {
|
||||
}
|
||||
|
||||
s_provisioning_active = true;
|
||||
wifi_manager_notify_event(WIFI_MANAGER_EVENT_PROVISIONING_STARTED);
|
||||
|
||||
ESP_LOGI(TAG,
|
||||
"SoftAP provisioning started: ssid=%s password=%s ip=192.168.4.1",
|
||||
@@ -726,6 +737,12 @@ static esp_err_t wifi_manager_start_softap_provisioning(void) {
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t wifi_manager_set_event_callback(wifi_manager_event_cb_t cb, void *user_data) {
|
||||
s_event_cb = cb;
|
||||
s_event_cb_user_data = user_data;
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static void wifi_manager_stop_softap_provisioning(void) {
|
||||
if (!s_provisioning_active) {
|
||||
return;
|
||||
@@ -942,6 +959,11 @@ bool wifi_manager_is_ready(void) {
|
||||
return s_ready;
|
||||
}
|
||||
|
||||
bool wifi_manager_has_saved_credentials(void) {
|
||||
wifi_sta_credentials_t creds = {0};
|
||||
return wifi_manager_load_credentials(&creds) == ESP_OK;
|
||||
}
|
||||
|
||||
void wifi_manager_get_ip(char *buf, size_t buf_len) {
|
||||
if (buf == NULL || buf_len == 0) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user