QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
MockLink Class Reference

#include <MockLink.h>

Inheritance diagram for MockLink:
Collaboration diagram for MockLink:

Public Types

enum  RequestMessageFailureMode_t { FailRequestMessageNone , FailRequestMessageCommandAcceptedMsgNotSent , FailRequestMessageCommandUnsupported , FailRequestMessageCommandNoResponse }
enum  ParamSetFailureMode_t { FailParamSetNone , FailParamSetNoAck , FailParamSetFirstAttemptNoAck , FailParamSetParamError }
enum  ParamRequestReadFailureMode_t { FailParamRequestReadNone , FailParamRequestReadNoResponse , FailParamRequestReadFirstAttemptNoResponse , FailParamRequestReadParamError }
enum  TakeoffFailureMode_t { FailTakeoffNone , FailTakeoffRejected , FailTakeoffNoResponse }

Signals

void writeBytesQueuedSignal (const QByteArray &bytes)
void highLatencyTransmissionEnabledChanged (bool highLatencyTransmissionEnabled)
Signals inherited from LinkInterface
void bytesReceived (LinkInterface *link, const QByteArray &data)
void bytesSent (LinkInterface *link, const QByteArray &data)
void connected ()
void disconnected ()
void communicationError (const QString &title, const QString &error)

Public Member Functions

 MockLink (SharedLinkConfigurationPtr &config, QObject *parent=nullptr)
virtual ~MockLink ()
void run1HzTasks ()
void run10HzTasks ()
void run500HzTasks ()
void sendStatusTextMessages ()
void sendBootStatusTextMessages ()
bool shouldSendStatusText () const
bool isConnected () const final
void disconnect () final
Q_INVOKABLE void setCommLost (bool commLost)
Q_INVOKABLE void simulateConnectionRemoved ()
void waitForWorkerIdle ()
quint32 vehicleId () const
MAV_AUTOPILOT getFirmwareType () const
double vehicleLatitude () const
double vehicleLongitude () const
double vehicleAltitudeAMSL () const
QGeoCoordinate homeCoordinate () const
 Configured home position, before the per-vehicle offset applied to the vehicle position.
bool signingEnabled () const
void respondWithMavlinkMessage (const mavlink_message_t &msg)
 Sends the specified mavlink message to QGC.
void sendStatusTextMessage (uint8_t severity, const QString &text)
void setCalibrationPose (MockLinkPX4Calibration::Pose pose) const
 Test API: places the simulated vehicle into the given pose during calibration.
bool failCalibration () const
 Test API: the simulated PX4 calibration which is running fails and stops, as the firmware does.
void setBaroCalibrationFails (bool fails)
 Test API: makes the simulated PX4 barometer calibration report that it has no GPS.
void setLevelCalibrationFails (bool fails)
 Test API: makes the simulated PX4 level horizon calibration report that the vehicle moved.
void setGyroCalibrationFails (bool fails)
 Test API: makes the simulated PX4 gyroscope calibration report that the vehicle moved.
void setInlineCalibrationStalls (bool stalls)
 Test API: makes the simulated PX4 baro, level horizon and gyroscope calibrations run until cancelled.
void setLargeVehicleCalibrationRejected (bool rejected)
 Test API: makes the simulated PX4 refuse the large vehicle compass calibration command, as it does when armed.
MockLinkFTP * mockLinkFTP () const
MockLinkGimbal * mockLinkGimbal () const
void setVehicleAttitudeOverrideDeg (float rollDeg, float pitchDeg, float yawDeg)
void clearVehicleAttitudeOverride ()
void setArmed (bool armed)
 Set the armed state of the simulated vehicle.
bool armed () const
void setMissionItemFailureMode (MockLinkMissionItemHandler::FailureMode_t failureMode, MAV_MISSION_RESULT failureAckResult) const
void sendUnexpectedMissionAck (MAV_MISSION_RESULT ackType) const
 Called to send a MISSION_ACK message while the MissionManager is in idle state.
void sendUnexpectedMissionItem () const
 Called to send a MISSION_ITEM message while the MissionManager is in idle state.
void sendUnexpectedMissionRequest () const
 Called to send a MISSION_REQUEST message while the MissionManager is in idle state.
void sendUnexpectedCommandAck (MAV_CMD command, MAV_RESULT ackResult)
void resetMissionItemHandler () const
 Reset the state of the MissionItemHandler to no items, no transactions in progress.
void loadSimpleMultirotorMission () const
 Test-only: seeds a simple multirotor mission (takeoff, waypoint, RTL) onto the simulated vehicle.
QString logDownloadFile () const
 Returns the filename for the simulated log file. Only available after a download is requested.
uint8_t outgoingMavlinkChannel () const
 Vehicle-side channel used to encode outgoing (mock vehicle -> QGC) messages. Signing state lives here.
