State machines

Asset Tracker Template

tags
Asset Tracker Template

SMF is a Zephyr library that provides a way to implement hierarchical state machines in a structured manner. Most modules in the Asset Tracker Template implement a hierarchical state machine. In a hierarchical state machine, you can implement behavior common to multiple states in a shared parent state.

The state machines in the Asset Tracker Template follow a run-to-completion model with the following characteristics:

  • Message processing and state machine execution, including transitions, are completed before processing any new messages.
  • Entry and exit functions are called in the correct order when transitioning states.
  • Parent state transitions are handled automatically when transitioning between child states.

This model ensures predictable behavior and proper state cleanup during transitions. Nothing outside the state machine can interrupt or change its execution.

This section covers how SMF is used in the modules in the Asset Tracker Template to implement state machines. For an introduction to SMF, see the SMF documentation.