pub trait PicoDriver:
Debug
+ Send
+ Sync {
Show 17 methods
// Required methods
fn get_driver(&self) -> Driver;
fn get_version(&self) -> PicoResult<String>;
fn get_path(&self) -> PicoResult<Option<String>>;
fn enumerate_units(&self) -> PicoResult<Vec<EnumerationResult>>;
fn open_unit(&self, serial: Option<&str>) -> PicoResult<i16>;
fn ping_unit(&self, handle: i16) -> PicoResult<()>;
fn maximum_value(&self, handle: i16) -> PicoResult<i16>;
fn close(&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 enable_channel(
&self,
handle: i16,
channel: PicoChannel,
config: &ChannelConfig,
) -> PicoResult<()>;
fn disable_channel(
&self,
handle: i16,
channel: PicoChannel,
) -> 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,
channels: &[PicoChannel],
callback: Box<dyn FnMut(usize, usize) + 'a>,
) -> PicoResult<()>;
fn stop(&self, handle: i16) -> PicoResult<()>;
// Provided method
fn check_version(&self) -> Result<(), DriverLoadError> { ... }
}
Expand description
Common trait implemented for every driver
Required Methods§
Sourcefn get_driver(&self) -> Driver
fn get_driver(&self) -> Driver
Gets the underlying driver type
Sourcefn get_version(&self) -> PicoResult<String>
fn get_version(&self) -> PicoResult<String>
Gets the driver version string
Sourcefn get_path(&self) -> PicoResult<Option<String>>
fn get_path(&self) -> PicoResult<Option<String>>
Gets the path to the loaded driver
Sourcefn enumerate_units(&self) -> PicoResult<Vec<EnumerationResult>>
fn enumerate_units(&self) -> PicoResult<Vec<EnumerationResult>>
Returns a list of discovered serial numbers
Sourcefn open_unit(&self, serial: Option<&str>) -> PicoResult<i16>
fn open_unit(&self, serial: Option<&str>) -> PicoResult<i16>
Opens a device, optionally with a specific serial number
Sourcefn ping_unit(&self, handle: i16) -> PicoResult<()>
fn ping_unit(&self, handle: i16) -> PicoResult<()>
Ping a unit to see if it’s still connected
Sourcefn maximum_value(&self, handle: i16) -> PicoResult<i16>
fn maximum_value(&self, handle: i16) -> PicoResult<i16>
Get the maximum expected ADC value. This is required to scale to volts
Sourcefn close(&self, handle: i16) -> PicoResult<()>
fn close(&self, handle: i16) -> PicoResult<()>
Close the specified unit
Sourcefn get_unit_info(&self, handle: i16, info_type: PicoInfo) -> PicoResult<String>
fn get_unit_info(&self, handle: i16, info_type: PicoInfo) -> PicoResult<String>
Get one of the unit info strings
Sourcefn get_channel_ranges(
&self,
handle: i16,
channel: PicoChannel,
) -> PicoResult<Vec<PicoRange>>
fn get_channel_ranges( &self, handle: i16, channel: PicoChannel, ) -> PicoResult<Vec<PicoRange>>
Get valid ranges for the specified channel
Sourcefn enable_channel(
&self,
handle: i16,
channel: PicoChannel,
config: &ChannelConfig,
) -> PicoResult<()>
fn enable_channel( &self, handle: i16, channel: PicoChannel, config: &ChannelConfig, ) -> PicoResult<()>
Set up a channel with the supplied config
Sourcefn disable_channel(&self, handle: i16, channel: PicoChannel) -> PicoResult<()>
fn disable_channel(&self, handle: i16, channel: PicoChannel) -> PicoResult<()>
Disable a channel
Sourcefn set_data_buffer(
&self,
handle: i16,
channel: PicoChannel,
buffer: Arc<RwLock<Pin<Vec<i16>>>>,
buffer_len: usize,
) -> PicoResult<()>
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
Sourcefn start_streaming(
&self,
handle: i16,
sample_config: &SampleConfig,
) -> PicoResult<SampleConfig>
fn start_streaming( &self, handle: i16, sample_config: &SampleConfig, ) -> PicoResult<SampleConfig>
Starts the device streaming
Sourcefn get_latest_streaming_values<'a>(
&self,
handle: i16,
channels: &[PicoChannel],
callback: Box<dyn FnMut(usize, usize) + 'a>,
) -> PicoResult<()>
fn get_latest_streaming_values<'a>( &self, handle: i16, channels: &[PicoChannel], callback: Box<dyn FnMut(usize, usize) + 'a>, ) -> PicoResult<()>
Gets the latest streaming values
Sourcefn stop(&self, handle: i16) -> PicoResult<()>
fn stop(&self, handle: i16) -> PicoResult<()>
Stops the device streaming
Provided Methods§
Sourcefn check_version(&self) -> Result<(), DriverLoadError>
fn check_version(&self) -> Result<(), DriverLoadError>
Check that the driver meets the minimum version tested with these wrappers