File tree 2 files changed +4
-2
lines changed
2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -103,18 +103,20 @@ OTAError OTALogic::update()
103
103
return _ota_error;
104
104
}
105
105
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)
107
107
{
108
108
size_t const bytes_available = (MQTT_OTA_BUF_SIZE - _mqtt_ota_buf.num_bytes );
109
109
if (length <= bytes_available)
110
110
{
111
111
memcpy (_mqtt_ota_buf.buf + _mqtt_ota_buf.num_bytes , data, length);
112
112
_mqtt_ota_buf.num_bytes += length;
113
+ return _mqtt_ota_buf.num_bytes ;
113
114
}
114
115
else
115
116
{
116
117
_ota_state = OTAState::Error;
117
118
_ota_error = OTAError::ReceivedDataOverrun;
119
+ return 0 ;
118
120
}
119
121
}
120
122
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ class OTALogic
76
76
77
77
78
78
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);
80
80
81
81
#ifdef HOST
82
82
inline OTAState state () const { return _ota_state; }
You can’t perform that action at this time.
0 commit comments