State machine
|
stateMachine is a feature-rich, yet simple finite state machine implementation. It supports grouped states, guarded transitions, events with payload, entry and exit actions, transition actions and access to user-defined state data from all actions.
The user must build the state machine by linking together states and transitions arrays with pointers. A pointer to an initial state and an error state is given to stateM_init() to initialise a state machine object. The state machine is run by passing events to it with the function stateM_handleEvent(). The return value of stateM_handleEvent() will give an indication to what has happened.