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 choice EXAMPLE_LOCAL_CTRL_TRANSPORT
bool "Local Control Transport" bool "Local Control Transport"
default EXAMPLE_LOCAL_CTRL_TRANSPORT_BLE if !SOC_WIFI_SUPPORTED default EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP
default EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP default EXAMPLE_LOCAL_CTRL_TRANSPORT_BLE if SOC_BT_SUPPORTED
help 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 config EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP
bool "Soft AP" bool "HTTP/S"
select LWIP_IPV4 select LWIP_IPV4
depends on SOC_WIFI_SUPPORTED
config EXAMPLE_LOCAL_CTRL_TRANSPORT_BLE config EXAMPLE_LOCAL_CTRL_TRANSPORT_BLE
bool "BLE" bool "BLE"
select BT_ENABLED select BT_ENABLED
depends on SOC_BT_SUPPORTED
endchoice endchoice
choice EXAMPLE_PROTOCOMM_SECURITY_VERSION choice EXAMPLE_PROTOCOMM_SECURITY_VERSION

Wyświetl plik

@ -39,7 +39,7 @@ void app_main(void)
} }
ESP_ERROR_CHECK(ret); 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_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default()); 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"); ESP_LOGI(TAG, "Connection failed, not starting esp_local_ctrl service");
vTaskDelay(portMAX_DELAY); vTaskDelay(portMAX_DELAY);
} }
#endif /* CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP */ #endif /* CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP */
start_esp_local_ctrl_service(); start_esp_local_ctrl_service();
ESP_LOGI(TAG, "esp_local_ctrl service started"); 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 */ /* Function used by app_main to start the esp_local_ctrl service */
void start_esp_local_ctrl_service(void) 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 #ifdef CONFIG_ESP_HTTPS_SERVER_ENABLE
/* Set the configuration */ /* Set the configuration */
httpd_ssl_config_t https_conf = HTTPD_SSL_CONFIG_DEFAULT(); 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, 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 #ifdef CONFIG_EXAMPLE_PROTOCOMM_SECURITY_VERSION_1
/* What is the security level that we want (0, 1, 2): /* What is the security level that we want (0, 1, 2):
@ -306,7 +306,7 @@ void start_esp_local_ctrl_service(void)
#endif #endif
esp_local_ctrl_config_t config = { 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 = ESP_LOCAL_CTRL_TRANSPORT_HTTPD,
.transport_config = { .transport_config = {
#ifdef CONFIG_ESP_HTTPS_SERVER_ENABLE #ifdef CONFIG_ESP_HTTPS_SERVER_ENABLE
@ -320,7 +320,7 @@ void start_esp_local_ctrl_service(void)
.transport_config = { .transport_config = {
.ble = ble_conf, .ble = ble_conf,
}, },
#endif /* CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP */ #endif /* CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP */
.proto_sec = { .proto_sec = {
.version = security, .version = security,
.custom_handle = NULL, .custom_handle = NULL,
@ -337,7 +337,7 @@ void start_esp_local_ctrl_service(void)
.max_properties = 10 .max_properties = 10
}; };
#ifdef CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_SOFTAP #ifdef CONFIG_EXAMPLE_LOCAL_CTRL_TRANSPORT_HTTP
mdns_init(); mdns_init();
mdns_hostname_set(SERVICE_NAME); mdns_hostname_set(SERVICE_NAME);
#endif #endif

Wyświetl plik

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