Compare commits
3 Commits
259fdeb7b0
...
e68cc8bcbc
Author | SHA1 | Date | |
---|---|---|---|
e68cc8bcbc | |||
|
08debc3899 | ||
|
3588e3f4a2 |
14
src/device.old
Normal file
14
src/device.old
Normal 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
|
||||
}
|
@ -21,6 +21,12 @@ 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()?;
|
||||
@ -30,10 +36,21 @@ impl HeliosDevice {
|
||||
};
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user