Device

Struct Device 

Source
pub struct Device { /* private fields */ }

Implementations§

Source§

impl Device

Source

pub fn new(com: impl AsRef<str>, baudrate: u32) -> Result<Self>

Examples found in repository?
examples/connect_dmm.rs (line 6)
4async fn main() -> f289ctrl::Result<()> {
5    let path = "/dev/ttyUSB0".to_string();
6    let mut device = Device::new(&path, DEFAULT_BAUDRATE)?;
7    eprintln!("Connected to: {}\n", device.ident().await?.model);
8    Ok(())
9}
More examples
Hide additional examples
examples/poll_measurement.rs (line 6)
4async fn main() -> f289ctrl::Result<()> {
5    let path = "/dev/ttyUSB0".to_string();
6    let mut device = Device::new(&path, DEFAULT_BAUDRATE)?;
7
8    // Read device specific maps, required to convert RawMeasurement to Measurement.
9    let maps = device.value_maps().await?;
10
11    loop {
12        let raw = device.live_measurement().await?;
13        match raw {
14            Some(data) => {
15                let mea = Measurement::from((data, &maps));
16                // Each measurement contains one or more readings.
17                mea.readings.iter().for_each(|r| {
18                    println!("Value: {}", r);
19                })
20            }
21            None => {
22                println!("NO_DATA");
23            }
24        }
25    }
26}
Source

pub async fn ident(&mut self) -> Result<Ident>

Examples found in repository?
examples/connect_dmm.rs (line 7)
4async fn main() -> f289ctrl::Result<()> {
5    let path = "/dev/ttyUSB0".to_string();
6    let mut device = Device::new(&path, DEFAULT_BAUDRATE)?;
7    eprintln!("Connected to: {}\n", device.ident().await?.model);
8    Ok(())
9}
Source

pub async fn value_maps(&mut self) -> Result<ValueMaps>

Examples found in repository?
examples/poll_measurement.rs (line 9)
4async fn main() -> f289ctrl::Result<()> {
5    let path = "/dev/ttyUSB0".to_string();
6    let mut device = Device::new(&path, DEFAULT_BAUDRATE)?;
7
8    // Read device specific maps, required to convert RawMeasurement to Measurement.
9    let maps = device.value_maps().await?;
10
11    loop {
12        let raw = device.live_measurement().await?;
13        match raw {
14            Some(data) => {
15                let mea = Measurement::from((data, &maps));
16                // Each measurement contains one or more readings.
17                mea.readings.iter().for_each(|r| {
18                    println!("Value: {}", r);
19                })
20            }
21            None => {
22                println!("NO_DATA");
23            }
24        }
25    }
26}
Source

pub async fn all_memory(&mut self, maps: &ValueMaps) -> Result<Vec<Memory>>

Source

pub async fn backlight(&mut self) -> Result<Duration>

Source

pub async fn set_backlight(&mut self, duration: Duration) -> Result<()>

Source

pub async fn poweroff(&mut self) -> Result<Duration>

Source

pub async fn set_poweroff(&mut self, duration: Duration) -> Result<()>

Source

pub async fn operator(&mut self) -> Result<String>

Source

pub async fn set_operator(&mut self, operator: impl AsRef<str>) -> Result<()>

Source

pub async fn company(&mut self) -> Result<String>

Source

pub async fn set_company(&mut self, company: impl AsRef<str>) -> Result<()>

Source

pub async fn site(&mut self) -> Result<String>

Source

pub async fn set_site(&mut self, site: impl AsRef<str>) -> Result<()>

Source

pub async fn contact(&mut self) -> Result<String>

Source

pub async fn set_contact(&mut self, contact: impl AsRef<str>) -> Result<()>

Source

pub async fn beeper(&mut self) -> Result<bool>

Source

pub async fn set_beeper(&mut self, state: bool) -> Result<()>

Source

pub async fn smoothing(&mut self) -> Result<bool>

Source

pub async fn set_smoothing(&mut self, state: bool) -> Result<()>

Source

pub async fn clock(&mut self) -> Result<u64>

Source

pub async fn set_clock(&mut self, clock: DateTime<Local>) -> Result<()>

Source

pub async fn clear(&mut self, mem: ClearMemory) -> Result<()>

Source

pub async fn reset(&mut self) -> Result<()>

Source

pub async fn custom_dbm(&mut self) -> Result<u16>

Source

pub async fn set_custom_dbm(&mut self, dbm: u16) -> Result<()>

