Structure describing FSM. More...
#include <fsm.h>
Public Attributes | |
struct robo_fsm * | next |
struct fsm_main_loop * | loop |
Main loop, which dispatches events for this FSM. | |
unsigned | flags |
pthread_mutex_t | send_mutex |
struct fsm_event | events [FSM_EVENT_QUEUE_LEN] |
Ring-buffer for incomming events. | |
unsigned | ev_head |
Index in the events of the next event to be processed. | |
unsigned | ev_tail |
Index in the events where to put events for this message. | |
struct timespec | timer |
Time of next timer expiration. | |
robo_fsm_state_t | state |
Pointer to current state function. | |
const char * | state_name |
Name of the current state. | |
robo_fsm_state_t | last_state |
Pointer to previous state function. | |
const char * | last_state_name |
Stack of sub-automaton states for use by FCALL() and SUBFSM_TRANSITION(). | |
robo_fsm_state_t | fnc_stack [10] |
robo_fsm_state_t * | fnc_sp |
Pointer to the top of fnc_stack. | |
int | debug_states |
Whether to print debug messages on state transitions. | |
char * | debug_name |
The name of automaton (printed in debug messages). | |
void(* | transition_callback )(struct robo_fsm *fsm) |
Pointer to transition callback function. |
Structure describing FSM.
char* robo_fsm::debug_name |
The name of automaton (printed in debug messages).
Whether to print debug messages on state transitions.
unsigned robo_fsm::ev_head |
Index in the events of the next event to be processed.
unsigned robo_fsm::ev_tail |
Index in the events where to put events for this message.
Protected by send_mutex
struct fsm_event robo_fsm::events[FSM_EVENT_QUEUE_LEN] |
Ring-buffer for incomming events.
unsigned robo_fsm::flags |
Pointer to the top of fnc_stack.
Pointer to previous state function.
const char* robo_fsm::last_state_name |
Stack of sub-automaton states for use by FCALL() and SUBFSM_TRANSITION().
Name of the last state
struct fsm_main_loop* robo_fsm::loop |
Main loop, which dispatches events for this FSM.
struct robo_fsm* robo_fsm::next |
pthread_mutex_t robo_fsm::send_mutex |
Pointer to current state function.
This function is called when an event occurs.
const char* robo_fsm::state_name |
Name of the current state.
struct timespec robo_fsm::timer |
Time of next timer expiration.
void(* robo_fsm::transition_callback)(struct robo_fsm *fsm) |
Pointer to transition callback function.
This function is called whenever fsm changes state. This callback can be used to track/debug the state of FSM. fsm->state_name
will contain the name of current state, fsm->last_state_name
the name of last state.