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"
4#include "MAVLinkLib.h"
5
6#include <QtCore/QLoggingCategory>
7
8Q_DECLARE_LOGGING_CATEGORY(InitialConnectStateMachineLog)
9
10class Vehicle;
14class RetryState;
15
24{
25 Q_OBJECT
26
27public:
28 explicit InitialConnectStateMachine(Vehicle* vehicle, QObject* parent = nullptr);
30
31 void start();
32
33private slots:
34 void _onSubProgressUpdate(double progressValue);
35
36private:
37 // State creation and wiring
38 void _createStates();
39 void _wireTransitions();
40 void _wireProgressTracking();
41 void _wireTimeoutHandling();
42
43 // State callbacks
44 void _handleAutopilotVersionSuccess(const mavlink_message_t& message);
45 void _handleAutopilotVersionFailure();
46 void _requestStandardModes(AsyncFunctionState* state);
47 void _requestCompInfo(AsyncFunctionState* state);
48 void _requestParameters(AsyncFunctionState* state);
49 void _onParametersReady(bool ready);
50 void _requestMission(SkippableAsyncState* state);
51 void _requestGeoFence(SkippableAsyncState* state);
52 void _requestRallyPoints(SkippableAsyncState* state);
53 void _signalComplete();
54
55 // Skip predicates
56 bool _shouldSkipAutopilotVersionRequest() const;
57 bool _shouldSkipForLinkType() const;
58 bool _hasPrimaryLink() const;
59
60 // State pointers for wiring
61 RetryableRequestMessageState* _stateAutopilotVersion = nullptr;
62 AsyncFunctionState* _stateStandardModes = nullptr;
63 AsyncFunctionState* _stateCompInfo = nullptr;
64 AsyncFunctionState* _stateParameters = nullptr;
65 SkippableAsyncState* _stateMission = nullptr;
66 SkippableAsyncState* _stateGeoFence = nullptr;
67 SkippableAsyncState* _stateRallyPoints = nullptr;
68 RetryState* _stateComplete = nullptr;
69 QGCFinalState* _stateFinal = nullptr;
70
71 // Timeout handling with retry
72 static constexpr int _maxRetries = 1;
73
74 // Timeout values (ms)
75 static constexpr int _timeoutAutopilotVersion = 5000;
76 static constexpr int _timeoutStandardModes = 5000;
77 static constexpr int _timeoutCompInfo = 30000;
78 static constexpr int _timeoutParameters = 60000;
79 static constexpr int _timeoutMission = 30000;
80 static constexpr int _timeoutGeoFence = 15000;
81 static constexpr int _timeoutRallyPoints = 15000;
82};
Q_DECLARE_LOGGING_CATEGORY(AndroidSerialLog)
struct __mavlink_message mavlink_message_t
Final state for a QGCStateMachine with logging support.
QGroundControl specific state machine with enhanced error handling.