Skip to main content

ChannelPlan

Struct ChannelPlan 

Source
pub struct ChannelPlan<'a> {
Show 22 fields pub name: &'a str, pub uplink_data_rates: &'a [Option<DataRate>], pub downlink_data_rates: &'a [Option<DataRate>], pub max_payload_repeater: &'a [Option<MaxPayload>], pub max_payload_direct: &'a [Option<MaxPayload>], pub downlink_max_payload_repeater: &'a [Option<MaxPayload>], pub downlink_max_payload_direct: &'a [Option<MaxPayload>], pub max_payload_dwell_limited: Option<&'a [Option<MaxPayload>]>, pub join_channels: &'a [ChannelBlock], pub default_channels: &'a [ChannelBlock], pub sub_bands: &'a [SubBand], pub default_max_eirp_dbm: i8, pub tx_power_step_db: u8, pub max_tx_power_index: u8, pub rx1_data_rate_offsets: &'a [&'a [u8]], pub rx1_data_rate_offsets_dwell_limited: Option<&'a [&'a [u8]]>, pub max_rx1_data_rate_offset: u8, pub rx2_frequency_hz: u32, pub rx2_data_rate: u8, pub data_rate_backoff: &'a [Option<u8>], pub beacon: Beacon, pub has_dwell_time_limit: bool,
}
Expand description

A complete regional channel plan.

The named Region values are constants of this type. A deployment on licensed spectrum, or one doing something the published regions do not describe, builds its own from tables it owns, and every method here still applies.

Fields§

§name: &'a str

The specification’s name for the band, such as "EU863-870".

§uplink_data_rates: &'a [Option<DataRate>]

The uplink data rates, indexed by data-rate number; None where the number is reserved.

§downlink_data_rates: &'a [Option<DataRate>]

The downlink data rates, indexed by data-rate number.

Most regions use one table in both directions, and carry the same slice here. The 900 MHz plans do not, which is why this is separate.

§max_payload_repeater: &'a [Option<MaxPayload>]

The uplink payload limits when the device may be behind a repeater.

§max_payload_direct: &'a [Option<MaxPayload>]

The uplink payload limits when it will not be.

§downlink_max_payload_repeater: &'a [Option<MaxPayload>]

The downlink payload limits when the device may be behind a repeater.

Most regions number their downlink data rates the same way as their uplink ones and carry the same slice here. The 900 MHz plans do not.

§downlink_max_payload_direct: &'a [Option<MaxPayload>]

The downlink payload limits when it will not be.

§max_payload_dwell_limited: Option<&'a [Option<MaxPayload>]>

The payload limits under a dwell-time limit, where the region has one.

§join_channels: &'a [ChannelBlock]

The channels a device must use to send a join request.

§default_channels: &'a [ChannelBlock]

The channels a device starts with before a network adds any.

§sub_bands: &'a [SubBand]

The sub-bands and their transmit limits.

§default_max_eirp_dbm: i8

The power ceiling assumed when no sub-band says otherwise, in dBm.

§tx_power_step_db: u8

The step between transmit-power settings, in dB.

§max_tx_power_index: u8

The highest transmit-power index the region defines.

§rx1_data_rate_offsets: &'a [&'a [u8]]

The downlink data rate for each uplink data rate and RX1 offset, as [uplink data rate][offset].

§rx1_data_rate_offsets_dwell_limited: Option<&'a [&'a [u8]]>

The same mapping under a downlink dwell-time limit, where the region publishes a second table for it.

§max_rx1_data_rate_offset: u8

The highest RX1 data-rate offset the region allows.

§rx2_frequency_hz: u32

The fixed frequency the second receive window listens on, in hertz.

§rx2_data_rate: u8

The data rate the second receive window listens at.

§data_rate_backoff: &'a [Option<u8>]

The next lower uplink data rate during adaptive back-off, indexed by the current data rate; None where there is nothing lower.

§beacon: Beacon

The Class B beacon settings.

§has_dwell_time_limit: bool

Whether the region limits how long one transmission may occupy a channel.

Implementations§

Source§

impl ChannelPlan<'_>

Returns the uplink data rate a number selects.

§Arguments
  • data_rate - the data-rate number.
§Returns

Some(rate), or None if the number is out of range or reserved in this region.

Returns the downlink data rate a number selects.

§Arguments
  • data_rate - the data-rate number.
§Returns

Some(rate), or None if the number is out of range or reserved.

Returns the link settings an uplink data rate describes.

This is the bridge into the airtime and duty-cycle math the rest of the crate already provides.

§Arguments
  • data_rate - the uplink data-rate number.
§Returns

