pub struct ChannelPlanBuilder { /* private fields */ }Expand description
Assembles a OwnedChannelPlan a table at a time.
Tables are indexed by position, so entries are pushed in data-rate order and
a number the plan does not use is pushed as None. What a region would share
between directions is filled in at build rather than being
repeated here.
§Examples
use pamoja_lora::region::{
ChannelBlock, ChannelPlanBuilder, DataRate, MaxPayload, PayloadTable, SubBand,
};
// A private deployment on licensed spectrum: two data rates and no duty cycle.
let plan = ChannelPlanBuilder::new("private-915")
.uplink_data_rate(Some(DataRate::lora(12, 125_000, 250)))
.uplink_data_rate(Some(DataRate::lora(7, 125_000, 5_470)))
.max_payload(PayloadTable::UplinkDirect, Some(MaxPayload::new(59, 51)))
.max_payload(PayloadTable::UplinkDirect, Some(MaxPayload::new(230, 222)))
.default_channel(ChannelBlock::new(915_000_000, 500_000, 4, 0, 1))
.sub_band(SubBand::new(915_000_000, 917_000_000, 1000, 30))
.rx(915_000_000, 0, 0)
.rx1_row(&[0])
.rx1_row(&[1])
.build()
.expect("a consistent plan");
// Licensed spectrum is reported as unrestricted, not refused.
assert_eq!(plan.with_plan(|p| p.duty_cycle_permille(915_500_000)), Some(1000));
assert_eq!(plan.with_plan(|p| p.default_channel_count()), 4);Implementations§
Source§impl ChannelPlanBuilder
impl ChannelPlanBuilder
Sourcepub fn uplink_data_rate(self, rate: Option<DataRate>) -> Self
pub fn uplink_data_rate(self, rate: Option<DataRate>) -> Self
Sourcepub fn downlink_data_rate(self, rate: Option<DataRate>) -> Self
pub fn downlink_data_rate(self, rate: Option<DataRate>) -> Self
Sourcepub fn max_payload(
self,
table: PayloadTable,
payload: Option<MaxPayload>,
) -> Self
pub fn max_payload( self, table: PayloadTable, payload: Option<MaxPayload>, ) -> Self
Sourcepub fn join_channel(self, block: ChannelBlock) -> Self
pub fn join_channel(self, block: ChannelBlock) -> Self
Sourcepub fn default_channel(self, block: ChannelBlock) -> Self
pub fn default_channel(self, block: ChannelBlock) -> Self
Sourcepub fn rx1_row_dwell_limited(self, offsets: &[u8]) -> Self
pub fn rx1_row_dwell_limited(self, offsets: &[u8]) -> Self
Sourcepub fn dwell_time_limit(self, limited: bool) -> Self
pub fn dwell_time_limit(self, limited: bool) -> Self
Sourcepub fn build(self) -> Result<OwnedChannelPlan, PlanError>
pub fn build(self) -> Result<OwnedChannelPlan, PlanError>
Finishes the plan.
Tables a region would share are filled in first: an empty downlink data-rate table mirrors the uplink one, an empty downlink payload table mirrors its uplink counterpart, and an empty back-off chain steps down one data rate at a time. What cannot be inferred is checked.
§Returns
The finished plan.
§Errors
Returns the PlanError describing the question this plan would answer
wrongly.
Trait Implementations§
Source§impl Clone for ChannelPlanBuilder
impl Clone for ChannelPlanBuilder
Source§fn clone(&self) -> ChannelPlanBuilder
fn clone(&self) -> ChannelPlanBuilder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ChannelPlanBuilder
impl RefUnwindSafe for ChannelPlanBuilder
impl Send for ChannelPlanBuilder
impl Sync for ChannelPlanBuilder
impl Unpin for ChannelPlanBuilder
impl UnsafeUnpin for ChannelPlanBuilder
impl UnwindSafe for ChannelPlanBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more