Struct BleConnector

Source
pub struct BleConnector<'d> { /* private fields */ }
Available on crate feature unstable only.
Expand description

A blocking HCI connector

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Implementations§

Source§

impl<'d> BleConnector<'d>

Source

pub fn new( _init: &'d Controller<'d>, device: BT<'d>, config: Config, ) -> Result<BleConnector<'d>, InvalidConfigError>

Create and init a new BLE connector.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub fn next(&mut self, buf: &mut [u8]) -> Result<usize, BleConnectorError>

Read the next HCI packet from the BLE controller.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub fn read(&mut self, buf: &mut [u8]) -> Result<usize, BleConnectorError>

Read from HCI.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub async fn read_async( &mut self, buf: &mut [u8], ) -> Result<usize, BleConnectorError>

Read from HCI.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Source

pub fn write(&mut self, buf: &[u8]) -> Result<usize, BleConnectorError>

Write to HCI.

§Stability

This API is marked as unstable and is only available when the unstable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Trait Implementations§

Source§

impl Drop for BleConnector<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl ErrorType for BleConnector<'_>

Source§

type Error = BleConnectorError

Error type of all the IO operations on this type.
Source§

impl ErrorType for BleConnector<'_>

Source§

type Error = BleConnectorError

Error type of all the IO operations on this type.
Source§

impl Read for BleConnector<'_>

Source§

fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>

Read some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Source§

fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>

Read the exact number of bytes required to fill buf. Read more
Source§

impl Read for BleConnector<'_>

Source§

fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>

Read some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Source§

fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>

Read the exact number of bytes required to fill buf. Read more
Source§

impl Read for BleConnector<'_>

Source§

async fn read(&mut self, buf: &mut [u8]) -> Result<usize, BleConnectorError>

Read some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Source§

async fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>

Read the exact number of bytes required to fill buf. Read more
Source§

impl Read for BleConnector<'_>

Source§

async fn read(&mut self, buf: &mut [u8]) -> Result<usize, BleConnectorError>

Read some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Source§

async fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>

Read the exact number of bytes required to fill buf. Read more
Source§

impl Transport for BleConnector<'_>

Source§

async fn read<'a>( &self, rx: &'a mut [u8], ) -> Result<ControllerToHostPacket<'a>, Self::Error>

Read a complete HCI packet into the rx buffer

Source§

async fn write<T: HostToControllerPacket>( &self, val: &T, ) -> Result<(), Self::Error>

Write a complete HCI packet from the tx buffer

Source§

impl Write for BleConnector<'_>

Source§

fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>

Write a buffer into this writer, returning how many bytes were written. Read more
Source§

fn flush(&mut self) -> Result<(), Self::Error>

Flush this output stream, blocking until all intermediately buffered contents reach their destination.
Source§

fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error>

Write an entire buffer into this writer. Read more
Source§

fn write_fmt( &mut self, fmt: Arguments<'_>, ) -> Result<(), WriteFmtError<Self::Error>>

Write a formatted string into this writer, returning any error encountered. Read more
Source§

impl Write for BleConnector<'_>

Source§

fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>

Write a buffer into this writer, returning how many bytes were written. Read more
Source§

fn flush(&mut self) -> Result<(), Self::Error>

Flush this output stream, blocking until all intermediately buffered contents reach their destination.
Source§

fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error>

Write an entire buffer into this writer. Read more
Source§

fn write_fmt( &mut self, fmt: Arguments<'_>, ) -> Result<(), WriteFmtError<Self::Error>>

Write a formatted string into this writer, returning any error encountered. Read more
Source§

impl Write for BleConnector<'_>

Source§

async fn write(&mut self, buf: &[u8]) -> Result<usize, BleConnectorError>

Write a buffer into this writer, returning how many bytes were written. Read more
Source§

async fn flush(&mut self) -> Result<(), BleConnectorError>

Flush this output stream, ensuring that all intermediately buffered contents reach their destination.
Source§

async fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error>

Write an entire buffer into this writer. Read more
Source§

impl Write for BleConnector<'_>

Source§

async fn write(&mut self, buf: &[u8]) -> Result<usize, BleConnectorError>

Write a buffer into this writer, returning how many bytes were written. Read more
Source§

async fn flush(&mut self) -> Result<(), BleConnectorError>

Flush this output stream, ensuring that all intermediately buffered contents reach their destination.
Source§

async fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error>

Write an entire buffer into this writer. Read more

Auto Trait Implementations§

§

impl<'d> Freeze for BleConnector<'d>

§

impl<'d> RefUnwindSafe for BleConnector<'d>

§

impl<'d> Send for BleConnector<'d>

§

impl<'d> Sync for BleConnector<'d>

§

impl<'d> Unpin for BleConnector<'d>

§

impl<'d> !UnwindSafe for BleConnector<'d>

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.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

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.