Some(settings) for a LoRa data rate, or None if the number is not defined here or names an FSK or LR-FHSS rate, which the chirp airtime model does not describe.

Source

pub fn max_payload( &self, data_rate: u8, behind_repeater: bool, ) -> Option<MaxPayload>

Returns the largest payload an uplink data rate carries.

§Arguments
  • data_rate - the uplink data-rate number.
  • behind_repeater - whether the device may operate through a repeater, which costs a few bytes of encapsulation at the higher data rates.
§Returns

Some(limit), or None if the data rate carries no payload here.

Returns the largest payload a downlink data rate carries.

§Arguments
  • data_rate - the downlink data-rate number.
  • behind_repeater - whether the device may operate through a repeater.
§Returns

Some(limit), or None if the data rate carries no payload here.

Source

pub fn max_payload_dwell_limited(&self, data_rate: u8) -> Option<MaxPayload>

Returns the largest payload an uplink data rate carries under a dwell-time limit.

§Arguments
  • data_rate - the uplink data-rate number.
§Returns

Some(limit), or None if the region has no dwell-time limit or the data rate carries nothing under one.

Source

pub fn duty_cycle_permille(&self, frequency_hz: u32) -> Option<u32>

Returns the duty-cycle limit that applies to a frequency.

§Arguments
  • frequency_hz - the frequency to look up.
§Returns

Some(permille) for a frequency inside a sub-band this region limits, or None where the region publishes no duty-cycle limit for it. None is not permission; it means the constraint is elsewhere, typically a dwell-time limit instead.

Source

pub fn max_eirp_dbm(&self, frequency_hz: u32) -> i8

Returns the power ceiling that applies to a frequency, in dBm.

§Arguments
  • frequency_hz - the frequency to look up.
§Returns

The sub-band’s ceiling, or the region default where no sub-band covers the frequency.

Source

pub fn tx_power_dbm(&self, index: u8, max_eirp_dbm: i8) -> Option<i8>

Returns the radiated power a transmit-power index selects, in dBm.

§Arguments
  • index - the TXPower index from a LinkADRReq.
  • max_eirp_dbm - the ceiling the index counts down from, usually max_eirp_dbm for the frequency in use.
§Returns

Some(dbm), or None if the index is above what the region defines.

Source

pub fn rx1_data_rate(&self, uplink_data_rate: u8, offset: u8) -> Option<u8>

Returns the downlink data rate the first receive window uses.

§Arguments
  • uplink_data_rate - the data rate the uplink was sent at.
  • offset - the RX1DROffset in force.
§Returns

Some(data_rate), or None if either argument is outside what the region defines.

Source

pub fn rx1_data_rate_dwell_limited( &self, uplink_data_rate: u8, offset: u8, ) -> Option<u8>

Returns the first receive window’s data rate under a dwell-time limit.

§Arguments
  • uplink_data_rate - the data rate the uplink was sent at.
  • offset - the RX1DROffset in force.
§Returns

Some(data_rate), or None if the region publishes no dwell-limited mapping or either argument is outside what it defines.

Source

pub fn rx2(&self) -> (u32, u8)

Returns the frequency and data rate of the second receive window.

§Returns

The frequency in hertz and the data-rate number.

Source

pub fn next_backoff_data_rate(&self, data_rate: u8) -> Option<u8>

Returns the next data rate down during adaptive back-off.

§Arguments
  • data_rate - the data rate currently in use.
§Returns

Some(next), or None when the device is already at the lowest rate the region backs off to.

Source

pub fn channel_frequency_hz(&self, channel: u16) -> Option<u32>

Returns the frequency of a channel by its number across the whole plan.

Channel numbers run through the default blocks in order, which is the numbering LinkADRReq channel masks use.

§Arguments
  • channel - the channel number.
§Returns

Some(hz), or None if the plan defines no such channel by default.

Source

pub fn default_channel_count(&self) -> u16

Returns how many channels the plan defines by default.

§Returns

The channel count.

Trait Implementations§

Source§

impl<'a> Clone for ChannelPlan<'a>

Source§

fn clone(&self) -> ChannelPlan<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for ChannelPlan<'a>

Source§

impl<'a> Debug for ChannelPlan<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for ChannelPlan<'a>

§

impl<'a> RefUnwindSafe for ChannelPlan<'a>

§

impl<'a> Send for ChannelPlan<'a>

§

impl<'a> Sync for ChannelPlan<'a>

§

impl<'a> Unpin for ChannelPlan<'a>

§

impl<'a> UnsafeUnpin for ChannelPlan<'a>

§

impl<'a> UnwindSafe for ChannelPlan<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.