rnetmon/src/outputs/mod.rs

22 lines
613 B
Rust
Raw Normal View History

2019-02-14 07:21:22 +00:00
pub mod espeak;
pub mod light_beewi_bbl227;
2019-02-23 17:45:43 +00:00
pub mod matrix;
2019-02-14 07:21:22 +00:00
pub mod stdout;
use crate::output::*;
pub fn factory(
name: &str,
2019-02-23 17:45:43 +00:00
config: serde_yaml::Value,
2019-02-14 07:21:22 +00:00
) -> Result<Box<Output>, Box<dyn std::error::Error>> {
match name {
2019-02-23 17:45:43 +00:00
"stdout" => Ok(Box::new(stdout::Stdout::new(config)?)),
"espeak" => Ok(Box::new(espeak::Espeak::new(config)?)),
"matrix" => Ok(Box::new(matrix::Matrix::new(config)?)),
2019-02-14 07:21:22 +00:00
"light_beewi_bbl227" => Ok(Box::new(light_beewi_bbl227::BluetoothLightbulb::new(
2019-02-23 17:45:43 +00:00
config,
2019-02-14 07:21:22 +00:00
)?)),
_ => panic!("Unknown monitor name: {}", name),
}
}