microsoft / azure-iot-central-esp32-sample

An end-to-end example code to connect an ESP32 board with Azure IoT Central and send temperature, humidity, and light data from sensors.
Other
13 stars 5 forks source link

Compilation Errors with the latest ESP32 package, v2.x works #7

Closed Bush-cat closed 3 weeks ago

Bush-cat commented 1 month ago

I didn't look into it so much and simply rolled back ESP32 package from v3.0.5 to v2.17. A notice in the README or an update would be nice.

esp_mqtt_client_config_t changed between esp-idf 4.x and 5.0

the latest version causes lots of errors:

C:\GIT\azure-iot-central-esp32-sample\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino: In function 'int mqtt_client_init_function(mqtt_client_config_t*, void**)':

C:\GIT\azure-iot-central-esp32-sample\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:125:15: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'uri'

  125 |   mqtt_config.uri = mqtt_broker_uri;

      |               ^~~

C:\GIT\azure-iot-central-esp32-sample\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:126:15: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'port'

  126 |   mqtt_config.port = mqtt_client_config->port;

      |               ^~~~

C:\GIT\azure-iot-central-esp32-sample\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:127:15: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'client_id'

  127 |   mqtt_config.client_id = (const char*)az_span_ptr(mqtt_client_config->client_id);

      |               ^~~~~~~~~

C:\GIT\azure-iot-central-esp32-sample\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:128:15: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'username'

  128 |   mqtt_config.username = (const char*)az_span_ptr(mqtt_client_config->username);

      |               ^~~~~~~~

C:\GIT\azure-iot-central-esp32-sample\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:135:17: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'password'

  135 |     mqtt_config.password = (const char*)az_span_ptr(mqtt_client_config->password);

      |                 ^~~~~~~~

C:\GIT\azure-iot-central-esp32-sample\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:138:15: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'keepalive'

  138 |   mqtt_config.keepalive = 30;

      |               ^~~~~~~~~

C:\GIT\azure-iot-central-esp32-sample\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:139:15: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'disable_clean_session'

  139 |   mqtt_config.disable_clean_session = 0;

      |               ^~~~~~~~~~~~~~~~~~~~~

C:\GIT\azure-iot-central-esp32-sample\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:140:15: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'disable_auto_reconnect'

  140 |   mqtt_config.disable_auto_reconnect = false;

      |               ^~~~~~~~~~~~~~~~~~~~~~

C:\GIT\azure-iot-central-esp32-sample\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:141:15: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'event_handle'

  141 |   mqtt_config.event_handle = esp_mqtt_event_handler;

      |               ^~~~~~~~~~~~

C:\GIT\azure-iot-central-esp32-sample\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:142:15: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'user_context'

  142 |   mqtt_config.user_context = NULL;

      |               ^~~~~~~~~~~~

C:\GIT\azure-iot-central-esp32-sample\Azure_IoT_Central_ESP32\Azure_IoT_Central_ESP32.ino:143:15: error: 'esp_mqtt_client_config_t' {aka 'struct esp_mqtt_client_config_t'} has no member named 'cert_pem'

  143 |   mqtt_config.cert_pem = (const char*)ca_pem;

      |               ^~~~~~~~
Bush-cat commented 3 weeks ago

The Problem was, this Repo was not updated, the Example in the Library got an Update where ESP32 Package v3 is supported and the Example was updated but only the Azure_IoT_Central_ESP32 and not the Azure_IoT_Central_ESP32_AzureIoTKit https://github.com/Azure/azure-sdk-for-c-arduino/commit/28acdc59b6ac095dd827a0f3d33793930f52e798