pub trait UartHci: HostHci {
// Required method
async fn read(&mut self) -> Result<Packet, Error>;
}
Expand description
Trait for reading packets from the controller.
Implementors must also implement crate::host::HostHci
, 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§
Sourceasync fn read(&mut self) -> Result<Packet, Error>
async fn read(&mut self) -> Result<Packet, Error>
Reads and returns a packet from the controller. Consumes exactly enough bytes to read the next packet including its header.
§Errors
- Returns
Error::BadPacketType
if the next byte is not a valid packet type. - Returns
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). Seecrate::event::Error
for possible values ofe
. - Returns [
Error::Comm
] if there is an error reading from the controller.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.