Compare commits
1 Commits
e68cc8bcbc
...
259fdeb7b0
Author | SHA1 | Date | |
---|---|---|---|
|
259fdeb7b0 |
@ -1,14 +0,0 @@
|
||||
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
|
||||
}
|
@ -21,12 +21,6 @@ pub struct HeliosDevice {
|
||||
}
|
||||
|
||||
impl HeliosDevice {
|
||||
|
||||
/// This is fabulous doc !
|
||||
/// # Woot
|
||||
///
|
||||
/// ` some example `
|
||||
///
|
||||
pub fn new(conf: &HeliosConf) -> LJResult<Self> {
|
||||
let id = conf.id;
|
||||
let controller = NativeHeliosDacController::new()?;
|
||||
@ -34,23 +28,12 @@ impl HeliosDevice {
|
||||
let Some(device) = devices.into_iter().nth(id as usize) else {
|
||||
return Err(Box::new(LJError::HeliosDeviceMissing));
|
||||
};
|
||||
let dac = device.open()?;
|
||||
let dac = device.open()?;
|
||||
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 {
|
||||
fn status(&self) -> Status {
|
||||
@ -73,7 +56,7 @@ impl Device for HeliosDevice {
|
||||
}
|
||||
|
||||
fn stop(&mut self) -> LJResult<()> {
|
||||
self.dac.stop()?;
|
||||
Ok(())
|
||||
self.dac.stop()?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user