@@ -112,9 +112,9 @@ int ArduinoIoTCloudTCP::begin(String brokerAddress, uint16_t brokerPort)
112
112
#endif /* OTA_ENABLED */
113
113
114
114
#ifdef BOARD_HAS_ECCX08
115
- if (!ECCX08.begin ()) { DBG_ERROR (" Cryptography processor failure. Make sure you have a compatible board." ); return 0 ; }
116
- if (!CryptoUtil::readDeviceId (ECCX08, getDeviceId (), ECCX08Slot::DeviceId)) { DBG_ERROR (" Cryptography processor read failure." ); return 0 ; }
117
- if (!CryptoUtil::reconstructCertificate (_eccx08_cert, getDeviceId (), ECCX08Slot::Key, ECCX08Slot::CompressedCertificate, ECCX08Slot::SerialNumberAndAuthorityKeyIdentifier)) { DBG_ERROR (" Cryptography certificate reconstruction failure." ); return 0 ; }
115
+ if (!ECCX08.begin ()) { DBG_ERROR (F ( " Cryptography processor failure. Make sure you have a compatible board." ) ); return 0 ; }
116
+ if (!CryptoUtil::readDeviceId (ECCX08, getDeviceId (), ECCX08Slot::DeviceId)) { DBG_ERROR (F ( " Cryptography processor read failure." ) ); return 0 ; }
117
+ if (!CryptoUtil::reconstructCertificate (_eccx08_cert, getDeviceId (), ECCX08Slot::Key, ECCX08Slot::CompressedCertificate, ECCX08Slot::SerialNumberAndAuthorityKeyIdentifier)) { DBG_ERROR (F ( " Cryptography certificate reconstruction failure." ) ); return 0 ; }
118
118
_sslClient.setClient (_connection->getClient ());
119
119
_sslClient.setEccSlot (static_cast <int >(ECCX08Slot::Key), _eccx08_cert.bytes (), _eccx08_cert.length ());
120
120
#elif defined(BOARD_ESP)
@@ -145,7 +145,7 @@ int ArduinoIoTCloudTCP::begin(String brokerAddress, uint16_t brokerPort)
145
145
#if OTA_STORAGE_SNU
146
146
String const nina_fw_version = WiFi.firmwareVersion ();
147
147
if (nina_fw_version < " 1.4.1" ) {
148
- DBG_ERROR (" ArduinoIoTCloudTCP::%s error nina firmware needs to be >= 1.4.1, current %s" , __FUNCTION__, nina_fw_version.c_str ());
148
+ DBG_ERROR (F ( " ArduinoIoTCloudTCP::%s error nina firmware needs to be >= 1.4.1, current %s" ) , __FUNCTION__, nina_fw_version.c_str ());
149
149
return 0 ;
150
150
}
151
151
#endif /* OTA_STORAGE_SNU */
@@ -180,10 +180,10 @@ int ArduinoIoTCloudTCP::connected()
180
180
181
181
void ArduinoIoTCloudTCP::printDebugInfo ()
182
182
{
183
- DBG_INFO (" ***** Arduino IoT Cloud - configuration info *****" );
184
- DBG_INFO (" Device ID: %s" , getDeviceId ().c_str ());
185
- DBG_INFO (" Thing ID: %s" , getThingId ().c_str ());
186
- DBG_INFO (" MQTT Broker: %s:%d" , _brokerAddress.c_str (), _brokerPort);
183
+ DBG_INFO (F ( " ***** Arduino IoT Cloud - configuration info *****" ) );
184
+ DBG_INFO (F ( " Device ID: %s" ) , getDeviceId ().c_str ());
185
+ DBG_INFO (F ( " Thing ID: %s" ) , getThingId ().c_str ());
186
+ DBG_INFO (F ( " MQTT Broker: %s:%d" ) , _brokerAddress.c_str (), _brokerPort);
187
187
}
188
188
189
189
/* *****************************************************************************
@@ -201,7 +201,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_ConnectPhy()
201
201
ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SyncTime ()
202
202
{
203
203
unsigned long const internal_posix_time = _time_service.getTime ();
204
- DBG_VERBOSE (" ArduinoIoTCloudTCP::%s internal clock configured to posix timestamp %d" , __FUNCTION__, internal_posix_time);
204
+ DBG_VERBOSE (F ( " ArduinoIoTCloudTCP::%s internal clock configured to posix timestamp %d" ) , __FUNCTION__, internal_posix_time);
205
205
return State::ConnectMqttBroker;
206
206
}
207
207
@@ -210,28 +210,28 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_ConnectMqttBroker()
210
210
if (_mqttClient.connect (_brokerAddress.c_str (), _brokerPort))
211
211
return State::SubscribeMqttTopics;
212
212
213
- DBG_ERROR (" ArduinoIoTCloudTCP::%s could not connect to %s:%d" , __FUNCTION__, _brokerAddress.c_str (), _brokerPort);
213
+ DBG_ERROR (F ( " ArduinoIoTCloudTCP::%s could not connect to %s:%d" ) , __FUNCTION__, _brokerAddress.c_str (), _brokerPort);
214
214
return State::ConnectPhy;
215
215
}
216
216
217
217
ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SubscribeMqttTopics ()
218
218
{
219
219
if (!_mqttClient.subscribe (_dataTopicIn))
220
220
{
221
- DBG_ERROR (" ArduinoIoTCloudTCP::%s could not subscribe to %s" , __FUNCTION__, _dataTopicIn.c_str ());
221
+ DBG_ERROR (F ( " ArduinoIoTCloudTCP::%s could not subscribe to %s" ) , __FUNCTION__, _dataTopicIn.c_str ());
222
222
return State::SubscribeMqttTopics;
223
223
}
224
224
225
225
if (_shadowTopicIn != " " )
226
226
{
227
227
if (!_mqttClient.subscribe (_shadowTopicIn))
228
228
{
229
- DBG_ERROR (" ArduinoIoTCloudTCP::%s could not subscribe to %s" , __FUNCTION__, _shadowTopicIn.c_str ());
229
+ DBG_ERROR (F ( " ArduinoIoTCloudTCP::%s could not subscribe to %s" ) , __FUNCTION__, _shadowTopicIn.c_str ());
230
230
return State::SubscribeMqttTopics;
231
231
}
232
232
}
233
233
234
- DBG_INFO (" Connected to Arduino IoT Cloud" );
234
+ DBG_INFO (F ( " Connected to Arduino IoT Cloud" ) );
235
235
execCloudEventCallback (ArduinoIoTCloudEvent::CONNECT);
236
236
237
237
if (_shadowTopicIn != " " )
@@ -246,7 +246,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_RequestLastValues()
246
246
unsigned long const now = millis ();
247
247
if ((now - _lastSyncRequestTickTime) > TIMEOUT_FOR_LASTVALUES_SYNC)
248
248
{
249
- DBG_VERBOSE (" ArduinoIoTCloudTCP::%s [%d] last values requested" , __FUNCTION__, now);
249
+ DBG_VERBOSE (F ( " ArduinoIoTCloudTCP::%s [%d] last values requested" ) , __FUNCTION__, now);
250
250
requestLastValue ();
251
251
_lastSyncRequestTickTime = now;
252
252
}
@@ -258,7 +258,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_Connected()
258
258
{
259
259
if (!_mqttClient.connected ())
260
260
{
261
- DBG_ERROR (" ArduinoIoTCloudTCP::%s MQTT client connection lost" , __FUNCTION__);
261
+ DBG_ERROR (F ( " ArduinoIoTCloudTCP::%s MQTT client connection lost" ) , __FUNCTION__);
262
262
263
263
/* Forcefully disconnect MQTT client and trigger a reconnection. */
264
264
_mqttClient.stop ();
@@ -321,7 +321,7 @@ void ArduinoIoTCloudTCP::handleMessage(int length)
321
321
322
322
if ((_shadowTopicIn == topic) && (_state == State::RequestLastValues))
323
323
{
324
- DBG_VERBOSE (" ArduinoIoTCloudTCP::%s [%d] last values received" , __FUNCTION__, millis ());
324
+ DBG_VERBOSE (F ( " ArduinoIoTCloudTCP::%s [%d] last values received" ) , __FUNCTION__, millis ());
325
325
CBORDecoder::decode (_property_container, (uint8_t *)bytes, length, true );
326
326
sendPropertiesToCloud ();
327
327
execCloudEventCallback (ArduinoIoTCloudEvent::SYNC);
@@ -376,8 +376,8 @@ void ArduinoIoTCloudTCP::on_OTA_REQ_Update()
376
376
377
377
void ArduinoIoTCloudTCP::onOTARequest ()
378
378
{
379
- DBG_VERBOSE (" ArduinoIoTCloudTCP::%s _ota_req = %s" , __FUNCTION__, _ota_req ? " true" : " false" );
380
- DBG_VERBOSE (" ArduinoIoTCloudTCP::%s _ota_url = %s" , __FUNCTION__, _ota_url.c_str ());
379
+ DBG_VERBOSE (F ( " ArduinoIoTCloudTCP::%s _ota_req = %s" ) , __FUNCTION__, _ota_req ? " true" : " false" );
380
+ DBG_VERBOSE (F ( " ArduinoIoTCloudTCP::%s _ota_url = %s" ) , __FUNCTION__, _ota_url.c_str ());
381
381
382
382
if (_ota_req)
383
383
{
@@ -398,7 +398,7 @@ void ArduinoIoTCloudTCP::onOTARequest()
398
398
uint8_t nina_ota_err_code = 0 ;
399
399
if (!WiFiStorage.downloadOTA (_ota_url.c_str (), &nina_ota_err_code))
400
400
{
401
- DBG_ERROR (" ArduinoIoTCloudTCP::%s error download to nina: %d" , __FUNCTION__, nina_ota_err_code);
401
+ DBG_ERROR (F ( " ArduinoIoTCloudTCP::%s error download to nina: %d" ) , __FUNCTION__, nina_ota_err_code);
402
402
_ota_error = static_cast <int >(OTAError::DownloadFailed);
403
403
return ;
404
404
}
0 commit comments