Skip to content

Commit 86d07a4

Browse files
committed
Add LIB_VERSION property to let cloud decide to use thing_topic or device_topic for OTA properties
1 parent 20c2da9 commit 86d07a4

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

src/AIoTC_Config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,6 @@
153153
#define AIOT_CONFIG_RP2040_OTA_HTTP_HEADER_RECEIVE_TIMEOUT_ms (10*1000UL)
154154
#define AIOT_CONFIG_RP2040_OTA_HTTP_DATA_RECEIVE_TIMEOUT_ms (4*60*1000UL)
155155

156+
#define AIOT_CONFIG_LIB_VERSION "1.5.0"
157+
156158
#endif /* ARDUINO_AIOTC_CONFIG_H_ */

src/ArduinoIoTCloud.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ ArduinoIoTCloudClass::ArduinoIoTCloudClass()
3333
, _tz_dst_until{0}
3434
, _thing_id{""}
3535
, _device_id{""}
36+
, _lib_version{AIOT_CONFIG_LIB_VERSION}
3637
, _cloud_event_callback{nullptr}
3738
, _thing_id_outdated{false}
3839
{

src/ArduinoIoTCloud.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ class ArduinoIoTCloudClass
174174
int _tz_offset;
175175
unsigned int _tz_dst_until;
176176
String _thing_id;
177+
String _lib_version;
177178

178179
void execCloudEventCallback(ArduinoIoTCloudEvent const event);
179180

src/ArduinoIoTCloudTCP.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ int ArduinoIoTCloudTCP::begin(bool const enable_watchdog, String brokerAddress,
250250
_deviceTopicOut = getTopic_deviceout();
251251
_deviceTopicIn = getTopic_devicein();
252252

253+
addPropertyReal(_lib_version, _device_property_container, "LIB_VERSION", Permission::Read);
253254
#if OTA_ENABLED
254255
addPropertyReal(_ota_cap, _device_property_container, "OTA_CAP", Permission::Read);
255256
addPropertyReal(_ota_error, _device_property_container, "OTA_ERROR", Permission::Read);
@@ -756,7 +757,7 @@ void ArduinoIoTCloudTCP::sendOTAPropertiesToCloud(bool include_ota_req)
756757
PropertyContainer ota_property_container;
757758
unsigned int last_ota_property_index = 0;
758759

759-
std::list<String> ota_property_list {"OTA_CAP", "OTA_ERROR", "OTA_SHA256"};
760+
std::list<String> ota_property_list {"LIB_VERSION", "OTA_CAP", "OTA_ERROR", "OTA_SHA256"};
760761
if (include_ota_req)
761762
ota_property_list.push_back("OTA_REQ");
762763
std::for_each(ota_property_list.begin(),

0 commit comments

Comments
 (0)