mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2024-12-22 19:53:49 +01:00
Add sensors registry to global registries
This commit is contained in:
parent
fc1480314f
commit
637490bd75
@ -2,6 +2,7 @@ mod actuators;
|
||||
mod sensors;
|
||||
|
||||
pub use actuators::{Actuator, ActBox};
|
||||
pub use sensors::{Sensor, SensBox};
|
||||
|
||||
#[derive(Clone)]
|
||||
/// BFFH registries
|
||||
@ -10,12 +11,14 @@ pub use actuators::{Actuator, ActBox};
|
||||
/// reference, not clone the registries
|
||||
pub struct Registries {
|
||||
pub actuators: actuators::Actuators,
|
||||
pub sensors: sensors::Sensors,
|
||||
}
|
||||
|
||||
impl Registries {
|
||||
pub fn new() -> Self {
|
||||
Registries {
|
||||
actuators: actuators::Actuators::new()
|
||||
actuators: actuators::Actuators::new(),
|
||||
sensors: sensors::Sensors::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,10 +7,19 @@ use std::sync::Arc;
|
||||
use smol::lock::RwLock;
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Sensors {
|
||||
inner: Arc<RwLock<Inner>>,
|
||||
}
|
||||
|
||||
impl Sensors {
|
||||
pub fn new() -> Self {
|
||||
Sensors {
|
||||
inner: Arc::new(RwLock::new(Inner::new())),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub type SensBox<'a> = Box<dyn Sensor<'a>>;
|
||||
type Inner = HashMap<String, SensBox<'static>>;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user