pub struct CfList { /* private fields */ }Expand description
The optional channel list at the end of a join accept.
§Examples
A European network adding the five channels most EU868 networks run between 867.1 and 867.9 MHz:
use pamoja_lorawan::{CfList, CfListKind};
let list = CfList::frequencies([867_100_000, 867_300_000, 867_500_000, 867_700_000, 867_900_000])?;
assert_eq!(list.kind(), CfListKind::Frequencies);
assert_eq!(list.to_bytes().len(), 16, "the last sixteen bytes of the accept");
// A device reads the same frequencies back out.
let heard = CfList::from_bytes(list.to_bytes());
assert_eq!(heard.frequencies_hz(), Some([867_100_000, 867_300_000, 867_500_000, 867_700_000, 867_900_000]));Implementations§
Source§impl CfList
impl CfList
Sourcepub const fn from_bytes(bytes: [u8; 16]) -> CfList
pub const fn from_bytes(bytes: [u8; 16]) -> CfList
Sourcepub const fn frequencies(
frequencies_hz: [u32; 5],
) -> Result<CfList, LorawanError>
pub const fn frequencies( frequencies_hz: [u32; 5], ) -> Result<CfList, LorawanError>
Builds a type 0 list from frequencies.
§Arguments
frequencies_hz- five frequencies in hertz, with0for a slot left unused.
§Returns
The channel list.
§Errors
Returns LorawanError::MalformedFrame if a frequency is not a whole number of
hundreds of hertz, or does not fit the three bytes it is carried in, which end just
under 1.678 GHz. Between those, RP002-1.0.5 reserves anything below 100 MHz, and that
is refused too.
Sourcepub const fn channel_masks(masks: [u16; 6]) -> CfList
pub const fn channel_masks(masks: [u16; 6]) -> CfList
Sourcepub const fn kind(&self) -> CfListKind
pub const fn kind(&self) -> CfListKind
Sourcepub const fn frequencies_hz(&self) -> Option<[u32; 5]>
pub const fn frequencies_hz(&self) -> Option<[u32; 5]>
Sourcepub const fn channel_mask_groups(&self) -> Option<[u16; 6]>
pub const fn channel_mask_groups(&self) -> Option<[u16; 6]>
Sourcepub fn enabled_channels(&self) -> impl Iterator<Item = u8> + '_
pub fn enabled_channels(&self) -> impl Iterator<Item = u8> + '_
Returns the channels a type 1 list enables, lowest first.
This is the order RP002-1.0.5 section 3.3.1.1 has a dynamic plan create them in, one after its last default channel for each bit set.
§Returns
The channel numbers, which is empty for a list of any other type.
Trait Implementations§
impl Copy for CfList
impl Eq for CfList
impl StructuralPartialEq for CfList
Auto Trait Implementations§
impl Freeze for CfList
impl RefUnwindSafe for CfList
impl Send for CfList
impl Sync for CfList
impl Unpin for CfList
impl UnsafeUnpin for CfList
impl UnwindSafe for CfList
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