void clearReceivedMavCommandCounts ()
int receivedMavCommandCount (MAV_CMD command) const
int receivedMavCommandCount (MAV_CMD command, int compId) const
int receivedRequestMessageCount (int compId, int messageId) const
void clearReceivedRequestMessageCounts ()
int receivedRequestMessageCount (uint32_t messageId) const
void clearReceivedMavlinkMessageCounts ()
int receivedMavlinkMessageCount (uint32_t messageId) const
bool lastReceivedMavlinkMessage (uint32_t messageId, mavlink_message_t &message) const
 Returns the last received message with the given id. Returns false if none received.
int receivedMissionRequestListCount (MAV_MISSION_TYPE type) const
void bumpAvailableModesMonitorSequence ()
void setAvailableModesSequenceBumpAtIndex (uint8_t index, bool repeat=false)
 Unit test support: change the AVAILABLE_MODES sequence immediately before sending this index.
void setDuplicateResponses (bool duplicate)
 Unit test support: sends every vehicle->QGC message twice, as when two links receive the same traffic.
void setRequestMessageFailureMode (RequestMessageFailureMode_t failureMode)
void setRequestMessageNoResponse (uint32_t messageId, bool noResponse=true)
void setParamSetFailureMode (ParamSetFailureMode_t mode)
void setParamRequestReadFailureMode (ParamRequestReadFailureMode_t mode)
void setHashCheckNoResponse (bool noResponse)
void setResetSysAutostartOnParamReset (bool reset)
int hashCheckRequestCount () const
 Returns the number of standalone PARAM_REQUEST_READ requests for _HASH_CHECK received.
QList< QPair< int, int > > paramRequestReadIndexLog () const
 Index-based PARAM_REQUEST_READs received, in arrival order: (componentId, paramIndex).
QList< int > paramRequestListTargetLog () const
 Target component of each PARAM_REQUEST_LIST received, in arrival order.
void setMockParamValue (int componentId, const QString &paramName, float value)
 Change a float parameter value directly on MockLink (for testing cache invalidation).
void startAPMStaleFailedMagCalReportStreaming ()
bool apmStaleFailedMagCalReportStreamingActive () const
 Returns true while the stale failed MAG_CAL_REPORT stream is active.
void setAPMMagCalStartFailureMode (bool fail)
void setTakeoffFailureMode (TakeoffFailureMode_t mode)
void setInt32ParamValue (int componentId, const QString &paramName, int32_t value)
void setFloatParamValue (int componentId, const QString &paramName, float value)
 Change a float parameter value directly on MockLink, like setInt32ParamValue.
QVariant paramValue (int componentId, const QString &paramName) const
void setRemoteIDArmStatus (uint8_t status, const QString &error)
void setPrearmCheck (bool enabled, bool passed)
void servedVideoStream (MockConfiguration::VideoStreamType &type, QString &uri) const
bool cameraStreamTransmitted (uint8_t compId, uint8_t streamId) const
MockConfiguration::VideoStreamType requestedVideoStreamType () const
 Video stream type the configuration requested (immutable after construction).
Public Member Functions inherited from LinkInterface
virtual ~LinkInterface ()
virtual bool isLogReplay () const
virtual bool isSecureConnection () const
virtual bool isRadioLink () const
void reportRadioStatusReceived ()
SharedLinkConfigurationPtr linkConfiguration ()
const SharedLinkConfigurationPtr linkConfiguration () const
uint8_t mavlinkChannel () const
bool mavlinkChannelIsSet () const
bool decodedFirstMavlinkPacket () const
void setDecodedFirstMavlinkPacket (bool decodedFirstMavlinkPacket)
void writeBytesThreadSafe (const char *bytes, int length)
void sendMessageThreadSafe (mavlink_message_t &message)
void addVehicleReference ()
void removeVehicleReference ()
void reportMavlinkV1Traffic ()
void reportMavlinkV2Traffic ()
 Called when a v2 message is received: permanently suppresses the v1-only warning for this link.
bool mavlinkV1TrafficReported () const
SigningController * signing ()
 Per-link signing state and confirmation state machine. Non-null after channel allocation.
const SigningController * signing () const

Static Public Member Functions

static MockLink * startPX4MockLink (MockConfiguration::Options options=MockConfiguration::OptionNone, MockConfiguration::FailureMode_t failureMode=MockConfiguration::FailNone, MockConfiguration::VideoStreamType videoStreamType=MockConfiguration::VideoStreamNone)
static MockLink * startMockLink (MockConfiguration *mockConfig)
 Starts a MockLink from a fully caller-configured MockConfiguration (ownership transfers to LinkManager).
