Skip to main content

pamoja_lorawan_end_device_new

Function pamoja_lorawan_end_device_new 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_lorawan_end_device_new( plan: *const PamojaLoraPlan, credentials: *const PamojaLorawanDevice, settings: *const PamojaLorawanDeviceSettings, fcnt_up: u32, has_fcnt_down: u8, fcnt_down: u32, out_device: *mut *mut PamojaLorawanEndDevice, ) -> PamojaStatus
Expand description

Makes a device that joins over the air.

§Arguments

  • plan - a published channel plan.
  • credentials - the device’s identifiers and root key, which the device copies.
  • settings - what its radio can do.
  • fcnt_up - the next uplink frame counter, 0 for a device that has never sent. A join starts it over.
  • has_fcnt_down - 1 if fcnt_down holds the last downlink counter accepted.
  • fcnt_down - that counter.
  • out_device - receives the device.

§Returns

PamojaStatus::Ok on success, with *out_device set to a handle the caller must release with pamoja_lorawan_end_device_free.

§Errors

Returns PamojaStatus::InvalidArgument if a pointer is null, the plan was built rather than published, the settings name no version or run backward, or the plan defines more channels than a device keeps.

§Safety

plan and credentials must be live handles, settings must point to a readable PamojaLorawanDeviceSettings, and out_device to a writable pointer.