26
26
#include < ArduinoIoTCloud.h>
27
27
#include < ArduinoMqttClient.h>
28
28
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
29
+ #if defined(BOARD_HAS_SECURE_ELEMENT)
36
30
#include < Arduino_SecureElement.h>
37
31
#include < utility/SElementArduinoCloudDeviceId.h>
38
- #if defined(BOARD_HAS_OFFLOADED_ECCX08)
39
- #else
32
+ #if !defined(BOARD_HAS_OFFLOADED_ECCX08)
40
33
#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
34
#endif
55
35
#endif
56
36
37
+ #if defined(BOARD_HAS_OFFLOADED_ECCX08)
38
+ #include " WiFiSSLClient.h"
39
+ #elif defined(BOARD_HAS_ECCX08)
40
+ #include " tls/BearSSLClient.h"
41
+ #elif defined(ARDUINO_PORTENTA_C33)
42
+ #include < SSLClient.h>
43
+ #elif defined(ARDUINO_NICLA_VISION)
44
+ #include < WiFiSSLSE050Client.h>
45
+ #elif defined(ARDUINO_EDGE_CONTROL)
46
+ #include < GSMSSLClient.h>
47
+ #elif defined(ARDUINO_UNOR4_WIFI)
48
+ #include < WiFiSSLClient.h>
49
+ #elif defined(BOARD_ESP)
50
+ #include < WiFiClientSecure.h>
51
+ #endif
52
+
57
53
/* *****************************************************************************
58
54
CONSTANTS
59
55
******************************************************************************/
60
-
56
+ # if defined(BOARD_HAS_SECURE_ELEMENT)
61
57
static char const DEFAULT_BROKER_ADDRESS_SECURE_AUTH[] = " mqtts-sa.iot.arduino.cc" ;
62
58
static uint16_t const DEFAULT_BROKER_PORT_SECURE_AUTH = 8883 ;
59
+ #endif
60
+
61
+ #if defined(BOARD_HAS_SECRET_KEY)
63
62
static char const DEFAULT_BROKER_ADDRESS_USER_PASS_AUTH[] = " mqtts-up.iot.arduino.cc" ;
64
63
static uint16_t const DEFAULT_BROKER_PORT_USER_PASS_AUTH = 8884 ;
64
+ #endif
65
65
66
66
/* *****************************************************************************
67
67
* TYPEDEF
@@ -85,11 +85,7 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass
85
85
virtual int connected () override ;
86
86
virtual void printDebugInfo () override ;
87
87
88
- #if !defined(BOARD_HAS_SECRET_KEY)
89
88
int begin (ConnectionHandler & connection, bool const enable_watchdog = true , String brokerAddress = DEFAULT_BROKER_ADDRESS_SECURE_AUTH, uint16_t brokerPort = DEFAULT_BROKER_PORT_SECURE_AUTH);
90
- #else
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);
92
- #endif
93
89
int begin (bool const enable_watchdog = true , String brokerAddress = DEFAULT_BROKER_ADDRESS_SECURE_AUTH, uint16_t brokerPort = DEFAULT_BROKER_PORT_SECURE_AUTH);
94
90
95
91
#ifdef BOARD_HAS_SECRET_KEY
@@ -150,29 +146,29 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass
150
146
151
147
#if defined(BOARD_HAS_SECRET_KEY)
152
148
String _password;
153
- #if defined(BOARD_ESP)
154
- WiFiClientSecure _sslClient;
155
- #elif defined(ARDUINO_EDGE_CONTROL)
156
- GSMSSLClient _sslClient;
157
- #endif
158
- #else
149
+ #endif
150
+
151
+ #if defined(BOARD_HAS_SECURE_ELEMENT)
159
152
SecureElement _crypto;
160
- #if defined(BOARD_HAS_OFFLOADED_ECCX08)
161
- WiFiBearSSLClient _sslClient;
162
- #else
163
- ECP256Certificate _cert;
164
- #if defined(BOARD_HAS_ECCX08)
153
+ #if !defined(BOARD_HAS_OFFLOADED_ECCX08)
154
+ ECP256Certificate _cert;
155
+ #endif
156
+ #endif
157
+
158
+ #if defined(BOARD_HAS_OFFLOADED_ECCX08)
159
+ WiFiSSLClient _sslClient;
160
+ #elif defined(BOARD_HAS_ECCX08)
165
161
BearSSLClient _sslClient;
166
- #elif defined(BOARD_HAS_SE050)
167
- #if defined(ARDUINO_PORTENTA_C33)
162
+ #elif defined(ARDUINO_PORTENTA_C33)
168
163
SSLClient _sslClient;
169
- # else
164
+ # elif defined(ARDUINO_NICLA_VISION)
170
165
WiFiSSLSE050Client _sslClient;
171
- #endif
172
- #elif defined(BOARD_HAS_SOFTSE)
166
+ #elif defined(ARDUINO_EDGE_CONTROL)
167
+ GSMSSLClient _sslClient;
168
+ #elif defined(ARDUINO_UNOR4_WIFI)
173
169
WiFiSSLClient _sslClient;
174
- # endif
175
- # endif
170
+ # elif defined(BOARD_ESP)
171
+ WiFiClientSecure _sslClient;
176
172
#endif
177
173
178
174
MqttClient _mqttClient;
0 commit comments