38 lines
784 B
Rust
38 lines
784 B
Rust
use super::*;
|
|
|
|
mod usage; use usage::Usage;
|
|
mod device; use device::Device;
|
|
mod internal; use internal::Internal;
|
|
|
|
pub struct InputManager {
|
|
channel:Sender<Query>,
|
|
}
|
|
|
|
impl InputManager {
|
|
|
|
}
|
|
|
|
impl Subsystem for InputManager {
|
|
fn start(supervisor:Option<Sender<Query>>) -> Result<Sender<Query>, Error>
|
|
{
|
|
if let Some(supervisor) = supervisor {
|
|
let (tx, rx) = channel::bounded::<Query>(24);
|
|
|
|
let sys_tx = tx.clone();
|
|
std::thread::spawn(move || {
|
|
Internal::thread(supervisor, sys_tx, rx);
|
|
});
|
|
|
|
Ok(tx)
|
|
} else {
|
|
Err(Error::new())
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<Sender<Query>> for InputManager {
|
|
fn from(channel:Sender<Query>) -> Self {
|
|
Self { channel }
|
|
}
|
|
}
|