[][src]Trait pico_driver::PicoDriver

pub trait PicoDriver: Send + Sync {
    fn get_driver(&self) -> Driver;
fn get_version(&self) -> PicoResult<String>;
fn get_path(&self) -> PicoResult<Option<String>>;
fn enumerate_units(&self) -> PicoResult<Vec<String>>;
fn open_unit<'a>(&self, serial: Option<&'a str>) -> PicoResult<i16>;
fn ping_unit(&self, handle: i16) -> PicoResult<()>;
fn maximum_value(&self, handle: i16) -> PicoResult<i16>;
fn close_unit(&self, handle: i16) -> PicoResult<()>;
fn get_unit_info(
        &self,
        handle: i16,
        info_type: PicoInfo
    ) -> PicoResult<String>;
fn get_channel_ranges(
        &self,
        handle: i16,
        channel: PicoChannel
    ) -> PicoResult<Vec<PicoRange>>;
fn set_channel(
        &self,
        handle: i16,
        channel: PicoChannel,
        config: &ChannelConfig
    ) -> PicoResult<()>;
fn set_data_buffer(
        &self,
        handle: i16,
        channel: PicoChannel,
        buffer: Arc<RwLock<Pin<Vec<i16>>>>,
        buffer_len: usize
    ) -> PicoResult<()>;
fn start_streaming(
        &self,
        handle: i16,
        sample_config: &SampleConfig
    ) -> PicoResult<SampleConfig>;
fn get_latest_streaming_values<'a>(
        &self,
        handle: i16,
        callback: Box<dyn FnMut(usize, usize) + 'a>
    ) -> PicoResult<()>;
fn stop_streaming(&self, handle: i16) -> PicoResult<()>; fn check_version(&self) -> Result<(), DriverLoadError> { ... } }

Common trait implemented for every driver

Required methods

fn get_driver(&self) -> Driver

Gets the underlying driver type

fn get_version(&self) -> PicoResult<String>

Gets the driver version string

fn get_path(&self) -> PicoResult<Option<String>>

Gets the path to the loaded driver

fn enumerate_units(&self) -> PicoResult<Vec<String>>

Returns a list of discovered serial numbers

fn open_unit<'a>(&self, serial: Option<&'a str>) -> PicoResult<i16>

Opens a device, optionally with a specific serial number

fn ping_unit(&self, handle: i16) -> PicoResult<()>

Ping a unit to see if it's still connected

fn maximum_value(&self, handle: i16) -> PicoResult<i16>

Get the maximum expected ADC value. This is required to scale to volts

fn close_unit(&self, handle: i16) -> PicoResult<()>

Close the specified unit

fn get_unit_info(&self, handle: i16, info_type: PicoInfo) -> PicoResult<String>

Get one of the unit info strings

fn get_channel_ranges(
    &self,
    handle: i16,
    channel: PicoChannel
) -> PicoResult<Vec<PicoRange>>

Get valid ranges for the specified channel

fn set_channel(
    &self,
    handle: i16,
    channel: PicoChannel,
    config: &ChannelConfig
) -> PicoResult<()>

Set up a channel with the supplied config

fn set_data_buffer(
    &self,
    handle: i16,
    channel: PicoChannel,
    buffer: Arc<RwLock<Pin<Vec<i16>>>>,
    buffer_len: usize
) -> PicoResult<()>

Give the driver a buffer to write data into

fn start_streaming(
    &self,
    handle: i16,
    sample_config: &SampleConfig
) -> PicoResult<SampleConfig>

Starts the device streaming

fn get_latest_streaming_values<'a>(
    &self,
    handle: i16,
    callback: Box<dyn FnMut(usize, usize) + 'a>
) -> PicoResult<()>

Gets the latest streaming values. The ps2000 has a different callback to the rest of the drivers.

fn stop_streaming(&self, handle: i16) -> PicoResult<()>

Stops the device streaming

Loading content...

Provided methods

fn check_version(&self) -> Result<(), DriverLoadError>

Check that the driver meets the minimum version tested with this wrapper

Loading content...

Implementors

impl PicoDriver for DriverCommon[src]

impl PicoDriver for DriverPS2000[src]

Loading content...