|
QGroundControl
Ground Control Station for MAVLink Drones
|
#include <ErrorRecoveryBuilder.h>
Public Types | |
| enum | ExhaustedBehavior { EmitError , EmitAdvance , LogAndError , LogAndAdvance } |
| What to do when all recovery options are exhausted. More... | |
| using | Action = std::function< bool()> |
| using | VoidAction = std::function< void()> |
Public Member Functions | |
| ErrorRecoveryBuilder (QGCStateMachine *machine, const QString &stateName) | |
| ErrorRecoveryBuilder & | withAction (Action action) |
| Set the primary action to execute. | |
| ErrorRecoveryBuilder & | retry (int maxRetries, int delayMsecs=1000) |
| ErrorRecoveryBuilder & | withFallback (Action fallback) |
| Add a fallback action to try if primary fails. | |
| ErrorRecoveryBuilder & | withRollback (VoidAction rollback) |
| Add a rollback action to execute on failure. | |
| ErrorRecoveryBuilder & | onExhausted (ExhaustedBehavior behavior) |
| Configure what happens when all options are exhausted. | |
| ErrorRecoveryBuilder & | withTimeout (int timeoutMsecs) |
| Set a timeout for the entire operation. | |
| QGCState * | build () |
| Build and return the configured state. | |
Fluent builder for creating error recovery states.
Combines multiple error recovery patterns into a single state using a declarative fluent API.
Example usage:
Definition at line 26 of file ErrorRecoveryBuilder.h.
| using ErrorRecoveryBuilder::Action = std::function<bool()> |
Definition at line 29 of file ErrorRecoveryBuilder.h.
| using ErrorRecoveryBuilder::VoidAction = std::function<void()> |
Definition at line 30 of file ErrorRecoveryBuilder.h.
What to do when all recovery options are exhausted.
| Enumerator | |
|---|---|
| EmitError | Emit error() signal (default) |
| EmitAdvance | Continue anyway (skip) |
| LogAndError | Log warning and emit error() |
| LogAndAdvance | Log warning and continue. |
Definition at line 33 of file ErrorRecoveryBuilder.h.
| ErrorRecoveryBuilder::ErrorRecoveryBuilder | ( | QGCStateMachine * | machine, |
| const QString & | stateName | ||
| ) |
Definition at line 9 of file ErrorRecoveryBuilder.cc.
| QGCState * ErrorRecoveryBuilder::build | ( | ) |
Build and return the configured state.
Definition at line 52 of file ErrorRecoveryBuilder.cc.
| ErrorRecoveryBuilder & ErrorRecoveryBuilder::onExhausted | ( | ExhaustedBehavior | behavior | ) |
Configure what happens when all options are exhausted.
Definition at line 40 of file ErrorRecoveryBuilder.cc.
| ErrorRecoveryBuilder & ErrorRecoveryBuilder::retry | ( | int | maxRetries, |
| int | delayMsecs = 1000 |
||
| ) |
Configure retry behavior
| maxRetries | Maximum number of retry attempts |
| delayMsecs | Delay between retries |
Definition at line 21 of file ErrorRecoveryBuilder.cc.
| ErrorRecoveryBuilder & ErrorRecoveryBuilder::withAction | ( | Action | action | ) |
Set the primary action to execute.
Definition at line 15 of file ErrorRecoveryBuilder.cc.
| ErrorRecoveryBuilder & ErrorRecoveryBuilder::withFallback | ( | Action | fallback | ) |
Add a fallback action to try if primary fails.
Definition at line 28 of file ErrorRecoveryBuilder.cc.
| ErrorRecoveryBuilder & ErrorRecoveryBuilder::withRollback | ( | VoidAction | rollback | ) |
Add a rollback action to execute on failure.
Definition at line 34 of file ErrorRecoveryBuilder.cc.
| ErrorRecoveryBuilder & ErrorRecoveryBuilder::withTimeout | ( | int | timeoutMsecs | ) |
Set a timeout for the entire operation.
Definition at line 46 of file ErrorRecoveryBuilder.cc.