@@ -89,7 +89,7 @@ int ArduinoIoTCloudNotecard::begin(ConnectionHandler &connection_, int interrupt
89
89
90
90
// Initialize the connection to the Notecard
91
91
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__);
93
93
return 0 ; // (false -> failure)
94
94
}
95
95
@@ -163,11 +163,11 @@ ArduinoIoTCloudNotecard::State ArduinoIoTCloudNotecard::handle_SyncTime()
163
163
const uint32_t current_time = ArduinoCloud.getInternalTime ();
164
164
if (TimeServiceClass::isTimeValid (current_time))
165
165
{
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);
167
167
return State::Connected;
168
168
}
169
169
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__);
171
171
return State::ConnectPhy;
172
172
}
173
173
@@ -206,7 +206,7 @@ ArduinoIoTCloudNotecard::State ArduinoIoTCloudNotecard::handle_Connected()
206
206
ArduinoIoTCloudNotecard::State ArduinoIoTCloudNotecard::handle_Disconnect ()
207
207
{
208
208
if (!connected ()) {
209
- DEBUG_ERROR (" ArduinoIoTCloudNotecard ::%s connection to Notehub lost" , __FUNCTION__);
209
+ DEBUG_ERROR (" Notecard ::%s connection to Notehub lost" , __FUNCTION__);
210
210
}
211
211
212
212
// Reset the Thing and Device property containers
@@ -285,9 +285,9 @@ void ArduinoIoTCloudNotecard::fetchIncomingBytes(uint8_t *buf, size_t &len)
285
285
buf[bytes_received] = _connection->read ();
286
286
}
287
287
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__);
289
289
} 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);
291
291
len = bytes_received;
292
292
}
293
293
}
@@ -306,20 +306,20 @@ void ArduinoIoTCloudNotecard::pollNotecard(void)
306
306
void ArduinoIoTCloudNotecard::processCommand (const uint8_t *buf, size_t len)
307
307
{
308
308
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);
310
310
CBORMessageDecoder decoder;
311
311
312
312
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 );
314
314
switch (command.c .id )
315
315
{
316
316
case CommandId::ThingUpdateCmdId:
317
317
{
318
- DEBUG_VERBOSE (" ArduinoIoTCloudNotecard ::%s [%d] device configuration received" , __FUNCTION__, millis ());
318
+ DEBUG_VERBOSE (" Notecard ::%s [%d] device configuration received" , __FUNCTION__, millis ());
319
319
String new_thing_id = String (command.thingUpdateCmd .params .thing_id );
320
320
321
321
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__);
323
323
_thing_id = " xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" ;
324
324
325
325
// 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)
328
328
_device.handleMessage (&message);
329
329
} else {
330
330
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 ());
332
332
detachThing ();
333
333
}
334
334
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 ());
336
336
attachThing (new_thing_id);
337
337
}
338
338
}
@@ -342,24 +342,24 @@ void ArduinoIoTCloudNotecard::processCommand(const uint8_t *buf, size_t len)
342
342
case CommandId::ThingDetachCmdId:
343
343
{
344
344
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 ());
346
346
}
347
347
348
- DEBUG_VERBOSE (" ArduinoIoTCloudNotecard ::%s [%d] thing detach received" , __FUNCTION__, millis ());
348
+ DEBUG_VERBOSE (" Notecard ::%s [%d] thing detach received" , __FUNCTION__, millis ());
349
349
detachThing ();
350
350
}
351
351
break ;
352
352
353
353
case CommandId::TimezoneCommandDownId:
354
354
{
355
- DEBUG_VERBOSE (" ArduinoIoTCloudNotecard ::%s [%d] timezone update received" , __FUNCTION__, millis ());
355
+ DEBUG_VERBOSE (" Notecard ::%s [%d] timezone update received" , __FUNCTION__, millis ());
356
356
_thing.handleMessage ((Message*)&command);
357
357
}
358
358
break ;
359
359
360
360
case CommandId::LastValuesUpdateCmdId:
361
361
{
362
- DEBUG_VERBOSE (" ArduinoIoTCloudNotecard ::%s [%d] last values received" , __FUNCTION__, millis ());
362
+ DEBUG_VERBOSE (" Notecard ::%s [%d] last values received" , __FUNCTION__, millis ());
363
363
CBORDecoder::decode (_thing.getPropertyContainer (),
364
364
(uint8_t *)command.lastValuesUpdateCmd .params .last_values ,
365
365
command.lastValuesUpdateCmd .params .length , true );
@@ -379,7 +379,7 @@ void ArduinoIoTCloudNotecard::processCommand(const uint8_t *buf, size_t len)
379
379
#if OTA_ENABLED
380
380
case CommandId::OtaUpdateCmdDownId:
381
381
{
382
- DEBUG_VERBOSE (" ArduinoIoTCloudNotecard ::%s [%d] ota update received" , __FUNCTION__, millis ());
382
+ DEBUG_VERBOSE (" Notecard ::%s [%d] ota update received" , __FUNCTION__, millis ());
383
383
_ota.handleMessage ((Message*)&command);
384
384
}
385
385
#endif
@@ -392,7 +392,7 @@ void ArduinoIoTCloudNotecard::processCommand(const uint8_t *buf, size_t len)
392
392
393
393
void ArduinoIoTCloudNotecard::processMessage (const uint8_t *buf, size_t len)
394
394
{
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);
396
396
NotecardConnectionHandler *notecard_connection = reinterpret_cast <NotecardConnectionHandler *>(_connection);
397
397
switch (notecard_connection->getTopicType ()) {
398
398
// Commands
@@ -433,15 +433,15 @@ void ArduinoIoTCloudNotecard::sendCommandMsgToCloud(Message * msg_)
433
433
if (CBOR_LORA_PAYLOAD_MAX_SIZE < bytes_encoded) {
434
434
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);
435
435
} 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);
437
437
notecard_connection->setTopicType (NotecardConnectionHandler::TopicType::Command);
438
438
if (notecard_connection->write (data, bytes_encoded)) {
439
439
DEBUG_ERROR (" Failed to send Command Message to cloud" );
440
440
} else {
441
441
notecard_connection->initiateNotehubSync (NotecardConnectionHandler::SyncType::Inbound);
442
442
}
443
443
} 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__);
445
445
}
446
446
} else {
447
447
DEBUG_ERROR (" Failed to encode Command Message" );
@@ -461,7 +461,7 @@ void ArduinoIoTCloudNotecard::sendThingPropertyContainerToCloud()
461
461
} else if (bytes_encoded < 0 ) {
462
462
DEBUG_ERROR (" Encoding Thing properties resulted in error: %d." , bytes_encoded);
463
463
} 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);
465
465
notecard_connection->setTopicType (NotecardConnectionHandler::TopicType::Thing);
466
466
if (notecard_connection->write (data, bytes_encoded)) {
467
467
DEBUG_ERROR (" Failed to sync Thing properties with cloud" );
0 commit comments