Skip to content

Commit 169509a

Browse files
committed
Adding 2 hidden properties OTA_URL (which contains the URL from where an OTA image should be downloaded) as well as OTA_REQ (which performs an OTA download from said URL when it's set to true
1 parent b6a1257 commit 169509a

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/ArduinoIoTCloudTCP.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ ArduinoIoTCloudTCP::ArduinoIoTCloudTCP()
9696
#if OTA_ENABLED
9797
, _ota_error{static_cast<int>(OTAError::None)}
9898
, _ota_img_sha256{"Inv."}
99+
, _ota_url{""}
100+
, _otq_request{false}
99101
#endif /* OTA_ENABLED */
100102
{
101103

@@ -246,6 +248,8 @@ void ArduinoIoTCloudTCP::setOTAStorage(OTAStorage & ota_storage)
246248
{
247249
addPropertyReal(_ota_error, "OTA_ERROR", Permission::Read);
248250
addPropertyReal(_ota_img_sha256, "OTA_SHA256", Permission::Read);
251+
addPropertyReal(_ota_url, "OTA_URL", Permission::ReadWrite).onSync(DEVICE_WINS);
252+
addPropertyReal(_otq_request, "OTA_REQ", Permission::ReadWrite).onSync(DEVICE_WINS);
249253
_ota_logic.setOTAStorage(ota_storage);
250254
}
251255
#endif /* OTA_ENABLED */

src/ArduinoIoTCloudTCP.h

+2
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass
128128
OTALogic _ota_logic;
129129
int _ota_error;
130130
String _ota_img_sha256;
131+
String _ota_url;
132+
bool _otq_request;
131133
#endif /* OTA_ENABLED */
132134

133135
inline String getTopic_stdin () { return String("/a/d/" + getDeviceId() + "/s/i"); }

0 commit comments

Comments
 (0)