Skip to main content

pamoja_mavlink_message_decode

Function pamoja_mavlink_message_decode 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_mavlink_message_decode( schema: *const PamojaMavlinkSchema, payload: *const u8, payload_len: usize, out_message: *mut *mut PamojaMavlinkMessage, ) -> PamojaStatus
Expand description

Reads a message out of a frame payload.

A payload shorter than the shape is zero-extended, as MAVLink 2 truncation requires, so a frame from a peer that trimmed trailing zeros or predates an extension field decodes.

§Arguments

  • schema - the shape to read the payload as.
  • payload - the frame payload.
  • payload_len - the payload length in bytes.
  • out_message - set to a new message handle on success, which the caller releases with pamoja_mavlink_message_free.

§Returns

PamojaStatus::Ok on success.

§Errors

Returns PamojaStatus::InvalidArgument if a pointer is null, and PamojaStatus::Codec if the payload is longer than the shape describes.

§Safety

schema must be a live schema handle, payload must point at payload_len readable bytes, and out_message must point at writable storage for one pointer.