static MockLink * startPX4MockLinkWithMission (MockConfiguration::Options options=MockConfiguration::OptionNone, MockConfiguration::FailureMode_t failureMode=MockConfiguration::FailNone)
static MockLink * startGenericMockLink (MockConfiguration::Options options=MockConfiguration::OptionNone, MockConfiguration::FailureMode_t failureMode=MockConfiguration::FailNone, MockConfiguration::VideoStreamType videoStreamType=MockConfiguration::VideoStreamNone)
static MockLink * startNoInitialConnectMockLink (MockConfiguration::Options options=MockConfiguration::OptionNone, MockConfiguration::FailureMode_t failureMode=MockConfiguration::FailNone)
static MockLink * startAPMArduCopterMockLink (MockConfiguration::Options options=MockConfiguration::OptionNone, MockConfiguration::FailureMode_t failureMode=MockConfiguration::FailNone, MockConfiguration::VideoStreamType videoStreamType=MockConfiguration::VideoStreamNone)
static MockLink * startAPMArduPlaneMockLink (MockConfiguration::Options options=MockConfiguration::OptionNone, MockConfiguration::FailureMode_t failureMode=MockConfiguration::FailNone, MockConfiguration::VideoStreamType videoStreamType=MockConfiguration::VideoStreamNone)
static MockLink * startAPMArduSubMockLink (MockConfiguration::Options options=MockConfiguration::OptionNone, MockConfiguration::FailureMode_t failureMode=MockConfiguration::FailNone, MockConfiguration::VideoStreamType videoStreamType=MockConfiguration::VideoStreamNone)
static MockLink * startAPMArduRoverMockLink (MockConfiguration::Options options=MockConfiguration::OptionNone, MockConfiguration::FailureMode_t failureMode=MockConfiguration::FailNone, MockConfiguration::VideoStreamType videoStreamType=MockConfiguration::VideoStreamNone)
Static Public Member Functions inherited from LinkInterface
static void setMavlinkV1TrafficGraceMsecs (int msecs)

Static Public Attributes

static constexpr MAV_CMD MAV_CMD_MOCKLINK_ALWAYS_RESULT_ACCEPTED = MAV_CMD_USER_1
static constexpr MAV_CMD MAV_CMD_MOCKLINK_ALWAYS_RESULT_FAILED = MAV_CMD_USER_2
static constexpr MAV_CMD MAV_CMD_MOCKLINK_SECOND_ATTEMPT_RESULT_ACCEPTED = MAV_CMD_USER_3
static constexpr MAV_CMD MAV_CMD_MOCKLINK_SECOND_ATTEMPT_RESULT_FAILED = MAV_CMD_USER_4
static constexpr MAV_CMD MAV_CMD_MOCKLINK_NO_RESPONSE = MAV_CMD_USER_5
static constexpr MAV_CMD MAV_CMD_MOCKLINK_NO_RESPONSE_NO_RETRY = static_cast<MAV_CMD>(MAV_CMD_USER_5 + 1)
static constexpr MAV_CMD MAV_CMD_MOCKLINK_RESULT_IN_PROGRESS_ACCEPTED = static_cast<MAV_CMD>(MAV_CMD_USER_5 + 2)
static constexpr MAV_CMD MAV_CMD_MOCKLINK_RESULT_IN_PROGRESS_FAILED = static_cast<MAV_CMD>(MAV_CMD_USER_5 + 3)
static constexpr MAV_CMD MAV_CMD_MOCKLINK_RESULT_IN_PROGRESS_NO_ACK = static_cast<MAV_CMD>(MAV_CMD_USER_5 + 4)
Static Public Attributes inherited from LinkInterface
static constexpr int kMavlinkV1TrafficGraceMsecsDefault = 10000

Friends

class MockLinkFTP
class StandardModesTest

Additional Inherited Members

Protected Member Functions inherited from LinkInterface
 LinkInterface (SharedLinkConfigurationPtr &config, QObject *parent=nullptr)
 Links are only created by LinkManager so constructor is not public.
void _connectionRemoved ()
void _shutdownWorkerThread (QThread *thread, const QLoggingCategory &category, bool allowTerminate=true)
Protected Attributes inherited from LinkInterface
SharedLinkConfigurationPtr _config

Detailed Description

Definition at line 31 of file MockLink.h.

Member Enumeration Documentation

◆ ParamRequestReadFailureMode_t

Enumerator
FailParamRequestReadNone 

Normal behavior.

FailParamRequestReadNoResponse 

Do not respond to PARAM_REQUEST_READ.

FailParamRequestReadFirstAttemptNoResponse 

Skip response on first attempt, respond to retry.

FailParamRequestReadParamError 

Respond with PARAM_ERROR (DOES_NOT_EXIST) instead of PARAM_VALUE.

Definition at line 201 of file MockLink.h.

◆ ParamSetFailureMode_t

Enumerator
FailParamSetNone 

Normal behavior.

FailParamSetNoAck 

Do not send PARAM_VALUE ack.

FailParamSetFirstAttemptNoAck 

Skip ack on first attempt, respond to retry.

FailParamSetParamError 

Respond with PARAM_ERROR (VALUE_OUT_OF_RANGE) instead of PARAM_VALUE.

Definition at line 190 of file MockLink.h.

◆ RequestMessageFailureMode_t

Enumerator
FailRequestMessageNone 
FailRequestMessageCommandAcceptedMsgNotSent 
FailRequestMessageCommandUnsupported 
FailRequestMessageCommandNoResponse 

Definition at line 171 of file MockLink.h.

◆ TakeoffFailureMode_t

Enumerator
FailTakeoffNone 

Normal behavior.

FailTakeoffRejected 

MAV_RESULT_TEMPORARILY_REJECTED, as PX4 sends when it cannot enter Takeoff.

FailTakeoffNoResponse 

