Skip to main content

Crate mavwire_ffi

Crate mavwire_ffi 

Source
Expand description

C FFI bindings for the mavwire MAVLink v1/v2 decoder.

Exposes a decode-only subset of mavwire’s API: decode a single v2 (or v1) frame from a raw byte buffer into an opaque message handle, then read its fields via a mavwire_message_as_<type> function that fills a plain C struct - one call per message, rather than one accessor call per field, since MAVLink has many small messages with several fields each. See include/mavwire.h for the generated C declarations.

This crate is a plain (non-no_std) library: it targets host environments linking a shared or static C library, not the embedded no_alloc use case mavwire itself supports. Embedded consumers should use the mavwire Rust crate directly.

Structs§

MavwireAttitude
ATTITUDE (id 30): roll/pitch/yaw and their rates.
MavwireCommandAck
COMMAND_ACK (id 77): the result of executing a COMMAND_LONG.
MavwireCommandLong
COMMAND_LONG (id 76): sends a command with up to seven parameters.
MavwireGlobalPositionInt
GLOBAL_POSITION_INT (id 33): fused global position.
MavwireGpsRawInt
GPS_RAW_INT (id 24): raw GPS fix.
MavwireHeartbeat
HEARTBEAT (id 0): system presence/type/mode.
MavwireMessage
Opaque handle to a decoded MAVLink message, owned by the caller until freed with mavwire_message_free.
MavwireParamValue
PARAM_VALUE (id 22): a single parameter’s current value.
MavwireRcChannels
RC_CHANNELS (id 65): raw RC receiver channel values.
MavwireStatusText
STATUSTEXT (id 253): a human-readable status/log message.
MavwireSysStatus
SYS_STATUS (id 1): onboard sensor and battery health.
MavwireVfrHud
VFR_HUD (id 74): airspeed/altitude/heading HUD data.

Enums§

MavwireError
Error codes returned by mavwire_decode.

Functions§

mavwire_decode⚠
Decodes a single MAVLink v1 or v2 frame from the start of buf (len bytes long). buf may contain trailing bytes after the frame (e.g. the start of the next frame in a stream); only the leading frame is parsed.
mavwire_message_as_attitude⚠
Reads this message’s fields into *out if it is an ATTITUDE message.
mavwire_message_as_command_ack⚠
Reads this message’s fields into *out if it is a COMMAND_ACK message.
mavwire_message_as_command_long⚠
Reads this message’s fields into *out if it is a COMMAND_LONG message.
mavwire_message_as_global_position_int⚠
Reads this message’s fields into *out if it is a GLOBAL_POSITION_INT message.
mavwire_message_as_gps_raw_int⚠
Reads this message’s fields into *out if it is a GPS_RAW_INT message.
mavwire_message_as_heartbeat⚠
Reads this message’s fields into *out if it is a HEARTBEAT message.
mavwire_message_as_param_value⚠
Reads this message’s fields into *out if it is a PARAM_VALUE message.
mavwire_message_as_rc_channels⚠
Reads this message’s fields into *out if it is an RC_CHANNELS message.
mavwire_message_as_statustext⚠
Reads this message’s fields into *out if it is a STATUSTEXT message.
mavwire_message_as_sys_status⚠
Reads this message’s fields into *out if it is a SYS_STATUS message.
mavwire_message_as_vfr_hud⚠
Reads this message’s fields into *out if it is a VFR_HUD message.
mavwire_message_component_id⚠
The sending component’s ID, or 0 for a NULL handle.
mavwire_message_free⚠
Frees a message handle returned by mavwire_decode. Passing NULL is a no-op.
mavwire_message_id⚠
The message’s MAVLink message id (e.g. 0 for HEARTBEAT), or 0xFFFFFFFF for a NULL handle.
mavwire_message_sequence⚠
The frame’s sequence number, or 0 for a NULL handle.
mavwire_message_system_id⚠
The sending system’s ID, or 0 for a NULL handle.
mavwire_version
The mavwire crate version, as a NUL-terminated, statically allocated string (e.g. "0.1.0"). Do not free.