aquarium_control/sensors/ds18b20_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*/
9use serde_derive::Deserialize;
10
11/// Holds the configuration data for DS18B20 sensor communication.
12/// The configuration is loaded from the .toml configuration file.
13/// This struct does not contain any implementation.
14#[derive(Deserialize, Debug)]
15pub struct Ds18b20Config {
16 /// used primarily for testing purposes
17 pub active: bool,
18
19 /// indicates if thread shall be started or not
20 pub execute: bool,
21
22 /// pause duration between two measurements in milliseconds
23 pub measurement_pause_duration_millis: u64,
24
25 /// system driver base path
26 pub system_driver_base_path: String,
27
28 /// system driver sensor-specific path
29 pub system_driver_sensor_path_prefix: String,
30
31 /// system driver file name
32 pub system_driver_file_name: String,
33
34 #[allow(unused)]
35 /// max. number of retries
36 pub max_retries: u32,
37
38 #[allow(unused)]
39 /// duration between retries in milliseconds
40 pub retry_pause_duration_millis: u64,
41
42 /// unique 64-bit ID of water temperature sensor
43 pub water_temperature_sensor_id: String,
44
45 /// unique 64-bit ID of ambient temperature sensor
46 pub ambient_temperature_sensor_id: String,
47}