Embedded Template Library  1.0
etl::fsm Class Reference

The FSM class. More...

#include <fsm.h>

Public Member Functions

 fsm (etl::message_router_id_t id)
 Constructor.
 
template<typename TSize >
void set_states (etl::ifsm_state **p_states, TSize size)
 Set the states for the FSM.
 
void start (bool call_on_enter_state=true)
 
void receive (const etl::imessage &message) ETL_OVERRIDE
 Top level message handler for the FSM.
 
void receive (imessage_router &source, etl::message_router_id_t destination_router_id, const etl::imessage &message) ETL_OVERRIDE
 Top level message handler for the FSM.
 
void receive (etl::imessage_router &source, const etl::imessage &message) ETL_OVERRIDE
 Top level message handler for the FSM.
 
bool accepts (etl::message_id_t) const ETL_OVERRIDE
 
etl::fsm_state_id_t get_state_id () const
 Gets the current state id.
 
ifsm_stateget_state ()
 Gets a reference to the current state interface.
 
const ifsm_stateget_state () const
 Gets a const reference to the current state interface.
 
bool is_started () const
 Checks if the FSM has been started.
 
void reset (bool call_on_exit_state=false)
 
ETL_DEPRECATED bool is_null_router () const ETL_OVERRIDE
 
bool is_producer () const ETL_OVERRIDE
 
bool is_consumer () const ETL_OVERRIDE
 
 fsm (etl::message_router_id_t id)
 Constructor.
 
template<typename TSize >
void set_states (etl::ifsm_state **p_states, TSize size)
 Set the states for the FSM.
 
void start (bool call_on_enter_state=true)
 Starts the FSM. Can only be called once. Subsequent calls will do nothing. More...
 
void receive (const etl::imessage &message) ETL_OVERRIDE
 Top level message handler for the FSM.
 
void receive (imessage_router &source, etl::message_router_id_t destination_router_id, const etl::imessage &message) ETL_OVERRIDE
 Top level message handler for the FSM.
 
void receive (etl::imessage_router &source, const etl::imessage &message) ETL_OVERRIDE
 Top level message handler for the FSM.
 
bool accepts (etl::message_id_t) const ETL_OVERRIDE
 Does this FSM accept the message id? Yes, it accepts everything!
 
etl::fsm_state_id_t get_state_id () const
 Gets the current state id.
 
ifsm_stateget_state ()
 Gets a reference to the current state interface.
 
const ifsm_stateget_state () const
 Gets a const reference to the current state interface.
 
bool is_started () const
 Checks if the FSM has been started.
 
void reset (bool call_on_exit_state=false)
 Reset the FSM to pre-started state. More...
 
ETL_DEPRECATED bool is_null_router () const ETL_OVERRIDE
 
bool is_producer () const ETL_OVERRIDE
 
bool is_consumer () const ETL_OVERRIDE
 
virtual bool accepts (etl::message_id_t id) const=0
 
bool accepts (const etl::imessage &msg) const
 
virtual bool accepts (etl::message_id_t id) const=0
 
bool accepts (const etl::imessage &msg) const
 
virtual bool accepts (etl::message_id_t id) const=0
 
bool accepts (const etl::imessage &msg) const
 
virtual bool accepts (etl::message_id_t id) const=0
 
bool accepts (const etl::imessage &msg) const
 
- Public Member Functions inherited from etl::imessage_router
bool accepts (const etl::imessage &msg) const
 
etl::message_router_id_t get_message_router_id () const
 
void set_successor (imessage_router &successor_)
 
imessage_routerget_successor () const
 
bool has_successor () const
 
bool accepts (const etl::imessage &msg) const
 
etl::message_router_id_t get_message_router_id () const
 
void set_successor (imessage_router &successor_)
 
imessage_routerget_successor () const
 
bool has_successor () const
 

Additional Inherited Members

- Public Types inherited from etl::imessage_router
enum  { NULL_MESSAGE_ROUTER = 255 , MESSAGE_BUS = 254 , ALL_MESSAGE_ROUTERS = 253 , MAX_MESSAGE_ROUTER = 249 }
 
enum  { NULL_MESSAGE_ROUTER = 255 , MESSAGE_BUS = 254 , ALL_MESSAGE_ROUTERS = 253 , MAX_MESSAGE_ROUTER = 249 }
 
- Protected Member Functions inherited from etl::imessage_router
 imessage_router (etl::message_router_id_t id_)
 
 imessage_router (etl::message_router_id_t id_, imessage_router &successor_)
 
 imessage_router (etl::message_router_id_t id_)
 
 imessage_router (etl::message_router_id_t id_, imessage_router &successor_)
 

Detailed Description

The FSM class.

Member Function Documentation

◆ accepts()

bool etl::fsm::accepts ( etl::message_id_t  ) const
inlinevirtual

Does this FSM accept the message id? Yes, it accepts everything!

Implements etl::imessage_router.

◆ reset() [1/2]

void etl::fsm::reset ( bool  call_on_exit_state = false)
inline

Reset the FSM to pre-started state.

Parameters
call_on_exit_stateIf true will call on_exit_state() for the current state. Default = false.

◆ reset() [2/2]

void etl::fsm::reset ( bool  call_on_exit_state = false)
inline

Reset the FSM to pre-started state.

Parameters
call_on_exit_stateIf true will call on_exit_state() for the current state. Default = false.

◆ start() [1/2]

void etl::fsm::start ( bool  call_on_enter_state = true)
inline

Starts the FSM. Can only be called once. Subsequent calls will do nothing.

Parameters
call_on_enter_stateIf true will call on_enter_state() for the first state. Default = true.

◆ start() [2/2]

void etl::fsm::start ( bool  call_on_enter_state = true)
inline

Starts the FSM. Can only be called once. Subsequent calls will do nothing.

Parameters
call_on_enter_stateIf true will call on_enter_state() for the first state. Default = true.

The documentation for this class was generated from the following files: