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>
impl<ModType> Stats<ModType>
sourcepub const fn status(&self) -> Status
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));
sourcepub const fn pkt_rx(&self) -> u16
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);
sourcepub const fn pkt_crc(&self) -> u16
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>
impl Stats<FskStats>
sourcepub const fn from_raw_fsk(buf: [u8; 7]) -> Stats<FskStats>
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);
sourcepub const fn pkt_len_err(&self) -> u16
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>
impl Stats<LoRaStats>
sourcepub const fn from_raw_lora(buf: [u8; 7]) -> Stats<LoRaStats>
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);
sourcepub const fn pkt_hdr_err(&self) -> u16
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: PartialEq> PartialEq for Stats<ModType>
impl<ModType: PartialEq> PartialEq for Stats<ModType>
impl<ModType: Copy> Copy for Stats<ModType>
impl<ModType: Eq> Eq for Stats<ModType>
impl<ModType> StructuralEq for Stats<ModType>
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> 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