Skip to main content

TrustedDevices

Struct TrustedDevices 

Source
pub struct TrustedDevices { /* private fields */ }
Expand description

The end devices a relay trusts, TRUSTED_ED_NUMBER of them, each at the index the network gave it.

Implementations§

Source§

impl TrustedDevices

Source

pub const fn new() -> TrustedDevices

An empty list.

§Returns

The list.

Source

pub fn get(&self, index: u8) -> Option<&TrustedDevice>

Returns the device at an index.

§Arguments
  • index - the entry, 0 to 15.
§Returns

The device, or None for an empty entry or one out of range.

Source

pub fn get_mut(&mut self, index: u8) -> Option<&mut TrustedDevice>

Returns the device at an index to change.

§Arguments
  • index - the entry, 0 to 15.
§Returns

The device, or None for an empty entry or one out of range.

Source

pub fn set(&mut self, index: u8, device: TrustedDevice) -> bool

Puts a device at an index, replacing whatever was there.

§Arguments
  • index - the entry, 0 to 15.
  • device - the device.
§Returns

false for an index out of range.

Source

pub fn remove(&mut self, index: u8) -> Option<TrustedDevice>

Stops trusting the device at an index.

§Arguments
  • index - the entry, 0 to 15.
§Returns

The device that was there.

Source

pub fn iter(&self) -> impl Iterator<Item = (u8, &TrustedDevice)> + '_

Lists the devices.

§Returns

Each device with its index, in index order.

Source

pub fn knows(&self, dev_addr: u32) -> bool

Reports whether any device has an address.

§Arguments
  • dev_addr - the address.
§Returns

true when a trusted device has it.

Source

pub fn open( &mut self, wor: &SealedWor, carrier: Carrier, ) -> Option<Result<(u8, u32, Carrier), LorawanError>>

Checks and opens a wake-on-radio frame with the keys of whichever device it verifies for.

§Arguments
  • wor - the frame.
  • carrier - the carrier it arrived on.
§Returns

The index of the device it came from, the full counter it carried, and where its uplink follows; or None when no trusted device has the address it names.

§Errors

When devices have the address but the frame verifies for none of them, the last of their errors, as TrustedDevice::open gives them.

Source

pub fn reload(&mut self, hours: u64)

Adds what every device’s bucket earns over some hours.

§Arguments
  • hours - the whole hours since the last reload.

Trait Implementations§

Source§

impl Clone for TrustedDevices

Source§

fn clone(&self) -> TrustedDevices

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 Copy for TrustedDevices

Source§

impl Debug for TrustedDevices

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for TrustedDevices

Source§

fn default() -> TrustedDevices

Returns the “default value” for a type. Read more
Source§

impl Eq for TrustedDevices

Source§

impl PartialEq for TrustedDevices

Source§

fn eq(&self, other: &TrustedDevices) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TrustedDevices

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
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.