QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
RollbackState.h
Go to the documentation of this file.
1#pragma once
2
3#include "QGCState.h"
4
5#include <functional>
6
22class RollbackState : public QGCState
23{
24 Q_OBJECT
25 Q_DISABLE_COPY(RollbackState)
26
27public:
29 using ForwardAction = std::function<bool()>;
30
32 using RollbackAction = std::function<void()>;
33
38 RollbackState(const QString& stateName, QState* parent,
39 ForwardAction forwardAction, RollbackAction rollbackAction);
40
42 bool wasRolledBack() const { return _wasRolledBack; }
43
45 bool rollbackSucceeded() const { return _rollbackSucceeded; }
46
47signals:
50
53
56
59
60protected:
61 void onEnter() override;
62
63private:
64 ForwardAction _forwardAction;
65 RollbackAction _rollbackAction;
66 bool _wasRolledBack = false;
67 bool _rollbackSucceeded = false;
68};
QString stateName() const
void onEnter() override
Override to perform actions on state entry.
bool wasRolledBack() const
Check if rollback was executed.
std::function< bool()> ForwardAction
Forward action - returns true on success.
void forwardSucceeded()
Emitted when forward action succeeds.
void rollingBack()
Emitted when rollback starts.
bool rollbackSucceeded() const
Check if rollback succeeded (only valid if wasRolledBack() is true)
void forwardFailed()
Emitted when forward action fails (before rollback)
void rollbackComplete()
Emitted when rollback completes.
std::function< void()> RollbackAction
Rollback action - executed on forward failure.