Hello,
Happy New Year of 2022!
We have some doubts regarding OTA firmware update (ota_demo_core_http) and would like to clarify about it.
- How to properly shutdown after receiving OtaJobEventActivate?
a) From the sample demo code, it seems that OTA_Shutdown
might not get called since OTA_ActivateNewImage()
may issue a reboot. May I know why OTA_Shutdown
is called after and not before?
b) In the sample code, MQTTAgent thread might be still be still running at this point of time, how can we terminate MQTT Agent gracefully?
Sample Code (ota_demo_core_http.c)
static void prvOtaAppCallback( OtaJobEvent_t xEvent,
const void * pData )
{
OtaErr_t xOtaError = OtaErrUninitialized;
switch( xEvent )
{
case OtaJobEventActivate:
LogInfo( ( "Received OtaJobEventActivate callback from OTA Agent." ) );
/* Activate the new firmware image. */
OTA_ActivateNewImage();
/* Initiate Shutdown of OTA Agent.
* If it is required that the unsubscribe operations are not
* performed while shutting down please set the second parameter to
* 0 instead of 1.
*/
OTA_Shutdown( otaexampleOTA_SHUTDOWN_WAIT_TICKS, otaexampleUNSUBSCRIBE_AFTER_OTA_SHUTDOWN );
Thanks!