Skip to main content

pamoja_lorawan_end_device_save

Function pamoja_lorawan_end_device_save 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_lorawan_end_device_save( device: *mut PamojaLorawanEndDevice, now_us: u64, out_saved: *mut u8, len: usize, ) -> PamojaStatus
Expand description

Saves a joined device’s state, to keep across a loss of power.

The bytes hold the session keys, so keep them wherever the keys would be safe.

§Arguments

  • device - the device.
  • now_us - the time, in microseconds, which the duty cycle waits are measured from.
  • out_saved - receives the state.
  • len - room at out_saved, which must be PAMOJA_LORAWAN_SAVED_LEN.

§Returns

PamojaStatus::Ok on success.

§Errors

Returns PamojaStatus::InvalidArgument if a pointer is null or len is wrong, and a failing status with the reason on pamoja_lorawan_end_device_error for a device that has not joined or is waiting on its windows.

§Safety

device must be a live handle and out_saved must point to len writable bytes.