1818#include < ArduinoIoTCloud.h>
1919
2020#ifdef BOARD_HAS_ECCX08
21- #include " utility/ECCX08Cert.h"
22- #include < ArduinoECCX08.h>
21+ #include " utility/ECCX08Cert.h"
22+ #include < ArduinoECCX08.h>
2323#elif defined(BOARD_ESP)
24- #include " utility/Certificate.h"
24+ #include " utility/Certificate.h"
2525#endif
2626
2727#ifdef ARDUINO_ARCH_SAMD
3030#endif
3131
3232#ifdef BOARD_HAS_ECCX08
33- const static int keySlot = 0 ;
34- const static int compressedCertSlot = 10 ;
35- const static int serialNumberAndAuthorityKeyIdentifierSlot = 11 ;
36- const static int deviceIdSlot = 12 ;
33+ const static int keySlot = 0 ;
34+ const static int compressedCertSlot = 10 ;
35+ const static int serialNumberAndAuthorityKeyIdentifierSlot = 11 ;
36+ const static int deviceIdSlot = 12 ;
3737#endif
3838
3939const static int CONNECT_SUCCESS = 1 ;
@@ -61,9 +61,9 @@ ArduinoIoTCloudClass::ArduinoIoTCloudClass() :
6161 _connection(NULL ),
6262 _thing_id(" " ),
6363 _sslClient(NULL ),
64- #ifdef BOARD_ESP
64+ #ifdef BOARD_ESP
6565 _certificate (MQTTS_UP_ARDUINO_CC_CERTIFICATE),
66- #endif
66+ #endif
6767 _mqttClient (NULL ),
6868 _lastSyncRequestTickTime(0 ),
6969 _stdinTopic(" " ),
@@ -93,7 +93,7 @@ ArduinoIoTCloudClass::~ArduinoIoTCloudClass() {
9393
9494int ArduinoIoTCloudClass::begin (ConnectionHandler & connection,
9595 String device_id,
96- String password,
96+ String password,
9797 String brokerAddress,
9898 uint16_t brokerPort) {
9999 _connection = &connection;
@@ -119,7 +119,7 @@ int ArduinoIoTCloudClass::begin(Client& net, String brokerAddress, uint16_t brok
119119 _brokerAddress = brokerAddress;
120120 _brokerPort = brokerPort;
121121
122- #ifdef BOARD_HAS_ECCX08
122+ #ifdef BOARD_HAS_ECCX08
123123 byte deviceIdBytes[72 ];
124124 if (!ECCX08.begin ()) {
125125 Debug.print (DBG_ERROR, " Cryptography processor failure. Make sure you have a compatible board." );
@@ -149,30 +149,30 @@ int ArduinoIoTCloudClass::begin(Client& net, String brokerAddress, uint16_t brok
149149 }
150150
151151 ArduinoBearSSL.onGetTime (getTime);
152- #endif /* BOARD_HAS_ECCX08 */
152+ #endif /* BOARD_HAS_ECCX08 */
153153
154154 if (_sslClient) {
155155 delete _sslClient;
156156 _sslClient = NULL ;
157157 }
158158
159- #ifdef BOARD_HAS_ECCX08
159+ #ifdef BOARD_HAS_ECCX08
160160 if (_connection != NULL ) {
161161 _sslClient = new BearSSLClient (_connection->getClient ());
162162 } else {
163163 _sslClient = new BearSSLClient (*_net);
164164 }
165165 _sslClient->setEccSlot (keySlot, ECCX08Cert.bytes (), ECCX08Cert.length ());
166- #elif defined(BOARD_ESP)
166+ #elif defined(BOARD_ESP)
167167 _sslClient = new WiFiClientSecure ();
168168 _sslClient->setTrustAnchors (&_certificate);
169- #endif
169+ #endif
170170
171171 _mqttClient = new MqttClient (*_sslClient);
172172
173- #ifdef BOARD_ESP
173+ #ifdef BOARD_ESP
174174 _mqttClient->setUsernamePassword (_device_id, _password);
175- #endif
175+ #endif
176176
177177 mqttClientBegin ();
178178
@@ -203,7 +203,7 @@ void ArduinoIoTCloudClass::mqttClientBegin() {
203203}
204204
205205int ArduinoIoTCloudClass::connect () {
206-
206+
207207 if (!_mqttClient->connect (_brokerAddress.c_str (), _brokerPort)) {
208208 return CONNECT_FAILURE;
209209 }
0 commit comments