pub struct Handle<T: UsbContext> { /* private fields */ }
Expand description
A handle to a calculator.
Implementations§
Source§impl<T: UsbContext> Handle<T>
impl<T: UsbContext> Handle<T>
Sourcepub fn new(device: DeviceHandle<T>) -> Result<Self>
pub fn new(device: DeviceHandle<T>) -> Result<Self>
Create a new handle to a USB device.
pub fn info(&self) -> Result<Info>
Sourcepub fn screenshot(&self) -> Result<Image>
pub fn screenshot(&self) -> Result<Image>
Take a screenshot.
Sourcepub fn file_attr(&self, src: &str) -> Result<DirItem>
pub fn file_attr(&self, src: &str) -> Result<DirItem>
Get the attributes of a file or directory.
Sourcepub fn delete_file(&self, path: &str) -> Result<()>
pub fn delete_file(&self, path: &str) -> Result<()>
Delete a file.
Sourcepub fn read_file(
&self,
path: &str,
buf: &mut [u8],
progress: &mut dyn FnMut(usize),
) -> Result<usize>
pub fn read_file( &self, path: &str, buf: &mut [u8], progress: &mut dyn FnMut(usize), ) -> Result<usize>
Read a file. Returns the number of bytes read. You must pass a buffer large enough to read the entire file (or smaller if that’s all you care about).
Sourcepub fn write_file(
&self,
path: &str,
buf: &[u8],
progress: &mut dyn FnMut(usize),
) -> Result<()>
pub fn write_file( &self, path: &str, buf: &[u8], progress: &mut dyn FnMut(usize), ) -> Result<()>
Write a file.
Sourcepub fn send_os(&self, buf: &[u8], progress: &mut dyn FnMut(usize)) -> Result<()>
pub fn send_os(&self, buf: &[u8], progress: &mut dyn FnMut(usize)) -> Result<()>
Send an OS update.
Sourcepub fn create_dir(&self, path: &str) -> Result<()>
pub fn create_dir(&self, path: &str) -> Result<()>
Create a directory.
Sourcepub fn delete_dir(&self, path: &str) -> Result<()>
pub fn delete_dir(&self, path: &str) -> Result<()>
Delete a directory.
Trait Implementations§
Source§impl<T: UsbContext> Drop for Handle<T>
impl<T: UsbContext> Drop for Handle<T>
Source§impl<T: UsbContext> TryFrom<DeviceHandle<T>> for Handle<T>
impl<T: UsbContext> TryFrom<DeviceHandle<T>> for Handle<T>
impl<T: UsbContext> Send for Handle<T>
impl<T: UsbContext> Sync for Handle<T>
Auto Trait Implementations§
impl<T> Freeze for Handle<T>where
T: Freeze,
impl<T> RefUnwindSafe for Handle<T>where
T: RefUnwindSafe,
impl<T> Unpin for Handle<T>where
T: Unpin,
impl<T> UnwindSafe for Handle<T>where
T: 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