diff --git a/components/mqtt/CMakeLists.txt b/components/mqtt/CMakeLists.txt index 1c30e3a9..1ea67fb4 100644 --- a/components/mqtt/CMakeLists.txt +++ b/components/mqtt/CMakeLists.txt @@ -4,4 +4,6 @@ idf_component_register(SRCS "esp-mqtt/mqtt_client.c" "esp-mqtt/lib/platform_esp32_idf.c" INCLUDE_DIRS esp-mqtt/include PRIV_INCLUDE_DIRS "esp-mqtt/lib/include" - REQUIRES lwip nghttp mbedtls tcp_transport) + REQUIRES lwip http_parser mbedtls tcp_transport) + +target_compile_definitions(${COMPONENT_LIB} PUBLIC -DMQTT_SUPPORTED_FEATURE_WS_SUBPROTOCOL -DMQTT_SUPPORTED_FEATURE_TRANSPORT_ERR_REPORTING) diff --git a/components/mqtt/component.mk b/components/mqtt/component.mk index 19e49802..58bf11bf 100644 --- a/components/mqtt/component.mk +++ b/components/mqtt/component.mk @@ -2,3 +2,5 @@ COMPONENT_SUBMODULES += esp-mqtt COMPONENT_ADD_INCLUDEDIRS := esp-mqtt/include COMPONENT_SRCDIRS := esp-mqtt esp-mqtt/lib COMPONENT_PRIV_INCLUDEDIRS := esp-mqtt/lib/include +#Due to RTOS version is lower than idf 4.0, so move some define in file mqtt_supported_features.h to here. +CFLAGS += -DMQTT_SUPPORTED_FEATURE_WS_SUBPROTOCOL -DMQTT_SUPPORTED_FEATURE_TRANSPORT_ERR_REPORTING diff --git a/components/mqtt/esp-mqtt b/components/mqtt/esp-mqtt new file mode 160000 index 00000000..566b0349 --- /dev/null +++ b/components/mqtt/esp-mqtt @@ -0,0 +1 @@ +Subproject commit 566b0349843edaedce9ad958bd47cd328b66ffbf diff --git a/examples/protocols/mqtt/publish_test/main/publish_test.c b/examples/protocols/mqtt/publish_test/main/publish_test.c index e14b1ed1..9db86873 100644 --- a/examples/protocols/mqtt/publish_test/main/publish_test.c +++ b/examples/protocols/mqtt/publish_test/main/publish_test.c @@ -14,7 +14,7 @@ #include "esp_system.h" #include "nvs_flash.h" #include "esp_event.h" -#include "tcpip_adapter.h" +#include "esp_netif.h" #include "protocol_examples_common.h" #include "freertos/FreeRTOS.h" @@ -169,7 +169,7 @@ void app_main() esp_log_level_set("OUTBOX", ESP_LOG_VERBOSE); ESP_ERROR_CHECK(nvs_flash_init()); - tcpip_adapter_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/mqtt/ssl/main/app_main.c b/examples/protocols/mqtt/ssl/main/app_main.c index a63d5bd6..e0ae73d7 100644 --- a/examples/protocols/mqtt/ssl/main/app_main.c +++ b/examples/protocols/mqtt/ssl/main/app_main.c @@ -15,7 +15,7 @@ #include "esp_system.h" #include "nvs_flash.h" #include "esp_event.h" -#include "tcpip_adapter.h" +#include "esp_netif.h" #include "protocol_examples_common.h" #include "freertos/FreeRTOS.h" @@ -129,7 +129,7 @@ void app_main() esp_log_level_set("OUTBOX", ESP_LOG_VERBOSE); ESP_ERROR_CHECK(nvs_flash_init()); - tcpip_adapter_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/mqtt/ssl_mutual_auth/main/app_main.c b/examples/protocols/mqtt/ssl_mutual_auth/main/app_main.c index 21c76ff4..543965fd 100644 --- a/examples/protocols/mqtt/ssl_mutual_auth/main/app_main.c +++ b/examples/protocols/mqtt/ssl_mutual_auth/main/app_main.c @@ -14,7 +14,7 @@ #include "esp_system.h" #include "nvs_flash.h" #include "esp_event.h" -#include "tcpip_adapter.h" +#include "esp_netif.h" #include "protocol_examples_common.h" #include "freertos/FreeRTOS.h" @@ -111,7 +111,7 @@ void app_main() esp_log_level_set("OUTBOX", ESP_LOG_VERBOSE); ESP_ERROR_CHECK(nvs_flash_init()); - tcpip_adapter_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/mqtt/tcp/main/app_main.c b/examples/protocols/mqtt/tcp/main/app_main.c index 9e24a377..dbdbcc42 100644 --- a/examples/protocols/mqtt/tcp/main/app_main.c +++ b/examples/protocols/mqtt/tcp/main/app_main.c @@ -15,7 +15,7 @@ #include "esp_system.h" #include "nvs_flash.h" #include "esp_event.h" -#include "tcpip_adapter.h" +#include "esp_netif.h" #include "protocol_examples_common.h" #include "freertos/FreeRTOS.h" @@ -138,7 +138,7 @@ void app_main() esp_log_level_set("OUTBOX", ESP_LOG_VERBOSE); ESP_ERROR_CHECK(nvs_flash_init()); - tcpip_adapter_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/mqtt/ws/main/app_main.c b/examples/protocols/mqtt/ws/main/app_main.c index cb45759e..20769c9e 100644 --- a/examples/protocols/mqtt/ws/main/app_main.c +++ b/examples/protocols/mqtt/ws/main/app_main.c @@ -14,7 +14,7 @@ #include "esp_system.h" #include "nvs_flash.h" #include "esp_event.h" -#include "tcpip_adapter.h" +#include "esp_netif.h" #include "protocol_examples_common.h" #include "freertos/FreeRTOS.h" @@ -111,7 +111,7 @@ void app_main() esp_log_level_set("OUTBOX", ESP_LOG_VERBOSE); ESP_ERROR_CHECK(nvs_flash_init()); - tcpip_adapter_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/examples/protocols/mqtt/wss/main/app_main.c b/examples/protocols/mqtt/wss/main/app_main.c index 6e45ea47..80c65162 100644 --- a/examples/protocols/mqtt/wss/main/app_main.c +++ b/examples/protocols/mqtt/wss/main/app_main.c @@ -13,8 +13,8 @@ #include "esp_wifi.h" #include "esp_system.h" #include "nvs_flash.h" +#include "esp_netif.h" #include "esp_event.h" -#include "tcpip_adapter.h" #include "protocol_examples_common.h" #include "freertos/FreeRTOS.h" @@ -120,7 +120,7 @@ void app_main() esp_log_level_set("OUTBOX", ESP_LOG_VERBOSE); ESP_ERROR_CHECK(nvs_flash_init()); - tcpip_adapter_init(); + ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); /* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig. diff --git a/tools/ci/build_examples.sh b/tools/ci/build_examples.sh index f4557649..21ebf889 100755 --- a/tools/ci/build_examples.sh +++ b/tools/ci/build_examples.sh @@ -60,6 +60,7 @@ export EXAMPLE_MQTT_BROKER_CERTIFICATE="https://www.espressif.com/" export EXAMPLE_MQTT_BROKER_WS="https://www.espressif.com/" export EXAMPLE_MQTT_BROKER_WSS="https://www.espressif.com/" export EXAMPLE_MQTT_BROKER_SSL="https://www.espressif.com/" +export EXAMPLE_MQTT_BROKER_TCP="https://www.espressif.com/" shopt -s lastpipe # Workaround for Bash to use variables in loops (http://mywiki.wooledge.org/BashFAQ/024) diff --git a/tools/ci/build_examples_cmake.sh b/tools/ci/build_examples_cmake.sh index 53edbacb..8e9e23a6 100755 --- a/tools/ci/build_examples_cmake.sh +++ b/tools/ci/build_examples_cmake.sh @@ -63,6 +63,7 @@ export EXAMPLE_MQTT_BROKER_CERTIFICATE="https://www.espressif.com/" export EXAMPLE_MQTT_BROKER_WS="https://www.espressif.com/" export EXAMPLE_MQTT_BROKER_WSS="https://www.espressif.com/" export EXAMPLE_MQTT_BROKER_SSL="https://www.espressif.com/" +export EXAMPLE_MQTT_BROKER_TCP="https://www.espressif.com/" shopt -s lastpipe # Workaround for Bash to use variables in loops (http://mywiki.wooledge.org/BashFAQ/024)