@@ -281,26 +281,25 @@ esp_err_t OTAImageProcessorImpl::DeltaOTAWriteCallback(const uint8_t * buf, size
281
281
#endif // CONFIG_ENABLE_DELTA_OTA
282
282
283
283
#if defined(CONFIG_AUTO_UPDATE_RCP) && defined(CONFIG_OPENTHREAD_BORDER_ROUTER)
284
- esp_err_t OTAImageProcessorImpl::ProcessRcpImage (intptr_t context, const uint8_t * buffer, uint32_t bufLen)
284
+ esp_err_t OTAImageProcessorImpl::ProcessRcpImage (const uint8_t * buffer, uint32_t bufLen)
285
285
{
286
- esp_err_t err = ESP_OK;
287
- auto * imageProcessor = reinterpret_cast <OTAImageProcessorImpl *>(context);
286
+ esp_err_t err = ESP_OK;
288
287
289
- if (!imageProcessor-> mRcpDone )
288
+ if (!this -> mRcpFirmwareDownloaded )
290
289
{
291
290
size_t rcpOtaReceivedLen = 0 ;
292
- err = esp_rcp_ota_receive (imageProcessor ->mRcpOtaHandle , buffer, bufLen, &rcpOtaReceivedLen);
291
+ err = esp_rcp_ota_receive (this ->mRcpOtaHandle , buffer, bufLen, &rcpOtaReceivedLen);
293
292
294
- if (esp_rcp_ota_get_state (imageProcessor ->mRcpOtaHandle ) == ESP_RCP_OTA_STATE_FINISHED)
293
+ if (esp_rcp_ota_get_state (this ->mRcpOtaHandle ) == ESP_RCP_OTA_STATE_FINISHED)
295
294
{
296
- imageProcessor ->mBrFirmwareSize = esp_rcp_ota_get_subfile_size (imageProcessor ->mRcpOtaHandle , FILETAG_HOST_FIRMWARE);
297
- err = esp_ota_write (imageProcessor ->mOTAUpdateHandle , buffer + rcpOtaReceivedLen, bufLen - rcpOtaReceivedLen);
298
- imageProcessor-> mRcpDone = true ;
295
+ this ->mBrFirmwareSize = esp_rcp_ota_get_subfile_size (this ->mRcpOtaHandle , FILETAG_HOST_FIRMWARE);
296
+ err = esp_ota_write (this ->mOTAUpdateHandle , buffer + rcpOtaReceivedLen, bufLen - rcpOtaReceivedLen);
297
+ this -> mRcpFirmwareDownloaded = true ;
299
298
}
300
299
}
301
- else if (imageProcessor ->mBrFirmwareSize > 0 )
300
+ else if (this ->mBrFirmwareSize > 0 )
302
301
{
303
- err = esp_ota_write (imageProcessor ->mOTAUpdateHandle , buffer, bufLen);
302
+ err = esp_ota_write (this ->mOTAUpdateHandle , buffer, bufLen);
304
303
}
305
304
else
306
305
{
@@ -369,9 +368,9 @@ void OTAImageProcessorImpl::HandlePrepareDownload(intptr_t context)
369
368
#endif // CONFIG_ENABLE_ENCRYPTED_OTA
370
369
371
370
#if defined(CONFIG_AUTO_UPDATE_RCP) && defined(CONFIG_OPENTHREAD_BORDER_ROUTER)
372
- imageProcessor->mRcpOtaHandle = 0 ;
373
- imageProcessor->mBrFirmwareSize = 0 ;
374
- imageProcessor->mRcpDone = false ;
371
+ imageProcessor->mRcpOtaHandle = 0 ;
372
+ imageProcessor->mBrFirmwareSize = 0 ;
373
+ imageProcessor->mRcpFirmwareDownloaded = false ;
375
374
if (esp_rcp_ota_begin (&imageProcessor->mRcpOtaHandle ) != ESP_OK)
376
375
{
377
376
return ;
@@ -424,9 +423,9 @@ void OTAImageProcessorImpl::HandleFinalize(intptr_t context)
424
423
#elif defined(CONFIG_AUTO_UPDATE_RCP) && defined(CONFIG_OPENTHREAD_BORDER_ROUTER)
425
424
esp_err_t err = esp_rcp_ota_end (imageProcessor->mRcpOtaHandle );
426
425
err |= esp_ota_end (imageProcessor->mOTAUpdateHandle );
427
- imageProcessor->mRcpOtaHandle = 0 ;
428
- imageProcessor->mBrFirmwareSize = 0 ;
429
- imageProcessor->mRcpDone = false ;
426
+ imageProcessor->mRcpOtaHandle = 0 ;
427
+ imageProcessor->mBrFirmwareSize = 0 ;
428
+ imageProcessor->mRcpFirmwareDownloaded = false ;
430
429
#else
431
430
esp_err_t err = esp_ota_end (imageProcessor->mOTAUpdateHandle );
432
431
#endif // CONFIG_ENABLE_DELTA_OTA
@@ -473,9 +472,9 @@ void OTAImageProcessorImpl::HandleAbort(intptr_t context)
473
472
{
474
473
ESP_LOGE (TAG, " ESP RCP OTA abort failed" );
475
474
}
476
- imageProcessor->mRcpOtaHandle = 0 ;
477
- imageProcessor->mBrFirmwareSize = 0 ;
478
- imageProcessor->mRcpDone = false ;
475
+ imageProcessor->mRcpOtaHandle = 0 ;
476
+ imageProcessor->mBrFirmwareSize = 0 ;
477
+ imageProcessor->mRcpFirmwareDownloaded = false ;
479
478
#endif
480
479
481
480
if (esp_ota_abort (imageProcessor->mOTAUpdateHandle ) != ESP_OK)
@@ -541,7 +540,7 @@ void OTAImageProcessorImpl::HandleProcessBlock(intptr_t context)
541
540
// Apply the patch and writes that data to the passive partition.
542
541
err = esp_delta_ota_feed_patch (imageProcessor->mDeltaOTAUpdateHandle , blockToWrite.data () + index , blockToWrite.size () - index );
543
542
#elif defined(CONFIG_AUTO_UPDATE_RCP) && defined(CONFIG_OPENTHREAD_BORDER_ROUTER)
544
- err = imageProcessor->ProcessRcpImage (context, blockToWrite.data (), blockToWrite.size ());
543
+ err = imageProcessor->ProcessRcpImage (blockToWrite.data (), blockToWrite.size ());
545
544
#else
546
545
err = esp_ota_write (imageProcessor->mOTAUpdateHandle , blockToWrite.data (), blockToWrite.size ());
547
546
#endif // CONFIG_ENABLE_DELTA_OTA
0 commit comments