Struct stm32wlxx_hal::subghz::Stats

source ·
pub struct Stats<ModType> { /* private fields */ }
Expand description

Packet statistics.

Returned by fsk_stats and lora_stats.

Implementations§

source§

impl<ModType> Stats<ModType>

source

pub const fn status(&self) -> Status

Get the radio status returned with the packet statistics.

Example
use stm32wlxx_hal::subghz::{CmdStatus, FskStats, Stats, StatusMode};

let example_data_from_radio: [u8; 7] = [0x54, 0, 0, 0, 0, 0, 0];
let stats: Stats<FskStats> = Stats::from_raw_fsk(example_data_from_radio);
assert_eq!(stats.status().mode(), Ok(StatusMode::Rx));
assert_eq!(stats.status().cmd(), Ok(CmdStatus::Available));
source

pub const fn pkt_rx(&self) -> u16

Number of packets received.

Example
use stm32wlxx_hal::subghz::{FskStats, Stats};

let example_data_from_radio: [u8; 7] = [0x54, 0, 3, 0, 0, 0, 0];
let stats: Stats<FskStats> = Stats::from_raw_fsk(example_data_from_radio);
assert_eq!(stats.pkt_rx(), 3);
source

pub const fn pkt_crc(&self) -> u16

Number of packets received with a payload CRC error

Example
use stm32wlxx_hal::subghz::{LoRaStats, Stats};

let example_data_from_radio: [u8; 7] = [0x54, 0, 0, 0, 1, 0, 0];
let stats: Stats<LoRaStats> = Stats::from_raw_lora(example_data_from_radio);
assert_eq!(stats.pkt_crc(), 1);
source§

impl Stats<FskStats>

source

pub const fn from_raw_fsk(buf: [u8; 7]) -> Stats<FskStats>

Create a new FSK packet statistics structure from a raw buffer.

Example
use stm32wlxx_hal::subghz::{FskStats, Stats};

let example_data_from_radio: [u8; 7] = [0x54, 0, 0, 0, 0, 0, 0];
let stats: Stats<FskStats> = Stats::from_raw_fsk(example_data_from_radio);
source

pub const fn pkt_len_err(&self) -> u16

Number of packets received with a payload length error.

Example
use stm32wlxx_hal::subghz::{FskStats, Stats};

let example_data_from_radio: [u8; 7] = [0x54, 0, 0, 0, 0, 0, 1];
let stats: Stats<FskStats> = Stats::from_raw_fsk(example_data_from_radio);
assert_eq!(stats.pkt_len_err(), 1);
source§

impl Stats<LoRaStats>

source

pub const fn from_raw_lora(buf: [u8; 7]) -> Stats<LoRaStats>

Create a new LoRa packet statistics structure from a raw buffer.

Example
use stm32wlxx_hal::subghz::{LoRaStats, Stats};

let example_data_from_radio: [u8; 7] = [0x54, 0, 0, 0, 0, 0, 0];
let stats: Stats<LoRaStats> = Stats::from_raw_lora(example_data_from_radio);
source

pub const fn pkt_hdr_err(&self) -> u16

Number of packets received with a header CRC error.

Example
use stm32wlxx_hal::subghz::{LoRaStats, Stats};

let example_data_from_radio: [u8; 7] = [0x54, 0, 0, 0, 0, 0, 1];
let stats: Stats<LoRaStats> = Stats::from_raw_lora(example_data_from_radio);
assert_eq!(stats.pkt_hdr_err(), 1);

Trait Implementations§

source§

impl<ModType: Clone> Clone for Stats<ModType>

source§

fn clone(&self) -> Stats<ModType>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Stats<FskStats>

source§

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

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

impl<ModType: PartialEq> PartialEq for Stats<ModType>

source§

fn eq(&self, other: &Stats<ModType>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<ModType: Copy> Copy for Stats<ModType>

source§

impl<ModType: Eq> Eq for Stats<ModType>

source§

impl<ModType> StructuralEq for Stats<ModType>

source§

impl<ModType> StructuralPartialEq for Stats<ModType>

Auto Trait Implementations§

§

impl<ModType> RefUnwindSafe for Stats<ModType>where ModType: RefUnwindSafe,

§

impl<ModType> Send for Stats<ModType>where ModType: Send,

§

impl<ModType> Sync for Stats<ModType>where ModType: Sync,

§

impl<ModType> Unpin for Stats<ModType>where ModType: Unpin,

§

impl<ModType> UnwindSafe for Stats<ModType>where ModType: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.