Skip to content

Commit 44167e9

Browse files
committed
Add LIB_VERSION property to let cloud decide to use thing_topic or device_topic for OTA properties
1 parent 1602ad2 commit 44167e9

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

src/AIoTC_Config.h

+2
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

+1
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

+1
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

+2-1
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ int ArduinoIoTCloudTCP::begin(bool const enable_watchdog, String brokerAddress,
251251
_deviceTopicOut = getTopic_deviceout();
252252
_deviceTopicIn = getTopic_devicein();
253253

254+
addPropertyReal(_lib_version, _device_property_container, "LIB_VERSION", Permission::Read);
254255
#if OTA_ENABLED
255256
addPropertyReal(_ota_cap, _device_property_container, "OTA_CAP", Permission::Read);
256257
addPropertyReal(_ota_error, _device_property_container, "OTA_ERROR", Permission::Read);
@@ -763,7 +764,7 @@ void ArduinoIoTCloudTCP::sendOTAPropertiesToCloud(bool include_ota_req)
763764
PropertyContainer ota_property_container;
764765
unsigned int last_ota_property_index = 0;
765766

766-
std::list<String> ota_property_list {"OTA_CAP", "OTA_ERROR", "OTA_SHA256"};
767+
std::list<String> ota_property_list {"LIB_VERSION", "OTA_CAP", "OTA_ERROR", "OTA_SHA256"};
767768
if (include_ota_req)
768769
ota_property_list.push_back("OTA_REQ");
769770
std::for_each(ota_property_list.begin(),

0 commit comments

Comments
 (0)