Skip to content

Commit 474eda4

Browse files
committed
TEMP: Add dedicated function to provide OTA_URL echo to the cloud
1 parent 68fd3c4 commit 474eda4

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/ArduinoIoTCloudTCP.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,11 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_Connected()
666666
*/
667667
sendThingPropertiesToCloud();
668668

669+
/* Check if we have received the OTA_URL property and provide
670+
* echo to the cloud.
671+
*/
672+
sendOTAUrlToCloud();
673+
669674
unsigned long const internal_posix_time = _time_service.getTime();
670675
if(internal_posix_time < _tz_dst_until) {
671676
return State::Connected;
@@ -802,6 +807,24 @@ void ArduinoIoTCloudTCP::sendOTAErrorToCloud()
802807

803808
sendPropertyContainerToCloud(_deviceTopicOut, ota_property_container);
804809
}
810+
811+
void ArduinoIoTCloudTCP::sendOTAUrlToCloud()
812+
{
813+
PropertyContainer ota_property_container;
814+
815+
std::list<String> ota_property_list {"OTA_URL"};
816+
std::for_each(ota_property_list.begin(),
817+
ota_property_list.end(),
818+
[this, &ota_property_container ] (String const & name)
819+
{
820+
Property* p = getProperty(this->_device_property_container, name);
821+
if(p != nullptr)
822+
addPropertyToContainer(ota_property_container, *p, p->name(), p->isWriteableByCloud() ? Permission::ReadWrite : Permission::Read);
823+
}
824+
);
825+
826+
sendPropertyContainerToCloud(_deviceTopicOut, ota_property_container);
827+
}
805828
#endif
806829

807830
void ArduinoIoTCloudTCP::requestLastValue()

src/ArduinoIoTCloudTCP.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass
195195
void onOTARequest();
196196
void sendClearedOTARequestToCloud();
197197
void sendOTAErrorToCloud();
198+
void sendOTAUrlToCloud();
198199
#endif
199200

200201
void updateThingTopics();

0 commit comments

Comments
 (0)