Skip to main content

pamoja_mavlink_frame_encode

Function pamoja_mavlink_frame_encode 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_mavlink_frame_encode( version: u8, header: PamojaMavlinkHeader, msgid: u32, payload: *const u8, payload_len: usize, crc_extra: u8, out_frame: *mut *mut PamojaMavlinkFrame, ) -> PamojaStatus
Expand description

Assembles a frame carrying a message.

§Arguments

  • version - PAMOJA_MAVLINK_VERSION_V1 or PAMOJA_MAVLINK_VERSION_V2.
  • header - the addressing fields to stamp on the frame.
  • msgid - the message id; a v1 frame only carries ids below 256.
  • payload - the message payload.
  • payload_len - how many bytes payload holds.
  • crc_extra - the seed for this message id.
  • out_frame - set to the frame handle on success, and to null otherwise.

§Returns

PamojaStatus::Ok on success.

§Errors

Returns PamojaStatus::InvalidArgument if out_frame is null, the version is neither constant, or the payload does not fit a frame.

§Safety

payload must point to payload_len readable bytes when the length is non-zero, and out_frame must point at writable storage for one pointer.