Skip to main content

PhyController

Struct PhyController 

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

PHY Controller

Manages PHY selection, switching, and monitoring for a BLE connection.

Implementations§

Source§

impl PhyController

Source

pub fn new(config: PhyControllerConfig, local_caps: PhyCapabilities) -> Self

Create a new PHY controller

Source

pub fn with_defaults(local_caps: PhyCapabilities) -> Self

Create with default config

Source

pub fn state(&self) -> PhyControllerState

Get current state

Source

pub fn tx_phy(&self) -> BlePhy

Get current TX PHY

Source

pub fn rx_phy(&self) -> BlePhy

Get current RX PHY

Source

pub fn current_preference(&self) -> PhyPreference

Get current PHY preference

Source

pub fn effective_capabilities(&self) -> PhyCapabilities

Get effective capabilities (intersection of local and peer)

Source

pub fn stats(&self) -> &PhyStats

Get statistics

Source

pub fn config(&self) -> &PhyControllerConfig

Get config

Source

pub fn start_negotiation(&mut self)

Start PHY negotiation for a new connection

Source

pub fn complete_negotiation( &mut self, peer_caps: PhyCapabilities, ) -> PhyControllerEvent

Complete negotiation with peer capabilities

Source

pub fn record_rssi( &mut self, rssi: i8, current_time: u64, ) -> Option<PhyControllerEvent>

Record an RSSI measurement

Source

pub fn average_rssi(&self) -> i8

Get average RSSI from samples

Source

pub fn evaluate_switch(&self, rssi: i8) -> PhySwitchDecision

Evaluate whether to switch PHY

Source

pub fn request_switch(&mut self, to_phy: BlePhy) -> Option<PhyPreference>

Request a PHY update

Source

pub fn handle_update_result( &mut self, result: PhyUpdateResult, current_time: u64, ) -> PhyControllerEvent

Handle PHY update result from stack

Source

pub fn reset(&mut self)

Reset controller state

Source

pub fn set_strategy(&mut self, strategy: PhyStrategy)

Set PHY strategy

Source

pub fn set_auto_switch(&mut self, enabled: bool)

Enable/disable auto switching

Trait Implementations§

Source§

impl Debug for PhyController

Source§

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

Formats the value using the given formatter. Read more

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