@@ -112,9 +112,9 @@ int ArduinoIoTCloudTCP::begin(String brokerAddress, uint16_t brokerPort)
112112#endif /* OTA_ENABLED */
113113
114114 #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 ; }
118118 _sslClient.setClient (_connection->getClient ());
119119 _sslClient.setEccSlot (static_cast <int >(ECCX08Slot::Key), _eccx08_cert.bytes (), _eccx08_cert.length ());
120120 #elif defined(BOARD_ESP)
@@ -145,7 +145,7 @@ int ArduinoIoTCloudTCP::begin(String brokerAddress, uint16_t brokerPort)
145145#if OTA_STORAGE_SNU
146146 String const nina_fw_version = WiFi.firmwareVersion ();
147147 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 ());
149149 return 0 ;
150150 }
151151#endif /* OTA_STORAGE_SNU */
@@ -180,10 +180,10 @@ int ArduinoIoTCloudTCP::connected()
180180
181181void ArduinoIoTCloudTCP::printDebugInfo ()
182182{
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);
187187}
188188
189189/* *****************************************************************************
@@ -201,7 +201,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_ConnectPhy()
201201ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SyncTime ()
202202{
203203 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);
205205 return State::ConnectMqttBroker;
206206}
207207
@@ -210,28 +210,28 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_ConnectMqttBroker()
210210 if (_mqttClient.connect (_brokerAddress.c_str (), _brokerPort))
211211 return State::SubscribeMqttTopics;
212212
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);
214214 return State::ConnectPhy;
215215}
216216
217217ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SubscribeMqttTopics ()
218218{
219219 if (!_mqttClient.subscribe (_dataTopicIn))
220220 {
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 ());
222222 return State::SubscribeMqttTopics;
223223 }
224224
225225 if (_shadowTopicIn != " " )
226226 {
227227 if (!_mqttClient.subscribe (_shadowTopicIn))
228228 {
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 ());
230230 return State::SubscribeMqttTopics;
231231 }
232232 }
233233
234- DBG_INFO (" Connected to Arduino IoT Cloud" );
234+ DBG_INFO (F ( " Connected to Arduino IoT Cloud" ) );
235235 execCloudEventCallback (ArduinoIoTCloudEvent::CONNECT);
236236
237237 if (_shadowTopicIn != " " )
@@ -246,7 +246,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_RequestLastValues()
246246 unsigned long const now = millis ();
247247 if ((now - _lastSyncRequestTickTime) > TIMEOUT_FOR_LASTVALUES_SYNC)
248248 {
249- DBG_VERBOSE (" ArduinoIoTCloudTCP::%s [%d] last values requested" , __FUNCTION__, now);
249+ DBG_VERBOSE (F ( " ArduinoIoTCloudTCP::%s [%d] last values requested" ) , __FUNCTION__, now);
250250 requestLastValue ();
251251 _lastSyncRequestTickTime = now;
252252 }
@@ -258,7 +258,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_Connected()
258258{
259259 if (!_mqttClient.connected ())
260260 {
261- DBG_ERROR (" ArduinoIoTCloudTCP::%s MQTT client connection lost" , __FUNCTION__);
261+ DBG_ERROR (F ( " ArduinoIoTCloudTCP::%s MQTT client connection lost" ) , __FUNCTION__);
262262
263263 /* Forcefully disconnect MQTT client and trigger a reconnection. */
264264 _mqttClient.stop ();
@@ -321,7 +321,7 @@ void ArduinoIoTCloudTCP::handleMessage(int length)
321321
322322 if ((_shadowTopicIn == topic) && (_state == State::RequestLastValues))
323323 {
324- DBG_VERBOSE (" ArduinoIoTCloudTCP::%s [%d] last values received" , __FUNCTION__, millis ());
324+ DBG_VERBOSE (F ( " ArduinoIoTCloudTCP::%s [%d] last values received" ) , __FUNCTION__, millis ());
325325 CBORDecoder::decode (_property_container, (uint8_t *)bytes, length, true );
326326 sendPropertiesToCloud ();
327327 execCloudEventCallback (ArduinoIoTCloudEvent::SYNC);
@@ -376,8 +376,8 @@ void ArduinoIoTCloudTCP::on_OTA_REQ_Update()
376376
377377void ArduinoIoTCloudTCP::onOTARequest ()
378378{
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 ());
381381
382382 if (_ota_req)
383383 {
@@ -398,7 +398,7 @@ void ArduinoIoTCloudTCP::onOTARequest()
398398 uint8_t nina_ota_err_code = 0 ;
399399 if (!WiFiStorage.downloadOTA (_ota_url.c_str (), &nina_ota_err_code))
400400 {
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);
402402 _ota_error = static_cast <int >(OTAError::DownloadFailed);
403403 return ;
404404 }
0 commit comments