Do not ack MAV_CMD_NAV_TAKEOFF.

Definition at line 242 of file MockLink.h.

Constructor & Destructor Documentation

◆ MockLink()

◆ ~MockLink()

MockLink::~MockLink ( )
virtual

Definition at line 256 of file MockLink.cc.

References disconnect().

Member Function Documentation

◆ apmStaleFailedMagCalReportStreamingActive()

bool MockLink::apmStaleFailedMagCalReportStreamingActive ( ) const

Returns true while the stale failed MAG_CAL_REPORT stream is active.

Definition at line 3735 of file MockLink.cc.

◆ armed()

bool MockLink::armed ( ) const
inline

Definition at line 109 of file MockLink.h.

Referenced by setArmed().

◆ bumpAvailableModesMonitorSequence()

void MockLink::bumpAvailableModesMonitorSequence ( )
inline

Unit test support: bumps the AVAILABLE_MODES_MONITOR sequence number, which unlocks the delayed flight mode and causes QGC to re-query standard modes.

Definition at line 159 of file MockLink.h.

◆ cameraStreamTransmitted()

bool MockLink::cameraStreamTransmitted ( uint8_t compId,
uint8_t streamId ) const

Whether the simulated camera compId transmits its stream streamId, as MAV_CMD_VIDEO_START_STREAMING and MAV_CMD_VIDEO_STOP_STREAMING left it. False without a simulated camera.

Definition at line 418 of file MockLink.cc.

◆ clearReceivedMavCommandCounts()

void MockLink::clearReceivedMavCommandCounts ( )
inline

Definition at line 139 of file MockLink.h.

◆ clearReceivedMavlinkMessageCounts()

void MockLink::clearReceivedMavlinkMessageCounts ( )
inline

Definition at line 145 of file MockLink.h.

◆ clearReceivedRequestMessageCounts()

void MockLink::clearReceivedRequestMessageCounts ( )
inline

Definition at line 143 of file MockLink.h.

◆ clearVehicleAttitudeOverride()

void MockLink::clearVehicleAttitudeOverride ( )

Definition at line 3623 of file MockLink.cc.

◆ disconnect()

void MockLink::disconnect ( )
finalvirtual

◆ failCalibration()

bool MockLink::failCalibration ( ) const
inline

Test API: the simulated PX4 calibration which is running fails and stops, as the firmware does.

Definition at line 82 of file MockLink.h.

◆ getFirmwareType()

MAV_AUTOPILOT MockLink::getFirmwareType ( ) const
inline

Definition at line 60 of file MockLink.h.

◆ hashCheckRequestCount()

int MockLink::hashCheckRequestCount ( ) const
inline

Returns the number of standalone PARAM_REQUEST_READ requests for _HASH_CHECK received.

Definition at line 220 of file MockLink.h.

◆ highLatencyTransmissionEnabledChanged

void MockLink::highLatencyTransmissionEnabledChanged ( bool highLatencyTransmissionEnabled)
signal

◆ homeCoordinate()

QGeoCoordinate MockLink::homeCoordinate ( ) const
inline

Configured home position, before the per-vehicle offset applied to the vehicle position.

Definition at line 67 of file MockLink.h.

◆ isConnected()

bool MockLink::isConnected ( ) const
inlinefinalvirtual

Implements LinkInterface.

Definition at line 49 of file MockLink.h.

◆ lastReceivedMavlinkMessage()

bool MockLink::lastReceivedMavlinkMessage ( uint32_t messageId,
mavlink_message_t & message ) const
inline

Returns the last received message with the given id. Returns false if none received.

Definition at line 148 of file MockLink.h.

◆ loadSimpleMultirotorMission()

void MockLink::loadSimpleMultirotorMission ( ) const
inline

Test-only: seeds a simple multirotor mission (takeoff, waypoint, RTL) onto the simulated vehicle.

Definition at line 131 of file MockLink.h.

◆ logDownloadFile()

QString MockLink::logDownloadFile ( ) const
inline

Returns the filename for the simulated log file. Only available after a download is requested.

Definition at line 134 of file MockLink.h.

◆ mockLinkFTP()

MockLinkFTP * MockLink::mockLinkFTP ( ) const

Definition at line 3609 of file MockLink.cc.

References MockLinkFTP.

◆ mockLinkGimbal()

MockLinkGimbal * MockLink::mockLinkGimbal ( ) const
inline

Definition at line 100 of file MockLink.h.

◆ outgoingMavlinkChannel()

uint8_t MockLink::outgoingMavlinkChannel ( ) const
inline

Vehicle-side channel used to encode outgoing (mock vehicle -> QGC) messages. Signing state lives here.

Definition at line 137 of file MockLink.h.

◆ paramRequestListTargetLog()

QList< int > MockLink::paramRequestListTargetLog ( ) const
inline

Target component of each PARAM_REQUEST_LIST received, in arrival order.

Definition at line 225 of file MockLink.h.

◆ paramRequestReadIndexLog()

QList< QPair< int, int > > MockLink::paramRequestReadIndexLog ( ) const
inline

Index-based PARAM_REQUEST_READs received, in arrival order: (componentId, paramIndex).

