Skip to main content

pamoja_lora_plan_builder_build

Function pamoja_lora_plan_builder_build 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn pamoja_lora_plan_builder_build( builder: *mut PamojaLoraPlanBuilder, out_plan: *mut *mut PamojaLoraPlan, ) -> PamojaStatus
Expand description

Finishes a plan and hands back a handle the query functions accept.

The builder is consumed whether the plan is accepted or rejected, so the caller must not free or reuse it afterwards.

Tables left empty are filled in where a region would share them: an empty downlink data-rate table reuses the uplink one, an empty downlink payload table reuses the matching uplink one, and an empty back-off chain steps down one data rate at a time. What cannot be guessed is checked instead, so a plan that would answer a question wrongly is refused here rather than at the question.

§Arguments

  • builder - the builder to finish, which this call consumes.
  • out_plan - set to the plan handle on success, and to null otherwise.

§Returns

PamojaStatus::Ok on success.

§Errors

Returns PamojaStatus::InvalidArgument if either pointer is null or the plan is inconsistent, with the reason available from pamoja_last_error_message, and PamojaStatus::Closed if the builder was already built.

§Safety

builder must be a live builder handle from pamoja_lora_plan_builder_new, and out_plan must point at writable storage for one pointer.