@@ -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
@@ -404,6 +405,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_ConnectMqttBroker()
404
405
if (_mqttClient.connect (_brokerAddress.c_str (), _brokerPort))
405
406
{
406
407
_last_connection_attempt_cnt = 0 ;
408
+ DEBUG_VERBOSE (" ArduinoIoTCloudTCP::%s connected to %s:%d" , __FUNCTION__, _brokerAddress.c_str (), _brokerPort);
407
409
return State::SendDeviceProperties;
408
410
}
409
411
@@ -424,6 +426,8 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SendDeviceProperties()
424
426
return State::Disconnect;
425
427
}
426
428
429
+ DEBUG_VERBOSE (" ArduinoIoTCloudTCP::%s" , __FUNCTION__);
430
+
427
431
#if OTA_ENABLED
428
432
sendOTAPropertiesToCloud ();
429
433
#endif
@@ -442,6 +446,8 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SubscribeDeviceTopic()
442
446
return State::SubscribeDeviceTopic;
443
447
}
444
448
449
+ DEBUG_VERBOSE (" ArduinoIoTCloudTCP::%s subscribed to %s" , __FUNCTION__, _deviceTopicIn.c_str ());
450
+
445
451
if (_last_device_subscribe_cnt > AIOT_CONFIG_LASTVALUES_SYNC_MAX_RETRY_CNT)
446
452
{
447
453
_last_device_subscribe_cnt = 0 ;
@@ -457,6 +463,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SubscribeDeviceTopic()
457
463
_next_device_subscribe_attempt_tick = millis () + subscribe_retry_delay;
458
464
_last_device_subscribe_cnt++;
459
465
466
+ DEBUG_VERBOSE (" ArduinoIoTCloudTCP::%s waiting device configuration from %s" , __FUNCTION__, _deviceTopicIn.c_str ());
460
467
return State::WaitDeviceConfig;
461
468
}
462
469
@@ -475,6 +482,8 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_WaitDeviceConfig()
475
482
if (millis () > _next_device_subscribe_attempt_tick)
476
483
{
477
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);
478
487
if (_mqttClient.unsubscribe (_deviceTopicIn))
479
488
{
480
489
return State::SubscribeDeviceTopic;
@@ -493,6 +502,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_CheckDeviceConfig()
493
502
if (_deviceSubscribedToThing == true )
494
503
{
495
504
/* Unsubscribe from old things topics and go on with a new subsctiption */
505
+ DEBUG_VERBOSE (" ArduinoIoTCloudTCP::%s Unsubscribing from old thing topics" , __FUNCTION__);
496
506
_mqttClient.unsubscribe (_shadowTopicIn);
497
507
_mqttClient.unsubscribe (_dataTopicIn);
498
508
_deviceSubscribedToThing = false ;
@@ -507,6 +517,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_CheckDeviceConfig()
507
517
attach_retry_delay = min (attach_retry_delay, static_cast <unsigned long >(AIOT_CONFIG_MAX_DEVICE_TOPIC_ATTACH_RETRY_DELAY_ms));
508
518
_next_device_subscribe_attempt_tick = millis () + attach_retry_delay;
509
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);
510
521
return State::WaitDeviceConfig;
511
522
}
512
523
@@ -518,6 +529,8 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_CheckDeviceConfig()
518
529
519
530
ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SubscribeThingTopics ()
520
531
{
532
+ DEBUG_VERBOSE (" ArduinoIoTCloudTCP::%s" , __FUNCTION__);
533
+
521
534
if (!_mqttClient.connected ())
522
535
{
523
536
return State::Disconnect;
@@ -688,6 +701,7 @@ void ArduinoIoTCloudTCP::handleMessage(int length)
688
701
/* Topic for OTA properties and device configuration */
689
702
if (_deviceTopicIn == topic) {
690
703
CBORDecoder::decode (_device_property_container, (uint8_t *)bytes, length);
704
+ DEBUG_VERBOSE (" ArduinoIoTCloudTCP::%s [%d] device configuration or OTA message received" , __FUNCTION__, millis ());
691
705
_last_device_subscribe_cnt = 0 ;
692
706
_next_device_subscribe_attempt_tick = 0 ;
693
707
}
0 commit comments