aquarium_control/recorder/
data_logger_config.rs

1/* Copyright 2025 Uwe Martin
2
3Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
5The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
7THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8*/
9#![allow(non_snake_case)]
10use crate::utilities::iir_filter::IIRFilterConfig;
11use serde_derive::Deserialize;
12
13/// Holds the configuration data for the regular data logging to SQL database.
14/// The configuration is loaded from the .toml configuration file.
15/// This struct does not contain any implementation.
16#[derive(Deserialize)]
17pub struct DataLoggerConfig {
18    /// data logging will only be active when the flag is set to true
19    pub active: bool,
20
21    /// indicates if the thread shall be started or not
22    pub execute: bool,
23
24    /// switch indicating if a self-generated timestamp or the database-generated timestamp shall be used
25    pub use_sql_timestamp: bool,
26
27    /// interval of the data logger in seconds
28    pub logging_interval: u64,
29
30    /// filter coefficient for the filtered version of the water temperature signal
31    pub filter_coefficient_water_temperature: IIRFilterConfig<()>,
32
33    /// filter coefficient for the filtered version of the pH signal
34    pub filter_coefficient_pH: IIRFilterConfig<()>,
35
36    /// filter coefficient for the filtered version of the conductivity signal
37    pub filter_coefficient_conductivity: IIRFilterConfig<()>,
38
39    /// switch if output to file (in ramdisk) shall be written
40    pub output_to_disk: bool,
41
42    /// output file name (in ramdisk) for the current timestamp
43    pub output_file_name_timestamp: String,
44
45    /// output file name (in ramdisk) for current value of water temperature
46    pub output_file_name_water_temperature: String,
47
48    /// output file name (in ramdisk) for current value of water temperature filtered
49    pub output_file_name_water_temperature_filtered: String,
50
51    /// output file name (in ramdisk) for the current value of pH
52    pub output_file_name_pH: String,
53
54    /// output file name (in ramdisk) for the current value of pH filtered
55    pub output_file_name_pH_filtered: String,
56
57    /// output file name (in ramdisk) for the current value of conductivity
58    pub output_file_name_conductivity: String,
59
60    /// output file name (in ramdisk) for the current value of conductivity filtered
61    pub output_file_name_conductivity_filtered: String,
62
63    /// output file name (in ramdisk) for the current value of tank level switch position
64    pub output_file_name_tank_level_switch_position: String,
65
66    /// output file name (in ramdisk) for the current value of tank level switch invalid
67    pub output_file_name_tank_level_switch_invalid: String,
68
69    /// output file name (in ramdisk) for the current value of tank level switch position stabilized
70    pub output_file_name_tank_level_switch_position_stabilized: String,
71
72    /// output file name (in ramdisk) for the current value of ventilation
73    pub output_file_name_ventilation_is_on: String,
74
75    /// output file name (in ramdisk) for the current value of heating
76    pub output_file_name_heating_is_on: String,
77
78    /// output file name (in ramdisk) for the current value of ambient air temperature
79    pub output_file_name_ambient_temperature: String,
80
81    /// output file name (in ramdisk) for the current value of air humidity
82    pub output_file_name_humidity: String,
83
84    /// output file name (in ramdisk) for the current refill pump status
85    pub output_file_name_refill_in_progress: String,
86
87    /// sleep time in milliseconds before starting the data recording
88    pub initial_sleep_time_millis: u64,
89}