|
QGroundControl
Ground Control Station for MAVLink Drones
|
#include <FTPManager.h>
Inheritance diagram for FTPManager:
Collaboration diagram for FTPManager:Signals | |
| void | downloadComplete (const QString &file, const QString &errorMsg) |
| void | uploadComplete (const QString &file, const QString &errorMsg) |
| void | listDirectoryComplete (const QStringList &dirList, const QString &errorMsg) |
| void | deleteComplete (const QString &file, const QString &errorMsg) |
| void | commandProgress (float value) |
Public Member Functions | |
| FTPManager (Vehicle *vehicle) | |
| bool | download (uint8_t fromCompId, const QString &fromURI, const QString &toDir, const QString &fileName="", bool checksize=true) |
| bool | upload (uint8_t toCompId, const QString &toURI, const QString &fromFile) |
| bool | listDirectory (uint8_t fromCompId, const QString &fromURI) |
| bool | listDirectoryWithTimeUnsupported () const |
| true when the vehicle NAK'ed kCmdListDirectoryWithTime, i.e. directory listings carry no modification times. | |
| bool | deleteFile (uint8_t fromCompId, const QString &fromURI) |
| void | cancelDownload () |
| void | cancelListDirectory () |
| void | cancelDelete () |
| void | cancelUpload () |
Static Public Attributes | |
| static constexpr const char * | mavlinkFTPScheme = "mftp" |
| static constexpr uint8_t | kFullReadChunkSize = sizeof(MavlinkFTP::Request::data) |
| Bytes requested per ReadFile/BurstReadFile chunk on non-radio links: the full FTP payload. | |
| static constexpr uint8_t | kRadioReadChunkSize = 110 |
| static constexpr int | kMaxDownloadSessionReopens = 2 |
| Max times a download re-opens after the server expires the session (PX4 idle timer fires mid-burst) | |
| static constexpr int | kTestAckTimeoutMs = 10 |
| Ack timeout used in unit tests (much shorter for faster tests) | |
| static constexpr int | kTestOperationMaxWaitMs = 5000 |
| Maximum wait time for FTP operations in unit tests (generous for multi-packet transfers) | |
Friends | |
| class | Vehicle |
Definition at line 11 of file FTPManager.h.
| FTPManager::FTPManager | ( | Vehicle * | vehicle | ) |
Definition at line 17 of file FTPManager.cc.
References QGC::runningUnitTests().
| void FTPManager::cancelDelete | ( | ) |
Cancel the delete operation if running. This will emit deleteComplete() with an error string when finished.
Definition at line 264 of file FTPManager.cc.
Referenced by FTPController::cancelActiveOperation().
| void FTPManager::cancelDownload | ( | ) |
Cancel the download operation This will emit downloadComplete() when done, and if there's currently a download in progress
Definition at line 215 of file FTPManager.cc.
Referenced by OnboardLogController::cancel(), and FTPController::cancelActiveOperation().
| void FTPManager::cancelListDirectory | ( | ) |
Cancel the list directory operation if running. This will emit listDirectoryComplete() with an error string when finished.
Definition at line 226 of file FTPManager.cc.
Referenced by OnboardLogController::cancel(), and FTPController::cancelActiveOperation().
| void FTPManager::cancelUpload | ( | ) |
Cancel the upload operation This will emit uploadComplete() when done, and if there's currently an upload in progress
Definition at line 239 of file FTPManager.cc.
Referenced by FTPController::cancelActiveOperation().
|
signal |
Signalled during a lengthy command to show progress
| value | Amount of progress: 0.0 = none, 1.0 = complete |
Referenced by FTPController::FTPController().
|
signal |
Referenced by FTPController::FTPController().
| bool FTPManager::deleteFile | ( | uint8_t | fromCompId, |
| const QString & | fromURI | ||
| ) |
Deletes a file on the vehicle.
| fromCompId | Component id of the component to delete from. If fromCompId is MAV_COMP_ID_ALL, then MAV_COMP_ID_AUTOPILOT1 is used. |
| fromURI | File path to delete on the component. May include mftp:// scheme and optional component id selector. |
Definition at line 186 of file FTPManager.cc.
Referenced by FTPController::deleteFile().
| bool FTPManager::download | ( | uint8_t | fromCompId, |
| const QString & | fromURI, | ||
| const QString & | toDir, | ||
| const QString & | fileName = "", |
||
| bool | checksize = true |
||
| ) |
Downloads the specified file.
| fromCompId | Component id of the component to download from. If fromCompId is MAV_COMP_ID_ALL, then MAV_COMP_ID_AUTOPILOT1 is used. |
| fromURI | File to download from component, fully qualified path. May be in the format "mftp://[;comp=<id>]..." where the component id is specified. If component id is not specified, then the id set via fromCompId is used. |
| toDir | Local directory to download file to |
| filename | (optional) |
| checksize | (optional, default true) If true compare the filesize indicated in the open response with the transmitted filesize. If false the transmission is tftp style and the indicated filesize from MAVFTP fileopen response is ignored. This is used for the APM parameter download where the filesize is wrong due to a dynamic file creation on the vehicle. |
Definition at line 32 of file FTPManager.cc.
Referenced by FTPController::downloadFile().
|
signal |
Referenced by FTPController::FTPController().
| bool FTPManager::listDirectory | ( | uint8_t | fromCompId, |
| const QString & | fromURI | ||
| ) |
Get the directory listing of the specified directory.
| fromCompId | Component id of the component to download from. If fromCompId is MAV_COMP_ID_ALL, then MAV_COMP_ID_AUTOPILOT1 is used. |
| fromURI | Directory path to list from component. May be in the format "mftp://[;comp=<id>]..." where the component id is specified. If component id is not specified, then the id set via fromCompId is used. |
Definition at line 144 of file FTPManager.cc.
References MavlinkFTP::kCmdListDirectory, MavlinkFTP::kCmdListDirectoryWithTime, and MavlinkFTP::opCodeToString().
Referenced by FTPController::listDirectory().
|
signal |
Referenced by FTPController::FTPController().
|
inline |
true when the vehicle NAK'ed kCmdListDirectoryWithTime, i.e. directory listings carry no modification times.
Definition at line 52 of file FTPManager.h.
| bool FTPManager::upload | ( | uint8_t | toCompId, |
| const QString & | toURI, | ||
| const QString & | fromFile | ||
| ) |
Uploads a local file to the specified URI on the vehicle.
| toCompId | Component id of the component to upload to. If toCompId is MAV_COMP_ID_ALL, then MAV_COMP_ID_AUTOPILOT1 is used. |
| toURI | Destination file path on the vehicle, fully qualified. May include mftp:// scheme and optional component id selector. |
| fromFile | Local filesystem path of the file to upload. |
Definition at line 89 of file FTPManager.cc.
Referenced by FTPController::uploadFile().
|
signal |
Referenced by FTPController::FTPController().
|
friend |
Definition at line 15 of file FTPManager.h.
|
staticconstexpr |
Bytes requested per ReadFile/BurstReadFile chunk on non-radio links: the full FTP payload.
Definition at line 285 of file FTPManager.h.
|
staticconstexpr |
Max times a download re-opens after the server expires the session (PX4 idle timer fires mid-burst)
Definition at line 291 of file FTPManager.h.
|
staticconstexpr |
Chunk size on SiK/RFD radio links. Keeps each FTP packet inside one ~252 byte air frame; a full payload spans two frames and is lost if either is. On the wire: 12 MAVLink v2 + 15 FTP fixed + 110 = 137 bytes (150 signed), leaving room for the radio to coalesce a telemetry packet into the same frame.
Definition at line 289 of file FTPManager.h.
|
staticconstexpr |
Ack timeout used in unit tests (much shorter for faster tests)
Definition at line 293 of file FTPManager.h.
|
staticconstexpr |
Maximum wait time for FTP operations in unit tests (generous for multi-packet transfers)
Definition at line 295 of file FTPManager.h.
|
staticconstexpr |
Definition at line 77 of file FTPManager.h.