aquarium_control/simulator/
tcp_data.rs

1/* Copyright 2024 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
10/// Contains constants representing commands received from the control application.
11#[allow(dead_code)]
12pub mod command {
13    /// command to switch on a relay (not necessarily switching on a device)
14    pub const SETSINGLE: &str = "SETSINGLE";
15
16    /// command to switch off a relay (not necessarily switching off a device)
17    pub const UNSETSINGLE: &str = "UNSETSINGLE";
18
19    /// command to retrieve the status of Controllino (currently not used)
20    pub const GETSTATUS: &str = "GETSTATUS";
21
22    /// command to switch on and off a relay for a defined, short time
23    pub const PULSE: &str = "PULSE";
24
25    /// command to send a live signal to the Controllino
26    pub const HEARTBEAT: &str = "HEARTBEAT";
27
28    /// command to retrieve the status of a certain relay (currently not used)
29    pub const READ: &str = "READ";
30
31    /// command to indicate that the main application has finished initialization (currently not used)    
32    pub const INITIALIZED: &str = "INITIALIZED";
33}
34
35/// Contains constants representing the category received from the control application.
36/// The category describes the device to which the command shall be applied.
37#[allow(dead_code)]
38pub mod category {
39    /// Controllino is the relay actuator.
40    pub const CONTROLLINO: &str = "CONTROLLINO";
41
42    /// DHT22 is the sensor for measuring ambient temperature and humidity.
43    pub const DHT22: &str = "DHT22";
44
45    /// AtlasScientific is the group of sensors which includes water temperature, pH and conductivity.
46    pub const ATLASSCIENTIFIC: &str = "ATLSSCNTFC";
47
48    /// The tank level switch is measured via GPIO.
49    pub const TANKLEVELSWITCH: &str = "TNKLVLSWTCH";
50
51    /// This category addresses the refill control - it is used to reset errors from the outside.
52    pub const REFILLCONTROL: &str = "REFILLCTRL";
53}
54
55/// Contains constants representing the signal request received from the control application.
56#[allow(dead_code)]
57pub mod signal {
58    #[allow(dead_code)]
59    /// ambient air temperature in °C measured by DHT22
60    pub const AMBIENTTEMPERATURE: &str = "AmbTemp";
61
62    /// ambient humidity in % measured by DHT22
63    pub const AMBIENTHUMIDITY: &str = "AmbHum";
64
65    /// tank level switch position
66    pub const TANKLEVELSWITCHPOSITION: &str = "TnkLvlSwtch";
67
68    /// tank level switch invalid    
69    pub const TANKLEVELSWITCHINVALID: &str = "TnkLvlSwtchInvld";
70
71    /// water temperature in °C
72    pub const ATLASSCIENTIFICTEMPERATURE: &str = "temperature";
73
74    /// pH value
75    pub const ATLASSCIENTIFICPH: &str = "pH";
76
77    /// conductivity in uS/cm
78    pub const ATLASSCIENTIFICCONDUCTIVITY: &str = "conductivity";
79}