Skip to content

Commit 804dbab

Browse files
committed
Add configuration flag to sendOTAPropertiesToCloud() fuction in order to append OTA_REQ property
1 parent 29f21d9 commit 804dbab

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/ArduinoIoTCloudTCP.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -741,13 +741,15 @@ void ArduinoIoTCloudTCP::sendPropertiesToCloud()
741741
}
742742

743743
#if OTA_ENABLED
744-
void ArduinoIoTCloudTCP::sendOTAPropertiesToCloud()
744+
void ArduinoIoTCloudTCP::sendOTAPropertiesToCloud(bool include_ota_req)
745745
{
746746
PropertyContainer ota_property_container;
747747

748-
std::list<String> const ota_property_list {"OTA_CAP", "OTA_ERROR", "OTA_SHA256"};
749-
std::for_each(ota_property_list.cbegin(),
750-
ota_property_list.cend(),
748+
std::list<String> ota_property_list {"OTA_CAP", "OTA_ERROR", "OTA_SHA256"};
749+
if (include_ota_req)
750+
ota_property_list.push_back("OTA_REQ");
751+
std::for_each(ota_property_list.begin(),
752+
ota_property_list.end(),
751753
[this, &ota_property_container ] (String const & name)
752754
{
753755
Property* p = getProperty(this->_device_property_container, name);

src/ArduinoIoTCloudTCP.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass
187187

188188
#if OTA_ENABLED
189189
void onOTARequest();
190-
void sendOTAPropertiesToCloud();
190+
void sendOTAPropertiesToCloud(bool include_ota_req = false);
191191
#endif
192192

193193
void updateThingTopics();
@@ -200,4 +200,4 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass
200200

201201
extern ArduinoIoTCloudTCP ArduinoCloud;
202202

203-
#endif
203+
#endif

0 commit comments

Comments
 (0)