pub struct PrinterHost<'d, A: UsbHostAllocator<'d>> { /* private fields */ }Expand description
USB Printer host driver.
Implementations§
Source§impl<'d, A: UsbHostAllocator<'d>> PrinterHost<'d, A>
impl<'d, A: UsbHostAllocator<'d>> PrinterHost<'d, A>
Sourcepub fn new(
alloc: &A,
enum_info: &EnumerationInfo,
config_desc: &[u8],
) -> Result<Self, PrinterError>
pub fn new( alloc: &A, enum_info: &EnumerationInfo, config_desc: &[u8], ) -> Result<Self, PrinterError>
Create a new USB printer host instance.
Sourcepub fn info(&self) -> &PrinterInfo
pub fn info(&self) -> &PrinterInfo
Return descriptor-located info.
Sourcepub async fn write(&mut self, data: &[u8]) -> Result<usize, PrinterError>
pub async fn write(&mut self, data: &[u8]) -> Result<usize, PrinterError>
Write print data (e.g. ESC/POS, text, graphics) to the printer.
Sourcepub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, PrinterError>
pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, PrinterError>
Read data from a bi-directional printer.
Sourcepub async fn get_device_id(
&mut self,
buf: &mut [u8],
) -> Result<usize, PrinterError>
pub async fn get_device_id( &mut self, buf: &mut [u8], ) -> Result<usize, PrinterError>
Query the IEEE 1284 Device ID string from the printer.
Copies the ASCII string into buf and returns the string length.
Sourcepub async fn get_port_status(&mut self) -> Result<PortStatus, PrinterError>
pub async fn get_port_status(&mut self) -> Result<PortStatus, PrinterError>
Query current port status flags (error, selected/online, paper empty).
Sourcepub async fn soft_reset(&mut self) -> Result<(), PrinterError>
pub async fn soft_reset(&mut self) -> Result<(), PrinterError>
Issue a soft reset request to the printer.
Trait Implementations§
Source§impl<'d, A: UsbHostAllocator<'d>> ErrorType for PrinterHost<'d, A>
Available on crate feature embedded-io only.
impl<'d, A: UsbHostAllocator<'d>> ErrorType for PrinterHost<'d, A>
Available on crate feature
embedded-io only.Source§type Error = PrinterError
type Error = PrinterError
Error type of all the IO operations on this type.
Source§impl<'d, A: UsbHostAllocator<'d>> Read for PrinterHost<'d, A>
Available on crate feature embedded-io only.
impl<'d, A: UsbHostAllocator<'d>> Read for PrinterHost<'d, A>
Available on crate feature
embedded-io only.Source§async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
async 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§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>>
Read the exact number of bytes required to fill
buf. Read moreSource§impl<'d, A: UsbHostAllocator<'d>> Write for PrinterHost<'d, A>
Available on crate feature embedded-io only.
impl<'d, A: UsbHostAllocator<'d>> Write for PrinterHost<'d, A>
Available on crate feature
embedded-io only.Source§async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
Write a buffer into this writer, returning how many bytes were written. Read more
Auto Trait Implementations§
impl<'d, A> Forget for PrinterHost<'d, A>
impl<'d, A> Freeze for PrinterHost<'d, A>
impl<'d, A> Move for PrinterHost<'d, A>
impl<'d, A> RefUnwindSafe for PrinterHost<'d, A>where
<A as UsbHostAllocator<'d>>::Pipe<Control, InOut>: RefUnwindSafe,
<A as UsbHostAllocator<'d>>::Pipe<Bulk, Out>: RefUnwindSafe,
Option<<A as UsbHostAllocator<'d>>::Pipe<Bulk, In>>: RefUnwindSafe,
impl<'d, A> Send for PrinterHost<'d, A>
impl<'d, A> Sync for PrinterHost<'d, A>
impl<'d, A> Unpin for PrinterHost<'d, A>
impl<'d, A> UnsafeUnpin for PrinterHost<'d, A>where
<A as UsbHostAllocator<'d>>::Pipe<Control, InOut>: UnsafeUnpin,
<A as UsbHostAllocator<'d>>::Pipe<Bulk, Out>: UnsafeUnpin,
Option<<A as UsbHostAllocator<'d>>::Pipe<Bulk, In>>: UnsafeUnpin,
impl<'d, A> UnwindSafe for PrinterHost<'d, A>where
<A as UsbHostAllocator<'d>>::Pipe<Control, InOut>: UnwindSafe,
<A as UsbHostAllocator<'d>>::Pipe<Bulk, Out>: UnwindSafe,
Option<<A as UsbHostAllocator<'d>>::Pipe<Bulk, In>>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more