QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGCHistoryState.cc
Go to the documentation of this file.
1#include "QGCHistoryState.h"
2#include "QGCStateMachine.h"
3
4QGCHistoryState::QGCHistoryState(const QString& stateName, QState* parent, HistoryType historyType)
5 : QHistoryState(historyType, parent)
6{
7 setObjectName(stateName);
8
9 connect(this, &QHistoryState::entered, this, [this]() {
10 qCDebug(QGCStateMachineLog) << "Entered history state" << this->stateName();
11 });
12 connect(this, &QHistoryState::exited, this, [this]() {
13 qCDebug(QGCStateMachineLog) << "Exited history state" << this->stateName();
14 });
15}
16
18{
19 return qobject_cast<QGCStateMachine*>(QHistoryState::machine());
20}
21
23{
24 auto* m = machine();
25 return m ? m->vehicle() : nullptr;
26}
27
29{
30 if (machine()) {
31 return QStringLiteral("%1:%2").arg(objectName(), machine()->machineName());
32 }
33 return objectName();
34}
Vehicle * vehicle() const
QString stateName() const
QGCStateMachine * machine() const
QGCHistoryState(const QString &stateName, QState *parent, HistoryType historyType=ShallowHistory)
QGroundControl specific state machine with enhanced error handling.