Skip to main content

Module mavlink_socket

Module mavlink_socket 

Source
Expand description

The MAVLink broadcast socket wire (/run/ados/mavlink.sock, contract mavlink.socket).

Every record in both directions is a 4-byte big-endian length followed by the body (crate::frame). Router → client bodies (version 2) start with an 8-byte little-endian rx_mono_ns, the host CLOCK_MONOTONIC time the router read that frame off the flight-controller transport (or received it from any other source), followed by one raw MAVLink frame. Client → router bodies are one raw MAVLink frame with no header.

Ungated (no MAVLink dialect dependency), so a consumer that only moves raw frames reads the socket without building the codec.

Structs§

SocketFrame
One frame as a client receives it.

Constants§

MAVLINK_SOCKET_HEADER_LEN
Length of the rx_mono_ns header that leads every router → client body.
MAVLINK_SOCKET_MAX_BODY
Largest router → client body: the frame cap plus the header.
MAVLINK_SOCKET_VERSION
Wire version of the router → client record; mirrors the mavlink.socket row in contracts.toml.

Functions§

decode_body
Split a router → client body into (rx_mono_ns, frame). None when the body is too short to carry the header.
encode_body
The router → client body: header then frame (no length prefix).
encode_record
The complete router → client record: length prefix, header, frame.
read_frame
Read one router → client record. Ok(None) on clean EOF; a body shorter than the header is InvalidData.