Compare commits

..

3 Commits

Author SHA1 Message Date
e68cc8bcbc fix borrowing issue and make everything compile 2023-06-07 11:46:30 +02:00
alban
08debc3899 wip 2023-06-06 22:56:39 +02:00
alban
3588e3f4a2 wip 2023-06-05 21:21:35 +02:00
2 changed files with 35 additions and 4 deletions

14
src/device.old Normal file
View File

@ -0,0 +1,14 @@
mod device;
mod helios;
use crate::conf::{Conf, DacFamily, EtherDreamConf, HeliosConf};
use crate::device::device::Device;
use crate::device::helios::HeliosDevice;
pub fn device_factory(config: Conf) -> Box<dyn Device> {
let device = match config.dac {
DacFamily::Helios(conf) => Box::new(HeliosDevice { conf }),
DacFamily::Etherdream(conf) => todo!(),
};
device
}

View File

@ -21,6 +21,12 @@ pub struct HeliosDevice {
} }
impl HeliosDevice { impl HeliosDevice {
/// This is fabulous doc !
/// # Woot
///
/// ` some example `
///
pub fn new(conf: &HeliosConf) -> LJResult<Self> { pub fn new(conf: &HeliosConf) -> LJResult<Self> {
let id = conf.id; let id = conf.id;
let controller = NativeHeliosDacController::new()?; let controller = NativeHeliosDacController::new()?;
@ -30,10 +36,21 @@ impl HeliosDevice {
}; };
let dac = device.open()?; let dac = device.open()?;
Ok(Self { Ok(Self {
conf: (*conf).clone(), dac, conf: (*conf).clone(),
dac,
}) })
} }
} }
//
// fn get_helios_device() -> LJResult<NativeHeliosDac> {
// let controller = NativeHeliosDacController::new()?;
// let devices = controller.list_devices()?;
// let Some(device) = devices.into_iter().next() else {
// return Err(Box::new(LJError::HeliosDeviceMissing));
// };
// let device = device.open()?;
// Ok(device)
// }
impl Device for HeliosDevice { impl Device for HeliosDevice {
fn status(&self) -> Status { fn status(&self) -> Status {