States

Serial Modem Host Applications

tags
Serial Modem Host Applications

The following states are used by the module:

  • STATE_RUNNING: Parent state entered on initialization. Its entry function initializes the FOTA poll library, confirms the running image, and publishes FOTA_MODULE_READY. It handles FOTA_DOWNLOAD_CANCEL on behalf of all substates that do not handle it themselves, which is how the cancel transition is reached from the downloading and reboot pending states.

    • STATE_WAITING_FOR_POLL_REQUEST: Default substate, in which the module is idle and waits for a FOTA_POLL_REQUEST. A cancel request is logged and ignored here, as there is nothing to cancel.
    • STATE_POLLING_FOR_UPDATE: The module asks nRF Cloud whether a job is available. If there is no job, it reports FOTA_ABORTED and returns to waiting. A cancel request is logged and ignored, since the download has not started.
    • STATE_DOWNLOADING_UPDATE: A download is in progress. The module publishes FOTA_STARTING on entry so the application knows not to interfere.
    • STATE_REBOOT_PENDING: The update is downloaded and the module publishes FOTA_REBOOT_REQUEST. The state machine stays here until the application reboots the device.
    • STATE_CANCELING: A cancel request was received. The module calls fota_download_cancel() and returns to waiting when the library confirms the abort.