feat: Update esp_local_ctrl example for ESP32P4

pull/13294/head
Harshit Malpani 2024-02-15 11:11:06 +05:30
rodzic 2df1ba8535
commit bae89606c3
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 441A8ACC7853D493
4 zmienionych plików z 15 dodań i 13 usunięć

Wyświetl plik

@ -2,19 +2,19 @@ menu "Example Configuration"
choice EXAMPLE_LOCAL_CTRL_TRANSPORT
bool "Local Control Transport"
default EXAMPLE_LOCAL_CTRL_TRANSPORT_BLE if !SOC_WIFI_SUPPORTED
default EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP
default EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP
default EXAMPLE_LOCAL_CTRL_TRANSPORT_BLE if SOC_BT_SUPPORTED
help
Local Control component offers both, SoftAP and BLE transports. Choose any one.
Local Control component offers both, HTTP/S and BLE transports. Choose any one.
config EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP
bool "Soft AP"
config EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP
bool "HTTP/S"
select LWIP_IPV4
depends on SOC_WIFI_SUPPORTED
config EXAMPLE_LOCAL_CTRL_TRANSPORT_BLE
bool "BLE"
select BT_ENABLED
depends on SOC_BT_SUPPORTED
endchoice
choice EXAMPLE_PROTOCOMM_SECURITY_VERSION

Wyświetl plik

@ -39,7 +39,7 @@ void app_main(void)
}
ESP_ERROR_CHECK(ret);
#ifdef CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP
#ifdef CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
@ -47,7 +47,7 @@ void app_main(void)
ESP_LOGI(TAG, "Connection failed, not starting esp_local_ctrl service");
vTaskDelay(portMAX_DELAY);
}
#endif /* CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP */
#endif /* CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP */
start_esp_local_ctrl_service();
ESP_LOGI(TAG, "esp_local_ctrl service started");

Wyświetl plik

@ -225,7 +225,7 @@ static void free_str(void *arg)
/* Function used by app_main to start the esp_local_ctrl service */
void start_esp_local_ctrl_service(void)
{
#ifdef CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP
#ifdef CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP
#ifdef CONFIG_ESP_HTTPS_SERVER_ENABLE
/* Set the configuration */
httpd_ssl_config_t https_conf = HTTPD_SSL_CONFIG_DEFAULT();
@ -262,7 +262,7 @@ void start_esp_local_ctrl_service(void)
0xb4, 0x42, 0xeb, 0x31, 0x4a, 0x1e, 0x98, 0x3d,
}
};
#endif /* CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP */
#endif /* CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP */
#ifdef CONFIG_EXAMPLE_PROTOCOMM_SECURITY_VERSION_1
/* What is the security level that we want (0, 1, 2):
@ -306,7 +306,7 @@ void start_esp_local_ctrl_service(void)
#endif
esp_local_ctrl_config_t config = {
#ifdef CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP
#ifdef CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP
.transport = ESP_LOCAL_CTRL_TRANSPORT_HTTPD,
.transport_config = {
#ifdef CONFIG_ESP_HTTPS_SERVER_ENABLE
@ -320,7 +320,7 @@ void start_esp_local_ctrl_service(void)
.transport_config = {
.ble = ble_conf,
},
#endif /* CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP */
#endif /* CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP */
.proto_sec = {
.version = security,
.custom_handle = NULL,
@ -337,7 +337,7 @@ void start_esp_local_ctrl_service(void)
.max_properties = 10
};
#ifdef CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP
#ifdef CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP
mdns_init();
mdns_hostname_set(SERVICE_NAME);
#endif

Wyświetl plik

@ -0,0 +1,2 @@
CONFIG_MDNS_PREDEF_NETIF_STA=n
CONFIG_MDNS_PREDEF_NETIF_AP=n