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

#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 = 91
static constexpr uint8_t kRadioReadChunkSizeSigned = kRadioReadChunkSize - 13
 Chunk size on a signed radio link, where every packet carries a 13 byte signature.
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 = 100
 Keep timeout tests fast while allowing queued MockLink replies during UI startup.
static constexpr int kTestOperationMaxWaitMs = 5000
 Maximum wait time for FTP operations in unit tests (generous for multi-packet transfers).

Friends

class Vehicle

Detailed Description

Definition at line 11 of file FTPManager.h.

Constructor & Destructor Documentation

◆ FTPManager()

FTPManager::FTPManager ( Vehicle * vehicle)

Definition at line 18 of file FTPManager.cc.

References FTPManager(), kTestAckTimeoutMs, QGC::runningUnitTests(), and Vehicle.

Referenced by commandProgress(), and FTPManager().

Member Function Documentation

◆ cancelDelete()

void FTPManager::cancelDelete ( )

Cancel the delete operation if running. This will emit deleteComplete() with an error string when finished.

Definition at line 274 of file FTPManager.cc.

◆ cancelDownload()

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 225 of file FTPManager.cc.

◆ cancelListDirectory()

void FTPManager::cancelListDirectory ( )

Cancel the list directory operation if running. This will emit listDirectoryComplete() with an error string when finished.

Definition at line 236 of file FTPManager.cc.

◆ cancelUpload()

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 249 of file FTPManager.cc.

◆ commandProgress

void FTPManager::commandProgress ( float value)
signal

Signalled during a lengthy command to show progress

Parameters
valueAmount of progress: 0.0 = none, 1.0 = complete

References FTPManager().

Referenced by FTPController::FTPController().

◆ deleteComplete

void FTPManager::deleteComplete ( const QString & file,
const QString & errorMsg )
signal

◆ deleteFile()

bool FTPManager::deleteFile ( uint8_t fromCompId,
const QString & fromURI )

Deletes a file on the vehicle.

Parameters
fromCompIdComponent id of the component to delete from. If fromCompId is MAV_COMP_ID_ALL, then MAV_COMP_ID_AUTOPILOT1 is used.
fromURIFile path to delete on the component. May include mftp:// scheme and optional component id selector.
Returns
true: process has started, false: error Signals deleteComplete

Definition at line 196 of file FTPManager.cc.

◆ download()

bool FTPManager::download ( uint8_t fromCompId,
const QString & fromURI,
const QString & toDir,
const QString & fileName = "",
bool checksize = true )

Downloads the specified file.

Parameters
fromCompIdComponent id of the component to download from. If fromCompId is MAV_COMP_ID_ALL, then MAV_COMP_ID_AUTOPILOT1 is used.
fromURIFile 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.
toDirLocal directory to download file to. Must be non-empty and already exist; otherwise download() returns false without starting.
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.
Returns
true: download has started, false: error, no download and no downloadComplete signal Signals downloadComplete, commandProgress

Definition at line 32 of file FTPManager.cc.

◆ downloadComplete

void FTPManager::downloadComplete ( const QString & file,
const QString & errorMsg )
signal

◆ listDirectory()

bool FTPManager::listDirectory ( uint8_t fromCompId,
const QString & fromURI )

Get the directory listing of the specified directory.

Parameters
fromCompIdComponent id of the component to download from. If fromCompId is MAV_COMP_ID_ALL, then MAV_COMP_ID_AUTOPILOT1 is used.
fromURIDirectory 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.
Returns
true: process has started, false: error Signals listDirectoryComplete

Definition at line 154 of file FTPManager.cc.

References MavlinkFTP::kCmdListDirectory, MavlinkFTP::kCmdListDirectoryWithTime, and MavlinkFTP::opCodeToString().

◆ listDirectoryComplete

void FTPManager::listDirectoryComplete ( const QStringList & dirList,
const QString & errorMsg )
signal

◆ listDirectoryWithTimeUnsupported()

bool FTPManager::listDirectoryWithTimeUnsupported ( ) const
inline

true when the vehicle NAK'ed kCmdListDirectoryWithTime, i.e. directory listings carry no modification times.

Definition at line 56 of file FTPManager.h.

◆ upload()

bool FTPManager::upload ( uint8_t toCompId,
const QString & toURI,
const QString & fromFile )

Uploads a local file to the specified URI on the vehicle.

Parameters
toCompIdComponent id of the component to upload to. If toCompId is MAV_COMP_ID_ALL, then MAV_COMP_ID_AUTOPILOT1 is used.
toURIDestination file path on the vehicle, fully qualified. May include mftp:// scheme and optional component id selector.
fromFileLocal filesystem path of the file to upload.
Returns
true: upload started, false: error, no upload Signals uploadComplete, commandProgress

Definition at line 99 of file FTPManager.cc.

◆ uploadComplete

void FTPManager::uploadComplete ( const QString & file,
const QString & errorMsg )
signal

◆ Vehicle

friend class Vehicle
friend

Definition at line 15 of file FTPManager.h.

References Vehicle.

Referenced by FTPManager(), and Vehicle.

Member Data Documentation

◆ kFullReadChunkSize

uint8_t FTPManager::kFullReadChunkSize = sizeof(MavlinkFTP::Request::data)
staticconstexpr

Bytes requested per ReadFile/BurstReadFile chunk on non-radio links: the full FTP payload.

Definition at line 289 of file FTPManager.h.

◆ kMaxDownloadSessionReopens

int FTPManager::kMaxDownloadSessionReopens = 2
staticconstexpr

Max times a download re-opens after the server expires the session (PX4 idle timer fires mid-burst).

Definition at line 297 of file FTPManager.h.

◆ kRadioReadChunkSize

uint8_t FTPManager::kRadioReadChunkSize = 91
staticconstexpr

Chunk size on SiK/RFD radio links, so each FTP packet fits in one radio packet. A SiK radio's limit (max_data_packet_length, reported by ATI6) is 250 bytes, but only 118 with error correction enabled, which we cannot detect. On the wire: 12 MAVLink v2 + 15 FTP fixed + 91 = 118 bytes.

Definition at line 293 of file FTPManager.h.

◆ kRadioReadChunkSizeSigned

uint8_t FTPManager::kRadioReadChunkSizeSigned = kRadioReadChunkSize - 13
staticconstexpr

Chunk size on a signed radio link, where every packet carries a 13 byte signature.

Definition at line 295 of file FTPManager.h.

◆ kTestAckTimeoutMs

int FTPManager::kTestAckTimeoutMs = 100
staticconstexpr

Keep timeout tests fast while allowing queued MockLink replies during UI startup.

Definition at line 299 of file FTPManager.h.

Referenced by FTPManager().

◆ kTestOperationMaxWaitMs

int FTPManager::kTestOperationMaxWaitMs = 5000
staticconstexpr

Maximum wait time for FTP operations in unit tests (generous for multi-packet transfers).

Definition at line 301 of file FTPManager.h.

◆ mavlinkFTPScheme

const char* FTPManager::mavlinkFTPScheme = "mftp"
staticconstexpr

Definition at line 81 of file FTPManager.h.


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