OS  v1.7.5
Documentation
Loading...
Searching...
No Matches
qOS::sm::handler_t Class Referencefinal

The state callback argument to handle the state-machine dynamics and provide execution information. Some methods can be written to perform state-transitions. More...

#include <fsm.hpp>

Public Member Functions

void nextState (state &s, historyMode m=historyMode::NO_HISTORY) noexcept
 Produce a transition to the desired state.
 
void startState (state &s) noexcept
 Set the nested initial state ( sub-state ). This The application writer should change this field to set the initial transition if the current state is a parent(or composite state). Using this method only takes effect when the state is executed under the signalID::SIGNAL_START signal.
 
bool timeoutSet (const index_t i, const qOS::duration_t t) noexcept
 Set the time for the selected built-in timeout inside the target FSM.
 
bool timeoutStop (const index_t i) noexcept
 Stop the time count for the selected built-in timeout.
 
statethisState (void) noexcept
 Get a reference to state being evaluated.
 
stateMachinethisMachine (void) noexcept
 Gets a reference to the state machine in which this state is contained.
 
signalID signal (void) const noexcept
 Get the Signal ID currently being evaluated for this state.
 
status lastStatus (void) const noexcept
 The last state return status.
 

Public Attributes

void * SignalData
 
void * Data
 
void * StateData
 

Detailed Description

The state callback argument to handle the state-machine dynamics and provide execution information. Some methods can be written to perform state-transitions.

Note
Should be used only in state-callbacks as the only input argument.

Member Function Documentation

◆ lastStatus()

status qOS::sm::handler_t::lastStatus ( void ) const
inlinenoexcept

The last state return status.

Note
Only available in the surrounding callback.
Returns
The las state return status.

◆ nextState()

void qOS::sm::handler_t::nextState ( state & s,
historyMode m = historyMode::NO_HISTORY )
inlinenoexcept

Produce a transition to the desired state.

Parameters
[in]sThe state object.
[in]mThe transition to history mode. This argument can be ignored ( default = sm::historyMode::NO_HISTORY ).

◆ signal()

signalID qOS::sm::handler_t::signal ( void ) const
inlinenoexcept

Get the Signal ID currently being evaluated for this state.

Returns
The signal ID.

◆ startState()

void qOS::sm::handler_t::startState ( state & s)
inlinenoexcept

Set the nested initial state ( sub-state ). This The application writer should change this field to set the initial transition if the current state is a parent(or composite state). Using this method only takes effect when the state is executed under the signalID::SIGNAL_START signal.

Parameters
[in]sThe state object.

◆ thisMachine()

stateMachine & qOS::sm::handler_t::thisMachine ( void )
inlinenoexcept

Gets a reference to the state machine in which this state is contained.

Returns
a reference to the state machine.

◆ thisState()

state & qOS::sm::handler_t::thisState ( void )
inlinenoexcept

Get a reference to state being evaluated.

Returns
A reference to the state being evaluated..

◆ timeoutSet()

bool qOS::sm::handler_t::timeoutSet ( const index_t i,
const qOS::duration_t t )
noexcept

Set the time for the selected built-in timeout inside the target FSM.

Precondition
Requires an installed timeout-specification. For this use stateMachine::install()
Requires an installed signal-queue. For this use stateMachine::install()
Parameters
[in]iThe index of the requested timeout (0, 1, 2 ... (Q_FSM_MAX_TIMEOUTS-1) )
[in]tThe specified time given in milliseconds.
Returns
Returns true on success, otherwise returns false.

◆ timeoutStop()

bool qOS::sm::handler_t::timeoutStop ( const index_t i)
noexcept

Stop the time count for the selected built-in timeout.

Precondition
Requires an installed timeout-specification. For this use stateMachine::install()
Requires an installed signal-queue. For this use stateMachine::install()
Parameters
[in]iThe index of the timeout (0, 1, 2 ... (Q_FSM_MAX_TIMEOUTS-1) )
Returns
Returns true on success, otherwise returns false.

Member Data Documentation

◆ Data

void* qOS::sm::handler_t::Data

The user storage pointer. If the FSM its running as a task, this will point to the event_t structure

◆ SignalData

void* qOS::sm::handler_t::SignalData

The data with which the signal is associated

◆ StateData

void* qOS::sm::handler_t::StateData

The state user storage pointer