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(Ftp::Result, ProgressData)> DownloadCallback Callback type for download_async.
std::function< void(Ftp::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 () Destructor (internal use only).
  Ftp (const Ftp &)=delete Copy constructor (object is not copyable).
void reset_async (const ResultCallback callback) Resets FTP server in case there are stale open sessions.
void download_async (std::string remote_file_path, std::string local_dir, DownloadCallback callback) Downloads a file to local directory.
void upload_async (std::string local_file_path, std::string remote_dir, 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.
void create_directory_async (std::string remote_dir, const ResultCallback callback) Creates a remote directory.
void remove_directory_async (std::string remote_dir, const ResultCallback callback) Removes a remote directory.
void remove_file_async (std::string remote_file_path, const ResultCallback callback) 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.
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.
Result set_root_directory (std::string root_dir)const Set root directory for MAVLink FTP server.
Result set_target_component_id (uint32_t component_id)const Set target component ID. By default it is the autopilot.
uint32_t get_our_component_id () const Get our own component ID.
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 = std::make_shared<Ftp>(system);

Parameters

  • System& system - The specific system associated with this plugin.

~Ftp()

mavsdk::Ftp::~Ftp()

Destructor (internal use only).

Ftp()

mavsdk::Ftp::Ftp(const Ftp &)=delete

Copy constructor (object is not copyable).

Parameters

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(Ftp::Result, ProgressData)>

Callback type for download_async.

typedef UploadCallback

using mavsdk::Ftp::UploadCallback =  std::function<void(Ftp::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.

Member Function Documentation

reset_async()

void mavsdk::Ftp::reset_async(const ResultCallback callback)

Resets FTP server in case there are stale open sessions.

This function is non-blocking.

Parameters

download_async()

void mavsdk::Ftp::download_async(std::string remote_file_path, std::string local_dir, DownloadCallback callback)

Downloads a file to local directory.

Parameters

  • std::string remote_file_path -
  • std::string local_dir -
  • DownloadCallback callback -

upload_async()

void mavsdk::Ftp::upload_async(std::string local_file_path, std::string remote_dir, UploadCallback callback)

Uploads local file to remote directory.

Parameters

  • std::string local_file_path -
  • std::string remote_dir -
  • 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.

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

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.

Parameters

  • std::string remote_from_path -
  • std::string remote_to_path -
  • const ResultCallback callback -

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.

Parameters

set_root_directory()

Result mavsdk::Ftp::set_root_directory(std::string root_dir) const

Set root directory for MAVLink FTP server.

This function is blocking.

Parameters

  • std::string root_dir -

Returns

Result - Result of request.

set_target_component_id()

Result mavsdk::Ftp::set_target_component_id(uint32_t component_id) const

Set target component ID. By default it is the autopilot.

This function is blocking.

Parameters

  • uint32_t component_id -

Returns

Result - Result of request.

get_our_component_id()

uint32_t mavsdk::Ftp::get_our_component_id() const

Get our own component ID.

This function is blocking.

Returns

 uint32_t - Result of request.

operator=()

const Ftp& mavsdk::Ftp::operator=(const Ftp &)=delete

Equality operator (object is not copyable).

Parameters

Returns

 const Ftp & -

© Dronecode 2017-2019. License: CC BY 4.0            Updated: 2020-05-18 06:07:17

results matching ""

    No results matching ""