pub struct Channel { /* private fields */ }Expand description
An open L2CAP channel.
Implementations§
Source§impl Channel
impl Channel
Sourcepub fn connect(
address: &str,
peer_address_type: &str,
psm: Psm,
sink: Arc<dyn ChannelSink>,
) -> Result<Self, String>
pub fn connect( address: &str, peer_address_type: &str, psm: Psm, sink: Arc<dyn ChannelSink>, ) -> Result<Self, String>
Connect to address on psm.
address_type is BlueZ’s AddressType: "public" or "random".
Sourcepub fn adopt_fd(
fd: c_int,
psm: Psm,
peer: String,
sink: Arc<dyn ChannelSink>,
) -> Self
pub fn adopt_fd( fd: c_int, psm: Psm, peer: String, sink: Arc<dyn ChannelSink>, ) -> Self
Adopt an already-connected LE L2CAP socket.
pub fn psm(&self) -> Psm
pub fn peer_id(&self) -> &str
Sourcepub fn send(&self, bytes: &[u8]) -> Result<(), Closed>
pub fn send(&self, bytes: &[u8]) -> Result<(), Closed>
Write bytes. Blocks only as long as the kernel’s socket buffer requires.
Sourcepub fn pending_bytes(&self) -> usize
pub fn pending_bytes(&self) -> usize
Always zero: writes go straight to the kernel rather than an internal queue. Present so both platforms answer the same question.
pub fn closed(&self) -> Option<Closed>
pub fn close(&self)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Channel
impl Forget for Channel
impl Move for Channel
impl RefUnwindSafe for Channel
impl Send for Channel
impl Sync for Channel
impl Unpin for Channel
impl UnsafeUnpin for Channel
impl UnwindSafe for Channel
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