|
23 | 23 | ******************************************************************************/ |
24 | 24 |
|
25 | 25 | #include <AIoTC_Config.h> |
26 | | - |
27 | 26 | #include <ArduinoIoTCloud.h> |
| 27 | +#include <ArduinoMqttClient.h> |
28 | 28 |
|
29 | | -#ifdef BOARD_HAS_ECCX08 |
30 | | - #include "tls/BearSSLClient.h" |
31 | | - #include "tls/utility/CryptoUtil.h" |
32 | | -#elif defined(BOARD_ESP) |
33 | | - #include <WiFiClientSecure.h> |
34 | | -#elif defined(ARDUINO_UNOR4_WIFI) |
35 | | - #include <WiFiSSLClient.h> |
36 | | -#elif defined(ARDUINO_PORTENTA_C33) |
37 | | - #include "tls/utility/CryptoUtil.h" |
38 | | - #include <SSLClient.h> |
39 | | -#elif defined(BOARD_HAS_SE050) |
40 | | - #include "tls/utility/CryptoUtil.h" |
41 | | - #include <WiFiSSLSE050Client.h> |
42 | | -#endif |
43 | | - |
44 | | -#ifdef BOARD_HAS_OFFLOADED_ECCX08 |
45 | | -#include "tls/utility/CryptoUtil.h" |
46 | | -#include <WiFiSSLClient.h> |
| 29 | +#if defined(BOARD_HAS_SECRET_KEY) |
| 30 | + #if defined(BOARD_ESP) |
| 31 | + #include <WiFiClientSecure.h> |
| 32 | + #elif defined(ARDUINO_EDGE_CONTROL) |
| 33 | + #include <GSMSSLClient.h> |
| 34 | + #endif |
| 35 | +#else |
| 36 | + #include <Arduino_SecureElement.h> |
| 37 | + #include <utility/SElementArduinoCloudDeviceId.h> |
| 38 | + #if defined(BOARD_HAS_OFFLOADED_ECCX08) |
| 39 | + #else |
| 40 | + #include <utility/SElementArduinoCloudCertificate.h> |
| 41 | + #ifdef BOARD_HAS_ECCX08 |
| 42 | + #include "tls/BearSSLClient.h" |
| 43 | + #elif defined(BOARD_HAS_OFFLOADED_ECCX08) |
| 44 | + #include <WiFiSSLClient.h> |
| 45 | + #elif defined(BOARD_HAS_SE050) |
| 46 | + #if defined(ARDUINO_PORTENTA_C33) |
| 47 | + #include <SSLClient.h> |
| 48 | + #else |
| 49 | + #include <WiFiSSLSE050Client.h> |
| 50 | + #endif |
| 51 | + #elif defined(BOARD_HAS_SOFTSE) |
| 52 | + #include <WiFiSSLClient.h> |
| 53 | + #endif |
| 54 | + #endif |
47 | 55 | #endif |
48 | 56 |
|
49 | | -#include <ArduinoMqttClient.h> |
50 | | - |
51 | 57 | /****************************************************************************** |
52 | 58 | CONSTANTS |
53 | 59 | ******************************************************************************/ |
@@ -79,7 +85,7 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass |
79 | 85 | virtual int connected () override; |
80 | 86 | virtual void printDebugInfo() override; |
81 | 87 |
|
82 | | - #if defined(BOARD_HAS_ECCX08) || defined(BOARD_HAS_OFFLOADED_ECCX08) || defined(BOARD_HAS_SE050) |
| 88 | + #if !defined(BOARD_HAS_SECRET_KEY) |
83 | 89 | int begin(ConnectionHandler & connection, bool const enable_watchdog = true, String brokerAddress = DEFAULT_BROKER_ADDRESS_SECURE_AUTH, uint16_t brokerPort = DEFAULT_BROKER_PORT_SECURE_AUTH); |
84 | 90 | #else |
85 | 91 | int begin(ConnectionHandler & connection, bool const enable_watchdog = true, String brokerAddress = DEFAULT_BROKER_ADDRESS_USER_PASS_AUTH, uint16_t brokerPort = DEFAULT_BROKER_PORT_USER_PASS_AUTH); |
@@ -142,33 +148,32 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass |
142 | 148 | int _mqtt_data_len; |
143 | 149 | bool _mqtt_data_request_retransmit; |
144 | 150 |
|
145 | | - #if defined(BOARD_HAS_ECCX08) |
146 | | - ArduinoIoTCloudCertClass _cert; |
147 | | - BearSSLClient _sslClient; |
148 | | - CryptoUtil _crypto; |
149 | | - #elif defined(BOARD_HAS_OFFLOADED_ECCX08) |
150 | | - ArduinoIoTCloudCertClass _cert; |
151 | | - WiFiBearSSLClient _sslClient; |
152 | | - CryptoUtil _crypto; |
153 | | - #elif defined(BOARD_ESP) |
| 151 | +#if defined(BOARD_HAS_SECRET_KEY) |
| 152 | + String _password; |
| 153 | + #if defined(BOARD_ESP) |
154 | 154 | WiFiClientSecure _sslClient; |
155 | | - #elif defined(ARDUINO_UNOR4_WIFI) |
156 | | - WiFiSSLClient _sslClient; |
157 | | - #elif defined(ARDUINO_EDGE_CONTROL) |
| 155 | + #elif defined(ARDUINO_EDGE_CONTROL) |
158 | 156 | GSMSSLClient _sslClient; |
159 | | - #elif defined(ARDUINO_PORTENTA_C33) |
160 | | - ArduinoIoTCloudCertClass _cert; |
161 | | - SSLClient _sslClient; |
162 | | - CryptoUtil _crypto; |
| 157 | + #endif |
| 158 | +#else |
| 159 | + SecureElement _crypto; |
| 160 | + #if defined(BOARD_HAS_OFFLOADED_ECCX08) |
| 161 | + WiFiBearSSLClient _sslClient; |
| 162 | + #else |
| 163 | + ECP256Certificate _cert; |
| 164 | + #if defined(BOARD_HAS_ECCX08) |
| 165 | + BearSSLClient _sslClient; |
163 | 166 | #elif defined(BOARD_HAS_SE050) |
164 | | - ArduinoIoTCloudCertClass _cert; |
| 167 | + #if defined(ARDUINO_PORTENTA_C33) |
| 168 | + SSLClient _sslClient; |
| 169 | + #else |
165 | 170 | WiFiSSLSE050Client _sslClient; |
166 | | - CryptoUtil _crypto; |
167 | | - #endif |
168 | | - |
169 | | - #if defined (BOARD_HAS_SECRET_KEY) |
170 | | - String _password; |
| 171 | + #endif |
| 172 | + #elif defined(BOARD_HAS_SOFTSE) |
| 173 | + WiFiSSLClient _sslClient; |
171 | 174 | #endif |
| 175 | + #endif |
| 176 | +#endif |
172 | 177 |
|
173 | 178 | MqttClient _mqttClient; |
174 | 179 |
|
|
0 commit comments