FILE_TRANSFER_PROTOCOL
Summary
File transfer message. Acts as a transport layer for the MAVLink FTP protocol (an FTP-like protocol over MAVLink).
Status
Supported (RX & TX)
Directionality
- TX (Transmit): All Vehicles - Sends FTP replies (file data, directory listings).
- RX (Receive): All Vehicles - Receives FTP requests (read, list, write).
Reception (RX)
Handled by GCS_MAVLINK::handle_file_transfer_protocol.
Source: libraries/GCS_MAVLink/GCS_FTP.cpp
Protocol Logic
Implements a stateful FTP server.
- OpCodes: Open, Read, Write, Terminate, ListDirectory, CreateDirectory, RemoveFile, etc.
- Transport: Data is encapsulated in the
payloadfield.
Data Fields
target_network: Network ID (0 for default).target_system: System ID.target_component: Component ID.payload: Variable length payload containing OpCode, Session ID, Offset, and Data.
Practical Use Cases
- Log Downloading:
- Scenario: Downloading Dataflash logs via MAVLink.
- Action: Mission Planner uses MAVFTP to list files in
@SYS/logsand download the.binfiles.
- Script Upload:
- Scenario: Uploading a Lua script.
- Action: User uploads
script.luato thescripts/directory on the SD card via MAVFTP.
Key Codebase Locations
- libraries/GCS_MAVLink/GCS_FTP.cpp:71: Handler.
LOG_REQUEST_LIST
Summary
The LOG_REQUEST_LIST message is sent by a Ground Control Station (GCS) to request a list of available logs on the vehicle's DataFlash storage. The vehicle responds by streaming LOG_ENTRY messages for the requested range.
Status
RX Only
Directionality
- TX (Transmit): None
- RX (Receive): All Vehicles (Starts log listing)
Reception (RX)
Reception is handled by AP_Logger::handle_log_request_list within libraries/AP_Logger/AP_Logger_MAVLinkLogTransfer.cpp:68.
Protocol Logic
- State Check: It checks if a log download is already in progress (
_log_sending_link != nullptr). If so, it rejects the request. - Range Setup: It parses the
startandendlog indices. - Sanitization: It clamps the range against the actual number of logs present (
_log_num_logs). - Activation: It sets the
transfer_activitystate toTransferActivity::LISTINGand assigns the requesting link as the active channel. The scheduler then iteratively sendsLOG_ENTRYmessages.
Data Fields
target_system: System ID.target_component: Component ID.start: First log ID to list.end: Last log ID to list.
Practical Use Cases
- Log Browser:
- Scenario: A user connects to the drone via USB and opens the "Download Logs" screen in Mission Planner.
- Action: The GCS sends
LOG_REQUEST_LIST(start=0, end=0xFFFF) to get a full directory of flight logs.
Key Codebase Locations
- libraries/AP_Logger/AP_Logger_MAVLinkLogTransfer.cpp:68: Implementation of the handler.
LOG_ENTRY
Summary
The LOG_ENTRY message is a reply to a LOG_REQUEST_LIST (117) command. It provides metadata about a single DataFlash log file on the vehicle, including its ID, size, and timestamp. The vehicle sends a stream of these messages to list all available logs.
Status
TX Only
Directionality
- TX (Transmit): All Vehicles (Log listing response)
- RX (Receive): None (Ignored)
Transmission (TX)
Transmission is handled by AP_Logger::handle_log_send_listing within libraries/AP_Logger/AP_Logger_MAVLinkLogTransfer.cpp:250.
Protocol Logic
- Iteration: The logger iterates from
starttoendas requested byLOG_REQUEST_LIST. - Metadata Retrieval: For each log index, it calls
get_log_infoto retrieve the file size (bytes) and UTC timestamp. - Completion: When the last entry is sent, the transfer activity state is reset to
IDLE.
Data Fields
id: Log id.num_logs: Total number of logs available.last_log_num: High log number.time_utc: UTC timestamp of log creation (seconds since 1970).size: Log size in bytes.
Practical Use Cases
- Log Browser:
- Scenario: A user clicks "Download Logs" in Mission Planner.
- Action: Mission Planner receives a stream of
LOG_ENTRYmessages and populates a table showing Log ID, Date, and Size, allowing the user to select specific flights for download.
Key Codebase Locations
- libraries/AP_Logger/AP_Logger_MAVLinkLogTransfer.cpp:250: Implementation of the sender.
LOG_REQUEST_DATA
Summary
The LOG_REQUEST_DATA message is sent by a Ground Control Station (GCS) to request a specific chunk of data from a log file. It initiates or continues the download of a DataFlash log.
Status
RX Only
Directionality
- TX (Transmit): None
- RX (Receive): All Vehicles (Starts/Continues log download)
Reception (RX)
Reception is handled by AP_Logger::handle_log_request_data within libraries/AP_Logger/AP_Logger_MAVLinkLogTransfer.cpp:107.
Protocol Logic
- State Check: Verifies if another download is active on a different channel.
- Initialization: If this is a new request or a different log ID, it looks up the log's physical location on storage (page/offset boundaries).
- Range Setup: It sets the internal read pointer (
_log_data_offset) to the requested offset (ofs) and calculates the bytes remaining to send (count). - Activation: It transitions to the
TransferActivity::SENDINGstate, which causes the scheduler to pumpLOG_DATApackets.
Data Fields
target_system: System ID.target_component: Component ID.id: Log ID (fromLOG_ENTRY).ofs: Offset into the log file (bytes).count: Number of bytes to send.
Practical Use Cases
- Downloading a Log:
- Scenario: A user downloads a 10MB log.
- Action: The GCS sends a sequence of
LOG_REQUEST_DATAmessages.id=5, ofs=0, count=90-> ReceivesLOG_DATA.id=5, ofs=90, count=90-> ReceivesLOG_DATA.- ...until EOF.
Key Codebase Locations
- libraries/AP_Logger/AP_Logger_MAVLinkLogTransfer.cpp:107: Implementation of the handler.
LOG_DATA
Summary
The LOG_DATA message carries a fixed-size chunk of binary data from a specific DataFlash log file. It is the response to a LOG_REQUEST_DATA (119) message. A sequence of these messages constitutes a file download.
Status
TX Only
Directionality
- TX (Transmit): All Vehicles (Log content transfer)
- RX (Receive): None (Ignored)
Transmission (TX)
Transmission is handled by AP_Logger::handle_log_send_data within libraries/AP_Logger/AP_Logger_MAVLinkLogTransfer.cpp:302.
Protocol Logic
- Read: It reads
lenbytes (max 90) from the storage backend (File or Block) at the current_log_data_offset. - Pack: It packs the data into the
dataarray of the message. - Pad: If the read bytes are fewer than 90, the remaining bytes are zeroed out.
- Send: The message is broadcast on the requesting channel.
- Advance: The
_log_data_offsetis incremented. If the requested byte count is met or the end of the log is reached, transmission stops (IDLE).
Data Fields
id: Log ID (1 through N).ofs: Offset into the log file (bytes).count: Number of bytes in this packet (typically 90).data: Raw log data (90 bytes).
Practical Use Cases
- Downloading a Log:
- Scenario: Mission Planner is downloading a log.
- Action: ArduPilot sends
LOG_DATApackets rapidly. Mission Planner concatenates thedatafields to reconstruct the.BINfile on the user's disk.
Key Codebase Locations
- libraries/AP_Logger/AP_Logger_MAVLinkLogTransfer.cpp:302: Implementation of the sender.
LOG_ERASE
Summary
The LOG_ERASE message is sent by a Ground Control Station (GCS) to command the vehicle to erase all stored DataFlash logs.
Status
RX Only
Directionality
- TX (Transmit): None
- RX (Receive): All Vehicles (Erases all logs)
Reception (RX)
Reception is handled by AP_Logger::handle_log_request_erase within libraries/AP_Logger/AP_Logger_MAVLinkLogTransfer.cpp:165.
Protocol Logic
- Decoding: The message is decoded (though it has no fields to use).
- Action: The
EraseAll()function is called on the logger backend. This typically reformats the SD card or erases the flash chip, removing all logs.
Data Fields
target_system: System ID.target_component: Component ID.
Practical Use Cases
- Maintenance:
- Scenario: A user wants to clear space on the SD card before a new mission.
- Action: Clicking "Erase Logs" in the GCS sends this message.
Key Codebase Locations
- libraries/AP_Logger/AP_Logger_MAVLinkLogTransfer.cpp:165: Implementation of the handler.
LOG_REQUEST_END
Summary
The LOG_REQUEST_END message is sent by a Ground Control Station (GCS) to terminate a log transfer session. This tells the vehicle to stop sending LOG_DATA or LOG_ENTRY messages and release any resources associated with the transfer.
Status
RX Only
Directionality
- TX (Transmit): None
- RX (Receive): All Vehicles (Stops log transfer)
Reception (RX)
Reception is handled by AP_Logger::handle_log_request_end within libraries/AP_Logger/AP_Logger_MAVLinkLogTransfer.cpp:174.
Protocol Logic
- State Reset: It sets
transfer_activitytoIDLE. - Resource Release: It clears the
_log_sending_linkpointer, allowing other MAVLink channels to initiate log transfers. - Backend Notification: It calls
end_log_transfer()on the active logger backend (e.g., to close the file handle).
Data Fields
target_system: System ID.target_component: Component ID.
Practical Use Cases
- Cancel Download:
- Scenario: A user realizes they selected the wrong log and clicks "Cancel" in the GCS.
- Action: The GCS sends
LOG_REQUEST_END, and the stream ofLOG_DATApackets stops immediately.
- Download Complete:
- Scenario: The GCS successfully receives the last byte of the log file.
- Action: It sends
LOG_REQUEST_ENDto politely close the session.
Key Codebase Locations
- libraries/AP_Logger/AP_Logger_MAVLinkLogTransfer.cpp:174: Implementation of the handler.
REMOTE_LOG_DATA_BLOCK
Summary
A block of dataflash log data sent to a remote listener. This is part of the "Remote Logging" feature where logs are streamed to a companion computer or GCS in real-time.
Status
Supported (TX Only)
Directionality
- TX (Transmit): All Vehicles (if configured) - Sends log blocks.
- RX (Receive): None
Transmission (TX)
ArduPilot sends this message via AP_Logger_MAVLink when remote logging is enabled.
Source: libraries/AP_Logger/AP_Logger_MAVLink.cpp
Protocol Logic
The logger buffers log data and sends it in 200-byte chunks (blocks) to the MAVLink stream.
- Reliability: The system expects
REMOTE_LOG_BLOCK_STATUSacks to ensure data integrity.
Data Fields
target_system: System ID of listener.target_component: Component ID of listener.seqno: Sequence number (high/low or 32-bit index).data: Log data block (200 bytes).
Practical Use Cases
- Redundant Logging:
- Scenario: A high-value drone operation requires logs to be saved on a companion computer (Raspberry Pi) in case the flight controller is destroyed.
- Action: The FC streams
REMOTE_LOG_DATA_BLOCKmessages to the Pi, which writes them to disk.
Key Codebase Locations
- libraries/AP_Logger/AP_Logger_MAVLink.cpp: Implementation.
REMOTE_LOG_BLOCK_STATUS
Summary
Status/Acknowledgment message for the Remote Logging protocol. Sent by the listener (e.g., companion computer) to the autopilot.
Status
Supported (RX Only)
Directionality
- TX (Transmit): None
- RX (Receive): All Vehicles - Receives acks for sent log blocks.
Reception (RX)
Handled by AP_Logger::handle_remote_log_block_status.
Source: libraries/AP_Logger/AP_Logger.cpp
Protocol Logic
The autopilot maintains a buffer of sent blocks. It waits for this status message to confirm which blocks have been safely received by the remote node.
- Gap Filling: If the status indicates missing blocks, the autopilot re-sends them.
Data Fields
target_system: System ID.target_component: Component ID.seqno: Latest received sequence number.status: Boolean/Enum status (1=OK).
Practical Use Cases
- Reliable Log Streaming:
- Scenario: Companion computer misses a packet due to CPU load.
- Action: It sends
REMOTE_LOG_BLOCK_STATUSwith the last valid sequence number. ArduPilot resends the missing data.
Key Codebase Locations
- libraries/AP_Logger/AP_Logger.cpp:850: Handler.
LOGGING_DATA
Summary
The LOGGING_DATA message is part of a protocol for streaming log data from the vehicle to a Ground Control Station (GCS) in real-time or as a robust download mechanism. It works in conjunction with LOGGING_DATA_ACKED (267) to ensure data integrity.
Status
Unsupported
Directionality
- TX (Transmit): None
- RX (Receive): None
Description
ArduPilot does not implement this message.
For downloading DataFlash logs (.BIN files), ArduPilot uses the standard MAVLink log download protocol involving:
LOG_REQUEST_LIST(117)LOG_ENTRY(118)LOG_REQUEST_DATA(119)LOG_DATA(120)
The LOGGING_DATA (266) message appears to be an alternative or streaming-focused mechanism that is not currently part of the ArduPilot codebase.
Intended Data Fields (Standard)
target_system: System ID of the target.target_component: Component ID of the target.sequence: Sequence number (can wrap).length: Data length (bytes).first_message_offset: Offset into data where the first message starts.data: Logged data (buffer).
Alternative
For log downloads in ArduPilot, refer to LOG_DATA (120).
Theoretical Use Cases
- Black Box Streaming:
- Scenario: A high-value experimental aircraft.
- Action: The vehicle streams critical log data in real-time via
LOGGING_DATA. If the vehicle is lost or destroyed, the last seconds of telemetry are preserved on the GCS.
- Reliable Download:
- Scenario: Downloading logs over a lossy telemetry link.
- Action: The protocol uses the sequence numbers and ACKs to re-transmit only the lost packets, ensuring a bit-perfect copy of the log file eventually arrives.
LOGGING_DATA_ACKED
Summary
The LOGGING_DATA_ACKED message is the acknowledged variant of the LOGGING_DATA (266) streaming protocol. It sends log data that requires an explicit LOGGING_ACK (268) from the receiver, ensuring critical data is not lost during transmission.
Status
Unsupported
Directionality
- TX (Transmit): None
- RX (Receive): None
Description
ArduPilot does not implement this message.
It is part of the same unsupported log streaming protocol as LOGGING_DATA (266). ArduPilot relies on the standard LOG_DATA (120) message for log downloads.
Intended Data Fields (Standard)
target_system: System ID of the target.target_component: Component ID of the target.sequence: Sequence number.length: Data length.first_message_offset: Offset to start of first message.data: Logged data.
Alternative
For log downloads in ArduPilot, refer to LOG_DATA (120).
Theoretical Use Cases
- Guaranteed Delivery:
- Scenario: Sending a critical "Crash Report" packet.
- Action: The vehicle sends the crash dump via
LOGGING_DATA_ACKEDand re-transmits it until the GCS confirms receipt withLOGGING_ACK, ensuring the data is not lost in radio noise.
LOGGING_ACK
Summary
The LOGGING_ACK message is used to acknowledge the receipt of a LOGGING_DATA_ACKED (267) packet. This closes the loop for the reliable log streaming protocol.
Status
Unsupported
Directionality
- TX (Transmit): None
- RX (Receive): None
Description
ArduPilot does not implement this message.
It is part of the same unsupported log streaming protocol as LOGGING_DATA (266) and LOGGING_DATA_ACKED (267).
Intended Data Fields (Standard)
target_system: System ID of the target.target_component: Component ID of the target.sequence: Sequence number (must match the one inLOGGING_DATA_ACKED).
Theoretical Use Cases
- Flow Control:
- Scenario: The GCS is overwhelmed by incoming log data.
- Action: The GCS delays sending
LOGGING_ACK, implicitly telling the vehicle to pause transmission until the buffer clears.