QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGCFinalState.cc
Go to the documentation of this file.
1#include "QGCFinalState.h"
2#include "QGCState.h"
3#include "QGCStateMachine.h"
4#include "Vehicle.h"
5
6QGCFinalState::QGCFinalState(const QString& stateName, QState* parent)
7 : QFinalState(parent)
8{
9 setObjectName(stateName);
10
11 connect(this, &QFinalState::entered, this, [this]() {
12 qCDebug(QGCStateMachineLog) << "Entered" << this->stateName();
13 });
14 connect(this, &QState::exited, this, [this]() {
15 qCDebug(QGCStateMachineLog) << "Exited" << this->stateName();
16 });
17}
18
20 : QGCFinalState(QStringLiteral("FinalState"), parent)
21{
22}
23
25{
26 auto* m = machine();
27 if (m) {
28 return QStringLiteral("%1:%2").arg(objectName(), m->machineName());
29 }
30 return objectName();
31}
32
34{
35 return qobject_cast<QGCStateMachine*>(QFinalState::machine());
36}
37
39{
40 auto* m = machine();
41 return m ? m->vehicle() : nullptr;
42}
Final state for a QGCStateMachine with logging support.
QGCFinalState(const QString &stateName, QState *parent=nullptr)
Vehicle * vehicle() const
QString stateName() const
QGCStateMachine * machine() const
QGroundControl specific state machine with enhanced error handling.