Skip to main content

pamoja_lorawan_package_encode

Function pamoja_lorawan_package_encode 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_lorawan_package_encode( command: *const PamojaLorawanPackageCommand, data: *const u8, data_len: usize, out_payload: *mut u8, capacity: usize, out_len: *mut usize, ) -> PamojaStatus
Expand description

Writes one command of an application layer package.

A data fragment carries its bytes separately: pass them as data, and the command’s fragment_n and frag_index say where they belong.

§Arguments

  • command - the command, whose port, cid and uplink decide which fields are read.
  • data - the bytes a data fragment carries, or null for every other command.
  • data_len - how many.
  • out_payload - receives the message.
  • capacity - how many bytes that buffer holds.
  • out_len - receives how many were written.

§Returns

PamojaStatus::Ok on success.

§Errors

Returns PamojaStatus::Codec for a command this build does not write, and PamojaStatus::InvalidArgument for a null pointer or a buffer too small.

§Safety

command must be readable, data must point to data_len readable bytes or be null, out_payload must point to capacity writable bytes, and out_len must be writable.