Definition at line 222 of file MockLink.h.

◆ paramValue()

QVariant MockLink::paramValue ( int componentId,
const QString & paramName ) const

Returns the current MockLink-side value of a parameter, including PX4 unused parameters. Used by unit tests to verify that PARAM_SET writes reached the simulated firmware.

Definition at line 2177 of file MockLink.cc.

◆ receivedMavCommandCount() [1/2]

int MockLink::receivedMavCommandCount ( MAV_CMD command) const
inline

Definition at line 140 of file MockLink.h.

◆ receivedMavCommandCount() [2/2]

int MockLink::receivedMavCommandCount ( MAV_CMD command,
int compId ) const
inline

Definition at line 141 of file MockLink.h.

◆ receivedMavlinkMessageCount()

int MockLink::receivedMavlinkMessageCount ( uint32_t messageId) const
inline

Definition at line 146 of file MockLink.h.

◆ receivedMissionRequestListCount()

int MockLink::receivedMissionRequestListCount ( MAV_MISSION_TYPE type) const
inline

Definition at line 155 of file MockLink.h.

◆ receivedRequestMessageCount() [1/2]

int MockLink::receivedRequestMessageCount ( int compId,
int messageId ) const
inline

Definition at line 142 of file MockLink.h.

◆ receivedRequestMessageCount() [2/2]

int MockLink::receivedRequestMessageCount ( uint32_t messageId) const
inline

Definition at line 144 of file MockLink.h.

◆ requestedVideoStreamType()

MockConfiguration::VideoStreamType MockLink::requestedVideoStreamType ( ) const
inline

Video stream type the configuration requested (immutable after construction).

Definition at line 295 of file MockLink.h.

◆ resetMissionItemHandler()

void MockLink::resetMissionItemHandler ( ) const
inline

Reset the state of the MissionItemHandler to no items, no transactions in progress.

Definition at line 128 of file MockLink.h.

◆ respondWithMavlinkMessage()

void MockLink::respondWithMavlinkMessage ( const mavlink_message_t & msg)

Sends the specified mavlink message to QGC.

Definition at line 1160 of file MockLink.cc.

References LinkInterface::bytesReceived().

Referenced by sendStatusTextMessage(), and sendUnexpectedCommandAck().

◆ run10HzTasks()

void MockLink::run10HzTasks ( )

◆ run1HzTasks()

void MockLink::run1HzTasks ( )

◆ run500HzTasks()

void MockLink::run500HzTasks ( )

◆ sendBootStatusTextMessages()

void MockLink::sendBootStatusTextMessages ( )

Definition at line 546 of file MockLink.cc.

References sendStatusTextMessage().

◆ sendStatusTextMessage()

void MockLink::sendStatusTextMessage ( uint8_t severity,
const QString & text )

Sends a STATUSTEXT message to QGC

Parameters
severityMAV_SEVERITY value

Definition at line 3072 of file MockLink.cc.

References respondWithMavlinkMessage().

Referenced by sendBootStatusTextMessages().

◆ sendStatusTextMessages()

void MockLink::sendStatusTextMessages ( )

Definition at line 541 of file MockLink.cc.

◆ sendUnexpectedCommandAck()

void MockLink::sendUnexpectedCommandAck ( MAV_CMD command,
MAV_RESULT ackResult )

Definition at line 2525 of file MockLink.cc.

References respondWithMavlinkMessage().

◆ sendUnexpectedMissionAck()

void MockLink::sendUnexpectedMissionAck ( MAV_MISSION_RESULT ackType) const
inline

Called to send a MISSION_ACK message while the MissionManager is in idle state.

Definition at line 117 of file MockLink.h.

◆ sendUnexpectedMissionItem()

void MockLink::sendUnexpectedMissionItem ( ) const
inline

Called to send a MISSION_ITEM message while the MissionManager is in idle state.

Definition at line 120 of file MockLink.h.

◆ sendUnexpectedMissionRequest()

void MockLink::sendUnexpectedMissionRequest ( ) const
inline

Called to send a MISSION_REQUEST message while the MissionManager is in idle state.

Definition at line 123 of file MockLink.h.

◆ servedVideoStream()

void MockLink::servedVideoStream ( MockConfiguration::VideoStreamType & type,
QString & uri ) const

Thread-safe snapshot of the video stream actually being served (VideoStreamNone/empty when none is served). Safe to call from the worker thread while _connect()/disconnect() mutate the served state on the main thread. MockLinkCamera advertises VIDEO_STREAM_INFORMATION consistent with this snapshot.

Definition at line 423 of file MockLink.cc.

◆ setAPMMagCalStartFailureMode()

void MockLink::setAPMMagCalStartFailureMode ( bool fail)
inline

When enabled, MAV_CMD_DO_START_MAG_CAL is rejected with MAV_RESULT_FAILED instead of starting the compass cal simulation.

Definition at line 240 of file MockLink.h.

◆ setArmed()

void MockLink::setArmed ( bool armed)
inline

Set the armed state of the simulated vehicle.

Definition at line 108 of file MockLink.h.

References armed().

