pub struct Device { /* private fields */ }Implementations§
Source§impl Device
impl Device
Sourcepub fn new(com: impl AsRef<str>, baudrate: u32) -> Result<Self>
pub fn new(com: impl AsRef<str>, baudrate: u32) -> Result<Self>
Examples found in repository?
More 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}Sourcepub async fn value_maps(&mut self) -> Result<ValueMaps>
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}pub async fn all_memory(&mut self, maps: &ValueMaps) -> Result<Vec<Memory>>
pub async fn backlight(&mut self) -> Result<Duration>
pub async fn set_backlight(&mut self, duration: Duration) -> Result<()>
pub async fn poweroff(&mut self) -> Result<Duration>
pub async fn set_poweroff(&mut self, duration: Duration) -> Result<()>
pub async fn operator(&mut self) -> Result<String>
pub async fn set_operator(&mut self, operator: impl AsRef<str>) -> Result<()>
pub async fn company(&mut self) -> Result<String>
pub async fn set_company(&mut self, company: impl AsRef<str>) -> Result<()>
pub async fn site(&mut self) -> Result<String>
pub async fn set_site(&mut self, site: impl AsRef<str>) -> Result<()>
pub async fn contact(&mut self) -> Result<String>
pub async fn set_contact(&mut self, contact: impl AsRef<str>) -> Result<()>
pub async fn beeper(&mut self) -> Result<bool>
pub async fn set_beeper(&mut self, state: bool) -> Result<()>
pub async fn smoothing(&mut self) -> Result<bool>
pub async fn set_smoothing(&mut self, state: bool) -> Result<()>
pub async fn clock(&mut self) -> Result<u64>
pub async fn set_clock(&mut self, clock: DateTime<Local>) -> Result<()>
pub async fn clear(&mut self, mem: ClearMemory) -> Result<()>
pub async fn reset(&mut self) -> Result<()>
pub async fn custom_dbm(&mut self) -> Result<u16>
pub async fn set_custom_dbm(&mut self, dbm: u16) -> Result<()>
pub async fn dbm_ref(&mut self) -> Result<DezibelReference>
pub async fn set_dbm_ref(&mut self, dbm: DezibelReference) -> Result<()>
pub async fn temp_offset(&mut self) -> Result<i16>
pub async fn set_temp_offset(&mut self, offset: i16) -> Result<()>
pub async fn digit_count(&mut self) -> Result<DigitCount>
pub async fn set_digit_count(&mut self, dc: DigitCount) -> Result<()>
pub async fn autohold_event_threshold(&mut self) -> Result<u8>
pub async fn set_autohold_event_threshold(&mut self, thd: u8) -> Result<()>
pub async fn recording_event_threshold(&mut self) -> Result<u8>
pub async fn set_recording_event_threshold(&mut self, thd: u8) -> Result<()>
pub async fn language(&mut self) -> Result<Language>
pub async fn set_language(&mut self, lang: Language) -> Result<()>
pub async fn date_format(&mut self) -> Result<DateFormat>
pub async fn set_date_format(&mut self, fmt: DateFormat) -> Result<()>
pub async fn time_format(&mut self) -> Result<TimeFormat>
pub async fn set_time_format(&mut self, fmt: TimeFormat) -> Result<()>
pub async fn numeric_format(&mut self) -> Result<NumericFormat>
pub async fn set_numeric_format(&mut self, fmt: NumericFormat) -> Result<()>
pub async fn save_name(&mut self, slot: u16) -> Result<String>
pub async fn set_save_name( &mut self, slot: u16, name: impl AsRef<str>, ) -> Result<()>
Sourcepub async fn live_measurement(&mut self) -> Result<Option<RawMeasurement>>
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}pub async fn memory_statistics(&mut self) -> Result<MemoryStat>
pub async fn saved_measurement( &mut self, idx: usize, ) -> Result<RawSavedMeasurement>
pub async fn saved_measurements_all( &mut self, ) -> Result<Vec<RawSavedMeasurement>>
pub async fn saved_minmax( &mut self, idx: usize, ) -> Result<RawSavedMinMaxMeasurement>
pub async fn saved_minmax_all( &mut self, ) -> Result<Vec<RawSavedMinMaxMeasurement>>
pub async fn saved_peak( &mut self, idx: usize, ) -> Result<RawSavedPeakMeasurement>
pub async fn saved_peak_all(&mut self) -> Result<Vec<RawSavedPeakMeasurement>>
pub async fn saved_recording( &mut self, idx: usize, ) -> Result<RawSavedRecordingSessionInfo>
pub async fn saved_recordings_all( &mut self, ) -> Result<Vec<RawSavedRecordingSessionInfo>>
pub async fn session_record_reading( &mut self, reading_idx: usize, sample_idx: usize, ) -> Result<RawSessionRecordReadings>
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>>
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 UnsafeUnpin for Device
impl !UnwindSafe for Device
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