Skip to main content

Info

Struct Info 

Source
pub struct Info {
Show 20 fields pub proto_major: u8, pub proto_minor: u8, pub fw_major: u8, pub fw_minor: u8, pub fw_patch: u8, pub radio_chip_id: u16, pub capability_bitmap: u64, pub supported_sf_bitmap: u16, pub supported_bw_bitmap: u16, pub max_payload_bytes: u16, pub rx_queue_capacity: u16, pub tx_queue_capacity: u16, pub freq_min_hz: u32, pub freq_max_hz: u32, pub tx_power_min_dbm: i8, pub tx_power_max_dbm: i8, pub mcu_uid_len: u8, pub mcu_uid: [u8; 32], pub radio_uid_len: u8, pub radio_uid: [u8; 16],
}
Expand description

GET_INFO response payload.

mcu_uid and radio_uid are fixed-capacity arrays (MAX_MCU_UID_LEN and MAX_RADIO_UID_LEN respectively). Only the first *_len bytes are meaningful on the wire; the rest are zero-padded and ignored.

radio_chip_id is stored as the raw u16. Use chip_id() to project it into the RadioChipId enum when convenient; unassigned values stay representable so a newer device advertising a chip this codec hasn’t heard of still round-trips cleanly.

Fields§

§proto_major: u8§proto_minor: u8§fw_major: u8§fw_minor: u8§fw_patch: u8§radio_chip_id: u16§capability_bitmap: u64§supported_sf_bitmap: u16§supported_bw_bitmap: u16§max_payload_bytes: u16§rx_queue_capacity: u16§tx_queue_capacity: u16§freq_min_hz: u32§freq_max_hz: u32§tx_power_min_dbm: i8§tx_power_max_dbm: i8§mcu_uid_len: u8§mcu_uid: [u8; 32]§radio_uid_len: u8§radio_uid: [u8; 16]

Implementations§

Source§

impl Info

Source

pub const MIN_WIRE_SIZE: usize = 37

Size of the fixed-layout prefix (through radio_uid_len’s byte). The spec locates radio_uid_len at offset 36 + mcu_uid_len; the 37 bytes of fixed fields before mcu_uid plus 1 for the radio_uid_len byte gives the absolute minimum wire size (with mcu_uid_len = 0 and radio_uid_len = 0).

Source

pub fn chip_id(&self) -> Option<RadioChipId>

Project radio_chip_id into the enum. Returns None for unassigned values so callers can decide how to handle them.

Source

pub fn supports(&self, mask: u64) -> bool

True if the device advertises a given capability bit.

Source

pub fn encode(&self, buf: &mut [u8]) -> Result<usize, InfoParseError>

Encode into buf. Returns the number of bytes written (37 + mcu_uid_len + radio_uid_len).

Source

pub fn decode(buf: &[u8]) -> Result<Self, InfoParseError>

Decode from buf. The full slice must be the GET_INFO payload.

Trait Implementations§

Source§

impl Clone for Info

Source§

fn clone(&self) -> Info

Returns a duplicate 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 Info

Source§

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

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

impl Format for Info
where [u8; 32]: Format, [u8; 16]: Format,

Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl PartialEq for Info

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Info

Source§

impl Eq for Info

Source§

impl StructuralPartialEq for Info

Auto Trait Implementations§

§

impl Freeze for Info

§

impl RefUnwindSafe for Info

§

impl Send for Info

§

impl Sync for Info

§

impl Unpin for Info

§

impl UnsafeUnpin for Info

§

impl UnwindSafe for Info

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, 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.