6#include <QtCore/QElapsedTimer>
8#include <QtCore/QObject>
9#include <QtCore/QTimer>
31 void sendCommand (
int compId, MAV_CMD command,
bool showError,
float param1 = 0.0f,
float param2 = 0.0f,
float param3 = 0.0f,
float param4 = 0.0f,
float param5 = 0.0f,
float param6 = 0.0f,
float param7 = 0.0f);
32 void sendCommandDelayed (
int compId, MAV_CMD command,
bool showError,
int milliseconds,
float param1 = 0.0f,
float param2 = 0.0f,
float param3 = 0.0f,
float param4 = 0.0f,
float param5 = 0.0f,
float param6 = 0.0f,
float param7 = 0.0f);
33 void sendCommandInt (
int compId, MAV_CMD command, MAV_FRAME frame,
bool showError,
float param1,
float param2,
float param3,
float param4,
double param5,
double param6,
float param7);
35 void sendCommandWithHandler (
const MavCmdAckHandlerInfo_t* ackHandlerInfo,
int compId, MAV_CMD command,
float param1 = 0.0f,
float param2 = 0.0f,
float param3 = 0.0f,
float param4 = 0.0f,
float param5 = 0.0f,
float param6 = 0.0f,
float param7 = 0.0f);
36 void sendCommandIntWithHandler (
const MavCmdAckHandlerInfo_t* ackHandlerInfo,
int compId, MAV_CMD command, MAV_FRAME frame,
float param1 = 0.0f,
float param2 = 0.0f,
float param3 = 0.0f,
float param4 = 0.0f,
double param5 = 0.0,
double param6 = 0.0,
float param7 = 0.0f);
38 void sendCommandWithLambdaFallback(std::function<
void()> lambda,
int compId, MAV_CMD command,
bool showError,
float param1 = 0.0f,
float param2 = 0.0f,
float param3 = 0.0f,
float param4 = 0.0f,
float param5 = 0.0f,
float param6 = 0.0f,
float param7 = 0.0f);
39 void sendCommandIntWithLambdaFallback(std::function<
void()> lambda,
int compId, MAV_CMD command, MAV_FRAME frame,
bool showError,
float param1 = 0.0f,
float param2 = 0.0f,
float param3 = 0.0f,
float param4 = 0.0f,
double param5 = 0.0,
double param6 = 0.0,
float param7 = 0.0f);
45 int compId, MAV_CMD command, MAV_FRAME frame,
46 float param1,
float param2,
float param3,
float param4,
double param5,
double param6,
float param7);
49 bool isPending(
int targetCompId, MAV_CMD command)
const;
74 void commandResult(
int vehicleId,
int targetComponent,
int command,
int ackResult,
int failureCode);
77 void _responseTimeoutCheck();
80 typedef struct MavCommandListEntry {
82 bool useCommandInt =
false;
92 bool showError =
true;
96 QElapsedTimer elapsedTimer;
97 int ackTimeoutMSecs = 0;
98 } MavCommandListEntry_t;
100 void sendCommandWithLambdaFallbackWorker(std::function<
void()> lambda,
bool commandInt,
int compId, MAV_CMD command, MAV_FRAME frame,
bool showError,
float param1,
float param2,
float param3,
float param4,
double param5,
double param6,
float param7);
102 void _sendFromList(
int index);
103 static bool _shouldRetry(MAV_CMD command);
104 static bool _canBeDuplicated(MAV_CMD command);
105 static int _responseCheckIntervalMSecs();
106 static int _ackTimeoutMSecs();
107 static QString _formatCommand(MAV_CMD command,
float param1);
110 QList<MavCommandListEntry_t> _list;
111 QTimer _responseCheckTimer;
112 bool _stopped =
false;
114 static constexpr int _ackTimeoutMSecsDefault = 1200;
115 static constexpr int _ackTimeoutMSecsHighLatency = 120000;
116 static std::optional<int> _testAckTimeoutOverride;
struct __mavlink_message mavlink_message_t
struct __mavlink_command_ack_t mavlink_command_ack_t
Owns the COMMAND_LONG / COMMAND_INT send/retry/ack pipeline for a single Vehicle.
void sendCommandInt(int compId, MAV_CMD command, MAV_FRAME frame, bool showError, float param1, float param2, float param3, float param4, double param5, double param6, float param7)
static QString failureCodeToString(MavCmdResultFailureCode_t failureCode)
void commandResult(int vehicleId, int targetComponent, int command, int ackResult, int failureCode)
Emitted for every terminal ack that has no user-provided resultHandler.
void sendCommandIntWithHandler(const MavCmdAckHandlerInfo_t *ackHandlerInfo, int compId, MAV_CMD command, MAV_FRAME frame, float param1=0.0f, float param2=0.0f, float param3=0.0f, float param4=0.0f, double param5=0.0, double param6=0.0, float param7=0.0f)
static std::optional< int > testAckTimeoutOverride()
void sendCommandWithHandler(const MavCmdAckHandlerInfo_t *ackHandlerInfo, int compId, MAV_CMD command, float param1=0.0f, float param2=0.0f, float param3=0.0f, float param4=0.0f, float param5=0.0f, float param6=0.0f, float param7=0.0f)
static constexpr int kMaxRetryCount
static void setTestAckTimeoutOverride(std::optional< int > msecs)
void sendWorker(bool commandInt, bool showError, const MavCmdAckHandlerInfo_t *ackHandlerInfo, int compId, MAV_CMD command, MAV_FRAME frame, float param1, float param2, float param3, float param4, double param5, double param6, float param7)
void handleCommandAck(const mavlink_message_t &message, const mavlink_command_ack_t &ack)
Process a COMMAND_ACK — match it to a pending entry and fire callbacks.
void sendCommandDelayed(int compId, MAV_CMD command, bool showError, int milliseconds, float param1=0.0f, float param2=0.0f, float param3=0.0f, float param4=0.0f, float param5=0.0f, float param6=0.0f, float param7=0.0f)
bool isPending(int targetCompId, MAV_CMD command) const
True if a matching (targetCompId, command) is already queued or awaiting ack.
static void showCommandAckError(const mavlink_command_ack_t &ack)
void sendCommand(int compId, MAV_CMD command, bool showError, float param1=0.0f, float param2=0.0f, float param3=0.0f, float param4=0.0f, float param5=0.0f, float param6=0.0f, float param7=0.0f)
int findEntryIndex(int targetCompId, MAV_CMD command) const
Index of a matching entry in the pending queue, or -1. Exposed for test use.
void sendCommandIntWithLambdaFallback(std::function< void()> lambda, int compId, MAV_CMD command, MAV_FRAME frame, bool showError, float param1=0.0f, float param2=0.0f, float param3=0.0f, float param4=0.0f, double param5=0.0, double param6=0.0, float param7=0.0f)
void sendCommandWithLambdaFallback(std::function< void()> lambda, int compId, MAV_CMD command, bool showError, float param1=0.0f, float param2=0.0f, float param3=0.0f, float param4=0.0f, float param5=0.0f, float param6=0.0f, float param7=0.0f)
Callback info bundle for sendMavCommandWithHandler.
MavCmdResultFailureCode_t