diff --git a/Cargo.lock b/Cargo.lock index 190236a..9a84ee2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,7 +13,7 @@ dependencies = [ [[package]] name = "air_filter" -version = "0.4.0" +version = "0.4.1" dependencies = [ "bme280", "cfg-if", diff --git a/Cargo.toml b/Cargo.toml index 20a92e2..762708e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "air_filter" -version = "0.4.0" +version = "0.4.1" edition = "2021" [dependencies] diff --git a/src/lib.rs b/src/lib.rs index 4f58f22..5198e14 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,6 +26,14 @@ impl FanState { pub fn new(speed: FanSpeed, manual: bool) -> Self { Self { speed, manual } } + + pub fn speed(&self) -> FanSpeed { + self.speed + } + + pub fn manual(&self) -> bool { + self.manual + } } #[derive(Deserialize)] @@ -34,6 +42,10 @@ pub struct SetFanSpeed { } impl SetFanSpeed { + pub fn new(speed: FanSpeed) -> Self { + Self { speed } + } + pub fn speed(&self) -> FanSpeed { self.speed } @@ -54,4 +66,16 @@ impl SensorData { pressure: measurements.pressure, } } + + pub fn temperature(&self) -> f32 { + self.temperature + } + + pub fn humidity(&self) -> f32 { + self.humidity + } + + pub fn pressure(&self) -> f32 { + self.pressure + } }