Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5332008

Browse files
committedJan 28, 2025·
WIP: uniform and reduce length of debug prints
1 parent eddc451 commit 5332008

5 files changed

+59
-59
lines changed
 

‎src/ArduinoIoTCloudDevice.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void ArduinoCloudDevice::handleMessage(Message *m) {
6565
case DeviceAttachedCmdId:
6666
_attached = true;
6767
_registered = true;
68-
DEBUG_VERBOSE("CloudDevice::%s Device is attached", __FUNCTION__);
68+
DEBUG_VERBOSE("Device::%s Device is attached", __FUNCTION__);
6969
nextState = State::Connected;
7070
break;
7171

@@ -115,7 +115,7 @@ ArduinoCloudDevice::State ArduinoCloudDevice::handleSendCapabilities() {
115115

116116
/* No device configuration received. Wait: 4s -> 8s -> 16s -> 32s -> 32s ...*/
117117
_attachAttempt.retry();
118-
DEBUG_VERBOSE("CloudDevice::%s not attached. %d next configuration request in %d ms",
118+
DEBUG_VERBOSE("Device::%s not attached. %d next configuration request in %d ms",
119119
__FUNCTION__, _attachAttempt.getRetryCount(), _attachAttempt.getWaitTime());
120120
return State::Connected;
121121
}

‎src/ArduinoIoTCloudLPWAN.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ ArduinoIoTCloudLPWAN::State ArduinoIoTCloudLPWAN::handle_ConnectPhy()
107107

108108
ArduinoIoTCloudLPWAN::State ArduinoIoTCloudLPWAN::handle_SyncTime()
109109
{
110-
DEBUG_VERBOSE("ArduinoIoTCloudLPWAN::%s internal clock configured to posix timestamp %lu", __FUNCTION__, _time_service.getTime());
110+
DEBUG_VERBOSE("LPWAN::%s internal clock configured to posix timestamp %lu", __FUNCTION__, _time_service.getTime());
111111
DEBUG_INFO("Connected to Arduino IoT Cloud");
112112
return State::Connected;
113113
}
@@ -116,7 +116,7 @@ ArduinoIoTCloudLPWAN::State ArduinoIoTCloudLPWAN::handle_Connected()
116116
{
117117
if (!connected())
118118
{
119-
DEBUG_ERROR("ArduinoIoTCloudLPWAN::%s connection to gateway lost", __FUNCTION__);
119+
DEBUG_ERROR("LPWAN::%s connection to gateway lost", __FUNCTION__);
120120
return State::ConnectPhy;
121121
}
122122

‎src/ArduinoIoTCloudNotecard.cpp

+22-22
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#if defined(HAS_NOTECARD)
1818

19-
#include "ArduinoIoTCloudNotecard.h"
19+
#include "Notecard.h"
2020

2121
#include <algorithm>
2222
#include <functional>
@@ -89,7 +89,7 @@ int ArduinoIoTCloudNotecard::begin(ConnectionHandler &connection_, int interrupt
8989

9090
// Initialize the connection to the Notecard
9191
if (NetworkConnectionState::ERROR == _connection->check()) {
92-
DEBUG_ERROR("ArduinoIoTCloudNotecard::%s encountered fatal connection error!", __FUNCTION__);
92+
DEBUG_ERROR("Notecard::%s encountered fatal connection error!", __FUNCTION__);
9393
return 0; // (false -> failure)
9494
}
9595

@@ -163,11 +163,11 @@ ArduinoIoTCloudNotecard::State ArduinoIoTCloudNotecard::handle_SyncTime()
163163
const uint32_t current_time = ArduinoCloud.getInternalTime();
164164
if (TimeServiceClass::isTimeValid(current_time))
165165
{
166-
DEBUG_VERBOSE("ArduinoIoTCloudNotecard::%s [%d] internal clock configured to posix timestamp %d", __FUNCTION__, millis(), current_time);
166+
DEBUG_VERBOSE("Notecard::%s [%d] internal clock configured to posix timestamp %d", __FUNCTION__, millis(), current_time);
167167
return State::Connected;
168168
}
169169

170-
DEBUG_ERROR("ArduinoIoTCloudNotecard::%s could not get valid time. Retrying now.", __FUNCTION__);
170+
DEBUG_ERROR("Notecard::%s could not get valid time. Retrying now.", __FUNCTION__);
171171
return State::ConnectPhy;
172172
}
173173

@@ -206,7 +206,7 @@ ArduinoIoTCloudNotecard::State ArduinoIoTCloudNotecard::handle_Connected()
206206
ArduinoIoTCloudNotecard::State ArduinoIoTCloudNotecard::handle_Disconnect()
207207
{
208208
if (!connected()) {
209-
DEBUG_ERROR("ArduinoIoTCloudNotecard::%s connection to Notehub lost", __FUNCTION__);
209+
DEBUG_ERROR("Notecard::%s connection to Notehub lost", __FUNCTION__);
210210
}
211211

212212
// Reset the Thing and Device property containers
@@ -285,9 +285,9 @@ void ArduinoIoTCloudNotecard::fetchIncomingBytes(uint8_t *buf, size_t &len)
285285
buf[bytes_received] = _connection->read();
286286
}
287287
if (bytes_received == len && _connection->available()) {
288-
DEBUG_ERROR("ArduinoIoTCloudNotecard::%s buffer overflow on inbound message", __FUNCTION__);
288+
DEBUG_ERROR("Notecard::%s buffer overflow on inbound message", __FUNCTION__);
289289
} else {
290-
DEBUG_DEBUG("ArduinoIoTCloudNotecard::%s received %d bytes from cloud", __FUNCTION__, bytes_received);
290+
DEBUG_DEBUG("Notecard::%s received %d bytes from cloud", __FUNCTION__, bytes_received);
291291
len = bytes_received;
292292
}
293293
}
@@ -306,20 +306,20 @@ void ArduinoIoTCloudNotecard::pollNotecard(void)
306306
void ArduinoIoTCloudNotecard::processCommand(const uint8_t *buf, size_t len)
307307
{
308308
CommandDown command;
309-
DEBUG_VERBOSE("ArduinoIoTCloudNotecard::%s [%d] received %d bytes", __FUNCTION__, millis(), len);
309+
DEBUG_VERBOSE("Notecard::%s [%d] received %d bytes", __FUNCTION__, millis(), len);
310310
CBORMessageDecoder decoder;
311311

312312
if (decoder.decode((Message*)&command, buf, len) != Decoder::Status::Error) {
313-
DEBUG_VERBOSE("ArduinoIoTCloudNotecard::%s [%d] received command id %d", __FUNCTION__, millis(), command.c.id);
313+
DEBUG_VERBOSE("Notecard::%s [%d] received command id %d", __FUNCTION__, millis(), command.c.id);
314314
switch (command.c.id)
315315
{
316316
case CommandId::ThingUpdateCmdId:
317317
{
318-
DEBUG_VERBOSE("ArduinoIoTCloudNotecard::%s [%d] device configuration received", __FUNCTION__, millis());
318+
DEBUG_VERBOSE("Notecard::%s [%d] device configuration received", __FUNCTION__, millis());
319319
String new_thing_id = String(command.thingUpdateCmd.params.thing_id);
320320

321321
if (!new_thing_id.length()) {
322-
DEBUG_DEBUG("ArduinoIoTCloudNotecard::%s received null Thing ID.", __FUNCTION__);
322+
DEBUG_DEBUG("Notecard::%s received null Thing ID.", __FUNCTION__);
323323
_thing_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
324324

325325
// Send message to device state machine to inform we have received a null thing-id
@@ -328,11 +328,11 @@ void ArduinoIoTCloudNotecard::processCommand(const uint8_t *buf, size_t len)
328328
_device.handleMessage(&message);
329329
} else {
330330
if (_device.isAttached() && _thing_id != new_thing_id) {
331-
DEBUG_DEBUG("ArduinoIoTCloudNotecard::%s detaching Thing ID: %s", __FUNCTION__, _thing_id.c_str());
331+
DEBUG_DEBUG("Notecard::%s detaching Thing ID: %s", __FUNCTION__, _thing_id.c_str());
332332
detachThing();
333333
}
334334
if (!_device.isAttached()) {
335-
DEBUG_DEBUG("ArduinoIoTCloudNotecard::%s attaching Thing ID: %s", __FUNCTION__, new_thing_id.c_str());
335+
DEBUG_DEBUG("Notecard::%s attaching Thing ID: %s", __FUNCTION__, new_thing_id.c_str());
336336
attachThing(new_thing_id);
337337
}
338338
}
@@ -342,24 +342,24 @@ void ArduinoIoTCloudNotecard::processCommand(const uint8_t *buf, size_t len)
342342
case CommandId::ThingDetachCmdId:
343343
{
344344
if (!_device.isAttached() || _thing_id != String(command.thingDetachCmd.params.thing_id)) {
345-
DEBUG_VERBOSE("ArduinoIoTCloudNotecard::%s [%d] thing detach rejected", __FUNCTION__, millis());
345+
DEBUG_VERBOSE("Notecard::%s [%d] thing detach rejected", __FUNCTION__, millis());
346346
}
347347

348-
DEBUG_VERBOSE("ArduinoIoTCloudNotecard::%s [%d] thing detach received", __FUNCTION__, millis());
348+
DEBUG_VERBOSE("Notecard::%s [%d] thing detach received", __FUNCTION__, millis());
349349
detachThing();
350350
}
351351
break;
352352

353353
case CommandId::TimezoneCommandDownId:
354354
{
355-
DEBUG_VERBOSE("ArduinoIoTCloudNotecard::%s [%d] timezone update received", __FUNCTION__, millis());
355+
DEBUG_VERBOSE("Notecard::%s [%d] timezone update received", __FUNCTION__, millis());
356356
_thing.handleMessage((Message*)&command);
357357
}
358358
break;
359359

360360
case CommandId::LastValuesUpdateCmdId:
361361
{
362-
DEBUG_VERBOSE("ArduinoIoTCloudNotecard::%s [%d] last values received", __FUNCTION__, millis());
362+
DEBUG_VERBOSE("Notecard::%s [%d] last values received", __FUNCTION__, millis());
363363
CBORDecoder::decode(_thing.getPropertyContainer(),
364364
(uint8_t*)command.lastValuesUpdateCmd.params.last_values,
365365
command.lastValuesUpdateCmd.params.length, true);
@@ -379,7 +379,7 @@ void ArduinoIoTCloudNotecard::processCommand(const uint8_t *buf, size_t len)
379379
#if OTA_ENABLED
380380
case CommandId::OtaUpdateCmdDownId:
381381
{
382-
DEBUG_VERBOSE("ArduinoIoTCloudNotecard::%s [%d] ota update received", __FUNCTION__, millis());
382+
DEBUG_VERBOSE("Notecard::%s [%d] ota update received", __FUNCTION__, millis());
383383
_ota.handleMessage((Message*)&command);
384384
}
385385
#endif
@@ -392,7 +392,7 @@ void ArduinoIoTCloudNotecard::processCommand(const uint8_t *buf, size_t len)
392392

393393
void ArduinoIoTCloudNotecard::processMessage(const uint8_t *buf, size_t len)
394394
{
395-
DEBUG_VERBOSE("ArduinoIoTCloudNotecard::%s [%d] decoding %d bytes from cloud...", __FUNCTION__, millis(), len);
395+
DEBUG_VERBOSE("Notecard::%s [%d] decoding %d bytes from cloud...", __FUNCTION__, millis(), len);
396396
NotecardConnectionHandler *notecard_connection = reinterpret_cast<NotecardConnectionHandler *>(_connection);
397397
switch (notecard_connection->getTopicType()) {
398398
// Commands
@@ -433,15 +433,15 @@ void ArduinoIoTCloudNotecard::sendCommandMsgToCloud(Message * msg_)
433433
if (CBOR_LORA_PAYLOAD_MAX_SIZE < bytes_encoded) {
434434
DEBUG_WARNING("Encoded %d bytes for Command Message. Exceeds maximum payload size of %d bytes, and cannot be sent to cloud.", bytes_encoded, CBOR_LORA_PAYLOAD_MAX_SIZE);
435435
} else if (bytes_encoded > 0) {
436-
DEBUG_DEBUG("ArduinoIoTCloudNotecard::%s encoded %d bytes for Command Message", __FUNCTION__, bytes_encoded);
436+
DEBUG_DEBUG("Notecard::%s encoded %d bytes for Command Message", __FUNCTION__, bytes_encoded);
437437
notecard_connection->setTopicType(NotecardConnectionHandler::TopicType::Command);
438438
if (notecard_connection->write(data, bytes_encoded)) {
439439
DEBUG_ERROR("Failed to send Command Message to cloud");
440440
} else {
441441
notecard_connection->initiateNotehubSync(NotecardConnectionHandler::SyncType::Inbound);
442442
}
443443
} else {
444-
DEBUG_DEBUG("ArduinoIoTCloudNotecard::%s encoded zero (0) bytes for Command Message", __FUNCTION__);
444+
DEBUG_DEBUG("Notecard::%s encoded zero (0) bytes for Command Message", __FUNCTION__);
445445
}
446446
} else {
447447
DEBUG_ERROR("Failed to encode Command Message");
@@ -461,7 +461,7 @@ void ArduinoIoTCloudNotecard::sendThingPropertyContainerToCloud()
461461
} else if (bytes_encoded < 0) {
462462
DEBUG_ERROR("Encoding Thing properties resulted in error: %d.", bytes_encoded);
463463
} else if (bytes_encoded > 0) {
464-
DEBUG_DEBUG("ArduinoIoTCloudNotecard::%s encoded %d bytes of Thing properties", __FUNCTION__, bytes_encoded);
464+
DEBUG_DEBUG("Notecard::%s encoded %d bytes of Thing properties", __FUNCTION__, bytes_encoded);
465465
notecard_connection->setTopicType(NotecardConnectionHandler::TopicType::Thing);
466466
if (notecard_connection->write(data, bytes_encoded)) {
467467
DEBUG_ERROR("Failed to sync Thing properties with cloud");

‎src/ArduinoIoTCloudTCP.cpp

+31-31
Original file line numberDiff line numberDiff line change
@@ -106,24 +106,24 @@ int ArduinoIoTCloudTCP::begin(ConnectionHandler & connection, bool const enable_
106106
#if defined(BOARD_HAS_SECURE_ELEMENT)
107107
if (!_selement.begin())
108108
{
109-
DEBUG_ERROR("ArduinoIoTCloudTCP::%s could not initialize secure element.", __FUNCTION__);
109+
DEBUG_ERROR("TCP::%s could not initialize secure element.", __FUNCTION__);
110110
#if defined(ARDUINO_UNOWIFIR4)
111111
if (String(WiFi.firmwareVersion()) < String("0.4.1")) {
112-
DEBUG_ERROR("ArduinoIoTCloudTCP::%s In order to read device certificate, WiFi firmware needs to be >= 0.4.1, current %s", __FUNCTION__, WiFi.firmwareVersion());
112+
DEBUG_ERROR("TCP::%s In order to read device certificate, WiFi firmware needs to be >= 0.4.1, current %s", __FUNCTION__, WiFi.firmwareVersion());
113113
}
114114
#endif
115115
return 0;
116116
}
117117
if (!SElementArduinoCloudDeviceId::read(_selement, getDeviceId(), SElementArduinoCloudSlot::DeviceId))
118118
{
119-
DEBUG_ERROR("ArduinoIoTCloudTCP::%s could not read device id.", __FUNCTION__);
119+
DEBUG_ERROR("TCP::%s could not read device id.", __FUNCTION__);
120120
return 0;
121121
}
122122
if (!_writeCertOnConnect) {
123123
/* No update pending read certificate stored in secure element */
124124
if (!SElementArduinoCloudCertificate::read(_selement, _cert, SElementArduinoCloudSlot::CompressedCertificate))
125125
{
126-
DEBUG_ERROR("ArduinoIoTCloudTCP::%s could not read device certificate.", __FUNCTION__);
126+
DEBUG_ERROR("TCP::%s could not read device certificate.", __FUNCTION__);
127127
return 0;
128128
}
129129
}
@@ -184,14 +184,14 @@ int ArduinoIoTCloudTCP::begin(bool const enable_watchdog, String brokerAddress,
184184

185185
#ifdef BOARD_HAS_OFFLOADED_ECCX08
186186
if (String(WiFi.firmwareVersion()) < String("1.4.4")) {
187-
DEBUG_ERROR("ArduinoIoTCloudTCP::%s In order to connect to Arduino IoT Cloud, NINA firmware needs to be >= 1.4.4, current %s", __FUNCTION__, WiFi.firmwareVersion());
187+
DEBUG_ERROR("TCP::%s In order to connect to Arduino IoT Cloud, NINA firmware needs to be >= 1.4.4, current %s", __FUNCTION__, WiFi.firmwareVersion());
188188
return 0;
189189
}
190190
#endif /* BOARD_HAS_OFFLOADED_ECCX08 */
191191

192192
#if defined(ARDUINO_UNOWIFIR4)
193193
if (String(WiFi.firmwareVersion()) < String("0.2.0")) {
194-
DEBUG_ERROR("ArduinoIoTCloudTCP::%s In order to connect to Arduino IoT Cloud, WiFi firmware needs to be >= 0.2.0, current %s", __FUNCTION__, WiFi.firmwareVersion());
194+
DEBUG_ERROR("TCP::%s In order to connect to Arduino IoT Cloud, WiFi firmware needs to be >= 0.2.0, current %s", __FUNCTION__, WiFi.firmwareVersion());
195195
}
196196
#endif
197197

@@ -274,11 +274,11 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SyncTime()
274274
/* If available force network time sync when connecting or reconnecting */
275275
if (_time_service.sync())
276276
{
277-
DEBUG_VERBOSE("ArduinoIoTCloudTCP::%s internal clock configured to posix timestamp %d", __FUNCTION__, getTime());
277+
DEBUG_VERBOSE("TCP::%s internal clock configured to posix timestamp %d", __FUNCTION__, getTime());
278278
return State::ConnectMqttBroker;
279279
}
280280

281-
DEBUG_ERROR("ArduinoIoTCloudTCP::%s could not get valid time. Retrying now.", __FUNCTION__);
281+
DEBUG_ERROR("TCP::%s could not get valid time. Retrying now.", __FUNCTION__);
282282
return State::ConnectPhy;
283283
}
284284

@@ -295,24 +295,24 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_ConnectMqttBroker()
295295
{
296296
if (SElementArduinoCloudCertificate::write(_selement, _cert, SElementArduinoCloudSlot::CompressedCertificate))
297297
{
298-
DEBUG_INFO("ArduinoIoTCloudTCP::%s device certificate update done.", __FUNCTION__);
298+
DEBUG_INFO("TCP::%s device certificate update done.", __FUNCTION__);
299299
_writeCertOnConnect = false;
300300
}
301301
}
302302
#endif
303-
DEBUG_VERBOSE("ArduinoIoTCloudTCP::%s connected to %s:%d", __FUNCTION__, _brokerAddress.c_str(), _brokerPort);
303+
DEBUG_VERBOSE("TCP::%s connected to %s:%d", __FUNCTION__, _brokerAddress.c_str(), _brokerPort);
304304
return State::Connected;
305305
}
306306

307307
/* Can't connect to the broker. Wait: 2s -> 4s -> 8s -> 16s -> 32s -> 32s ... */
308308
_connection_attempt.retry();
309309

310310
#if defined (BOARD_STM32H7) && defined(BOARD_HAS_ECCX08)
311-
DEBUG_ERROR("ArduinoIoTCloudTCP::%s could not connect to %s:%d Mqtt error: %d TLS error: %d", __FUNCTION__, _brokerAddress.c_str(), _brokerPort, _mqttClient.connectError(), _brokerClient.errorCode());
311+
DEBUG_ERROR("TCP::%s could not connect to %s:%d Mqtt error: %d TLS error: %d", __FUNCTION__, _brokerAddress.c_str(), _brokerPort, _mqttClient.connectError(), _brokerClient.errorCode());
312312
#else
313-
DEBUG_ERROR("ArduinoIoTCloudTCP::%s could not connect to %s:%d Error: %d", __FUNCTION__, _brokerAddress.c_str(), _brokerPort, _mqttClient.connectError());
313+
DEBUG_ERROR("TCP::%s could not connect to %s:%d Error: %d", __FUNCTION__, _brokerAddress.c_str(), _brokerPort, _mqttClient.connectError());
314314
#endif
315-
DEBUG_VERBOSE("ArduinoIoTCloudTCP::%s %d next connection attempt in %d ms", __FUNCTION__, _connection_attempt.getRetryCount(), _connection_attempt.getWaitTime());
315+
DEBUG_VERBOSE("TCP::%s %d next connection attempt in %d ms", __FUNCTION__, _connection_attempt.getRetryCount(), _connection_attempt.getWaitTime());
316316
/* Go back to ConnectPhy and retry to get time from network (invalid time for SSL handshake?)*/
317317
return State::ConnectPhy;
318318
}
@@ -360,7 +360,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_Connected()
360360
ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_Disconnect()
361361
{
362362
if (!_mqttClient.connected()) {
363-
DEBUG_ERROR("ArduinoIoTCloudTCP::%s MQTT client connection lost", __FUNCTION__);
363+
DEBUG_ERROR("TCP::%s MQTT client connection lost", __FUNCTION__);
364364
} else {
365365
/* No need to manually unsubscribe because we are using clean sessions */
366366
_mqttClient.stop();
@@ -401,17 +401,17 @@ void ArduinoIoTCloudTCP::handleMessage(int length)
401401
/* Topic for device commands */
402402
if (_messageTopicIn == topic) {
403403
CommandDown command;
404-
DEBUG_VERBOSE("ArduinoIoTCloudTCP::%s [%d] received %d bytes", __FUNCTION__, millis(), length);
404+
DEBUG_VERBOSE("TCP::%s [%d] received %d bytes", __FUNCTION__, millis(), length);
405405
CBORMessageDecoder decoder;
406406

407407
size_t buffer_length = length;
408408
if (decoder.decode((Message*)&command, bytes, buffer_length) != Decoder::Status::Error) {
409-
DEBUG_VERBOSE("ArduinoIoTCloudTCP::%s [%d] received command id %d", __FUNCTION__, millis(), command.c.id);
409+
DEBUG_VERBOSE("TCP::%s [%d] received command id %d", __FUNCTION__, millis(), command.c.id);
410410
switch (command.c.id)
411411
{
412412
case CommandId::ThingUpdateCmdId:
413413
{
414-
DEBUG_VERBOSE("ArduinoIoTCloudTCP::%s [%d] device configuration received", __FUNCTION__, millis());
414+
DEBUG_VERBOSE("TCP::%s [%d] device configuration received", __FUNCTION__, millis());
415415
String new_thing_id = String(command.thingUpdateCmd.params.thing_id);
416416

417417
if (!new_thing_id.length()) {
@@ -434,24 +434,24 @@ void ArduinoIoTCloudTCP::handleMessage(int length)
434434
case CommandId::ThingDetachCmdId:
435435
{
436436
if (!_device.isAttached() || _thing_id != String(command.thingDetachCmd.params.thing_id)) {
437-
DEBUG_VERBOSE("ArduinoIoTCloudTCP::%s [%d] thing detach rejected", __FUNCTION__, millis());
437+
DEBUG_VERBOSE("TCP::%s [%d] thing detach rejected", __FUNCTION__, millis());
438438
}
439439

440-
DEBUG_VERBOSE("ArduinoIoTCloudTCP::%s [%d] thing detach received", __FUNCTION__, millis());
440+
DEBUG_VERBOSE("TCP::%s [%d] thing detach received", __FUNCTION__, millis());
441441
detachThing();
442442
}
443443
break;
444444

445445
case CommandId::TimezoneCommandDownId:
446446
{
447-
DEBUG_VERBOSE("ArduinoIoTCloudTCP::%s [%d] timezone update received", __FUNCTION__, millis());
447+
DEBUG_VERBOSE("TCP::%s [%d] timezone update received", __FUNCTION__, millis());
448448
_thing.handleMessage((Message*)&command);
449449
}
450450
break;
451451

452452
case CommandId::LastValuesUpdateCmdId:
453453
{
454-
DEBUG_VERBOSE("ArduinoIoTCloudTCP::%s [%d] last values received", __FUNCTION__, millis());
454+
DEBUG_VERBOSE("TCP::%s [%d] last values received", __FUNCTION__, millis());
455455
CBORDecoder::decode(_thing.getPropertyContainer(),
456456
(uint8_t*)command.lastValuesUpdateCmd.params.last_values,
457457
command.lastValuesUpdateCmd.params.length, true);
@@ -470,7 +470,7 @@ void ArduinoIoTCloudTCP::handleMessage(int length)
470470
#if OTA_ENABLED
471471
case CommandId::OtaUpdateCmdDownId:
472472
{
473-
DEBUG_VERBOSE("ArduinoIoTCloudTCP::%s [%d] ota update received", __FUNCTION__, millis());
473+
DEBUG_VERBOSE("TCP::%s [%d] ota update received", __FUNCTION__, millis());
474474
_ota.handleMessage((Message*)&command);
475475
}
476476
#endif
@@ -534,7 +534,7 @@ void ArduinoIoTCloudTCP::attachThing(String thingId)
534534
_dataTopicIn = getTopic_datain();
535535
_dataTopicOut = getTopic_dataout();
536536
if (!_mqttClient.subscribe(_dataTopicIn)) {
537-
DEBUG_ERROR("ArduinoIoTCloudTCP::%s could not subscribe to %s", __FUNCTION__, _dataTopicIn.c_str());
537+
DEBUG_ERROR("TCP::%s could not subscribe to %s", __FUNCTION__, _dataTopicIn.c_str());
538538
DEBUG_ERROR("Check your thing configuration, and press the reset button on your board.");
539539
_thing_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
540540
return;
@@ -552,7 +552,7 @@ void ArduinoIoTCloudTCP::attachThing(String thingId)
552552
void ArduinoIoTCloudTCP::detachThing()
553553
{
554554
if (!_mqttClient.unsubscribe(_dataTopicIn)) {
555-
DEBUG_ERROR("ArduinoIoTCloudTCP::%s could not unsubscribe from %s", __FUNCTION__, _dataTopicIn.c_str());
555+
DEBUG_ERROR("TCP::%s could not unsubscribe from %s", __FUNCTION__, _dataTopicIn.c_str());
556556
return;
557557
}
558558

@@ -591,38 +591,38 @@ int ArduinoIoTCloudTCP::updateCertificate(String authorityKeyIdentifier, String
591591
{
592592
if (!_selement.begin())
593593
{
594-
DEBUG_ERROR("ArduinoIoTCloudTCP::%s could not initialize secure element.", __FUNCTION__);
594+
DEBUG_ERROR("TCP::%s could not initialize secure element.", __FUNCTION__);
595595
#if defined(ARDUINO_UNOWIFIR4)
596596
if (String(WiFi.firmwareVersion()) < String("0.4.1")) {
597-
DEBUG_ERROR("ArduinoIoTCloudTCP::%s In order to read device certificate, WiFi firmware needs to be >= 0.4.1, current %s", __FUNCTION__, WiFi.firmwareVersion());
597+
DEBUG_ERROR("TCP::%s In order to read device certificate, WiFi firmware needs to be >= 0.4.1, current %s", __FUNCTION__, WiFi.firmwareVersion());
598598
}
599599
#endif
600600
return 0;
601601
}
602602
if (!SElementArduinoCloudDeviceId::read(_selement, getDeviceId(), SElementArduinoCloudSlot::DeviceId))
603603
{
604-
DEBUG_ERROR("ArduinoIoTCloudTCP::%s could not read device id.", __FUNCTION__);
604+
DEBUG_ERROR("TCP::%s could not read device id.", __FUNCTION__);
605605
return 0;
606606
}
607607
/* read certificate stored in secure element to compare AUTHORITY_KEY_ID */
608608
if (!SElementArduinoCloudCertificate::read(_selement, _cert, SElementArduinoCloudSlot::CompressedCertificate))
609609
{
610-
DEBUG_ERROR("ArduinoIoTCloudTCP::%s could not read device certificate.", __FUNCTION__);
610+
DEBUG_ERROR("TCP::%s could not read device certificate.", __FUNCTION__);
611611
return 0;
612612
}
613613
/* check if we need to update 0 = equal <0 = error skip rebuild */
614614
if(SElementArduinoCloudCertificate::signatureCompare(_cert.signatureBytes(), signature) <= 0) {
615-
DEBUG_INFO("ArduinoIoTCloudTCP::%s request skipped.", __FUNCTION__);
615+
DEBUG_INFO("TCP::%s request skipped.", __FUNCTION__);
616616
return 0;
617617
}
618618
/* rebuild device certificate */
619619
if (SElementArduinoCloudCertificate::rebuild(_selement, _cert, getDeviceId(), notBefore, notAfter, serialNumber, authorityKeyIdentifier, signature))
620620
{
621-
DEBUG_INFO("ArduinoIoTCloudTCP::%s request started.", __FUNCTION__);
621+
DEBUG_INFO("TCP::%s request started.", __FUNCTION__);
622622
#if defined(BOARD_HAS_OFFLOADED_ECCX08)
623623
if (SElementArduinoCloudCertificate::write(_selement, _cert, SElementArduinoCloudSlot::CompressedCertificate))
624624
{
625-
DEBUG_INFO("ArduinoIoTCloudTCP::%s update done.", __FUNCTION__);
625+
DEBUG_INFO("TCP::%s update done.", __FUNCTION__);
626626
}
627627
#else
628628
_writeCertOnConnect = true;

‎src/ArduinoIoTCloudThing.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ void ArduinoCloudThing::handleMessage(Message* m) {
8989
switch (_command) {
9090
case LastValuesUpdateCmdId:
9191
if (_state == State::RequestLastValues) {
92-
DEBUG_VERBOSE("CloudThing::%s Thing is synced", __FUNCTION__);
92+
DEBUG_VERBOSE("Thing::%s Thing is synced", __FUNCTION__);
9393
nextState = State::Connected;
9494
}
9595
break;
@@ -136,7 +136,7 @@ ArduinoCloudThing::State ArduinoCloudThing::handleRequestLastValues() {
136136
/* Send message upstream to inform infrastructure we need to request thing
137137
* last values
138138
*/
139-
DEBUG_VERBOSE("CloudThing::%s not int sync. %d next sync request in %d ms",
139+
DEBUG_VERBOSE("Thing::%s not int sync. %d next sync request in %d ms",
140140
__FUNCTION__, _syncAttempt.getRetryCount(), _syncAttempt.getWaitTime());
141141
Message message = { LastValuesBeginCmdId };
142142
deliver(&message);

0 commit comments

Comments
 (0)
Please sign in to comment.