pub struct PhyController { /* private fields */ }Expand description
PHY Controller
Manages PHY selection, switching, and monitoring for a BLE connection.
Implementations§
Source§impl PhyController
impl PhyController
Sourcepub fn new(config: PhyControllerConfig, local_caps: PhyCapabilities) -> Self
pub fn new(config: PhyControllerConfig, local_caps: PhyCapabilities) -> Self
Create a new PHY controller
Sourcepub fn with_defaults(local_caps: PhyCapabilities) -> Self
pub fn with_defaults(local_caps: PhyCapabilities) -> Self
Create with default config
Sourcepub fn state(&self) -> PhyControllerState
pub fn state(&self) -> PhyControllerState
Get current state
Sourcepub fn current_preference(&self) -> PhyPreference
pub fn current_preference(&self) -> PhyPreference
Get current PHY preference
Sourcepub fn effective_capabilities(&self) -> PhyCapabilities
pub fn effective_capabilities(&self) -> PhyCapabilities
Get effective capabilities (intersection of local and peer)
Sourcepub fn config(&self) -> &PhyControllerConfig
pub fn config(&self) -> &PhyControllerConfig
Get config
Sourcepub fn start_negotiation(&mut self)
pub fn start_negotiation(&mut self)
Start PHY negotiation for a new connection
Sourcepub fn complete_negotiation(
&mut self,
peer_caps: PhyCapabilities,
) -> PhyControllerEvent
pub fn complete_negotiation( &mut self, peer_caps: PhyCapabilities, ) -> PhyControllerEvent
Complete negotiation with peer capabilities
Sourcepub fn record_rssi(
&mut self,
rssi: i8,
current_time: u64,
) -> Option<PhyControllerEvent>
pub fn record_rssi( &mut self, rssi: i8, current_time: u64, ) -> Option<PhyControllerEvent>
Record an RSSI measurement
Sourcepub fn average_rssi(&self) -> i8
pub fn average_rssi(&self) -> i8
Get average RSSI from samples
Sourcepub fn evaluate_switch(&self, rssi: i8) -> PhySwitchDecision
pub fn evaluate_switch(&self, rssi: i8) -> PhySwitchDecision
Evaluate whether to switch PHY
Sourcepub fn request_switch(&mut self, to_phy: BlePhy) -> Option<PhyPreference>
pub fn request_switch(&mut self, to_phy: BlePhy) -> Option<PhyPreference>
Request a PHY update
Sourcepub fn handle_update_result(
&mut self,
result: PhyUpdateResult,
current_time: u64,
) -> PhyControllerEvent
pub fn handle_update_result( &mut self, result: PhyUpdateResult, current_time: u64, ) -> PhyControllerEvent
Handle PHY update result from stack
Sourcepub fn set_strategy(&mut self, strategy: PhyStrategy)
pub fn set_strategy(&mut self, strategy: PhyStrategy)
Set PHY strategy
Sourcepub fn set_auto_switch(&mut self, enabled: bool)
pub fn set_auto_switch(&mut self, enabled: bool)
Enable/disable auto switching
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PhyController
impl RefUnwindSafe for PhyController
impl Send for PhyController
impl Sync for PhyController
impl Unpin for PhyController
impl UnwindSafe for PhyController
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