Skip to main content

Settings

Struct Settings 

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

What a device’s radio can do, and how it takes part.

Implementations§

Source§

impl Settings

Source

pub const fn new(min_output_dbm: i8, max_output_dbm: i8) -> Settings

Settings for a radio with an output power range.

The rest start as a typical node: TS001-1.0.4, adaptive data rate on, an antenna with no gain over its cable, a radio that tunes 137 to 1020 MHz as an SX1276 does, the region’s duty cycle kept, and no repeater in the path.

§Arguments
  • min_output_dbm - the lowest power the radio puts out, conducted.
  • max_output_dbm - the highest, conducted.
§Returns

The settings.

Source

pub const fn with_crystal_ppm(self, crystal_ppm: u32) -> Settings

Sets how far the device’s own clock may drift.

It decides how much preamble a wake-on-radio frame needs to still cover a relay’s scan, TS011-1.0.1 appendix 1. The default is the 20 parts per million of a typical temperature-compensated crystal.

§Arguments
  • crystal_ppm - the accuracy in parts per million.
§Returns

The settings.

Source

pub const fn with_version(self, version: Version) -> Settings

Follows another revision of the link layer.

§Arguments
  • version - the revision the network was told this device follows.
§Returns

The settings.

Source

pub const fn with_adr(self, adr: bool) -> Settings

Turns adaptive data rate on or off.

With it on, the device sets the ADR bit, takes the data rate and power the network chooses, and backs off when the network goes quiet. With it off, the device keeps its own data rate and TS001-1.0.4 section 5.2 lets it accept a LinkADRReq one field at a time.

§Arguments
  • adr - whether the network manages the data rate.
§Returns

The settings.

Source

pub const fn with_antenna_gain(self, gain_db: i8) -> Settings

Accounts for the antenna and its feed.

Most regions limit radiated power, so a device with a 3 dBi antenna puts out 3 dB less than one with a 0 dBi antenna to radiate the same. US902-928 limits conducted power instead, and only the gain above the 6 dBi its limit allows for comes off.

§Arguments
  • gain_db - the antenna gain less the cable and connector losses, in dB.
§Returns

The settings.

Source

pub const fn with_tuning_range( self, lowest_hz: u32, highest_hz: u32, ) -> Settings

Sets the frequencies the radio and its front end can use.

A network that asks for a channel or a receive window outside them is told so.

§Arguments
  • lowest_hz - the lowest usable frequency.
  • highest_hz - the highest.
§Returns

The settings.

Source

pub const fn without_regional_duty_cycle(self) -> Settings

Stops holding the device to the region’s sub-band duty cycles.

The regional tables report a limit rather than enforce one, because the operator is the one who knows whether a regulation applies where the device stands. The network’s DutyCycleReq and the join back-off still hold.

§Returns

The settings.

Source

pub const fn behind_repeater(self) -> Settings

Sizes payloads for a path through a relay, which costs a few bytes of each frame.

§Returns

The settings.

Source

pub const fn with_seed(self, seed: u32) -> Settings

Seeds the device’s random choices of channel and retry delay.

The device identifier is mixed in, so devices given the same seed still differ.

§Arguments
  • seed - any value, ideally from a hardware random source.
§Returns

The settings.

Trait Implementations§

Source§

impl Clone for Settings

Source§

fn clone(&self) -> Settings

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 Settings

Source§

impl Debug for Settings

Source§

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

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

impl Eq for Settings

Source§

impl PartialEq for Settings

Source§

fn eq(&self, other: &Settings) -> 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 Settings

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.