State machine initialization

Serial Modem Host Applications

tags
Serial Modem Host Applications

State machines are initialized to an initial state using smf_set_initial():

smf_set_initial(SMF_CTX(&fota_state), &states[STATE_RUNNING]);

This has to be done before the state machine is executed for the first time. Entry functions of the initial state, and of any state reached through initial transitions, run at this point. This is where modules that need it perform their initialization, such as the FOTA module initializing the nRF Cloud FOTA poll library in state_running_entry().