Merge branch 'master' into feature/esp32s2beta_update

This commit is contained in:
Angus Gratton
2019-08-08 13:44:24 +10:00
committed by Angus Gratton
2414 changed files with 160785 additions and 45781 deletions
@@ -22,7 +22,7 @@ This example can be executed on any ESP32 board, the only required interface is
### Configure the project
* Run `make menuconfig` (or `idf.py menuconfig` if using CMake build system)
* Open the project configuration menu (`idf.py menuconfig`)
* Configure Wi-Fi or Ethernet under "Example Connection Configuration" menu. See "Establishing Wi-Fi or Ethernet Connection" section in [examples/protocols/README.md](../../README.md) for more details.
* When using Make build system, set `Default serial port` under `Serial flasher config`.
* Set brokers for all 4 transports (TCP, SSL, WS, WSS), also set certificate if needed
@@ -1,4 +1,2 @@
set(COMPONENT_SRCS "publish_test.c")
set(COMPONENT_ADD_INCLUDEDIRS ".")
register_component()
idf_component_register(SRCS "publish_test.c"
INCLUDE_DIRS ".")
+8 -3
View File
@@ -3,6 +3,7 @@
(See the README.md file in the upper level 'examples' directory for more information about examples.)
This example connects to the broker iot.eclipse.org using ssl transport and as a demonstration subscribes/unsubscribes and send a message on certain topic.
(Please note that the public broker is maintained by the community so may not be always available, for details please see this [disclaimer](https://iot.eclipse.org/getting-started/#sandboxes))
It uses ESP-MQTT library which implements mqtt client to connect to mqtt broker.
@@ -14,14 +15,18 @@ This example can be executed on any ESP32 board, the only required interface is
### Configure the project
* Run `make menuconfig` (or `idf.py menuconfig` if using CMake build system)
* Open the project configuration menu (`idf.py menuconfig`)
* Configure Wi-Fi or Ethernet under "Example Connection Configuration" menu. See "Establishing Wi-Fi or Ethernet Connection" section in [examples/protocols/README.md](../../README.md) for more details.
* When using Make build system, set `Default serial port` under `Serial flasher config`.
Note how to create a PEM certificate for iot.eclipse.org:
PEM certificate for this example could be extracted from an openssl `s_client` command connecting to iot.eclipse.org.
In case a host operating system has `openssl` and `sed` packages installed, one could execute the following command to download and save the root certificate to a file (Note for Windows users: Both Linux like environment or Windows native packages may be used).
```
openssl s_client -showcerts -connect iot.eclipse.org:8883 </dev/null 2>/dev/null|openssl x509 -outform PEM >iot_eclipse_org.pem
echo "" | openssl s_client -showcerts -connect iot.eclipse.org:8883 | sed -n "1,/Root/d; /BEGIN/,/END/p" | openssl x509 -outform PEM >iot_eclipse_org.pem
```
Please note that this is not a general command for downloading a root certificate for an arbitrary host;
this command works with iot.eclipse.org as the site provides root certificate in the chain, which then could be extracted
with text operation.
### Build and Flash
@@ -1,4 +1,2 @@
set(COMPONENT_SRCS "app_main.c")
set(COMPONENT_ADD_INCLUDEDIRS ".")
register_component()
idf_component_register(SRCS "app_main.c"
INCLUDE_DIRS ".")
@@ -29,6 +29,7 @@
#include "esp_log.h"
#include "mqtt_client.h"
#include "esp_tls.h"
static const char *TAG = "MQTTS_EXAMPLE";
@@ -79,6 +80,10 @@ static esp_err_t mqtt_event_handler_cb(esp_mqtt_event_handle_t event)
break;
case MQTT_EVENT_ERROR:
ESP_LOGI(TAG, "MQTT_EVENT_ERROR");
int mbedtls_err = 0;
esp_err_t err = esp_tls_get_and_clear_last_error(event->error_handle, &mbedtls_err, NULL);
ESP_LOGI(TAG, "Last esp error code: 0x%x", err);
ESP_LOGI(TAG, "Last mbedtls failure: 0x%x", mbedtls_err);
break;
default:
ESP_LOGI(TAG, "Other event id:%d", event->event_id);
@@ -3,6 +3,7 @@
(See the README.md file in the upper level 'examples' directory for more information about examples.)
This example connects to the broker test.mosquitto.org using ssl transport with client certificate and as a demonstration subscribes/unsubscribes and send a message on certain topic.
(Please note that the public broker is maintained by the community so may not be always available, for details please visit http://test.mosquitto.org)
It uses ESP-MQTT library which implements mqtt client to connect to mqtt broker.
@@ -14,7 +15,7 @@ This example can be executed on any ESP32 board, the only required interface is
### Configure the project
* Run `make menuconfig` (or `idf.py menuconfig` if using CMake build system)
* Open the project configuration menu (`idf.py menuconfig`)
* Configure Wi-Fi or Ethernet under "Example Connection Configuration" menu. See "Establishing Wi-Fi or Ethernet Connection" section in [examples/protocols/README.md](../../README.md) for more details.
* When using Make build system, set `Default serial port` under `Serial flasher config`.
@@ -1,4 +1,2 @@
set(COMPONENT_SRCS "app_main.c")
set(COMPONENT_ADD_INCLUDEDIRS ".")
register_component()
idf_component_register(SRCS "app_main.c"
INCLUDE_DIRS ".")
+3 -1
View File
@@ -2,6 +2,8 @@
(See the README.md file in the upper level 'examples' directory for more information about examples.)
This example connects to the broker URI selected using `make menuconfig` (using mqtt tcp transport) and as a demonstration subscribes/unsubscribes and send a message on certain topic.
(Please note that the public broker is maintained by the community so may not be always available, for details please see this [disclaimer](https://iot.eclipse.org/getting-started/#sandboxes))
Note: If the URI equals `FROM_STDIN` then the broker address is read from stdin upon application startup (used for testing)
It uses ESP-MQTT library which implements mqtt client to connect to mqtt broker.
@@ -14,7 +16,7 @@ This example can be executed on any ESP32 board, the only required interface is
### Configure the project
* Run `make menuconfig` (or `idf.py menuconfig` if using CMake build system)
* Open the project configuration menu (`idf.py menuconfig`)
* Configure Wi-Fi or Ethernet under "Example Connection Configuration" menu. See "Establishing Wi-Fi or Ethernet Connection" section in [examples/protocols/README.md](../../README.md) for more details.
* When using Make build system, set `Default serial port` under `Serial flasher config`.
@@ -1,4 +1,2 @@
set(COMPONENT_SRCS "app_main.c")
set(COMPONENT_ADD_INCLUDEDIRS ".")
register_component()
idf_component_register(SRCS "app_main.c"
INCLUDE_DIRS ".")
+2 -1
View File
@@ -3,6 +3,7 @@
(See the README.md file in the upper level 'examples' directory for more information about examples.)
This example connects to the broker iot.eclipse.org over web sockets as a demonstration subscribes/unsubscribes and send a message on certain topic.
(Please note that the public broker is maintained by the community so may not be always available, for details please see this [disclaimer](https://iot.eclipse.org/getting-started/#sandboxes))
It uses ESP-MQTT library which implements mqtt client to connect to mqtt broker.
@@ -14,7 +15,7 @@ This example can be executed on any ESP32 board, the only required interface is
### Configure the project
* Run `make menuconfig` (or `idf.py menuconfig` if using CMake build system)
* Open the project configuration menu (`idf.py menuconfig`)
* Configure Wi-Fi or Ethernet under "Example Connection Configuration" menu. See "Establishing Wi-Fi or Ethernet Connection" section in [examples/protocols/README.md](../../README.md) for more details.
* When using Make build system, set `Default serial port` under `Serial flasher config`.
@@ -1,4 +1,2 @@
set(COMPONENT_SRCS "app_main.c")
set(COMPONENT_ADD_INCLUDEDIRS ".")
register_component()
idf_component_register(SRCS "app_main.c"
INCLUDE_DIRS ".")
+8 -2
View File
@@ -2,6 +2,7 @@
(See the README.md file in the upper level 'examples' directory for more information about examples.)
This example connects to the broker iot.eclipse.org over secure websockets and as a demonstration subscribes/unsubscribes and send a message on certain topic.
(Please note that the public broker is maintained by the community so may not be always available, for details please see this [disclaimer](https://iot.eclipse.org/getting-started/#sandboxes))
It uses ESP-MQTT library which implements mqtt client to connect to mqtt broker.
@@ -13,15 +14,20 @@ This example can be executed on any ESP32 board, the only required interface is
### Configure the project
* Run `make menuconfig` (or `idf.py menuconfig` if using CMake build system)
* Open the project configuration menu (`idf.py menuconfig`)
* Configure Wi-Fi or Ethernet under "Example Connection Configuration" menu. See "Establishing Wi-Fi or Ethernet Connection" section in [examples/protocols/README.md](../../README.md) for more details.
* When using Make build system, set `Default serial port` under `Serial flasher config`.
Note how to create a PEM certificate for iot.eclipse.org:
PEM certificate for this example could be extracted from an openssl `s_client` command connecting to iot.eclipse.org.
In case a host operating system has `openssl` and `sed` packages installed, one could execute the following command to download and save the root certificate to a file (Note for Windows users: Both Linux like environment or Windows native packages may be used).
```
openssl s_client -showcerts -connect iot.eclipse.org:8883 </dev/null 2>/dev/null|openssl x509 -outform PEM >iot_eclipse_org.pem
echo "" | openssl s_client -showcerts -connect iot.eclipse.org:443 | sed -n "1,/Root/d; /BEGIN/,/END/p" | openssl x509 -outform PEM >iot_eclipse_org.pem
```
Please note that this is not a general command for downloading a root certificate for an arbitrary host;
this command works with iot.eclipse.org as the site provides root certificate in the chain, which then could be extracted
with text operation.
### Build and Flash
@@ -1,4 +1,2 @@
set(COMPONENT_SRCS "app_main.c")
set(COMPONENT_ADD_INCLUDEDIRS ".")
register_component()
idf_component_register(SRCS "app_main.c"
INCLUDE_DIRS ".")