#include <TotalLeakDetection.h>
|
| TotalLeakDetection (PulseCounter *pulseCounter, Type type, LeakDetectionConfig_t normalConfig, LeakDetectionConfig_t alarmConfig) |
| Constructor of the class. More...
|
|
| ~TotalLeakDetection () |
| Descrutor of the class. More...
|
|
void | reset () override |
| Resets the algorithm. More...
|
|
const String | getRow (int row) const override |
| Returns the content of the row given as a parameter. More...
|
|
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 appropriate value according to the id given as a parameter. More...
|
|
| HighLeakDetection (PulseCounter *pulseCounter, Type type, LeakDetectionConfig_t normalConfig, LeakDetectionConfig_t alarmConfig) |
| Constructor of the class. More...
|
|
| ~HighLeakDetection () |
| Descrutor of the class. More...
|
|
void | update () override |
| Updates the algorithm. More...
|
|
String | getFormatOfSettingsToSave () override |
| Returns the current settings of the algorithm. More...
|
|
float | getPercentLeakDetectionReset () const |
| Returns percentage information about how close a high-water leak is from being detected. More...
|
|
float | getPercentLeakDetected () const |
| Returns percentage information about how close the algorithm is from being reset. More...
|
|
| ALeakDetectable (PulseCounter *pulseCounter, Type type, LeakDetectionConfig_t normalConfig, LeakDetectionConfig_t alarmConfig) |
| Constructor of the class. More...
|
|
virtual | ~ALeakDetectable () |
| Destructor of the class. More...
|
|
int | isActive () const |
| Returns a flag whether of not a leak has been detected and the bypass is off. More...
|
|
void | changeStateOfHomeAlarm (bool state) |
| Changes the state of the home alarm. More...
|
|
LeakDetectionConfig_t | getAlarmConfig () |
| Returns the current alarm config. More...
|
|
LeakDetectionConfig_t | getNormalConfig () |
| Returns the current normal config. More...
|
|
void | updateNormalConfig (LeakDetectionConfig_t newNormalConfig) |
| Updates the normal settings. More...
|
|
void | updateAlarmConfig (LeakDetectionConfig_t newAlarmConfig) |
| Updates the alarm settings. More...
|
|
|
float | getPercentLeakDetectionReset () const |
| Returns percentage information about how close a total-water leak is from being detected. More...
|
|
void | testResetLeak () override |
| Tests if a total-water leak has occurred, and if so, it will set the appropriate variables and flags. More...
|
|
void | testActiveLeak () override |
| Tests if the total-water the algorithm should be reset if the current monitoring period is over. More...
|
|
void | applyNewConfig () |
| Applies the new config configuration. More...
|
|
String | getType () const |
| Returns the type of the water leak detection algorithm. More...
|
|
- Author
- silhavyj A17B0362P
This class implements the total-water leak detection algorithm. It takes adventage of the already implemented in the high-water leak detection algorithm and overwrites some required parts of it.
Definition at line 15 of file TotalLeakDetection.h.
◆ TotalLeakDetection()
Constructor of the class.
- Parameters
-
pulseCounter | instance of PulseCounter (input) |
type | of the algorithm (total-water) |
normalConfig | default normal settings |
alarmConfig | default alarm settings |
Definition at line 23 of file TotalLeakDetection.cpp.
References HTML_activePercentage, HTML_activePercentageColor, HTML_bypass, HTML_detected, HTML_detectedText, HTML_detectedTime, HTML_detectionLimit, HTML_detectionLimitAlarm, HTML_resetLimitDays, HTML_resetLimitDaysAlarm, HTML_resetLimitHours, HTML_resetLimitHoursAlarm, HTML_resetLimitMins, HTML_resetLimitMinsAlarm, HTML_resetLimitSecs, HTML_resetLimitSecsAlarm, HTML_resetPercentage, htmlData, and reset().
◆ ~TotalLeakDetection()
TotalLeakDetection::~TotalLeakDetection |
( |
| ) |
|
|
inline |
◆ getHTMLData()
const String TotalLeakDetection::getHTMLData |
( |
const int |
id | ) |
const |
|
overridevirtual |
Since this class is registered as a source of data for the HTML content, it needs return the appropriate value according to the id given as a parameter.
- Parameters
-
id | - the id of the piece of data |
- Returns
- If the class holds this piece of information, it will return it. Otherwise, "UNDEFINED" will be returned.
Reimplemented from HighLeakDetection.
◆ getPercentLeakDetectionReset()
float TotalLeakDetection::getPercentLeakDetectionReset |
( |
| ) |
const |
|
protected |
◆ getRow()
const String TotalLeakDetection::getRow |
( |
int |
row | ) |
const |
|
overridevirtual |
Returns the content of the row given as a parameter.
This class represents one page on the LCD display. Each of the 4 rows has different content identified by the number of the row.
- Parameters
-
- Returns
- content to be displayed on that row of the LCD
Reimplemented from HighLeakDetection.
◆ reset()
void TotalLeakDetection::reset |
( |
| ) |
|
|
overridevirtual |
◆ testActiveLeak()
void TotalLeakDetection::testActiveLeak |
( |
| ) |
|
|
overrideprotectedvirtual |
Tests if the total-water the algorithm should be reset if the current monitoring period is over.
Reimplemented from HighLeakDetection.
Definition at line 69 of file TotalLeakDetection.cpp.
80 #ifdef EMAIL_NOTIFICATION
81 sendEmailLeakDetected();
References ALeakDetectable::active, ALeakDetectable::bypass, ALeakDetectable::config, ALeakDetectable::detected, DateTime::getDateTimeStr(), DateTime::getInstance(), getPercentLeakDetectionReset(), LeakDetectionConfig_t::limitPulseAction, HighLeakDetection::pulseCount, ALeakDetectable::resetWhenDetected, ALeakDetectable::timeOfDetection, and TOTAL_ILOCK_LED_PIN.
◆ testResetLeak()
void TotalLeakDetection::testResetLeak |
( |
| ) |
|
|
overrideprotectedvirtual |
◆ HTML_activePercentage
Associated function for returing the [%] information about how close a leak is from being detected.
- Parameters
-
- Returns
- [%] information about how close a leak is from being detected
Referenced by TotalLeakDetection().
◆ HTML_activePercentageColor
Associated function for returing a color according to [%] information about how close a leak is from being detected.
For instance, 0 - 59% -> gray 60 - 79% -> yellow 80 - 89% -> orange
90 - 100% ->red
- Parameters
-
- Returns
- color according to the state of the algorithm - detected [%]
Referenced by TotalLeakDetection().
◆ HTML_bypass
Associated function for returing information about the state of the bypass.
- Parameters
-
- Returns
- "OFF"/"ON" according to the current state of the bypass
Referenced by TotalLeakDetection().
◆ HTML_detected
Associated function for returing information about a total-water leak being detected (1)
- Parameters
-
- Returns
- "ON" if a total-water leak has occurred, "OFF" otherwise
Referenced by TotalLeakDetection().
◆ HTML_detectedText
Associated function for returing information about a total-water leak being detected (2)
- Parameters
-
- Returns
- "Detected" if a total-water leak has occurred, "Undetected" otherwise
Referenced by TotalLeakDetection().
◆ HTML_detectedTime
Associated function for returing the detection time of a total-water leak.
- Parameters
-
- Returns
- the time of detection in a string format
Referenced by TotalLeakDetection().
◆ HTML_detectionLimit
Associated function for returing the limit (detection) in terms of the normal configuration.
- Parameters
-
- Returns
- the limit (detection) in the normal configuration
Referenced by TotalLeakDetection().
◆ HTML_detectionLimitAlarm
Associated function for returing the limit (detection) in terms of the alarm configuration.
- Parameters
-
- Returns
- the limit (detection) in the alarm configuration
Referenced by TotalLeakDetection().
◆ HTML_resetLimitDays
Associated function for returing the reset time (days) in the normal configuration.
- Parameters
-
- Returns
- reset time (days) in the normal configuration
Referenced by TotalLeakDetection().
◆ HTML_resetLimitDaysAlarm
Associated function for returing the reset time (days) in the alarm configuration.
- Parameters
-
- Returns
- reset time (days) in the alarm configuration
Referenced by TotalLeakDetection().
◆ HTML_resetLimitHours
Associated function for returing the reset time (hours) in the normal configuration.
- Parameters
-
- Returns
- reset time (hours) in the normal configuration
Referenced by TotalLeakDetection().
◆ HTML_resetLimitHoursAlarm
Associated function for returing the reset time (hours) in the alarm configuration.
- Parameters
-
- Returns
- reset time (hours) in the alarm configuration
Referenced by TotalLeakDetection().
◆ HTML_resetLimitMins
Associated function for returing the reset time (mins) in the normal configuration.
- Parameters
-
- Returns
- reset time (mins) in the normal configuration
Referenced by TotalLeakDetection().
◆ HTML_resetLimitMinsAlarm
Associated function for returing the reset time (mins) in the alarm configuration.
- Parameters
-
- Returns
- reset time (mins) in the alarm configuration
Referenced by TotalLeakDetection().
◆ HTML_resetLimitSecs
Associated function for returing the reset time (secs) in the normal configuration.
- Parameters
-
- Returns
- reset time (secs) in the normal configuration
Referenced by TotalLeakDetection().
◆ HTML_resetLimitSecsAlarm
Associated function for returing the reset time (secs) in the alarm configuration.
- Parameters
-
- Returns
- reset time (secs) in the alarm configuration
Referenced by TotalLeakDetection().
◆ HTML_resetPercentage
Associated function for returing the [%] information about how close the algorithm is from being reset.
- Parameters
-
- Returns
- [%] information about how close the algorithm is from being reset
Referenced by TotalLeakDetection().
◆ htmlData
◆ startDayPulseTime
time_t TotalLeakDetection::startDayPulseTime |
|
private |
The documentation for this class was generated from the following files:
LeakDetectionConfig_t alarmConfig
alarm configuration for when there's nobody in the house
String timeOfDetection
time when the leak has been detected
Type type
the type of the water leak detection algorithm
friend String HTML_resetLimitMinsAlarm(const TotalLeakDetection &totalLeakDetection)
Associated function for returing the reset time (mins) in the alarm configuration.
friend String HTML_detectedTime(const TotalLeakDetection &totalLeakDetection)
Associated function for returing the detection time of a total-water leak.
friend String HTML_detectionLimitAlarm(const TotalLeakDetection &totalLeakDetection)
Associated function for returing the limit (detection) in terms of the alarm configuration.
HighLeakDetection(PulseCounter *pulseCounter, Type type, LeakDetectionConfig_t normalConfig, LeakDetectionConfig_t alarmConfig)
Constructor of the class.
friend String HTML_resetLimitSecs(const TotalLeakDetection &totalLeakDetection)
Associated function for returing the reset time (secs) in the normal configuration.
friend String HTML_resetLimitHoursAlarm(const TotalLeakDetection &totalLeakDetection)
Associated function for returing the reset time (hours) in the alarm configuration.
time_t limitResetTime
limit reset time e.g. 5 mins, 24h, ....
friend String HTML_detected(const TotalLeakDetection &totalLeakDetection)
Associated function for returing information about a total-water leak being detected (1)
int limitPulseAction
limit action in pulses
friend String HTML_activePercentage(const TotalLeakDetection &totalLeakDetection)
Associated function for returing the [%] information about how close a leak is from being detected.
#define TOTAL_ILOCK_LED_PIN
total-water leak bypass button
int resetWhenDetected
the reset value (%) when a leak was detected
LeakDetectionConfig_t * config
pointer to the current configuration
bool detected
indication if a leak has been detected
void reset() override
Resets the algorithm.
void applyNewConfig()
Applies the new config configuration.
int pulseCount
number of pulses detected so far
friend String HTML_resetLimitDaysAlarm(const TotalLeakDetection &totalLeakDetection)
Associated function for returing the reset time (days) in the alarm configuration.
static DateTime * getInstance()
Returns the instance of the class.
friend String HTML_detectedText(const TotalLeakDetection &totalLeakDetection)
Associated function for returing information about a total-water leak being detected (2)
unsigned long time_t
Referring to the data type unsigned long as time_t.
time_t startDayPulseTime
the start of the monoring period
friend String HTML_detectionLimit(const TotalLeakDetection &totalLeakDetection)
Associated function for returing the limit (detection) in terms of the normal configuration.
friend String HTML_resetLimitMins(const TotalLeakDetection &totalLeakDetection)
Associated function for returing the reset time (mins) in the normal configuration.
float getPercentLeakDetectionReset() const
Returns percentage information about how close a total-water leak is from being detected.
friend String HTML_resetLimitSecsAlarm(const TotalLeakDetection &totalLeakDetection)
Associated function for returing the reset time (secs) in the alarm configuration.
friend String HTML_bypass(const TotalLeakDetection &totalLeakDetection)
Associated function for returing information about the state of the bypass.
String getDateTimeStr() const
Returns the current datatime in a string format.
friend String HTML_resetLimitHours(const TotalLeakDetection &totalLeakDetection)
Associated function for returing the reset time (hours) in the normal configuration.
friend String HTML_resetLimitDays(const TotalLeakDetection &totalLeakDetection)
Associated function for returing the reset time (days) in the normal configuration.
void reset() override
Resets the algorithm.
int active
indication if a leak has been detected + bypass is off
friend String HTML_activePercentageColor(const TotalLeakDetection &totalLeakDetection)
Associated function for returing a color according to [%] information about how close a leak is from ...
#define DELTA_TIME(time1, time2)
Calculates the time difference between two times given as parameters.
PulseCounter * pulseCounter
instance of a pulse counter (input of the system)
friend String HTML_resetPercentage(const TotalLeakDetection &totalLeakDetection)
Associated function for returing the [%] information about how close the algorithm is from being rese...
LeakDetectionConfig_t normalConfig
normal configuarion for when the house is occupied
std::map< int, String(*)(const TotalLeakDetection &highLeakDetection)> htmlData
A map of different values (keys) and their associated functions which returns the appropriate values.