1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
use crate::ommui::{ CalibrationDescription, DeviceSettings, SampleCachedInformation, Sampling, SamplingSettings, }; use crate::Result; use arnalisa::Calibration; use indexmap::{IndexMap, IndexSet}; use uuid::Uuid; pub trait LoadableDevice { fn load_system_profile_index(&self) -> Result<IndexSet<Uuid>>; fn load_user_profile_index(&self) -> Result<IndexSet<Uuid>>; fn load_calibration_index(&self) -> Result<IndexSet<String>>; fn load_device_settings(&self) -> Result<DeviceSettings>; fn load_calibration_description( &self, calibration_id: &str, ) -> Result<CalibrationDescription>; fn load_sampling_settings( &self, sampling_id: &str, ) -> Result<SamplingSettings>; fn load_calibration( &self, calibration_id: &str, ) -> Result<Calibration>; fn load_calibrations(&self) -> Result<IndexMap<String, Calibration>> { self.load_calibration_index()? .into_iter() .map(|id| { let item = self.load_calibration(&id)?; Ok((id, item)) }) .collect::<Result<_>>() } fn load_sampling(&self, sampling_id: &str) -> Result<Sampling> { Ok(Sampling { settings: self.load_sampling_settings(sampling_id)?, }) } fn load_sample_cached_information( &self, ) -> Result<IndexMap<Uuid, SampleCachedInformation>>; }