Referenced by MockLink().

◆ setAvailableModesSequenceBumpAtIndex()

void MockLink::setAvailableModesSequenceBumpAtIndex ( uint8_t index,
bool repeat = false )
inline

Unit test support: change the AVAILABLE_MODES sequence immediately before sending this index.

Definition at line 162 of file MockLink.h.

◆ setBaroCalibrationFails()

void MockLink::setBaroCalibrationFails ( bool fails)
inline

Test API: makes the simulated PX4 barometer calibration report that it has no GPS.

Definition at line 85 of file MockLink.h.

◆ setCalibrationPose()

void MockLink::setCalibrationPose ( MockLinkPX4Calibration::Pose pose) const
inline

Test API: places the simulated vehicle into the given pose during calibration.

Definition at line 79 of file MockLink.h.

◆ setCommLost()

Q_INVOKABLE void MockLink::setCommLost ( bool commLost)
inline

Definition at line 52 of file MockLink.h.

References setCommLost().

Referenced by setCommLost().

◆ setDuplicateResponses()

void MockLink::setDuplicateResponses ( bool duplicate)
inline

Unit test support: sends every vehicle->QGC message twice, as when two links receive the same traffic.

Definition at line 169 of file MockLink.h.

◆ setFloatParamValue()

void MockLink::setFloatParamValue ( int componentId,
const QString & paramName,
float value )
inline

Change a float parameter value directly on MockLink, like setInt32ParamValue.

Definition at line 256 of file MockLink.h.

◆ setGyroCalibrationFails()

void MockLink::setGyroCalibrationFails ( bool fails)
inline

Test API: makes the simulated PX4 gyroscope calibration report that the vehicle moved.

Definition at line 91 of file MockLink.h.

◆ setHashCheckNoResponse()

void MockLink::setHashCheckNoResponse ( bool noResponse)
inline

Definition at line 212 of file MockLink.h.

◆ setInlineCalibrationStalls()

void MockLink::setInlineCalibrationStalls ( bool stalls)
inline

Test API: makes the simulated PX4 baro, level horizon and gyroscope calibrations run until cancelled.

Definition at line 94 of file MockLink.h.

◆ setInt32ParamValue()

void MockLink::setInt32ParamValue ( int componentId,
const QString & paramName,
int32_t value )
inline

Change an int32 parameter value directly on MockLink. Used to simulate the firmware storing calibration results (e.g. CAL_MAG0_ID).

Definition at line 253 of file MockLink.h.

◆ setLargeVehicleCalibrationRejected()

void MockLink::setLargeVehicleCalibrationRejected ( bool rejected)
inline

Test API: makes the simulated PX4 refuse the large vehicle compass calibration command, as it does when armed.

Definition at line 97 of file MockLink.h.

◆ setLevelCalibrationFails()

void MockLink::setLevelCalibrationFails ( bool fails)
inline

Test API: makes the simulated PX4 level horizon calibration report that the vehicle moved.

Definition at line 88 of file MockLink.h.

◆ setMissionItemFailureMode()

void MockLink::setMissionItemFailureMode ( MockLinkMissionItemHandler::FailureMode_t failureMode,
MAV_MISSION_RESULT failureAckResult ) const
inline

Sets a failure mode for unit testing

Parameters
failureModeType of failure to simulate
failureAckResultError to send if one the ack error modes

Definition at line 114 of file MockLink.h.

◆ setMockParamValue()

void MockLink::setMockParamValue ( int componentId,
const QString & paramName,
float value )

Change a float parameter value directly on MockLink (for testing cache invalidation).

Definition at line 1603 of file MockLink.cc.

◆ setParamRequestReadFailureMode()

void MockLink::setParamRequestReadFailureMode ( ParamRequestReadFailureMode_t mode)
inline

Definition at line 207 of file MockLink.h.

References FailParamRequestReadFirstAttemptNoResponse.

◆ setParamSetFailureMode()

void MockLink::setParamSetFailureMode ( ParamSetFailureMode_t mode)
inline

Definition at line 196 of file MockLink.h.

References FailParamSetFirstAttemptNoAck.

◆ setPrearmCheck()

void MockLink::setPrearmCheck ( bool enabled,
bool passed )

Sets the MAV_SYS_STATUS_PREARM_CHECK enabled and health bits in the 1Hz SYS_STATUS, sending the new status immediately when connected

Definition at line 3485 of file MockLink.cc.

◆ setRemoteIDArmStatus()

void MockLink::setRemoteIDArmStatus ( uint8_t status,
const QString & error )

Override the OPEN_DRONE_ID_ARM_STATUS the simulated RID device sends at 1Hz, sending the new status immediately when connected. status is a MAV_ODID_ARM_STATUS value.

Definition at line 3470 of file MockLink.cc.

◆ setRequestMessageFailureMode()

void MockLink::setRequestMessageFailureMode ( RequestMessageFailureMode_t failureMode)
inline

Definition at line 177 of file MockLink.h.

◆ setRequestMessageNoResponse()

void MockLink::setRequestMessageNoResponse ( uint32_t messageId,
bool noResponse = true )
inline

