QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
InitialConnectStateMachine.h
Go to the documentation of this file.
1#pragma once
2
3#include "QGCStateMachine.h"
5
6class Vehicle;
10class RetryState;
11
22{
23 Q_OBJECT
24
25public:
26 explicit InitialConnectStateMachine(Vehicle* vehicle, QObject* parent = nullptr);
28
29 void start();
30
31private slots:
32 void _onSubProgressUpdate(double progressValue);
33
34private:
35 // State creation and wiring
36 void _createStates();
37 void _wireTransitions();
38 void _wireProgressTracking();
39
40 // State callbacks
41 void _handleAutopilotVersionSuccess(const mavlink_message_t& message);
42 void _handleAutopilotVersionFailure();
43 void _requestStandardModes(AsyncFunctionState* state);
44 void _requestCompInfo(AsyncFunctionState* state);
45 void _requestParameters(SkippableAsyncState* state);
46 void _onParametersReady(bool ready);
47 void _requestMission(SkippableAsyncState* state);
48 void _requestGeoFence(SkippableAsyncState* state);
49 void _requestRallyPoints(SkippableAsyncState* state);
50 void _signalComplete();
51
52 // Skip predicates
53 bool _shouldSkipAutopilotVersionRequest() const;
54 bool _shouldSkipForArmed() const;
55 bool _shouldSkipForLinkType() const;
56 bool _hasPrimaryLink() const;
57 bool _shouldSkipForPlanLoad();
58
59 QString _lastSkipReason;
60
61 // State pointers for wiring
62 RetryableRequestMessageState* _stateAutopilotVersion = nullptr;
63 AsyncFunctionState* _stateStandardModes = nullptr;
64 AsyncFunctionState* _stateCompInfo = nullptr;
65 SkippableAsyncState* _stateParameters = nullptr;
66 SkippableAsyncState* _stateMission = nullptr;
67 SkippableAsyncState* _stateGeoFence = nullptr;
68 SkippableAsyncState* _stateRallyPoints = nullptr;
69 RetryState* _stateComplete = nullptr;
70 QGCFinalState* _stateFinal = nullptr;
71
72 static constexpr int _autopilotVersionMaxRetries = 1;
73};
struct __mavlink_message mavlink_message_t
Calls a function when entered and waits for an external trigger to advance.
State machine for initial vehicle connection sequence.
Final state for a QGCStateMachine with logging support.
QGroundControl specific state machine with enhanced error handling.
Vehicle * vehicle() const
A state that retries an action and chooses behavior when retries are exhausted.
Definition RetryState.h:15
Requests a MAVLink message with built-in retry logic.
Combines skip condition checking with async operation setup in a single state.