HomeWaterLeaksDetection
HighLeakDetection.h
Go to the documentation of this file.
1 #ifndef HIGH_LEAK_DETECTION_H
2 #define HIGH_LEAK_DETECTION_H
3 
4 #include "Setup.h"
5 #include "ALeakDetectable.h"
6 
7 //=============HighLeakDetection class==================
8 
14  #ifdef DEBUG
15  , public ILoggable
16  #endif
17  #ifdef WEB_SERVER
18  , public HTMLDataSource
19  #endif
20  #ifdef LCD_DISPLAY
21  , public IDisplayable
22  #endif
23 {
24 //===================protected data=====================
25 protected:
26  int pulseCount;
27 
28 //=================protected methods====================
29 protected:
32  void testActiveLeak() override;
33 
36  void testResetLeak() override;
37 
38 //==================public methods======================
39 public:
47  Type type,
50 
53 
55  void update() override;
56 
58  void reset() override;
59 
66  String getFormatOfSettingsToSave() override;
67 
74  float getPercentLeakDetectionReset() const;
75 
82  float getPercentLeakDetected() const;
83 
84 //====================debugging=========================
85 #ifdef DEBUG
86 public:
89  const String getLogDescription() const override;
90 
93  const String getLogID() const override;
94 #endif
95 
96 //==================LCD display=========================
97 #ifdef LCD_DISPLAY
98  const String getRow(int row) const override;
107 #endif
108 
109 //====================web server========================
110 #ifdef WEB_SERVER
111 protected:
114  std::map<int, String (*)(const HighLeakDetection& highLeakDetection)> htmlData;
115 
116 public:
124  const String getHTMLData(const int id) const override;
125 
126 private:
131 
136 
141 
146 
151 
162 
167 
172 
177 
182 
187 
192 
197 
202 
207 
212 
217 #endif
218 
219 //===============email notifications====================
220 #ifdef EMAIL_NOTIFICATION
221 private:
227  virtual void sendEmailLeakDetected();
228 #endif
229 };
230 
231 #endif
ALeakDetectable::alarmConfig
LeakDetectionConfig_t alarmConfig
alarm configuration for when there's nobody in the house
Definition: ALeakDetectable.h:67
ALeakDetectable::type
Type type
the type of the water leak detection algorithm
Definition: ALeakDetectable.h:76
highLeakDetection
HighLeakDetection * highLeakDetection
Definition: main.cpp:51
HighLeakDetection::htmlData
std::map< int, String(*)(const HighLeakDetection &highLeakDetection)> htmlData
A map of different values (keys) and their associated functions which returns the appropriate values.
Definition: HighLeakDetection.h:114
HighLeakDetection::HighLeakDetection
HighLeakDetection(PulseCounter *pulseCounter, Type type, LeakDetectionConfig_t normalConfig, LeakDetectionConfig_t alarmConfig)
Constructor of the class.
Definition: HighLeakDetection.cpp:23
HighLeakDetection::HTML_resetLimitSecsAlarm
friend String HTML_resetLimitSecsAlarm(const HighLeakDetection &highLeakDetection)
Associated function for returing the reset time (secs) in the alarm configuration.
LeakDetectionConfig_t
Definition: LeakDetectionConfig.h:17
HighLeakDetection::~HighLeakDetection
~HighLeakDetection()
Descrutor of the class.
Definition: HighLeakDetection.h:52
HighLeakDetection::getPercentLeakDetectionReset
float getPercentLeakDetectionReset() const
Returns percentage information about how close a high-water leak is from being detected.
Definition: HighLeakDetection.cpp:148
ALeakDetectable.h
HighLeakDetection::getFormatOfSettingsToSave
String getFormatOfSettingsToSave() override
Returns the current settings of the algorithm.
Definition: HighLeakDetection.cpp:63
HighLeakDetection
Definition: HighLeakDetection.h:23
ALeakDetectable
Definition: ALeakDetectable.h:52
Setup.h
HighLeakDetection::HTML_activePercentage
friend String HTML_activePercentage(const HighLeakDetection &highLeakDetection)
Associated function for returing the [%] information about how close a leak is from being detected.
HighLeakDetection::reset
void reset() override
Resets the algorithm.
Definition: HighLeakDetection.cpp:53
HighLeakDetection::HTML_detectedTime
friend String HTML_detectedTime(const HighLeakDetection &highLeakDetection)
Associated function for returing the detection time of a high-water leak.
HighLeakDetection::testResetLeak
void testResetLeak() override
Tests if the high-water the algorithm should be reset based on inactivity of pulse on the input pin.
Definition: HighLeakDetection.cpp:70
HighLeakDetection::HTML_resetLimitMins
friend String HTML_resetLimitMins(const HighLeakDetection &highLeakDetection)
Associated function for returing the reset time (mins) in the normal configuration.
HighLeakDetection::getRow
const String getRow(int row) const override
Returns the content of the row given as a parameter.
HighLeakDetection::pulseCount
int pulseCount
number of pulses detected so far
Definition: HighLeakDetection.h:26
HighLeakDetection::HTML_bypass
friend String HTML_bypass(const HighLeakDetection &highLeakDetection)
Associated function for returing information about the state of the bypass.
HighLeakDetection::HTML_resetPercentage
friend String HTML_resetPercentage(const HighLeakDetection &highLeakDetection)
Associated function for returing the [%] information about how close the algorithm is from being rese...
HighLeakDetection::HTML_detectionLimitAlarm
friend String HTML_detectionLimitAlarm(const HighLeakDetection &highLeakDetection)
Associated function for returing the limit (detection) in terms of the alarm configuration.
HighLeakDetection::HTML_resetLimitHoursAlarm
friend String HTML_resetLimitHoursAlarm(const HighLeakDetection &highLeakDetection)
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
ILoggable
Definition: ILoggable.h:13
HighLeakDetection::HTML_detectionLimit
friend String HTML_detectionLimit(const HighLeakDetection &highLeakDetection)
Associated function for returing the limit (detection) in terms of the normal configuration.
HighLeakDetection::HTML_resetLimitMinsAlarm
friend String HTML_resetLimitMinsAlarm(const HighLeakDetection &highLeakDetection)
Associated function for returing the reset time (mins) in the alarm configuration.
HighLeakDetection::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...
IDisplayable
Definition: IDisplayable.h:12
PulseCounter
Definition: PulseCounter.h:29
HTMLDataSource
Definition: HTMLDataSource.h:15
HighLeakDetection::HTML_resetLimitDaysAlarm
friend String HTML_resetLimitDaysAlarm(const HighLeakDetection &highLeakDetection)
Associated function for returing the reset time (days) in the alarm configuration.
HighLeakDetection::HTML_activePercentageColor
friend String HTML_activePercentageColor(const HighLeakDetection &highLeakDetection)
Associated function for returing a color according to [%] information about how close a leak is from ...
HighLeakDetection::HTML_detectedText
friend String HTML_detectedText(const HighLeakDetection &highLeakDetection)
Associated function for returing information about a high-water leak being detected (2)
HighLeakDetection::testActiveLeak
void testActiveLeak() override
Tests if a high-water leak has occurred, and if so, it will set the appropriate variables and flags.
Definition: HighLeakDetection.cpp:81
HighLeakDetection::HTML_resetLimitDays
friend String HTML_resetLimitDays(const HighLeakDetection &highLeakDetection)
Associated function for returing the reset time (days) in the normal configuration.
ALeakDetectable::pulseCounter
PulseCounter * pulseCounter
instance of a pulse counter (input of the system)
Definition: ALeakDetectable.h:65
HighLeakDetection::getPercentLeakDetected
float getPercentLeakDetected() const
Returns percentage information about how close the algorithm is from being reset.
Definition: HighLeakDetection.cpp:142
HighLeakDetection::HTML_resetLimitSecs
friend String HTML_resetLimitSecs(const HighLeakDetection &highLeakDetection)
Associated function for returing the reset time (secs) in the normal configuration.
HighLeakDetection::update
void update() override
Updates the algorithm.
Definition: HighLeakDetection.cpp:115
HighLeakDetection::HTML_detected
friend String HTML_detected(const HighLeakDetection &highLeakDetection)
Associated function for returing information about a high-water leak being detected (1)
ALeakDetectable::normalConfig
LeakDetectionConfig_t normalConfig
normal configuarion for when the house is occupied
Definition: ALeakDetectable.h:66
HighLeakDetection::HTML_resetLimitHours
friend String HTML_resetLimitHours(const HighLeakDetection &highLeakDetection)
Associated function for returing the reset time (hours) in the normal configuration.