mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-22 17:10:28 +00:00
wifi_provisioning_softap: Allow applications to start webserver externally
If an application wants to use webserver, instead of creating another webserver instance, the wifi provisioning manager can re-use the same. The webserver handle can be passed using this new API. Signed-off-by: Piyush Shah <piyush@espressif.com>
This commit is contained in:
@@ -33,7 +33,7 @@ typedef struct softap_config {
|
||||
static const char *TAG = "wifi_prov_scheme_softap";
|
||||
|
||||
extern const wifi_prov_scheme_t wifi_prov_scheme_softap;
|
||||
|
||||
static void *scheme_softap_prov_httpd_handle;
|
||||
static esp_err_t start_wifi_ap(const char *ssid, const char *pass)
|
||||
{
|
||||
/* Build Wi-Fi configuration for AP mode */
|
||||
@@ -85,6 +85,11 @@ static esp_err_t prov_start(protocomm_t *pc, void *config)
|
||||
|
||||
protocomm_httpd_config_t *httpd_config = &softap_config->httpd_config;
|
||||
|
||||
if (scheme_softap_prov_httpd_handle) {
|
||||
httpd_config->ext_handle_provided = true;
|
||||
httpd_config->data.handle = scheme_softap_prov_httpd_handle;
|
||||
}
|
||||
|
||||
/* Start protocomm server on top of HTTP */
|
||||
esp_err_t err = protocomm_httpd_start(pc, httpd_config);
|
||||
if (err != ESP_OK) {
|
||||
@@ -186,6 +191,11 @@ static esp_err_t set_config_endpoint(void *config, const char *endpoint_name, ui
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
void wifi_prov_scheme_softap_set_httpd_handle(void *handle)
|
||||
{
|
||||
scheme_softap_prov_httpd_handle = handle;
|
||||
}
|
||||
|
||||
const wifi_prov_scheme_t wifi_prov_scheme_softap = {
|
||||
.prov_start = prov_start,
|
||||
.prov_stop = prov_stop,
|
||||
|
Reference in New Issue
Block a user