@@ -50,12 +50,13 @@ static void fota_status(enum nrf_cloud_fota_status status, const char *const sta
50
50
/* State machine */
51
51
52
52
/* Defining modules states.
53
- * STATE_RUNNING: The FOTA module is initializing and waiting for a poll request.
54
- * STATE_WAITING_FOR_POLL_REQUEST: The FOTA module is waiting for a poll request.
55
- * STATE_POLLING_FOR_UPDATE: The FOTA module is polling for an update.
56
- * STATE_DOWNLOADING_UPDATE: The FOTA module is downloading an update.
57
- * STATE_WAITING_FOR_NETWORK_DISCONNECT: The FOTA module is waiting for a network disconnect
58
- * in order to apply the update.
53
+ * STATE_RUNNING: The module is initializing and waiting for a poll request.
54
+ * STATE_WAITING_FOR_POLL_REQUEST: The module is waiting for a poll request.
55
+ * STATE_POLLING_FOR_UPDATE: The module is polling for an update.
56
+ * STATE_DOWNLOADING_UPDATE: The module is downloading an update.
57
+ * STATE_WAITING_FOR_IMAGE_APPLY: The module is waiting for the event FOTA_IMAGE_APPLY to
58
+ * apply the image. This requires the application to
59
+ * disconnect from the network before sending the event.
59
60
* STATE_REBOOT_NEEDED: The FOTA module is waiting for a reboot.
60
61
* STATE_CANCELED: The FOTA module has been canceled, cleaning up.
61
62
*/
@@ -64,7 +65,7 @@ enum fota_module_state {
64
65
STATE_WAITING_FOR_POLL_REQUEST ,
65
66
STATE_POLLING_FOR_UPDATE ,
66
67
STATE_DOWNLOADING_UPDATE ,
67
- STATE_WAITING_FOR_NETWORK_DISCONNECT ,
68
+ STATE_WAITING_FOR_IMAGE_APPLY ,
68
69
STATE_REBOOT_NEEDED ,
69
70
STATE_CANCELED ,
70
71
};
@@ -95,8 +96,8 @@ static void state_polling_for_update_entry(void *o);
95
96
static void state_polling_for_update_run (void * o );
96
97
static void state_downloading_update_entry (void * o );
97
98
static void state_downloading_update_run (void * o );
98
- static void state_waiting_for_network_disconnect_entry (void * o );
99
- static void state_waiting_for_network_disconnect_run (void * o );
99
+ static void state_waiting_for_image_apply_entry (void * o );
100
+ static void state_waiting_for_image_apply_run (void * o );
100
101
static void state_reboot_needed_entry (void * o );
101
102
static void state_canceled_entry (void * o );
102
103
@@ -130,9 +131,9 @@ static const struct smf_state states[] = {
130
131
NULL ,
131
132
& states [STATE_RUNNING ],
132
133
NULL ),
133
- [STATE_WAITING_FOR_NETWORK_DISCONNECT ] =
134
- SMF_CREATE_STATE (state_waiting_for_network_disconnect_entry ,
135
- state_waiting_for_network_disconnect_run ,
134
+ [STATE_WAITING_FOR_IMAGE_APPLY ] =
135
+ SMF_CREATE_STATE (state_waiting_for_image_apply_entry ,
136
+ state_waiting_for_image_apply_run ,
136
137
NULL ,
137
138
& states [STATE_RUNNING ],
138
139
NULL ),
@@ -200,7 +201,7 @@ static void fota_status(enum nrf_cloud_fota_status status, const char *const sta
200
201
case NRF_CLOUD_FOTA_FMFU_VALIDATION_NEEDED :
201
202
LOG_DBG ("Full Modem FOTA Update validation needed, network disconnect required" );
202
203
203
- evt = FOTA_NETWORK_DISCONNECT_NEEDED ;
204
+ evt = FOTA_NETWORK_DISCONNECT_AND_APPLY_NEEDED ;
204
205
break ;
205
206
default :
206
207
LOG_DBG ("Unknown FOTA status: %d" , status );
@@ -354,8 +355,8 @@ static void state_downloading_update_run(void *o)
354
355
const enum fota_msg_type evt = MSG_TO_FOTA_TYPE (state_object -> msg_buf );
355
356
356
357
switch (evt ) {
357
- case FOTA_NETWORK_DISCONNECT_NEEDED :
358
- STATE_SET (fota_state , STATE_WAITING_FOR_NETWORK_DISCONNECT );
358
+ case FOTA_NETWORK_DISCONNECT_AND_APPLY_NEEDED :
359
+ STATE_SET (fota_state , STATE_WAITING_FOR_IMAGE_APPLY );
359
360
break ;
360
361
case FOTA_DOWNLOAD_FAILED :
361
362
STATE_SET (fota_state , STATE_WAITING_FOR_POLL_REQUEST );
@@ -367,22 +368,22 @@ static void state_downloading_update_run(void *o)
367
368
}
368
369
}
369
370
370
- static void state_waiting_for_network_disconnect_entry (void * o )
371
+ static void state_waiting_for_image_apply_entry (void * o )
371
372
{
372
373
ARG_UNUSED (o );
373
374
374
375
LOG_DBG ("%s" , __func__ );
375
376
}
376
377
377
- static void state_waiting_for_network_disconnect_run (void * o )
378
+ static void state_waiting_for_image_apply_run (void * o )
378
379
{
379
380
struct fota_state * state_object = o ;
380
381
381
382
if (& FOTA_CHAN == state_object -> chan ) {
382
383
const enum fota_msg_type evt = MSG_TO_FOTA_TYPE (state_object -> msg_buf );
383
384
384
385
switch (evt ) {
385
- case FOTA_APPLY_IMAGE :
386
+ case FOTA_IMAGE_APPLY :
386
387
387
388
LOG_DBG ("Applying downloaded firmware image" );
388
389
0 commit comments