Skip to main content

pamoja_lorawan_package_parse

Function pamoja_lorawan_package_parse 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_lorawan_package_parse( port: u8, uplink: u8, payload: *const u8, payload_len: usize, out_command: *mut PamojaLorawanPackageCommand, out_taken: *mut usize, ) -> PamojaStatus
Expand description

Reads one command of an application layer package.

A data fragment takes the whole message, as TS004-2.0.0 section 3 asks, and its bytes are left in the caller’s buffer: out_command.fragment_n says which fragment it is, and the data starts three bytes into the message.

§Arguments

  • port - which package the message arrived on.
  • uplink - 1 when a device sent it, 0 when a server did.
  • payload - the message, from this command’s identifier on.
  • payload_len - its length.
  • out_command - receives the command.
  • out_taken - receives how many bytes it took.

§Returns

PamojaStatus::Ok on success.

§Errors

Returns PamojaStatus::Codec for a message this package cannot read, and PamojaStatus::InvalidArgument for a port that names no package or a null pointer.

§Safety

payload must point to payload_len readable bytes and both out pointers must be writable.