DeviceCtl

Trait DeviceCtl 

Source
pub trait DeviceCtl {
    // Required methods
    fn set_label(&self, label: &str) -> Result<()>;
    fn info(&self) -> Result<DeviceInformation>;
    fn lock(&self, timeout: Option<Duration>) -> Result<()>;
    fn unlock(&self) -> Result<()>;
    fn transmit(&self, command: &[u8], recv_capacity: usize) -> Result<Vec<u8>>;
}

Required Methods§

Source

fn set_label(&self, label: &str) -> Result<()>

Set label of device

[label] - The label.

§specification note
  • label: should less than 32 bytes
Source

fn info(&self) -> Result<DeviceInformation>

Get device info,e.g. vendor id,product id

Source

fn lock(&self, timeout: Option<Duration>) -> Result<()>

Lock device for exclusive access

[timeout] - The lock timeout,None means wait forever

Source

fn unlock(&self) -> Result<()>

Unlock device

Source

fn transmit(&self, command: &[u8], recv_capacity: usize) -> Result<Vec<u8>>

Transmit data to execute,and get response

[command] - The command to execute

[recv_capacity] - The capacity of receive buffer

§specification note

This function is for testing purpose

Implementors§