Skip to content

Commit 9d734ab

Browse files
RC-Repositoriesurutva
authored andcommitted
aws-iot: Refactor ota_agent_task redundant code
The function `otaAppCallback` is called upon an event such as a new file block being received, or the OTA image being activated. The function then redundantly checks the OTA state via `OTA_GetState`, which reduces code clarity via duplication including redundant calls to the ota update's active and inactive hooks. This fix has been tested via passing Arm's internal CI. Signed-off-by: Reuben Cartwright <[email protected]>
1 parent f173854 commit 9d734ab

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

components/aws_iot/ota_for_aws_iot_embedded_sdk/integration/src/ota_agent_task.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -599,34 +599,6 @@ STATIC void otaAppCallback( OtaJobEvent_t event,
599599
LogWarn( ( "Received an unhandled callback event from OTA Agent, event = %d", event ) );
600600
break;
601601
}
602-
603-
OtaState_t state = OTA_GetState();
604-
605-
switch( state )
606-
{
607-
case OtaAgentStateNoTransition:
608-
case OtaAgentStateInit:
609-
case OtaAgentStateReady:
610-
case OtaAgentStateSuspended:
611-
case OtaAgentStateShuttingDown:
612-
case OtaAgentStateStopped:
613-
LogInfo( ( "OTA not active state `%d` from OTA Agent.", state ) );
614-
vOtaNotActiveHook();
615-
break;
616-
617-
case OtaAgentStateRequestingJob:
618-
case OtaAgentStateCreatingFile:
619-
case OtaAgentStateRequestingFileBlock:
620-
case OtaAgentStateWaitingForFileBlock:
621-
case OtaAgentStateClosingFile:
622-
LogInfo( ( "OTA active state `%d` from OTA Agent.", state ) );
623-
vOtaActiveHook();
624-
break;
625-
626-
case OtaAgentStateWaitingForJob:
627-
default:
628-
break;
629-
}
630602
}
631603

632604
STATIC void prvMqttJobCallback( void * pvIncomingPublishCallbackContext,

0 commit comments

Comments
 (0)