pub struct ValidatorConfig {
pub co2_min: u16,
pub co2_max: u16,
pub temperature_min: f32,
pub temperature_max: f32,
pub pressure_min: f32,
pub pressure_max: f32,
pub radon_max: u32,
pub radiation_rate_max: f32,
pub radiation_total_max: f64,
pub warn_on_zero_co2: bool,
pub warn_on_all_zeros: bool,
}Expand description
Configuration for reading validation.
Fields§
§co2_min: u16Minimum expected CO2 value (ppm).
co2_max: u16Maximum expected CO2 value (ppm).
temperature_min: f32Minimum expected temperature (°C).
temperature_max: f32Maximum expected temperature (°C).
pressure_min: f32Minimum expected pressure (hPa).
pressure_max: f32Maximum expected pressure (hPa).
radon_max: u32Maximum expected radon value (Bq/m³).
radiation_rate_max: f32Maximum expected radiation rate (µSv/h).
radiation_total_max: f64Maximum expected radiation total (mSv).
warn_on_zero_co2: boolTreat CO2 = 0 as an error.
warn_on_all_zeros: boolTreat all zeros as an error.
Implementations§
Source§impl ValidatorConfig
impl ValidatorConfig
Sourcepub fn temperature_min(self, min: f32) -> Self
pub fn temperature_min(self, min: f32) -> Self
Set minimum temperature (°C).
Sourcepub fn temperature_max(self, max: f32) -> Self
pub fn temperature_max(self, max: f32) -> Self
Set maximum temperature (°C).
Sourcepub fn temperature_range(self, min: f32, max: f32) -> Self
pub fn temperature_range(self, min: f32, max: f32) -> Self
Set temperature range (min, max).
Sourcepub fn pressure_min(self, min: f32) -> Self
pub fn pressure_min(self, min: f32) -> Self
Set minimum pressure (hPa).
Sourcepub fn pressure_max(self, max: f32) -> Self
pub fn pressure_max(self, max: f32) -> Self
Set maximum pressure (hPa).
Sourcepub fn pressure_range(self, min: f32, max: f32) -> Self
pub fn pressure_range(self, min: f32, max: f32) -> Self
Set pressure range (min, max).
Sourcepub fn warn_on_zero_co2(self, warn: bool) -> Self
pub fn warn_on_zero_co2(self, warn: bool) -> Self
Set whether to warn on CO2 = 0.
Sourcepub fn warn_on_all_zeros(self, warn: bool) -> Self
pub fn warn_on_all_zeros(self, warn: bool) -> Self
Set whether to warn on all zeros.
Sourcepub fn radiation_rate_max(self, max: f32) -> Self
pub fn radiation_rate_max(self, max: f32) -> Self
Set maximum radiation rate (µSv/h).
Sourcepub fn radiation_total_max(self, max: f64) -> Self
pub fn radiation_total_max(self, max: f64) -> Self
Set maximum radiation total (mSv).
Sourcepub fn for_aranet4() -> Self
pub fn for_aranet4() -> Self
Create validation config optimized for Aranet4 (CO2 sensor).
Aranet4 measures CO2, temperature, humidity, and pressure. This preset uses appropriate ranges for indoor air quality monitoring.
Sourcepub fn for_aranet2() -> Self
pub fn for_aranet2() -> Self
Create validation config optimized for Aranet2 (temperature/humidity sensor).
Aranet2 measures only temperature and humidity. CO2 and pressure validation is disabled.
Note: This preset is based on device specifications. Actual testing with an Aranet2 device may reveal adjustments needed.
Sourcepub fn for_aranet_radon() -> Self
pub fn for_aranet_radon() -> Self
Create validation config optimized for AranetRn+ (radon sensor).
AranetRn+ measures radon, temperature, humidity, and pressure. CO2 validation is disabled.
Note: This preset is based on device specifications. Actual testing with an AranetRn+ device may reveal adjustments needed.
Sourcepub fn for_aranet_radiation() -> Self
pub fn for_aranet_radiation() -> Self
Create validation config optimized for Aranet Radiation sensor.
Aranet Radiation measures gamma radiation rate and accumulated dose. CO2 and radon validation is disabled.
Note: This preset is based on device specifications. Actual testing with an Aranet Radiation device may reveal adjustments needed.
Sourcepub fn for_device(device_type: DeviceType) -> Self
pub fn for_device(device_type: DeviceType) -> Self
Create validation config for a specific device type.
Automatically selects the appropriate preset based on the device type:
DeviceType::Aranet4→for_aranet4()DeviceType::Aranet2→for_aranet2()DeviceType::AranetRadon→for_aranet_radon()DeviceType::AranetRadiation→for_aranet_radiation()- Unknown types → default config
§Example
use aranet_core::validation::ValidatorConfig;
use aranet_types::DeviceType;
let config = ValidatorConfig::for_device(DeviceType::Aranet4);
assert_eq!(config.co2_max, 10000);
let config = ValidatorConfig::for_device(DeviceType::AranetRadon);
assert_eq!(config.radon_max, 1000);Trait Implementations§
Source§impl Clone for ValidatorConfig
impl Clone for ValidatorConfig
Source§fn clone(&self) -> ValidatorConfig
fn clone(&self) -> ValidatorConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more