pub struct ChannelPlan<'a> {Show 30 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 relay_channels: &'a [RelayChannel],
pub has_dwell_time_limit: bool,
pub kind: PlanKind,
pub tx_param_setup: bool,
pub mask_controls: [MaskControl; 8],
pub downlink_channels: &'a [ChannelBlock],
pub join_sequence: JoinSequence,
pub power_reference: PowerReference,
pub join_plans: &'a [JoinPlan<'a>],
}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.
It is radiated power unless power_reference says the plan
counts conducted power, as US902-928 does.
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.
relay_channels: &'a [RelayChannel]The default channels of a LoRaWAN relay, by channel index, from the region’s relay parameters in RP002-1.0.5 sections 3.4.9 to 3.13.9; empty where a region defines none.
has_dwell_time_limit: boolWhether the region limits how long one transmission may occupy a channel.
kind: PlanKindWhether a network may create and move channels, or only enable numbered ones.
tx_param_setup: boolWhether devices in the region answer TXParamSetupReq, which sets their
radiated power ceiling and dwell time.
RP002-1.0.5 has AS923 and AU915-928 implement it and every other region leave it out; a device in a region without it drops the command unanswered.
mask_controls: [MaskControl; 8]What each value of a LinkADRReq command’s ChMaskCntl field does, indexed by the
value.
downlink_channels: &'a [ChannelBlock]The numbered downlink channels the first receive window answers on, for a plan that has them, and empty for one that answers on the uplink’s own frequency.
The fixed plans number their downlink channels apart from their uplink ones, and
answer an uplink on channel n on downlink channel n modulo how many there are:
“RX1 Channel Number = Transmit Channel Number modulo NbChannel”, RP002-1.0.5 section
3.5.7.
join_sequence: JoinSequenceThe order a device tries the join channels in.
power_reference: PowerReferenceWhat the transmit power indexes count down from.
join_plans: &'a [JoinPlan<'a>]The plans a join selects between, for a region that puts a device on a plan by the channel it joined on, and empty where the plan is the one a device joins on.
Implementations§
Source§impl<'a> ChannelPlan<'a>
impl<'a> ChannelPlan<'a>
Sourcepub fn join_plan(&self, join_channel: u16) -> Option<(JoinPlan<'a>, u16)>
pub fn join_plan(&self, join_channel: u16) -> Option<(JoinPlan<'a>, u16)>
Returns the run of join channels a join channel number falls in.
Join channels are numbered through join_plans in order, which
is how RP002-1.0.5 table 49 indexes the CN470-510 common join channels.
§Arguments
join_channel- the join channel number.
§Returns
The run and the channel’s position within it, or None for a plan with no join
plans or a number past the last run.
§Examples
use pamoja_lora::region::{Cn470Plan, Region};
// RP002-1.0.5 table 49: common join channel 9 goes out on 499.9 MHz, is answered
// there, and puts the device on the 20 MHz antenna's plan B.
let (run, offset) = Region::Cn470.plan().join_plan(9).expect("twenty join channels");
assert_eq!(run.channels.frequency_hz(offset), Some(499_900_000));
assert_eq!(run.accept_hz(offset), Some(499_900_000));
assert!(core::ptr::eq(run.plan, Cn470Plan::Antenna20MhzB.plan()));Source§impl ChannelPlan<'_>
impl ChannelPlan<'_>
Sourcepub fn downlink_channel_frequency_hz(&self, channel: u16) -> Option<u32>
pub fn downlink_channel_frequency_hz(&self, channel: u16) -> Option<u32>
Returns the frequency of a numbered downlink channel.
§Arguments
channel- the downlink channel number, counted throughdownlink_channelsin order.
§Returns
Some(hz), or None if the plan numbers no such downlink channel.
Sourcepub fn downlink_channel_count(&self) -> u16
pub fn downlink_channel_count(&self) -> u16
Returns how many numbered downlink channels the plan has.
§Returns
The count, zero for a plan that answers on the uplink’s own frequency.
Sourcepub fn rx1_frequency_hz(
&self,
uplink_channel: u16,
uplink_hz: u32,
) -> Option<u32>
pub fn rx1_frequency_hz( &self, uplink_channel: u16, uplink_hz: u32, ) -> Option<u32>
Returns where the first receive window listens after an uplink.
§Arguments
uplink_channel- the channel number the uplink went out on.uplink_hz- the frequency it went out on.
§Returns
The uplink’s own frequency for a plan with no numbered downlink channels, and
otherwise the downlink channel the uplink channel maps to, or None if the plan’s
downlink channels leave it undefined.
§Examples
use pamoja_lora::region::Region;
// US902-928: an uplink on channel 65, the second 500 kHz channel at 904.6 MHz, is
// answered on downlink channel 1 at 923.9 MHz.
let plan = Region::Us915.plan();
assert_eq!(plan.rx1_frequency_hz(65, 904_600_000), Some(923_900_000));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 power a transmit-power index selects, in dBm.
The power is radiated or conducted as the plan’s
power_reference says.
§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 relay_channel(&self, index: u8) -> Option<RelayChannel>
pub fn relay_channel(&self, index: u8) -> Option<RelayChannel>
Returns a default relay channel.
§Arguments
index- the channel index a relay configuration names, 0 or 1.
§Returns
The channel, or None where the region defines none at that index.
§Examples
use pamoja_lora::region::{RelayChannel, Region};
let plan = Region::Eu868.plan();
assert_eq!(
plan.relay_channel(0),
Some(RelayChannel::new(865_100_000, 865_300_000, 3))
);
assert_eq!(plan.relay_channel(2), None);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