trouble-host

Crates

git

Versions

default

Flavors

Struct ExternalController

Source
pub struct ExternalController<T, const SLOTS: usize> { /* private fields */ }
Expand description

An external Bluetooth controller with communication via Transport type T.

The controller state holds a number of command slots that can be used to issue commands and await responses from an underlying controller.

The contract is that before sending a command, a slot is reserved, which returns a signal handle that can be used to await a response.

Implementations§

Source§

impl<T, const SLOTS: usize> ExternalController<T, SLOTS>

Source

pub fn new(transport: T) -> ExternalController<T, SLOTS>

Create a new instance.

Trait Implementations§

Source§

impl<T, const SLOTS: usize> Controller for ExternalController<T, SLOTS>
where T: Transport,

Source§

async fn write_acl_data( &self, packet: &AclPacket<'_>, ) -> Result<(), <ExternalController<T, SLOTS> as ErrorType>::Error>

Write ACL data to the controller.
Source§

async fn write_sync_data( &self, packet: &SyncPacket<'_>, ) -> Result<(), <ExternalController<T, SLOTS> as ErrorType>::Error>

Write Sync data to the controller.
Source§

async fn write_iso_data( &self, packet: &IsoPacket<'_>, ) -> Result<(), <ExternalController<T, SLOTS> as ErrorType>::Error>

Write Iso data to the controller.
Source§

async fn read<'a>( &self, buf: &'a mut [u8], ) -> Result<ControllerToHostPacket<'a>, <ExternalController<T, SLOTS> as ErrorType>::Error>

Read a valid HCI packet from the controller.
Source§

impl<T, const SLOTS: usize> Controller for ExternalController<T, SLOTS>
where T: Transport,

Source§

fn write_acl_data( &self, packet: &AclPacket<'_>, ) -> Result<(), <ExternalController<T, SLOTS> as ErrorType>::Error>

Write ACL data to the controller. Blocks until done.
Source§

fn write_sync_data( &self, packet: &SyncPacket<'_>, ) -> Result<(), <ExternalController<T, SLOTS> as ErrorType>::Error>

Write Sync data to the controller. Blocks until done.
Source§

fn write_iso_data( &self, packet: &IsoPacket<'_>, ) -> Result<(), <ExternalController<T, SLOTS> as ErrorType>::Error>

Write Iso data to the controller. Blocks until done.
Source§

fn read<'a>( &self, buf: &'a mut [u8], ) -> Result<ControllerToHostPacket<'a>, <ExternalController<T, SLOTS> as ErrorType>::Error>

Read a valid HCI packet from the controller. Blocks until done.
Source§

fn try_write_acl_data( &self, packet: &AclPacket<'_>, ) -> Result<(), TryError<<ExternalController<T, SLOTS> as ErrorType>::Error>>

Attempt to write ACL data to the controller. Read more
Source§

fn try_write_sync_data( &self, packet: &SyncPacket<'_>, ) -> Result<(), TryError<<ExternalController<T, SLOTS> as ErrorType>::Error>>

Attempt to write Sync data to the controller. Read more
Source§

fn try_write_iso_data( &self, packet: &IsoPacket<'_>, ) -> Result<(), TryError<<ExternalController<T, SLOTS> as ErrorType>::Error>>

Attempt to write Iso data to the controller. Read more
Source§

fn try_read<'a>( &self, buf: &'a mut [u8], ) -> Result<ControllerToHostPacket<'a>, TryError<<ExternalController<T, SLOTS> as ErrorType>::Error>>

Read a valid HCI packet from the controller. Read more
Source§

impl<T, C, const SLOTS: usize> ControllerCmdAsync<C> for ExternalController<T, SLOTS>
where T: Transport, C: AsyncCmd,

Source§

async fn exec( &self, cmd: &C, ) -> Result<(), Error<<ExternalController<T, SLOTS> as ErrorType>::Error>>

Note: Some implementations may require Controller::read() to be polled for this to return.
Source§

impl<T, C, const SLOTS: usize> ControllerCmdSync<C> for ExternalController<T, SLOTS>

Source§

async fn exec( &self, cmd: &C, ) -> Result<<C as SyncCmd>::Return, Error<<ExternalController<T, SLOTS> as ErrorType>::Error>>

Note: Some implementations may require Controller::read() to be polled for this to return.
Source§

impl<T, const SLOTS: usize> ErrorType for ExternalController<T, SLOTS>
where T: ErrorType,

Source§

type Error = <T as ErrorType>::Error

Error type of all the IO operations on this type.

Auto Trait Implementations§

§

impl<T, const SLOTS: usize> !Freeze for ExternalController<T, SLOTS>

§

impl<T, const SLOTS: usize> !RefUnwindSafe for ExternalController<T, SLOTS>

§

impl<T, const SLOTS: usize> !Send for ExternalController<T, SLOTS>

§

impl<T, const SLOTS: usize> !Sync for ExternalController<T, SLOTS>

§

impl<T, const SLOTS: usize> Unpin for ExternalController<T, SLOTS>
where T: Unpin,

§

impl<T, const SLOTS: usize> UnwindSafe for ExternalController<T, SLOTS>
where T: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.
Source§

impl<C> Controller for C