Block or unblock REQUEST_MESSAGE responses for a specific message ID. When blocked, MockLink silently drops the request (no ACK, no message).

Definition at line 181 of file MockLink.h.

◆ setResetSysAutostartOnParamReset()

void MockLink::setResetSysAutostartOnParamReset ( bool reset)
inline

Controls whether SYS_AUTOSTART is also reset when a MAV_CMD_PREFLIGHT_STORAGE param1=2 (reset params to defaults) command is received. Defaults to false so the simulated airframe doesn't change.

Definition at line 217 of file MockLink.h.

◆ setTakeoffFailureMode()

void MockLink::setTakeoffFailureMode ( TakeoffFailureMode_t mode)
inline

Definition at line 249 of file MockLink.h.

◆ setVehicleAttitudeOverrideDeg()

void MockLink::setVehicleAttitudeOverrideDeg ( float rollDeg,
float pitchDeg,
float yawDeg )

Test API: pins the simulated vehicle attitude (degrees) in place of the default sinusoid. Heading reported by Vehicle::heading() is truncated to whole degrees, so pass integral yaw.

Definition at line 3614 of file MockLink.cc.

◆ shouldSendStatusText()

bool MockLink::shouldSendStatusText ( ) const
inline

Definition at line 47 of file MockLink.h.

◆ signingEnabled()

bool MockLink::signingEnabled ( ) const
inline

Definition at line 69 of file MockLink.h.

◆ simulateConnectionRemoved()

void MockLink::simulateConnectionRemoved ( )

Definition at line 3603 of file MockLink.cc.

References LinkInterface::_connectionRemoved().

◆ startAPMArduCopterMockLink()

MockLink * MockLink::startAPMArduCopterMockLink ( MockConfiguration::Options options = MockConfiguration::OptionNone,
MockConfiguration::FailureMode_t failureMode = MockConfiguration::FailNone,
MockConfiguration::VideoStreamType videoStreamType = MockConfiguration::VideoStreamNone )
static

Definition at line 2967 of file MockLink.cc.

References MockLink().

◆ startAPMArduPlaneMockLink()

MockLink * MockLink::startAPMArduPlaneMockLink ( MockConfiguration::Options options = MockConfiguration::OptionNone,
MockConfiguration::FailureMode_t failureMode = MockConfiguration::FailNone,
MockConfiguration::VideoStreamType videoStreamType = MockConfiguration::VideoStreamNone )
static

Definition at line 2972 of file MockLink.cc.

References MockLink().

◆ startAPMArduRoverMockLink()

MockLink * MockLink::startAPMArduRoverMockLink ( MockConfiguration::Options options = MockConfiguration::OptionNone,
MockConfiguration::FailureMode_t failureMode = MockConfiguration::FailNone,
MockConfiguration::VideoStreamType videoStreamType = MockConfiguration::VideoStreamNone )
static

Definition at line 2982 of file MockLink.cc.

References MockLink().

◆ startAPMArduSubMockLink()

MockLink * MockLink::startAPMArduSubMockLink ( MockConfiguration::Options options = MockConfiguration::OptionNone,
MockConfiguration::FailureMode_t failureMode = MockConfiguration::FailNone,
MockConfiguration::VideoStreamType videoStreamType = MockConfiguration::VideoStreamNone )
static

Definition at line 2977 of file MockLink.cc.

References MockLink().

◆ startAPMStaleFailedMagCalReportStreaming()

void MockLink::startAPMStaleFailedMagCalReportStreaming ( )

Simulates ArduPilot streaming MAG_CAL_REPORT(MAG_CAL_FAILED) after a failed onboard compass cal. Like real ArduPilot, the failed report keeps streaming until MAV_CMD_DO_CANCEL_MAG_CAL is received; MAV_CMD_DO_START_MAG_CAL does not stop it.

Definition at line 3728 of file MockLink.cc.

◆ startGenericMockLink()

MockLink * MockLink::startGenericMockLink ( MockConfiguration::Options options = MockConfiguration::OptionNone,
MockConfiguration::FailureMode_t failureMode = MockConfiguration::FailNone,
MockConfiguration::VideoStreamType videoStreamType = MockConfiguration::VideoStreamNone )
static

Definition at line 2957 of file MockLink.cc.

References MockLink().

◆ startMockLink()

MockLink * MockLink::startMockLink ( MockConfiguration * mockConfig)
inlinestatic

Starts a MockLink from a fully caller-configured MockConfiguration (ownership transfers to LinkManager).

Definition at line 275 of file MockLink.h.

References MockLink().

Referenced by QGroundControlQmlGlobal::startMockLink().

◆ startNoInitialConnectMockLink()

MockLink * MockLink::startNoInitialConnectMockLink ( MockConfiguration::Options options = MockConfiguration::OptionNone,
MockConfiguration::FailureMode_t failureMode = MockConfiguration::FailNone )
static

Definition at line 2962 of file MockLink.cc.

References MockLink().

◆ startPX4MockLink()

