pub struct BleConnector<'d> { /* private fields */ }ble and 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>
impl<'d> BleConnector<'d>
Sourcepub fn new(
device: BT<'d>,
config: Config,
) -> Result<BleConnector<'d>, BleInitError>
pub fn new( device: BT<'d>, config: Config, ) -> Result<BleConnector<'d>, BleInitError>
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.
Sourcepub fn next(&mut self, buf: &mut [u8]) -> Result<usize, BleConnectorError>
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.
Sourcepub fn read(&mut self, buf: &mut [u8]) -> Result<usize, BleConnectorError>
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.
Sourcepub async fn read_async(
&mut self,
buf: &mut [u8],
) -> Result<usize, BleConnectorError>
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.
Sourcepub fn write(&mut self, buf: &[u8]) -> Result<usize, BleConnectorError>
pub fn write(&mut self, buf: &[u8]) -> Result<usize, BleConnectorError>
Write to HCI.
Returns the number of bytes written, which is at most one packet.
§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.
Sourcepub async fn write_async(
&mut self,
buf: &[u8],
) -> Result<usize, BleConnectorError>
pub async fn write_async( &mut self, buf: &[u8], ) -> Result<usize, BleConnectorError>
Write to HCI asynchronously.
Returns the number of bytes written, which is at most one packet.
§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<'_>
impl Drop for BleConnector<'_>
Source§impl ErrorType for BleConnector<'_>
impl ErrorType for BleConnector<'_>
Source§type Error = BleConnectorError
type Error = BleConnectorError
Source§impl ErrorType for BleConnector<'_>
impl ErrorType for BleConnector<'_>
Source§type Error = BleConnectorError
type Error = BleConnectorError
Source§impl Read for BleConnector<'_>
impl Read for BleConnector<'_>
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Source§fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
buf. Read moreSource§impl Read for BleConnector<'_>
impl Read for BleConnector<'_>
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Source§fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
buf. Read moreSource§impl Read for BleConnector<'_>
impl Read for BleConnector<'_>
Source§fn read(
&mut self,
buf: &mut [u8],
) -> impl Future<Output = Result<usize, BleConnectorError>>
fn read( &mut self, buf: &mut [u8], ) -> impl Future<Output = Result<usize, BleConnectorError>>
Source§async fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
async fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
buf. Read moreSource§impl Read for BleConnector<'_>
impl Read for BleConnector<'_>
Source§fn read(
&mut self,
buf: &mut [u8],
) -> impl Future<Output = Result<usize, BleConnectorError>>
fn read( &mut self, buf: &mut [u8], ) -> impl Future<Output = Result<usize, BleConnectorError>>
Source§async fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
async fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
buf. Read moreSource§impl Transport for BleConnector<'_>
impl Transport for BleConnector<'_>
Source§async fn read<'a>(
&self,
rx: &'a mut [u8],
) -> Result<ControllerToHostPacket<'a>, Self::Error>
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>
async fn write<T: HostToControllerPacket>( &self, val: &T, ) -> Result<(), Self::Error>
Write a complete HCI packet from the tx buffer
Source§impl Transport for BleConnector<'_>
impl Transport for BleConnector<'_>
Source§async fn read<'a, P: PacketToHost<'a>>(
&self,
rx: &'a mut [u8],
) -> Result<P, Self::Error>
async fn read<'a, P: PacketToHost<'a>>( &self, rx: &'a mut [u8], ) -> Result<P, Self::Error>
Read a complete HCI packet into the rx buffer
Source§async fn write<P: PacketToController>(&self, tx: &P) -> Result<(), Self::Error>
async fn write<P: PacketToController>(&self, tx: &P) -> Result<(), Self::Error>
Write a complete HCI packet from the tx buffer