QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
AsyncFunctionState.cc
Go to the documentation of this file.
3
4AsyncFunctionState::AsyncFunctionState(const QString& stateName, QState* parent, SetupFunction setupFunction, int timeoutMsecs)
5 : WaitStateBase(stateName, parent, timeoutMsecs)
6 , _setupFunction(std::move(setupFunction))
7{
8}
9
11{
12 // Connection is set up dynamically via connectToCompletion() in the setup function
13}
14
16{
17 if (_completionConnection) {
18 disconnect(_completionConnection);
19 _completionConnection = {};
20 }
21}
22
24{
25 if (_setupFunction) {
26 _setupFunction(this);
27 }
28
29 if (!_completionConnection && timeoutMsecs() == 0) {
30 qCCritical(QGCStateMachineLog) << stateName()
31 << "has no completion connection and no timeout - state may hang indefinitely";
32 }
33}
void connectWaitSignal() override
Subclasses override to set up their signal connections.
void disconnectWaitSignal() override
Subclasses override to tear down their signal connections.
void onWaitEntered() override
Called when the state is entered - subclasses should call base implementation.
std::function< void(AsyncFunctionState *state)> SetupFunction
AsyncFunctionState(const QString &stateName, QState *parent, SetupFunction setupFunction, int timeoutMsecs=0)
QString stateName() const
int timeoutMsecs() const