|
28 | 28 | #include "tls/utility/CryptoUtil.h"
|
29 | 29 | #endif
|
30 | 30 |
|
| 31 | +#include "utility/ota/OTA.h" |
31 | 32 | #include "utility/ota/FlashSHA256.h"
|
32 |
| -#include "utility/ota/OTAStorage_SNU.h" |
33 |
| -#include "utility/ota/OTAStorage_SFU.h" |
34 |
| -#include "utility/ota/OTAStorage_SSU.h" |
35 | 33 |
|
36 | 34 | #include "cbor/CBOREncoder.h"
|
37 | 35 |
|
38 |
| -/****************************************************************************** |
39 |
| - GLOBAL VARIABLES |
40 |
| - ******************************************************************************/ |
41 |
| - |
42 |
| -#if OTA_STORAGE_SSU |
43 |
| - static OTAStorage_SSU ota_storage_ssu; |
44 |
| -#elif OTA_STORAGE_SFU |
45 |
| - static OTAStorage_SFU ota_storage_sfu; |
46 |
| -#elif OTA_STORAGE_SNU |
47 |
| - static OTAStorage_SNU ota_storage_snu; |
48 |
| -#endif |
49 |
| - |
50 | 36 | /******************************************************************************
|
51 | 37 | GLOBAL CONSTANTS
|
52 | 38 | ******************************************************************************/
|
@@ -155,28 +141,18 @@ int ArduinoIoTCloudTCP::begin(String brokerAddress, uint16_t brokerPort)
|
155 | 141 | _dataTopicIn = getTopic_datain();
|
156 | 142 | _ota_topic_in = getTopic_ota_in();
|
157 | 143 |
|
158 |
| -#if OTA_STORAGE_SSU |
159 |
| - setOTAStorage(ota_storage_ssu); |
160 |
| -#elif OTA_STORAGE_SFU |
161 |
| - setOTAStorage(ota_storage_sfu); |
162 |
| -#elif OTA_STORAGE_SNU |
163 |
| - setOTAStorage(ota_storage_snu); |
164 |
| -#endif |
| 144 | +#if OTA_ENABLED |
| 145 | + addPropertyReal(_ota_error, "OTA_ERROR", Permission::Read); |
| 146 | + addPropertyReal(_ota_img_sha256, "OTA_SHA256", Permission::Read); |
| 147 | + addPropertyReal(_ota_url, "OTA_URL", Permission::ReadWrite).onSync(DEVICE_WINS); |
| 148 | + addPropertyReal(_ota_req, "OTA_REQ", Permission::ReadWrite).onSync(DEVICE_WINS).onUpdate(ArduinoIoTCloudTCP::on_OTA_REQ_Update); |
| 149 | +#endif /* OTA_ENABLED */ |
165 | 150 |
|
166 | 151 | return 1;
|
167 | 152 | }
|
168 | 153 |
|
169 | 154 | void ArduinoIoTCloudTCP::update()
|
170 | 155 | {
|
171 |
| -#if OTA_ENABLED |
172 |
| - /* If a _ota_logic object has been instantiated then we are spinning its |
173 |
| - * 'update' method here in order to process incoming data and generally |
174 |
| - * to transition to the OTA logic update states. |
175 |
| - */ |
176 |
| - //OTAError const err = _ota_logic.update(); |
177 |
| - //_ota_error = static_cast<int>(err); |
178 |
| -#endif /* OTA_ENABLED */ |
179 |
| - |
180 | 156 | /* Run through the state machine. */
|
181 | 157 | State next_state = _state;
|
182 | 158 | switch (_state)
|
@@ -208,17 +184,6 @@ void ArduinoIoTCloudTCP::printDebugInfo()
|
208 | 184 | DBG_INFO("MQTT Broker: %s:%d", _brokerAddress.c_str(), _brokerPort);
|
209 | 185 | }
|
210 | 186 |
|
211 |
| -#if OTA_ENABLED |
212 |
| -void ArduinoIoTCloudTCP::setOTAStorage(OTAStorage & ota_storage) |
213 |
| -{ |
214 |
| - addPropertyReal(_ota_error, "OTA_ERROR", Permission::Read); |
215 |
| - addPropertyReal(_ota_img_sha256, "OTA_SHA256", Permission::Read); |
216 |
| - addPropertyReal(_ota_url, "OTA_URL", Permission::ReadWrite).onSync(DEVICE_WINS); |
217 |
| - addPropertyReal(_ota_req, "OTA_REQ", Permission::ReadWrite).onSync(DEVICE_WINS).onUpdate(ArduinoIoTCloudTCP::on_OTA_REQ_Update); |
218 |
| - _ota_logic.setOTAStorage(ota_storage); |
219 |
| -} |
220 |
| -#endif /* OTA_ENABLED */ |
221 |
| - |
222 | 187 | /******************************************************************************
|
223 | 188 | * PRIVATE MEMBER FUNCTIONS
|
224 | 189 | ******************************************************************************/
|
@@ -372,12 +337,6 @@ void ArduinoIoTCloudTCP::handleMessage(int length)
|
372 | 337 | execCloudEventCallback(ArduinoIoTCloudEvent::SYNC);
|
373 | 338 | _state = State::Connected;
|
374 | 339 | }
|
375 |
| - |
376 |
| -#if OTA_ENABLED |
377 |
| - if (_ota_topic_in == topic) { |
378 |
| - _ota_logic.onOTADataReceived(bytes, length); |
379 |
| - } |
380 |
| -#endif /* OTA_ENABLED */ |
381 | 340 | }
|
382 | 341 |
|
383 | 342 | void ArduinoIoTCloudTCP::sendPropertiesToCloud()
|
|
0 commit comments