Trait bluetooth_hci::host::uart::Hci [−][src]
pub trait Hci<E, Vendor, VE>: Hci<E> { fn read(&mut self) -> Result<Packet<Vendor>, Error<E, VE>>
where
Vendor: VendorEvent<Error = VE>; }
Trait for reading packets from the controller.
Implementors must also implement ::host::Hci
, which provides all of the functions to write
commands to the controller. This trait adds the ability to read packets back from the
controller.
Must be specialized for communication errors (E
), vendor-specific events (Vendor
), and
vendor-specific errors (VE
).
Required Methods
fn read(&mut self) -> Result<Packet<Vendor>, Error<E, VE>> where
Vendor: VendorEvent<Error = VE>,
Vendor: VendorEvent<Error = VE>,
Reads and returns a packet from the controller. Consumes exactly enough bytes to read the next packet including its header.
Errors
- Returns
nb::Error::WouldBlock
if the controller does not have enough bytes available to read the full packet right now. - Returns
nb::Error::Other
(
Error::BadPacketType
)
if the next byte is not a valid packet type. - Returns
nb::Error::Other
(
Error::BLE
)
if there is an error deserializing the packet (such as a mismatch between the packet length and the expected length of the event). See::event::Error
for possible values ofe
. - Returns
nb::Error::Other
(
Error::Comm
)
if there is an error reading from the controller.
Implementors
impl<E, Vendor, VE, T> Hci<E, Vendor, VE> for T where
T: Controller<Error = E, Header = CommandHeader>,