@@ -58,11 +58,6 @@ void updateTimezoneInfo()
58
58
ArduinoCloud.updateInternalTimezoneInfo ();
59
59
}
60
60
61
- void setThingIdOutdated ()
62
- {
63
- ArduinoCloud.setThingIdOutdatedFlag ();
64
- }
65
-
66
61
/* *****************************************************************************
67
62
CTOR/DTOR
68
63
******************************************************************************/
@@ -218,7 +213,7 @@ int ArduinoIoTCloudTCP::begin(bool const enable_watchdog, String brokerAddress,
218
213
addPropertyToContainer (_device_property_container, *p, " OTA_REQ" , Permission::ReadWrite, -1 );
219
214
#endif /* OTA_ENABLED */
220
215
p = new CloudWrapperString (_thing_id);
221
- addPropertyToContainer (_device_property_container, *p, " thing_id" , Permission::ReadWrite, -1 ).onUpdate (setThingIdOutdated );
216
+ _thing_id_property = & addPropertyToContainer (_device_property_container, *p, " thing_id" , Permission::ReadWrite, -1 ).writeOnDemand ( );
222
217
223
218
addPropertyReal (_tz_offset, " tz_offset" , Permission::ReadWrite).onSync (CLOUD_WINS).onUpdate (updateTimezoneInfo);
224
219
addPropertyReal (_tz_dst_until, " tz_dst_until" , Permission::ReadWrite).onSync (CLOUD_WINS).onUpdate (updateTimezoneInfo);
@@ -409,7 +404,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_WaitDeviceConfig()
409
404
return State::Disconnect;
410
405
}
411
406
412
- if (getThingIdOutdatedFlag ())
407
+ if (_thing_id_property-> isDifferentFromCloud ())
413
408
{
414
409
return State::CheckDeviceConfig;
415
410
}
@@ -445,7 +440,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_CheckDeviceConfig()
445
440
446
441
updateThingTopics ();
447
442
448
- if (deviceNotAttached () )
443
+ if (_thing_id. length () == 0 )
449
444
{
450
445
/* Configuration received but device not attached. Wait: 40s */
451
446
unsigned long attach_retry_delay = (1 << _last_device_attach_cnt) * AIOT_CONFIG_DEVICE_TOPIC_SUBSCRIBE_RETRY_DELAY_ms;
@@ -468,7 +463,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SubscribeThingTopics()
468
463
return State::Disconnect;
469
464
}
470
465
471
- if (getThingIdOutdatedFlag ())
466
+ if (_thing_id_property-> isDifferentFromCloud ())
472
467
{
473
468
return State::CheckDeviceConfig;
474
469
}
@@ -524,7 +519,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_RequestLastValues()
524
519
return State::Disconnect;
525
520
}
526
521
527
- if (getThingIdOutdatedFlag ())
522
+ if (_thing_id_property-> isDifferentFromCloud ())
528
523
{
529
524
return State::CheckDeviceConfig;
530
525
}
@@ -567,7 +562,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_Connected()
567
562
/* We are connected so let's to our stuff here. */
568
563
else
569
564
{
570
- if (getThingIdOutdatedFlag ())
565
+ if (_thing_id_property-> isDifferentFromCloud ())
571
566
{
572
567
return State::CheckDeviceConfig;
573
568
}
@@ -762,12 +757,12 @@ int ArduinoIoTCloudTCP::write(String const topic, byte const data[], int const l
762
757
763
758
void ArduinoIoTCloudTCP::updateThingTopics ()
764
759
{
760
+ _thing_id_property->fromCloudToLocal ();
761
+
765
762
_shadowTopicOut = getTopic_shadowout ();
766
763
_shadowTopicIn = getTopic_shadowin ();
767
764
_dataTopicOut = getTopic_dataout ();
768
765
_dataTopicIn = getTopic_datain ();
769
-
770
- clrThingIdOutdatedFlag ();
771
766
}
772
767
773
768
/* *****************************************************************************
0 commit comments