|
QGroundControl
Ground Control Station for MAVLink Drones
|
Mock implementation of Mavlink FTP server. More...
#include <MockLinkFTP.h>
Inheritance diagram for MockLinkFTP:
Collaboration diagram for MockLinkFTP:Public Types | |
| enum | ErrorMode_t { errModeNone , errModeNoResponse , errModeNakResponse , errModeNoSecondResponse , errModeNoSecondResponseAllowRetry , errModeNakSecondResponse , errModeBadSequence } |
| By calling setErrorMode with one of these modes you can cause the server to simulate an error. More... | |
Signals | |
| void | terminateCommandReceived () |
| You can connect to this signal to be notified when the server receives a Terminate command. | |
| void | resetCommandReceived () |
| You can connect to this signal to be notified when the server receives a Reset command. | |
Public Member Functions | |
| MockLinkFTP (uint8_t systemIdServer, uint8_t componentIdServer, MockLink *mockLink) | |
| ~MockLinkFTP () | |
| void | setFileList (const QStringList &fileList) |
| void | mavlinkMessageReceived (const mavlink_message_t &message) |
| Called to handle an FTP message. | |
| void | enableRandomDrops (bool enable) |
| void | enableBinParamFile (bool enable) |
| QStringList | uploadedFiles () const |
| Returns the list of remote paths which have been uploaded in this session. | |
| QByteArray | uploadedFileContents (const QString &remotePath) const |
| Returns the contents of an uploaded file. Empty if the path is unknown. | |
| void | clearUploadedFiles () |
| Clears the stored uploaded file contents. | |
| void | setErrorMode (ErrorMode_t errMode) |
| Sets the error mode for command responses. This allows you to simulate various server errors. | |
Static Public Attributes | |
| static constexpr const ErrorMode_t | rgFailureModes [] |
| static constexpr const size_t | cFailureModes = std::size(MockLinkFTP::rgFailureModes) |
| The number of ErrorModes in the rgFailureModes array. | |
| static constexpr const char * | sizeFilenamePrefix = "mocklink-size-" |
Mock implementation of Mavlink FTP server.
Definition at line 17 of file MockLinkFTP.h.
By calling setErrorMode with one of these modes you can cause the server to simulate an error.
Definition at line 45 of file MockLinkFTP.h.
| MockLinkFTP::MockLinkFTP | ( | uint8_t | systemIdServer, |
| uint8_t | componentIdServer, | ||
| MockLink * | mockLink | ||
| ) |
Definition at line 10 of file MockLinkFTP.cc.
| MockLinkFTP::~MockLinkFTP | ( | ) |
Definition at line 19 of file MockLinkFTP.cc.
|
inline |
Clears the stored uploaded file contents.
Definition at line 42 of file MockLinkFTP.h.
|
inline |
Definition at line 33 of file MockLinkFTP.h.
|
inline |
Definition at line 32 of file MockLinkFTP.h.
| void MockLinkFTP::mavlinkMessageReceived | ( | const mavlink_message_t & | message | ) |
Called to handle an FTP message.
Definition at line 386 of file MockLinkFTP.cc.
References errModeNakResponse, errModeNoResponse, MavlinkFTP::kCmdBurstReadFile, MavlinkFTP::kCmdCreateFile, MavlinkFTP::kCmdListDirectory, MavlinkFTP::kCmdNone, MavlinkFTP::kCmdOpenFileRO, MavlinkFTP::kCmdOpenFileWO, MavlinkFTP::kCmdReadFile, MavlinkFTP::kCmdResetSessions, MavlinkFTP::kCmdTerminateSession, MavlinkFTP::kCmdWriteFile, MavlinkFTP::kErrFail, MavlinkFTP::kErrUnknownCommand, MavlinkFTP::kRspAck, and MockLink::respondWithMavlinkMessage().
|
signal |
You can connect to this signal to be notified when the server receives a Reset command.
|
inline |
Sets the error mode for command responses. This allows you to simulate various server errors.
Definition at line 56 of file MockLinkFTP.h.
|
inline |
Sets the list of files returned by the List command. Prepend names with F or D to indicate (F)ile or (D)irectory.
Definition at line 27 of file MockLinkFTP.h.
|
signal |
You can connect to this signal to be notified when the server receives a Terminate command.
|
inline |
Returns the contents of an uploaded file. Empty if the path is unknown.
Definition at line 39 of file MockLinkFTP.h.
|
inline |
Returns the list of remote paths which have been uploaded in this session.
Definition at line 36 of file MockLinkFTP.h.
|
staticconstexpr |
The number of ErrorModes in the rgFailureModes array.
Definition at line 70 of file MockLinkFTP.h.
|
staticconstexpr |
Array of failure modes you can cycle through for testing. By looping through this array you can avoid hardcoding the specific error modes in your unit test. This way when new error modes are added your unit test code may not need to be modified.
Definition at line 61 of file MockLinkFTP.h.
|
staticconstexpr |
Definition at line 72 of file MockLinkFTP.h.