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 strThe 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: i8The power ceiling assumed when no sub-band says otherwise, in dBm.
tx_power_step_db: u8The step between transmit-power settings, in dB.
max_tx_power_index: u8The 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: u8The highest RX1 data-rate offset the region allows.
rx2_frequency_hz: u32The fixed frequency the second receive window listens on, in hertz.
rx2_data_rate: u8The 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: BeaconThe Class B beacon settings.
has_dwell_time_limit: boolWhether the region limits how long one transmission may occupy a channel.
Implementations§
Source§impl ChannelPlan<'_>
impl ChannelPlan<'_>
Sourcepub fn uplink_data_rate(&self, data_rate: u8) -> Option<DataRate>
pub fn uplink_data_rate(&self, data_rate: u8) -> Option<DataRate>
Sourcepub fn downlink_data_rate(&self, data_rate: u8) -> Option<DataRate>
pub fn downlink_data_rate(&self, data_rate: u8) -> Option<DataRate>
Sourcepub fn link_settings(&self, data_rate: u8) -> Option<LinkSettings>
pub fn link_settings(&self, data_rate: u8) -> Option<LinkSettings>
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.
Sourcepub fn max_payload(
&self,
data_rate: u8,
behind_repeater: bool,
) -> Option<MaxPayload>
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.
Sourcepub fn downlink_max_payload(
&self,
data_rate: u8,
behind_repeater: bool,
) -> Option<MaxPayload>
pub fn downlink_max_payload( &self, data_rate: u8, behind_repeater: bool, ) -> Option<MaxPayload>
Sourcepub fn max_payload_dwell_limited(&self, data_rate: u8) -> Option<MaxPayload>
pub fn max_payload_dwell_limited(&self, data_rate: u8) -> Option<MaxPayload>
Sourcepub fn duty_cycle_permille(&self, frequency_hz: u32) -> Option<u32>
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.
Sourcepub fn max_eirp_dbm(&self, frequency_hz: u32) -> i8
pub fn max_eirp_dbm(&self, frequency_hz: u32) -> i8
Sourcepub fn tx_power_dbm(&self, index: u8, max_eirp_dbm: i8) -> Option<i8>
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- theTXPowerindex from aLinkADRReq.max_eirp_dbm- the ceiling the index counts down from, usuallymax_eirp_dbmfor the frequency in use.
§Returns
Some(dbm), or None if the index is above what the region defines.
Sourcepub fn rx1_data_rate_dwell_limited(
&self,
uplink_data_rate: u8,
offset: u8,
) -> Option<u8>
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- theRX1DROffsetin force.
§Returns
Some(data_rate), or None if the region publishes no dwell-limited
mapping or either argument is outside what it defines.
Sourcepub fn rx2(&self) -> (u32, u8)
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.
Sourcepub fn next_backoff_data_rate(&self, data_rate: u8) -> Option<u8>
pub fn next_backoff_data_rate(&self, data_rate: u8) -> Option<u8>
Sourcepub fn channel_frequency_hz(&self, channel: u16) -> Option<u32>
pub fn channel_frequency_hz(&self, channel: u16) -> Option<u32>
Sourcepub fn default_channel_count(&self) -> u16
pub fn default_channel_count(&self) -> u16
Trait Implementations§
Source§impl<'a> Clone for ChannelPlan<'a>
impl<'a> Clone for ChannelPlan<'a>
Source§fn clone(&self) -> ChannelPlan<'a>
fn clone(&self) -> ChannelPlan<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more