pub struct RfcommMultiplexer { /* private fields */ }Expand description
RFCOMM multiplexer: manages all channels over a single L2CAP connection
Implementations§
Source§impl RfcommMultiplexer
impl RfcommMultiplexer
Sourcepub fn is_session_open(&self) -> bool
pub fn is_session_open(&self) -> bool
Check if the multiplexer session is established
Sourcepub fn channel_count(&self) -> usize
pub fn channel_count(&self) -> usize
Get number of active channels
Sourcepub fn get_channel(&self, dlci: u8) -> Option<&RfcommChannel>
pub fn get_channel(&self, dlci: u8) -> Option<&RfcommChannel>
Get a channel by DLCI
Sourcepub fn start_session(&mut self) -> Result<RfcommFrame, KernelError>
pub fn start_session(&mut self) -> Result<RfcommFrame, KernelError>
Start multiplexer session (send SABM on DLCI 0)
Returns the SABM frame to send over L2CAP
Sourcepub fn open_channel(&mut self, dlci: u8) -> Result<RfcommFrame, KernelError>
pub fn open_channel(&mut self, dlci: u8) -> Result<RfcommFrame, KernelError>
Open a data channel on the given DLCI
Returns the SABM frame to send over L2CAP
Sourcepub fn close_channel(&mut self, dlci: u8) -> Result<RfcommFrame, KernelError>
pub fn close_channel(&mut self, dlci: u8) -> Result<RfcommFrame, KernelError>
Close a data channel on the given DLCI
Returns the DISC frame to send over L2CAP
Sourcepub fn send(
&mut self,
dlci: u8,
data: &[u8],
) -> Result<RfcommFrame, KernelError>
pub fn send( &mut self, dlci: u8, data: &[u8], ) -> Result<RfcommFrame, KernelError>
Send data on an open RFCOMM channel
Returns the UIH frame to send, or error if no credits available
Sourcepub fn receive(
&mut self,
frame: &RfcommFrame,
) -> Result<Option<RfcommFrame>, KernelError>
pub fn receive( &mut self, frame: &RfcommFrame, ) -> Result<Option<RfcommFrame>, KernelError>
Process a received RFCOMM frame
Returns an optional response frame to send back