Struct ValidatorConfig

Source
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: u16

Minimum expected CO2 value (ppm).

§co2_max: u16

Maximum expected CO2 value (ppm).

§temperature_min: f32

Minimum expected temperature (°C).

§temperature_max: f32

Maximum expected temperature (°C).

§pressure_min: f32

Minimum expected pressure (hPa).

§pressure_max: f32

Maximum expected pressure (hPa).

§radon_max: u32

Maximum expected radon value (Bq/m³).

§radiation_rate_max: f32

Maximum expected radiation rate (µSv/h).

§radiation_total_max: f64

Maximum expected radiation total (mSv).

§warn_on_zero_co2: bool

Treat CO2 = 0 as an error.

§warn_on_all_zeros: bool

Treat all zeros as an error.

Implementations§

Source§

impl ValidatorConfig

Source

pub fn new() -> Self

Create new validator config with defaults.

Source

pub fn co2_min(self, min: u16) -> Self

Set minimum CO2 value (ppm).

Source

pub fn co2_max(self, max: u16) -> Self

Set maximum CO2 value (ppm).

Source

pub fn co2_range(self, min: u16, max: u16) -> Self

Set CO2 range (min, max).

Source

pub fn temperature_min(self, min: f32) -> Self

Set minimum temperature (°C).

Source

pub fn temperature_max(self, max: f32) -> Self

Set maximum temperature (°C).

Source

pub fn temperature_range(self, min: f32, max: f32) -> Self

Set temperature range (min, max).

Source

pub fn pressure_min(self, min: f32) -> Self

Set minimum pressure (hPa).

Source

pub fn pressure_max(self, max: f32) -> Self

Set maximum pressure (hPa).

Source

pub fn pressure_range(self, min: f32, max: f32) -> Self

Set pressure range (min, max).

Source

pub fn warn_on_zero_co2(self, warn: bool) -> Self

Set whether to warn on CO2 = 0.

Source

pub fn warn_on_all_zeros(self, warn: bool) -> Self

Set whether to warn on all zeros.

Source

pub fn radon_max(self, max: u32) -> Self

Set maximum radon value (Bq/m³).

Source

pub fn radiation_rate_max(self, max: f32) -> Self

Set maximum radiation rate (µSv/h).

Source

pub fn radiation_total_max(self, max: f64) -> Self

Set maximum radiation total (mSv).

Source

pub fn strict() -> Self

Create strict validation config (narrow ranges).

Source

pub fn relaxed() -> Self

Create relaxed validation config (wide ranges).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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:

§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

Source§

fn clone(&self) -> ValidatorConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ValidatorConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ValidatorConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more