@@ -65,11 +65,6 @@ void updateTimezoneInfo()
65
65
ArduinoCloud.updateInternalTimezoneInfo ();
66
66
}
67
67
68
- void setThingIdOutdated ()
69
- {
70
- ArduinoCloud.setThingIdOutdatedFlag ();
71
- }
72
-
73
68
/* *****************************************************************************
74
69
CTOR/DTOR
75
70
******************************************************************************/
@@ -201,8 +196,8 @@ int ArduinoIoTCloudTCP::begin(bool const enable_watchdog, String brokerAddress,
201
196
p = new CloudWrapperBool (_ota_req);
202
197
addPropertyToContainer (_device_property_container, *p, " OTA_REQ" , Permission::ReadWrite, -1 );
203
198
#endif /* OTA_ENABLED */
204
- p = new CloudWrapperString (_thing_id);
205
- addPropertyToContainer (_device_property_container, *p , " thing_id" , Permission::ReadWrite , -1 ). onUpdate (setThingIdOutdated );
199
+
200
+ addPropertyToContainer (_device_property_container, _thing_id , " thing_id" , Permission::Read , -1 );
206
201
207
202
addPropertyReal (_tz_offset, " tz_offset" , Permission::ReadWrite).onSync (CLOUD_WINS).onUpdate (updateTimezoneInfo);
208
203
addPropertyReal (_tz_dst_until, " tz_dst_until" , Permission::ReadWrite).onSync (CLOUD_WINS).onUpdate (updateTimezoneInfo);
@@ -386,7 +381,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_WaitDeviceConfig()
386
381
return State::Disconnect;
387
382
}
388
383
389
- if ( getThingIdOutdatedFlag ())
384
+ if (_thing_id. isDifferentFromCloud ())
390
385
{
391
386
return State::CheckDeviceConfig;
392
387
}
@@ -422,7 +417,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_CheckDeviceConfig()
422
417
423
418
updateThingTopics ();
424
419
425
- if (deviceNotAttached () )
420
+ if (_thing_id. getValue (). length () == 0 )
426
421
{
427
422
/* Configuration received but device not attached. Wait: 40s */
428
423
unsigned long attach_retry_delay = (1 << _last_device_attach_cnt) * AIOT_CONFIG_DEVICE_TOPIC_SUBSCRIBE_RETRY_DELAY_ms;
@@ -445,7 +440,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SubscribeThingTopics()
445
440
return State::Disconnect;
446
441
}
447
442
448
- if (getThingIdOutdatedFlag ())
443
+ if (_thing_id. isDifferentFromCloud ())
449
444
{
450
445
return State::CheckDeviceConfig;
451
446
}
@@ -501,7 +496,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_RequestLastValues()
501
496
return State::Disconnect;
502
497
}
503
498
504
- if (getThingIdOutdatedFlag ())
499
+ if (_thing_id. isDifferentFromCloud ())
505
500
{
506
501
return State::CheckDeviceConfig;
507
502
}
@@ -544,7 +539,7 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_Connected()
544
539
/* We are connected so let's to our stuff here. */
545
540
else
546
541
{
547
- if (getThingIdOutdatedFlag ())
542
+ if (_thing_id. isDifferentFromCloud ())
548
543
{
549
544
return State::CheckDeviceConfig;
550
545
}
@@ -738,12 +733,12 @@ int ArduinoIoTCloudTCP::write(String const topic, byte const data[], int const l
738
733
739
734
void ArduinoIoTCloudTCP::updateThingTopics ()
740
735
{
736
+ _thing_id.fromCloudToLocal ();
737
+
741
738
_shadowTopicOut = getTopic_shadowout ();
742
739
_shadowTopicIn = getTopic_shadowin ();
743
740
_dataTopicOut = getTopic_dataout ();
744
741
_dataTopicIn = getTopic_datain ();
745
-
746
- clrThingIdOutdatedFlag ();
747
742
}
748
743
749
744
/* *****************************************************************************
0 commit comments