MockLink * MockLink::startPX4MockLink ( MockConfiguration::Options options = MockConfiguration::OptionNone,
MockConfiguration::FailureMode_t failureMode = MockConfiguration::FailNone,
MockConfiguration::VideoStreamType videoStreamType = MockConfiguration::VideoStreamNone )
static

Definition at line 2947 of file MockLink.cc.

References MockLink().

◆ startPX4MockLinkWithMission()

MockLink * MockLink::startPX4MockLinkWithMission ( MockConfiguration::Options options = MockConfiguration::OptionNone,
MockConfiguration::FailureMode_t failureMode = MockConfiguration::FailNone )
static

Definition at line 2952 of file MockLink.cc.

References MockLink(), and MockConfiguration::OptionPreloadMission.

◆ vehicleAltitudeAMSL()

double MockLink::vehicleAltitudeAMSL ( ) const
inline

Definition at line 64 of file MockLink.h.

◆ vehicleId()

quint32 MockLink::vehicleId ( ) const
inline

Definition at line 59 of file MockLink.h.

◆ vehicleLatitude()

double MockLink::vehicleLatitude ( ) const
inline

Definition at line 62 of file MockLink.h.

◆ vehicleLongitude()

double MockLink::vehicleLongitude ( ) const
inline

Definition at line 63 of file MockLink.h.

◆ waitForWorkerIdle()

void MockLink::waitForWorkerIdle ( )

Returns once the worker thread has finished the tasks already under way, so whatever they sent is queued for its receivers. Must not be called from the worker thread.

Definition at line 1173 of file MockLink.cc.

◆ writeBytesQueuedSignal

void MockLink::writeBytesQueuedSignal ( const QByteArray & bytes)
signal

Referenced by MockLink().

◆ MockLinkFTP

friend class MockLinkFTP
friend

Definition at line 34 of file MockLink.h.

References MockLinkFTP.

Referenced by MockLink(), MockLinkFTP, and mockLinkFTP().

◆ StandardModesTest

friend class StandardModesTest
friend

Definition at line 35 of file MockLink.h.

References StandardModesTest.

Referenced by StandardModesTest.

Member Data Documentation

◆ MAV_CMD_MOCKLINK_ALWAYS_RESULT_ACCEPTED

MAV_CMD MockLink::MAV_CMD_MOCKLINK_ALWAYS_RESULT_ACCEPTED = MAV_CMD_USER_1
staticconstexpr

Definition at line 298 of file MockLink.h.

◆ MAV_CMD_MOCKLINK_ALWAYS_RESULT_FAILED

MAV_CMD MockLink::MAV_CMD_MOCKLINK_ALWAYS_RESULT_FAILED = MAV_CMD_USER_2
staticconstexpr

Definition at line 299 of file MockLink.h.

◆ MAV_CMD_MOCKLINK_NO_RESPONSE

MAV_CMD MockLink::MAV_CMD_MOCKLINK_NO_RESPONSE = MAV_CMD_USER_5
staticconstexpr

Definition at line 302 of file MockLink.h.

◆ MAV_CMD_MOCKLINK_NO_RESPONSE_NO_RETRY

MAV_CMD MockLink::MAV_CMD_MOCKLINK_NO_RESPONSE_NO_RETRY = static_cast<MAV_CMD>(MAV_CMD_USER_5 + 1)
staticconstexpr

Definition at line 303 of file MockLink.h.

◆ MAV_CMD_MOCKLINK_RESULT_IN_PROGRESS_ACCEPTED

MAV_CMD MockLink::MAV_CMD_MOCKLINK_RESULT_IN_PROGRESS_ACCEPTED = static_cast<MAV_CMD>(MAV_CMD_USER_5 + 2)
staticconstexpr

Definition at line 304 of file MockLink.h.

◆ MAV_CMD_MOCKLINK_RESULT_IN_PROGRESS_FAILED

MAV_CMD MockLink::MAV_CMD_MOCKLINK_RESULT_IN_PROGRESS_FAILED = static_cast<MAV_CMD>(MAV_CMD_USER_5 + 3)
staticconstexpr

Definition at line 305 of file MockLink.h.

◆ MAV_CMD_MOCKLINK_RESULT_IN_PROGRESS_NO_ACK

MAV_CMD MockLink::MAV_CMD_MOCKLINK_RESULT_IN_PROGRESS_NO_ACK = static_cast<MAV_CMD>(MAV_CMD_USER_5 + 4)
staticconstexpr

Definition at line 306 of file MockLink.h.

◆ MAV_CMD_MOCKLINK_SECOND_ATTEMPT_RESULT_ACCEPTED

MAV_CMD MockLink::MAV_CMD_MOCKLINK_SECOND_ATTEMPT_RESULT_ACCEPTED = MAV_CMD_USER_3
staticconstexpr

Definition at line 300 of file MockLink.h.

◆ MAV_CMD_MOCKLINK_SECOND_ATTEMPT_RESULT_FAILED

MAV_CMD MockLink::MAV_CMD_MOCKLINK_SECOND_ATTEMPT_RESULT_FAILED = MAV_CMD_USER_4
staticconstexpr

Definition at line 301 of file MockLink.h.


The documentation for this class was generated from the following files: