File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -103,18 +103,20 @@ OTAError OTALogic::update()
103103 return _ota_error;
104104}
105105
106- void OTALogic::onOTADataReceived (uint8_t const * const data, size_t const length)
106+ uint32_t OTALogic::onOTADataReceived (uint8_t const * const data, size_t const length)
107107{
108108 size_t const bytes_available = (MQTT_OTA_BUF_SIZE - _mqtt_ota_buf.num_bytes );
109109 if (length <= bytes_available)
110110 {
111111 memcpy (_mqtt_ota_buf.buf + _mqtt_ota_buf.num_bytes , data, length);
112112 _mqtt_ota_buf.num_bytes += length;
113+ return _mqtt_ota_buf.num_bytes ;
113114 }
114115 else
115116 {
116117 _ota_state = OTAState::Error;
117118 _ota_error = OTAError::ReceivedDataOverrun;
119+ return 0 ;
118120 }
119121}
120122
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ class OTALogic
7676
7777
7878 OTAError update ();
79- void onOTADataReceived (uint8_t const * const data, size_t const length);
79+ uint32_t onOTADataReceived (uint8_t const * const data, size_t const length);
8080
8181#ifdef HOST
8282 inline OTAState state () const { return _ota_state; }
You can’t perform that action at this time.
0 commit comments