Ftp Client
FtpClient provides basic operations for communicating with the MAVLink FTP server. Use the FTP client if you need to exchange files over a MAVLink network, for example, to download logs from the drone (server).
Use case
As an example we will show you how to create a directory and list its contents.
Get FtpClient through the microservice locator:
Call CreateDirectory to create a new folder in the root directory:
Call ListDirectory to get data about the root directory:
Print the directory listing (decoded characters) to the console:
Api
MavlinkFtpClientConfig
Property | Type | Default | Description |
|---|---|---|---|
|
|
| Timeout (in milliseconds) for a single FTP command. |
|
|
| How many times to retry a command on timeout failure. |
|
|
| Target MAVLink network ID (target_network) used for routing. |
|
|
| Burst-read inactivity timeout (in milliseconds). |
IFtpClient
MAVLink FTP (File Transfer Protocol) client abstraction. Provides remote filesystem operations over the MAVLink FTP microservice.
Method | Return Type | Description |
|---|---|---|
|
| Opens a file for reading on the remote filesystem. |
|
| Opens a file for writing on the remote filesystem. |
|
| Creates a directory on the remote filesystem. |
|
| Creates an empty file on the remote filesystem. |
|
| Resets (closes) all FTP sessions on the remote side. |
|
| Removes a directory at the specified path on the remote filesystem. |
|
| Removes a file at the specified path on the remote filesystem. |
|
| Calculates CRC32 of a remote file. |
|
| Truncates a remote file to the specified byte offset. |
|
| Writes a chunk of bytes into an already opened write session on the remote filesystem. |
|
| Performs burst file read from the remote filesystem. Data is delivered to onBurstData as packets arrive. |
|
| Renames or moves a file/directory on the remote filesystem. |
|
| Terminates an FTP session on the remote side. |
|
| Reads a chunk of bytes from an already opened read session on the remote filesystem. |
|
| Reads file data into a byte memory buffer from the remote filesystem. |
|
| Reads file data into a buffer from the remote filesystem. |
|
| Lists a directory starting at the given offset cursor from the remote filesystem. |
|
| Lists directory and writes raw bytes into a buffer from the remote filesystem. |
|
| Lists directory and writes decoded characters into a buffer from the remote filesystem. |
|
| Lists directory and writes decoded characters into a memory block from the remote filesystem. |
IFtpClient.OpenFileRead
Parameter | Type | Description |
|---|---|---|
|
| Remote file path. |
|
| Optional cancel token argument. |
IFtpClient.OpenFileWrite
Parameter | Type | Description |
|---|---|---|
|
| Remote file path. |
|
| Optional cancel token argument. |
IFtpClient.CreateDirectory
Parameter | Type | Description |
|---|---|---|
|
| Remote directory path. |
|
| Optional cancel token argument. |
IFtpClient.CreateFile
Parameter | Type | Description |
|---|---|---|
|
| Remote file path. |
|
| Optional cancel token argument. |
IFtpClient.ResetSessions
Parameter | Type | Description |
|---|---|---|
|
| Optional cancel token argument. |
IFtpClient.RemoveDirectory
Parameter | Type | Description |
|---|---|---|
|
| Remote directory path. |
|
| Optional cancel token argument. |
IFtpClient.RemoveFile
Parameter | Type | Description |
|---|---|---|
|
| Remote file path. |
|
| Optional cancel token argument. |
IFtpClient.CalcFileCrc32
Parameter | Type | Description |
|---|---|---|
|
| Remote file path. |
|
| Optional cancel token argument. |
IFtpClient.TruncateFile
Parameter | Type | Description |
|---|---|---|
|
| Truncate request (path and offset). |
|
| Optional cancel token argument. |
IFtpClient.WriteFile
Parameter | Type | Description |
|---|---|---|
|
| Write request (session, offset, and size). |
|
| Source buffer. |
|
| Optional cancel token argument. |
IFtpClient.BurstReadFile
Parameter | Type | Description |
|---|---|---|
|
| Read request (session, offset, and size). |
|
| Callback invoked for each received FTP packet during burst read. |
|
| Optional cancel token argument. |
IFtpClient.Rename
Parameter | Type | Description |
|---|---|---|
|
| Source path. |
|
| Destination path (new name for the path). |
|
| Optional cancel token argument. |
IFtpClient.TerminateSession
Parameter | Type | Description |
|---|---|---|
|
| Session id. |
|
| Optional cancel token argument. |
IFtpClient.ReadFile
Parameter | Type | Description |
|---|---|---|
|
| Read request (session, offset, and size). |
|
| Optional cancel token argument. |
Parameter | Type | Description |
|---|---|---|
|
| Read request (session, offset, and size). |
|
| Destination buffer. |
|
| Optional cancel token argument. |
Parameter | Type | Description |
|---|---|---|
|
| Read request (session, offset, and size). |
|
| Destination buffer writer. |
|
| Optional cancel token argument. |
IFtpClient.ListDirectory
Parameter | Type | Description |
|---|---|---|
|
| Remote directory path. |
|
| Paging offset. |
|
| Optional cancel token argument. |
Parameter | Type | Description |
|---|---|---|
|
| Remote directory path. |
|
| Paging offset. |
|
| Destination buffer writer. |
|
| Optional cancel token argument. |
Parameter | Type | Description |
|---|---|---|
|
| Remote directory path. |
|
| Paging offset. |
|
| Destination buffer writer. |
|
| Optional cancel token argument. |
Parameter | Type | Description |
|---|---|---|
|
| Remote directory path. |
|
| Paging offset. |
|
| Destination buffer writer. |
|
| Optional cancel token argument. |