mavsdk::Ftp Class Reference
#include: ftp.h
Implements file transfer functionality using MAVLink FTP.
Data Structures
struct ProgressData
Public Types
Type | Description |
---|---|
enum Result | Possible results returned for FTP commands. |
std::function< void(Result)> ResultCallback | Callback type for asynchronous Ftp calls. |
std::function< void(Result, ProgressData)> DownloadCallback | Callback type for download_async. |
std::function< void(Result, ProgressData)> UploadCallback | Callback type for upload_async. |
std::function< void(Result, std::vector< std::string >)> ListDirectoryCallback | Callback type for list_directory_async. |
std::function< void(Result, bool)> AreFilesIdenticalCallback | Callback type for are_files_identical_async. |
Public Member Functions
Type | Name | Description |
---|---|---|
Ftp (System & system) | Constructor. Creates the plugin for a specific System. | |
Ftp (std::shared_ptr< System > system) | Constructor. Creates the plugin for a specific System. | |
~Ftp () override | Destructor (internal use only). | |
Ftp (const Ftp & other) | Copy constructor. | |
void | download_async (std::string remote_file_path, std::string local_dir, bool use_burst, const DownloadCallback & callback) | Downloads a file to local directory. |
void | upload_async (std::string local_file_path, std::string remote_dir, const UploadCallback & callback) | Uploads local file to remote directory. |
void | list_directory_async (std::string remote_dir, const ListDirectoryCallback callback) | Lists items from a remote directory. |
std::pair< Result, std::vector< std::string > > | list_directory (std::string remote_dir)const | Lists items from a remote directory. |
void | create_directory_async (std::string remote_dir, const ResultCallback callback) | Creates a remote directory. |
Result | create_directory (std::string remote_dir)const | Creates a remote directory. |
void | remove_directory_async (std::string remote_dir, const ResultCallback callback) | Removes a remote directory. |
Result | remove_directory (std::string remote_dir)const | Removes a remote directory. |
void | remove_file_async (std::string remote_file_path, const ResultCallback callback) | Removes a remote file. |
Result | remove_file (std::string remote_file_path)const | Removes a remote file. |
void | rename_async (std::string remote_from_path, std::string remote_to_path, const ResultCallback callback) | Renames a remote file or remote directory. |
Result | rename (std::string remote_from_path, std::string remote_to_path)const | Renames a remote file or remote directory. |
void | are_files_identical_async (std::string local_file_path, std::string remote_file_path, const AreFilesIdenticalCallback callback) | Compares a local file to a remote file using a CRC32 checksum. |
std::pair< Result, bool > | are_files_identical (std::string local_file_path, std::string remote_file_path)const | Compares a local file to a remote file using a CRC32 checksum. |
Result | set_target_compid (uint32_t compid)const | Set target component ID. By default it is the autopilot. |
const Ftp & | operator= (const Ftp &)=delete | Equality operator (object is not copyable). |
Constructor & Destructor Documentation
Ftp()
mavsdk::Ftp::Ftp(System &system)
Constructor. Creates the plugin for a specific System.
The plugin is typically created as shown below:
auto ftp = Ftp(system);
Parameters
- System& system - The specific system associated with this plugin.
Ftp()
mavsdk::Ftp::Ftp(std::shared_ptr< System > system)
Constructor. Creates the plugin for a specific System.
The plugin is typically created as shown below:
auto ftp = Ftp(system);
Parameters
- std::shared_ptr< System > system - The specific system associated with this plugin.
~Ftp()
mavsdk::Ftp::~Ftp() override
Destructor (internal use only).
Ftp()
mavsdk::Ftp::Ftp(const Ftp &other)
Copy constructor.
Parameters
- const Ftp& other -
Member Typdef Documentation
typedef ResultCallback
using mavsdk::Ftp::ResultCallback = std::function<void(Result)>
Callback type for asynchronous Ftp calls.
typedef DownloadCallback
using mavsdk::Ftp::DownloadCallback = std::function<void(Result, ProgressData)>
Callback type for download_async.
typedef UploadCallback
using mavsdk::Ftp::UploadCallback = std::function<void(Result, ProgressData)>
Callback type for upload_async.
typedef ListDirectoryCallback
using mavsdk::Ftp::ListDirectoryCallback = std::function<void(Result, std::vector<std::string>)>
Callback type for list_directory_async.
typedef AreFilesIdenticalCallback
using mavsdk::Ftp::AreFilesIdenticalCallback = std::function<void(Result, bool)>
Callback type for are_files_identical_async.
Member Enumeration Documentation
enum Result
Possible results returned for FTP commands.
Value | Description |
---|---|
Unknown |
Unknown result. |
Success |
Success. |
Next |
Intermediate message showing progress. |
Timeout |
Timeout. |
Busy |
Operation is already in progress. |
FileIoError |
File IO operation error. |
FileExists |
File exists already. |
FileDoesNotExist |
File does not exist. |
FileProtected |
File is write protected. |
InvalidParameter |
Invalid parameter. |
Unsupported |
Unsupported command. |
ProtocolError |
General protocol error. |
NoSystem |
No system connected. |
Member Function Documentation
download_async()
void mavsdk::Ftp::download_async(std::string remote_file_path, std::string local_dir, bool use_burst, const DownloadCallback &callback)
Downloads a file to local directory.
Parameters
- std::string remote_file_path -
- std::string local_dir -
- bool use_burst -
- const DownloadCallback& callback -
upload_async()
void mavsdk::Ftp::upload_async(std::string local_file_path, std::string remote_dir, const UploadCallback &callback)
Uploads local file to remote directory.
Parameters
- std::string local_file_path -
- std::string remote_dir -
- const UploadCallback& callback -
list_directory_async()
void mavsdk::Ftp::list_directory_async(std::string remote_dir, const ListDirectoryCallback callback)
Lists items from a remote directory.
This function is non-blocking. See 'list_directory' for the blocking counterpart.
Parameters
- std::string remote_dir -
- const ListDirectoryCallback callback -
list_directory()
std::pair<Result, std::vector<std::string> > mavsdk::Ftp::list_directory(std::string remote_dir) const
Lists items from a remote directory.
This function is blocking. See 'list_directory_async' for the non-blocking counterpart.
Parameters
- std::string remote_dir -
Returns
std::pair< Result, std::vector< std::string > > - Result of request.
create_directory_async()
void mavsdk::Ftp::create_directory_async(std::string remote_dir, const ResultCallback callback)
Creates a remote directory.
This function is non-blocking. See 'create_directory' for the blocking counterpart.
Parameters
- std::string remote_dir -
- const ResultCallback callback -
create_directory()
Result mavsdk::Ftp::create_directory(std::string remote_dir) const
Creates a remote directory.
This function is blocking. See 'create_directory_async' for the non-blocking counterpart.
Parameters
- std::string remote_dir -
Returns
Result - Result of request.
remove_directory_async()
void mavsdk::Ftp::remove_directory_async(std::string remote_dir, const ResultCallback callback)
Removes a remote directory.
This function is non-blocking. See 'remove_directory' for the blocking counterpart.
Parameters
- std::string remote_dir -
- const ResultCallback callback -
remove_directory()
Result mavsdk::Ftp::remove_directory(std::string remote_dir) const
Removes a remote directory.
This function is blocking. See 'remove_directory_async' for the non-blocking counterpart.
Parameters
- std::string remote_dir -
Returns
Result - Result of request.
remove_file_async()
void mavsdk::Ftp::remove_file_async(std::string remote_file_path, const ResultCallback callback)
Removes a remote file.
This function is non-blocking. See 'remove_file' for the blocking counterpart.
Parameters
- std::string remote_file_path -
- const ResultCallback callback -
remove_file()
Result mavsdk::Ftp::remove_file(std::string remote_file_path) const
Removes a remote file.
This function is blocking. See 'remove_file_async' for the non-blocking counterpart.
Parameters
- std::string remote_file_path -
Returns
Result - Result of request.
rename_async()
void mavsdk::Ftp::rename_async(std::string remote_from_path, std::string remote_to_path, const ResultCallback callback)
Renames a remote file or remote directory.
This function is non-blocking. See 'rename' for the blocking counterpart.
Parameters
- std::string remote_from_path -
- std::string remote_to_path -
- const ResultCallback callback -
rename()
Result mavsdk::Ftp::rename(std::string remote_from_path, std::string remote_to_path) const
Renames a remote file or remote directory.
This function is blocking. See 'rename_async' for the non-blocking counterpart.
Parameters
- std::string remote_from_path -
- std::string remote_to_path -
Returns
Result - Result of request.
are_files_identical_async()
void mavsdk::Ftp::are_files_identical_async(std::string local_file_path, std::string remote_file_path, const AreFilesIdenticalCallback callback)
Compares a local file to a remote file using a CRC32 checksum.
This function is non-blocking. See 'are_files_identical' for the blocking counterpart.
Parameters
- std::string local_file_path -
- std::string remote_file_path -
- const AreFilesIdenticalCallback callback -
are_files_identical()
std::pair<Result, bool> mavsdk::Ftp::are_files_identical(std::string local_file_path, std::string remote_file_path) const
Compares a local file to a remote file using a CRC32 checksum.
This function is blocking. See 'are_files_identical_async' for the non-blocking counterpart.
Parameters
- std::string local_file_path -
- std::string remote_file_path -
Returns
std::pair< Result, bool > - Result of request.
set_target_compid()
Result mavsdk::Ftp::set_target_compid(uint32_t compid) const
Set target component ID. By default it is the autopilot.
This function is blocking.
Parameters
- uint32_t compid -
Returns
Result - Result of request.
operator=()
const Ftp& mavsdk::Ftp::operator=(const Ftp &)=delete
Equality operator (object is not copyable).
Parameters
- const Ftp& -
Returns
const Ftp & -