QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
SubMachineState.h
Go to the documentation of this file.
1#pragma once
2
3#include "QGCState.h"
4
5#include <functional>
6
8
13{
14 Q_OBJECT
15 Q_DISABLE_COPY(SubMachineState)
16
17public:
21 using MachineFactory = std::function<QGCStateMachine*(SubMachineState* parent)>;
22
27 SubMachineState(const QString& stateName, QState* parent, MachineFactory factory);
28
30 QGCStateMachine* childMachine() const { return _childMachine; }
31
32signals:
34 void childError();
35
36protected:
37 void onEntry(QEvent* event) override;
38 void onExit(QEvent* event) override;
39
40private slots:
41 void _onChildFinished();
42 void _onChildError();
43
44private:
45 MachineFactory _factory;
46 QGCStateMachine* _childMachine = nullptr;
47};
QString stateName() const
bool event(QEvent *event) override
QGroundControl specific state machine with enhanced error handling.
void childError()
Emitted when the child machine encounters an error.
void onEntry(QEvent *event) override
void onExit(QEvent *event) override
QGCStateMachine * childMachine() const
Get the currently running child machine (nullptr if not running)
std::function< QGCStateMachine *(SubMachineState *parent)> MachineFactory