State machine
 All Classes Files Functions Variables Enumerations Enumerator Groups
Classes | Enumerations | Functions
stateMachine.h File Reference
#include <stddef.h>
#include <stdbool.h>

Go to the source code of this file.

Classes

struct  event
 Event. More...
struct  transition
 Transition between a state and another state. More...
struct  state
 State. More...
struct  stateMachine
 State machine. More...

Enumerations

enum  stateM_handleEventRetVals {
  stateM_errArg = -2, stateM_errorStateReached, stateM_stateChanged, stateM_stateLoopSelf,
  stateM_noStateChange, stateM_finalStateReached
}
 stateM_handleEvent() return values More...

Functions

void stateM_init (struct stateMachine *stateMachine, struct state *initialState, struct state *errorState)
 Initialise the state machine.
int stateM_handleEvent (struct stateMachine *stateMachine, struct event *event)
 Pass an event to the state machine.
struct statestateM_currentState (struct stateMachine *stateMachine)
 Get the current state.
struct statestateM_previousState (struct stateMachine *stateMachine)
 Get the previous state.
bool stateM_stopped (struct stateMachine *stateMachine)
 Check if the state machine has stopped.

Detailed Description