|
QGroundControl
Ground Control Station for MAVLink Drones
|
#include <QGCAbstractState.h>
Inheritance diagram for QGCAbstractState:
Collaboration diagram for QGCAbstractState:Public Types | |
| using | EntryCallback = std::function< void()> |
| using | ExitCallback = std::function< void()> |
| using | EventHandler = std::function< bool(QEvent *)> |
Signals | |
| void | advance () |
| void | error () |
Public Member Functions | |
| QGCAbstractState (const QString &stateName, QState *parent) | |
| QGCStateMachine * | machine () const |
| Vehicle * | vehicle () const |
| QString | stateName () const |
| class StateContext * | context () const |
| void | setOnEntry (EntryCallback callback) |
| Set a callback to be invoked when the state is entered. | |
| void | setOnExit (ExitCallback callback) |
| Set a callback to be invoked when the state is exited. | |
| void | setCallbacks (EntryCallback onEntry, ExitCallback onExit=nullptr) |
| Set both entry and exit callbacks. | |
| void | setEventHandler (EventHandler handler) |
| Set a custom event handler for this state. | |
Protected Member Functions | |
| virtual void | onEnter () |
| Override to perform actions on state entry. | |
| virtual void | onLeave () |
| Override to perform actions on state exit. | |
| void | onEntry (QEvent *event) override |
| void | onExit (QEvent *event) override |
| bool | event (QEvent *event) override |
Lightweight base class for simple states.
Use QGCAbstractState when:
Use QGCState when:
Definition at line 27 of file QGCAbstractState.h.
| using QGCAbstractState::EntryCallback = std::function<void()> |
Definition at line 33 of file QGCAbstractState.h.
| using QGCAbstractState::EventHandler = std::function<bool(QEvent*)> |
Definition at line 35 of file QGCAbstractState.h.
| using QGCAbstractState::ExitCallback = std::function<void()> |
Definition at line 34 of file QGCAbstractState.h.
| QGCAbstractState::QGCAbstractState | ( | const QString & | stateName, |
| QState * | parent | ||
| ) |
Definition at line 5 of file QGCAbstractState.cc.
References stateName().
|
signal |
| StateContext * QGCAbstractState::context | ( | ) | const |
Get the state machine's context for inter-state data passing
Definition at line 21 of file QGCAbstractState.cc.
References machine().
|
signal |
|
overrideprotected |
Definition at line 65 of file QGCAbstractState.cc.
References event().
Referenced by event(), ParallelState::onEntry(), onEntry(), SubMachineState::onEntry(), ParallelState::onExit(), onExit(), and SubMachineState::onExit().
| QGCStateMachine * QGCAbstractState::machine | ( | ) | const |
Definition at line 11 of file QGCAbstractState.cc.
Referenced by EventQueuedState::connectWaitSignal(), context(), WaitStateBase::restartWait(), stateName(), and vehicle().
|
inlineprotectedvirtual |
Override to perform actions on state entry.
Reimplemented in ErrorRecoveryState, CircuitBreakerState, FallbackChainState, LoopState< T >, ProgressState, RetryState, RollbackState, and SequenceState.
Definition at line 73 of file QGCAbstractState.h.
Referenced by onEntry().
|
overrideprotected |
Definition at line 41 of file QGCAbstractState.cc.
References event(), onEnter(), and stateName().
Referenced by ParallelState::onEntry(), SubMachineState::onEntry(), and setCallbacks().
|
overrideprotected |
Definition at line 53 of file QGCAbstractState.cc.
References event(), onLeave(), and stateName().
Referenced by ParallelState::onExit(), SubMachineState::onExit(), and setCallbacks().
|
inlineprotectedvirtual |
Override to perform actions on state exit.
Definition at line 76 of file QGCAbstractState.h.
Referenced by onExit().
| void QGCAbstractState::setCallbacks | ( | EntryCallback | onEntry, |
| ExitCallback | onExit = nullptr |
||
| ) |
Set both entry and exit callbacks.
Definition at line 35 of file QGCAbstractState.cc.
|
inline |
Set a custom event handler for this state.
Definition at line 65 of file QGCAbstractState.h.
|
inline |
Set a callback to be invoked when the state is entered.
Definition at line 52 of file QGCAbstractState.h.
|
inline |
Set a callback to be invoked when the state is exited.
Definition at line 55 of file QGCAbstractState.h.
| QString QGCAbstractState::stateName | ( | ) | const |
Definition at line 26 of file QGCAbstractState.cc.
References machine().
Referenced by DelayState::DelayState(), CircuitBreakerState::onEnter(), RollbackState::onEnter(), ParallelState::onEntry(), onEntry(), SubMachineState::onEntry(), ParallelState::onExit(), onExit(), SubMachineState::onExit(), AsyncFunctionState::onWaitEntered(), EventQueuedState::onWaitEntered(), RequestMessageState::onWaitEntered(), RetryableRequestMessageState::onWaitEntered(), SkippableAsyncState::onWaitEntered(), RequestMessageState::onWaitTimeout(), RetryableRequestMessageState::onWaitTimeout(), QGCAbstractState(), CircuitBreakerState::reset(), QGCState::setLocalErrorState(), and ShowAppMessageState::ShowAppMessageState().
| Vehicle * QGCAbstractState::vehicle | ( | ) | const |
Definition at line 16 of file QGCAbstractState.cc.
References machine().
Referenced by SendMavlinkCommandState::connectWaitSignal(), WaitForMavlinkMessageState::connectWaitSignal(), SendMavlinkCommandState::disconnectWaitSignal(), WaitForMavlinkMessageState::disconnectWaitSignal(), RequestMessageState::onWaitEntered(), and SendMavlinkCommandState::onWaitEntered().