@@ -71,6 +71,7 @@ extern "C" void updateTimezoneInfo()
71
71
72
72
extern " C" void setThingIdOutdated ()
73
73
{
74
+ DEBUG_VERBOSE (" Set thing_id outdated flag" );
74
75
ArduinoCloud.setThingIdOutdatedFlag ();
75
76
}
76
77
@@ -425,6 +426,8 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SendDeviceProperties()
425
426
return State::Disconnect;
426
427
}
427
428
429
+ DEBUG_VERBOSE (" ArduinoIoTCloudTCP::%s" , __FUNCTION__);
430
+
428
431
#if OTA_ENABLED
429
432
sendOTAPropertiesToCloud ();
430
433
#endif
@@ -443,6 +446,8 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SubscribeDeviceTopic()
443
446
return State::SubscribeDeviceTopic;
444
447
}
445
448
449
+ DEBUG_VERBOSE (" ArduinoIoTCloudTCP::%s subscribed to %s" , __FUNCTION__, _deviceTopicIn.c_str ());
450
+
446
451
if (_last_device_subscribe_cnt > AIOT_CONFIG_LASTVALUES_SYNC_MAX_RETRY_CNT)
447
452
{
448
453
_last_device_subscribe_cnt = 0 ;
@@ -458,6 +463,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SubscribeDeviceTopic()
458
463
_next_device_subscribe_attempt_tick = millis () + subscribe_retry_delay;
459
464
_last_device_subscribe_cnt++;
460
465
466
+ DEBUG_VERBOSE (" ArduinoIoTCloudTCP::%s waiting device configuration from %s" , __FUNCTION__, _deviceTopicIn.c_str ());
461
467
return State::WaitDeviceConfig;
462
468
}
463
469
@@ -476,6 +482,8 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_WaitDeviceConfig()
476
482
if (millis () > _next_device_subscribe_attempt_tick)
477
483
{
478
484
/* Configuration not received or device not attached to a valid thing. Try to resubscribe */
485
+ DEBUG_VERBOSE (" ArduinoIoTCloudTCP::%s configuration not received or device not attached to a valid thing" , __FUNCTION__);
486
+ DEBUG_VERBOSE (" ArduinoIoTCloudTCP::%s new subscription attempt at tick time %d" , __FUNCTION__, _next_device_subscribe_attempt_tick);
479
487
if (_mqttClient.unsubscribe (_deviceTopicIn))
480
488
{
481
489
return State::SubscribeDeviceTopic;
@@ -494,6 +502,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_CheckDeviceConfig()
494
502
if (_deviceSubscribedToThing == true )
495
503
{
496
504
/* Unsubscribe from old things topics and go on with a new subsctiption */
505
+ DEBUG_VERBOSE (" ArduinoIoTCloudTCP::%s Unsubscribing from old thing topics" , __FUNCTION__);
497
506
_mqttClient.unsubscribe (_shadowTopicIn);
498
507
_mqttClient.unsubscribe (_dataTopicIn);
499
508
_deviceSubscribedToThing = false ;
@@ -508,6 +517,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_CheckDeviceConfig()
508
517
attach_retry_delay = min (attach_retry_delay, static_cast <unsigned long >(AIOT_CONFIG_MAX_DEVICE_TOPIC_ATTACH_RETRY_DELAY_ms));
509
518
_next_device_subscribe_attempt_tick = millis () + attach_retry_delay;
510
519
_last_device_attach_cnt++;
520
+ DEBUG_VERBOSE (" ArduinoIoTCloudTCP::%s Device not attached to a valid Thing. New Request delay: %d" , __FUNCTION__, attach_retry_delay);
511
521
return State::WaitDeviceConfig;
512
522
}
513
523
@@ -519,6 +529,8 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_CheckDeviceConfig()
519
529
520
530
ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SubscribeThingTopics ()
521
531
{
532
+ DEBUG_VERBOSE (" ArduinoIoTCloudTCP::%s" , __FUNCTION__);
533
+
522
534
if (!_mqttClient.connected ())
523
535
{
524
536
return State::Disconnect;
@@ -689,6 +701,7 @@ void ArduinoIoTCloudTCP::handleMessage(int length)
689
701
/* Topic for OTA properties and device configuration */
690
702
if (_deviceTopicIn == topic) {
691
703
CBORDecoder::decode (_device_property_container, (uint8_t *)bytes, length);
704
+ DEBUG_VERBOSE (" ArduinoIoTCloudTCP::%s [%d] device configuration or OTA message received" , __FUNCTION__, millis ());
692
705
_last_device_subscribe_cnt = 0 ;
693
706
_next_device_subscribe_attempt_tick = 0 ;
694
707
}
0 commit comments