Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions en/services/ftp.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Below is the over-the-wire format for the payload part of the [FILE_TRANSFER_PRO

## OpCodes/Command {#opcodes}

The opcodes that may be sent by the GCS (client) to the drone (server) are enumerated in [MAV_FTP_ERR](#MAV_FTP_ERR), and listed below for convenience.
The opcodes that may be sent by the GCS (client) to the drone (server) are enumerated in [MAV_FTP_OPCODE](../messages/common.md#MAV_FTP_OPCODE), and listed below for convenience.

<!-- uint8_t enum Opcode: https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/mavlink/mavlink_ftp.h -->

Expand All @@ -79,7 +79,7 @@ The opcodes that may be sent by the GCS (client) to the drone (server) are enume
| <a id="TerminateSession"></a> 1 | TerminateSession | Terminates open Read `session`.<br>- Closes the file associated with (`session`) and frees the session ID for re-use. |
| <a id="ResetSessions"></a> 2 | ResetSessions | Terminates _all_ open read sessions.<br>- Clears all state held by the drone (server); closes all open files, etc.<br>- Sends an ACK reply with no data. <!-- Note, is same as Terminate, but does not check if file session exists --> |
| <a id="ListDirectory"></a> 3 | [ListDirectory](#list_directory) | List directory entry information (files, folders etc.) in `<path>`, starting from a specified entry index (`<offset>`).<br>- Response is an ACK packet with one or more entries on success, otherwise a NAK packet with an error code.<br>- Completion is indicated by a NACK with EOF in response to a requested index (`offset`) beyond the list of entries.<br>- The directory is closed after the operation, so this leaves no state on the server. |
| <a id="OpenFileRO"></a> 4 | [OpenFileRO](#reading-a-file) | Opens file at `<path>` for reading, returns `<session>`<br>- The `path` is stored in the [payload](#payload) `data`. The drone opens the file (`path`) and allocates a _session number_. The file must exist.<br>- An ACK packet must include the allocated `session` and the data size of the file to be opened (`size`)<br>- A NAK packet must contain [error information](#error_codes) . Typical error codes for this command are `NoSessionsAvailable`, `FileExists`. <br>- The file remains open after the operation, and must eventually be closed by `Reset` or `Terminate`. |
| <a id="OpenFileRO"></a> 4 | [OpenFileRO](#reading-a-file-readfile) | Opens file at `<path>` for reading, returns `<session>`<br>- The `path` is stored in the [payload](#payload) `data`. The drone opens the file (`path`) and allocates a _session number_. The file must exist.<br>- An ACK packet must include the allocated `session` and the data size of the file to be opened (`size`)<br>- A NAK packet must contain [error information](#error_codes) . Typical error codes for this command are `NoSessionsAvailable`, `FileExists`. <br>- The file remains open after the operation, and must eventually be closed by `Reset` or `Terminate`. |
| <a id="ReadFile"></a> 5 | [ReadFile](#reading-a-file-readfile) | Reads `<size>` bytes from `<offset>` in `<session>`.<br>- Seeks to (`offset`) in the file opened in (session) and reads (`size`) bytes into the result buffer.<br>- Sends an ACK packet with the result buffer on success, otherwise a NAK packet with an error code. For short reads or reads beyond the end of a file, the (`size`) field in the ACK packet will indicate the actual number of bytes read.<br>- Reads can be issued to any offset in the file for any number of bytes, so reconstructing portions of the file to deal with lost packets should be easy.<br>- For best download performance, try to keep two `Read` packets in flight. |
| <a id="CreateFile"></a> 6 | `CreateFile` | Creates file at `<path>` for writing, returns `<session>`.<br>- Creates the file (path) and allocates a _session number_. All parent directories must exist. If the file already existed, then this call will truncate it. Equivalent UNIX flags: (O_CREAT &#124; O_TRUNC &#124; O_WRONLY)<br>- Sends an ACK packet with the allocated session number on success, or a NAK packet with an error code on error (i.e. [FileExists](#FileExists) if the `path` already exists).<br>- The file remains open after the operation, and must eventually be closed by `Reset` or `Terminate`. |
| <a id="WriteFile"></a> 7 | `WriteFile` | Writes `<size>` bytes to `<offset>` in `<session>`.<br>- Sends an ACK reply with no data on success, otherwise a NAK packet with an error code. |
Expand Down
Loading