Source

pub async fn dbm_ref(&mut self) -> Result<DezibelReference>

Source

pub async fn set_dbm_ref(&mut self, dbm: DezibelReference) -> Result<()>

Source

pub async fn temp_offset(&mut self) -> Result<i16>

Source

pub async fn set_temp_offset(&mut self, offset: i16) -> Result<()>

Source

pub async fn digit_count(&mut self) -> Result<DigitCount>

Source

pub async fn set_digit_count(&mut self, dc: DigitCount) -> Result<()>

Source

pub async fn autohold_event_threshold(&mut self) -> Result<u8>

Source

pub async fn set_autohold_event_threshold(&mut self, thd: u8) -> Result<()>

Source

pub async fn recording_event_threshold(&mut self) -> Result<u8>

Source

pub async fn set_recording_event_threshold(&mut self, thd: u8) -> Result<()>

Source

pub async fn language(&mut self) -> Result<Language>

Source

pub async fn set_language(&mut self, lang: Language) -> Result<()>

Source

pub async fn date_format(&mut self) -> Result<DateFormat>

Source

pub async fn set_date_format(&mut self, fmt: DateFormat) -> Result<()>

Source

pub async fn time_format(&mut self) -> Result<TimeFormat>

Source

pub async fn set_time_format(&mut self, fmt: TimeFormat) -> Result<()>

Source

pub async fn numeric_format(&mut self) -> Result<NumericFormat>

Source

pub async fn set_numeric_format(&mut self, fmt: NumericFormat) -> Result<()>

Source

pub async fn save_name(&mut self, slot: u16) -> Result<String>

Source

pub async fn set_save_name( &mut self, slot: u16, name: impl AsRef<str>, ) -> Result<()>

Source

pub async fn live_measurement(&mut self) -> Result<Option<RawMeasurement>>

Examples found in repository?
examples/poll_measurement.rs (line 12)
4async fn main() -> f289ctrl::Result<()> {
5    let path = "/dev/ttyUSB0".to_string();
6    let mut device = Device::new(&path, DEFAULT_BAUDRATE)?;
7
8    // Read device specific maps, required to convert RawMeasurement to Measurement.
9    let maps = device.value_maps().await?;
10
11    loop {
12        let raw = device.live_measurement().await?;
13        match raw {
14            Some(data) => {
15                let mea = Measurement::from((data, &maps));
16                // Each measurement contains one or more readings.
17                mea.readings.iter().for_each(|r| {
18                    println!("Value: {}", r);
19                })
20            }
21            None => {
22                println!("NO_DATA");
23            }
24        }
25    }
26}
Source

pub async fn memory_statistics(&mut self) -> Result<MemoryStat>

Source

pub async fn saved_measurement( &mut self, idx: usize, ) -> Result<RawSavedMeasurement>

Source

pub async fn saved_measurements_all( &mut self, ) -> Result<Vec<RawSavedMeasurement>>

Source

pub async fn saved_minmax( &mut self, idx: usize, ) -> Result<RawSavedMinMaxMeasurement>

Source

pub async fn saved_minmax_all( &mut self, ) -> Result<Vec<RawSavedMinMaxMeasurement>>

Source

pub async fn saved_peak( &mut self, idx: usize, ) -> Result<RawSavedPeakMeasurement>

Source

pub async fn saved_peak_all(&mut self) -> Result<Vec<RawSavedPeakMeasurement>>

Source

pub async fn saved_recording( &mut self, idx: usize, ) -> Result<RawSavedRecordingSessionInfo>

Source

pub async fn saved_recordings_all( &mut self, ) -> Result<Vec<RawSavedRecordingSessionInfo>>

Source

pub async fn session_record_reading( &mut self, reading_idx: usize, sample_idx: usize, ) -> Result<RawSessionRecordReadings>

Source

pub async fn session_record_reading_all_cb( &mut self, reading_index: usize, num_samples: usize, callback: impl FnOnce(usize, usize) + Copy + 'static, ) -> Result<Vec<RawSessionRecordReadings>>

Source

pub async fn session_record_reading_all( &mut self, reading_index: usize, num_samples: usize, ) -> Result<Vec<RawSessionRecordReadings>>

Auto Trait Implementations§

§

impl Freeze for Device

§

impl !RefUnwindSafe for Device

§

impl !Send for Device

§

impl !Sync for Device

§

impl Unpin for Device

§

impl !UnwindSafe for Device

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.