⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

RfcommMultiplexer

Struct RfcommMultiplexer 

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

RFCOMM multiplexer: manages all channels over a single L2CAP connection

Implementations§

Source§

impl RfcommMultiplexer

Source

pub fn new(l2cap_cid: u16) -> Self

Create a new RFCOMM multiplexer

Source

pub fn l2cap_cid(&self) -> u16

Get the underlying L2CAP CID

Source

pub fn is_session_open(&self) -> bool

Check if the multiplexer session is established

Source

pub fn channel_count(&self) -> usize

Get number of active channels

Source

pub fn get_channel(&self, dlci: u8) -> Option<&RfcommChannel>

Get a channel by DLCI

Source

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

Source

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

Source

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

Source

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

Source

pub fn receive( &mut self, frame: &RfcommFrame, ) -> Result<Option<RfcommFrame>, KernelError>

Process a received RFCOMM frame

Returns an optional response frame to send back

Trait Implementations§

Source§

impl Default for RfcommMultiplexer

Available on crate feature alloc only.
Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for RfcommMultiplexer

§

impl RefUnwindSafe for RfcommMultiplexer

§

impl Send for RfcommMultiplexer

§

impl Sync for RfcommMultiplexer

§

impl Unpin for RfcommMultiplexer

§

impl UnwindSafe for RfcommMultiplexer

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.