HomeWaterLeaksDetection
LowLeakDetection.h
Go to the documentation of this file.
1 #ifndef LOW_LEAK_DETECTION_H
2 #define LOW_LEAK_DETECTION_H
3 
4 #include "Setup.h"
5 #include "ALeakDetectable.h"
6 
12  #ifdef DEBUG
13  , public ILoggable
14  #endif
15  #ifdef WEB_SERVER
16  , public HTMLDataSource
17  #endif
18  #ifdef LCD_DISPLAY
19  , public IDisplayable
20  #endif
21 {
22 //====================private data======================
23 private:
24  int flipFlop;
26 
27 //==================private methods=====================
28 private:
31  void testActiveLeak() override;
32 
35  void testResetLeak() override;
36 
37 //==================public methods======================
38 public:
46  Type type,
49 
52 
54  void update() override;
55 
57  void reset() override;
58 
65  String getFormatOfSettingsToSave() override;
66 
73  float getPercentLeakDetectionReset() const;
74 
81  float getPercentLeakDetected() const;
82 
83 //====================debugging=========================
84 #ifdef DEBUG
85 public:
88  const String getLogDescription() const override;
89 
92  const String getLogID() const override;
93 #endif
94 
95 //==================LCD display=========================
96 #ifdef LCD_DISPLAY
97  const String getRow(int row) const override;
106 #endif
107 
108 //====================web server========================
109 #ifdef WEB_SERVER
110 protected:
113  std::map<int, String (*)(const LowLeakDetection& highLeakDetection)> htmlData;
114 
115 public:
123  const String getHTMLData(const int id) const override;
124 
125 private:
130 
135 
140 
145 
150 
161 
166 
171 
176 
181 
186 
191 
196 
201 
206 
211 
216 
221 
226 
231 
236 
241 
246 #endif
247 
248 //===============email notifications====================
249 #ifdef EMAIL_NOTIFICATION
250 private:
256  void sendEmailLeakDetected();
257 #endif
258 };
259 
260 #endif
ALeakDetectable::alarmConfig
LeakDetectionConfig_t alarmConfig
alarm configuration for when there's nobody in the house
Definition: ALeakDetectable.h:67
LowLeakDetection::LowLeakDetection
LowLeakDetection(PulseCounter *pulseCounter, Type type, LeakDetectionConfig_t normalConfig, LeakDetectionConfig_t alarmConfig)
Constructor of the class.
Definition: LowLeakDetection.cpp:29
LowLeakDetection::flipFlop
int flipFlop
state of the flip-flop (1/0)
Definition: LowLeakDetection.h:24
LowLeakDetection::HTML_resetLimitDaysAlarm
friend String HTML_resetLimitDaysAlarm(const LowLeakDetection &lowLeakDetection)
Associated function for returing the reset time (days) in the alarm configuration.
LowLeakDetection::getFormatOfSettingsToSave
String getFormatOfSettingsToSave() override
Returns the current settings of the algorithm.
Definition: LowLeakDetection.cpp:107
lowLeakDetection
LowLeakDetection * lowLeakDetection
Definition: main.cpp:52
ALeakDetectable::type
Type type
the type of the water leak detection algorithm
Definition: ALeakDetectable.h:76
LowLeakDetection::HTML_detectedLimitDays
friend String HTML_detectedLimitDays(const LowLeakDetection &lowLeakDetection)
Associated function for returing the limit action time (days) in terms of the normal configuration.
LowLeakDetection::htmlData
std::map< int, String(*)(const LowLeakDetection &highLeakDetection)> htmlData
A map of different values (keys) and their associated functions which returns the appropriate values.
Definition: LowLeakDetection.h:113
LowLeakDetection::HTML_resetPercentage
friend String HTML_resetPercentage(const LowLeakDetection &lowLeakDetection)
Associated function for returing the [%] information about how close the algorithm is from being rese...
highLeakDetection
HighLeakDetection * highLeakDetection
Definition: main.cpp:51
LowLeakDetection::reset
void reset() override
Resets the algorithm.
Definition: LowLeakDetection.cpp:67
LeakDetectionConfig_t
Definition: LeakDetectionConfig.h:17
LowLeakDetection::HTML_detectedLimitSecsAlarm
friend String HTML_detectedLimitSecsAlarm(const LowLeakDetection &lowLeakDetection)
Associated function for returing the limit action time (secs) in terms of the alarm configuration.
LowLeakDetection::flipFlopSetTime
time_t flipFlopSetTime
time when the flip-flop has been set to 1
Definition: LowLeakDetection.h:25
LowLeakDetection::HTML_resetLimitSecsAlarm
friend String HTML_resetLimitSecsAlarm(const LowLeakDetection &lowLeakDetection)
Associated function for returing the reset time (secs) in the alarm configuration.
LowLeakDetection::HTML_resetLimitHours
friend String HTML_resetLimitHours(const LowLeakDetection &lowLeakDetection)
Associated function for returing the reset time (hours) in the normal configuration.
ALeakDetectable.h
ALeakDetectable
Definition: ALeakDetectable.h:52
LowLeakDetection::HTML_detectedLimitSecs
friend String HTML_detectedLimitSecs(const LowLeakDetection &lowLeakDetection)
Associated function for returing the limit action time (secs) in terms of the normal configuration.
LowLeakDetection::~LowLeakDetection
~LowLeakDetection()
Descrutor of the class.
Definition: LowLeakDetection.h:51
LowLeakDetection::HTML_detectedLimitMinsAlarm
friend String HTML_detectedLimitMinsAlarm(const LowLeakDetection &lowLeakDetection)
Associated function for returing the limit action time (mins) in terms of the alarm configuration.
LowLeakDetection::HTML_resetLimitDays
friend String HTML_resetLimitDays(const LowLeakDetection &lowLeakDetection)
Associated function for returing the reset time (days) in the normal configuration.
LowLeakDetection::HTML_activePercentageColor
friend String HTML_activePercentageColor(const LowLeakDetection &lowLeakDetection)
Associated function for returing a color according to [%] information about how close a leak is from ...
Setup.h
LowLeakDetection::HTML_detected
friend String HTML_detected(const LowLeakDetection &lowLeakDetection)
Associated function for returing information about a low-water leak being detected (1)
LowLeakDetection::HTML_resetLimitMins
friend String HTML_resetLimitMins(const LowLeakDetection &lowLeakDetection)
Associated function for returing the reset time (mins) in the normal configuration.
LowLeakDetection::getPercentLeakDetectionReset
float getPercentLeakDetectionReset() const
Returns percentage information about how close a low-water leak is from being detected.
Definition: LowLeakDetection.cpp:161
LowLeakDetection::getRow
const String getRow(int row) const override
Returns the content of the row given as a parameter.
LowLeakDetection::update
void update() override
Updates the algorithm.
Definition: LowLeakDetection.cpp:78
LowLeakDetection::HTML_detectedLimitHoursAlarm
friend String HTML_detectedLimitHoursAlarm(const LowLeakDetection &lowLeakDetection)
Associated function for returing the limit action time (hours) in terms of the alarm configuration.
time_t
unsigned long time_t
Referring to the data type unsigned long as time_t.
Definition: DateTime.h:20
LowLeakDetection::HTML_detectedLimitDaysAlarm
friend String HTML_detectedLimitDaysAlarm(const LowLeakDetection &lowLeakDetection)
Associated function for returing the limit action time (days) in terms of the alarm configuration.
LowLeakDetection::getPercentLeakDetected
float getPercentLeakDetected() const
Returns percentage information about how close the algorithm is from being reset.
Definition: LowLeakDetection.cpp:174
LowLeakDetection::getHTMLData
const String getHTMLData(const int id) const override
Since this class is registered as a source of data for the HTML content, it needs return the appropri...
LowLeakDetection::HTML_resetLimitHoursAlarm
friend String HTML_resetLimitHoursAlarm(const LowLeakDetection &lowLeakDetection)
Associated function for returing the reset time (hours) in the alarm configuration.
ALeakDetectable::Type
Type
The type of the water leak detection algorithm.
Definition: ALeakDetectable.h:57
LowLeakDetection::HTML_bypass
friend String HTML_bypass(const LowLeakDetection &lowLeakDetection)
Associated function for returing information about the state of the bypass.
LowLeakDetection::testActiveLeak
void testActiveLeak() override
Tests if a low-water leak has occurred, and if so, it will set the appropriate variables and flags.
Definition: LowLeakDetection.cpp:125
LowLeakDetection::HTML_resetLimitMinsAlarm
friend String HTML_resetLimitMinsAlarm(const LowLeakDetection &lowLeakDetection)
Associated function for returing the reset time (mins) in the alarm configuration.
ILoggable
Definition: ILoggable.h:13
LowLeakDetection::HTML_detectedLimitHours
friend String HTML_detectedLimitHours(const LowLeakDetection &lowLeakDetection)
Associated function for returing the limit action time (hours) in terms of the normal configuration.
LowLeakDetection::testResetLeak
void testResetLeak() override
Tests if the low-water the algorithm should be reset based on inactivity of pulse on the input pin.
Definition: LowLeakDetection.cpp:114
IDisplayable
Definition: IDisplayable.h:12
PulseCounter
Definition: PulseCounter.h:29
HTMLDataSource
Definition: HTMLDataSource.h:15
LowLeakDetection::HTML_detectedTime
friend String HTML_detectedTime(const LowLeakDetection &lowLeakDetection)
Associated function for returing the detection time of a low-water leak.
ALeakDetectable::pulseCounter
PulseCounter * pulseCounter
instance of a pulse counter (input of the system)
Definition: ALeakDetectable.h:65
LowLeakDetection::HTML_detectedText
friend String HTML_detectedText(const LowLeakDetection &lowLeakDetection)
Associated function for returing information about a low-water leak being detected (2)
LowLeakDetection::HTML_detectedLimitMins
friend String HTML_detectedLimitMins(const LowLeakDetection &lowLeakDetection)
Associated function for returing the limit action time (mins) in terms of the normal configuration.
ALeakDetectable::normalConfig
LeakDetectionConfig_t normalConfig
normal configuarion for when the house is occupied
Definition: ALeakDetectable.h:66
LowLeakDetection
Definition: LowLeakDetection.h:21
LowLeakDetection::HTML_activePercentage
friend String HTML_activePercentage(const LowLeakDetection &lowLeakDetection)
Associated function for returing the [%] information about how close a leak is from being detected.
LowLeakDetection::HTML_resetLimitSecs
friend String HTML_resetLimitSecs(const LowLeakDetection &lowLeakDetection)
Associated function for returing the reset time (secs) in the normal configuration.