HomeWaterLeaksDetection
|
#include <Consumption.h>
Public Types | |
enum | Type { DAY, WEEK, MONTH } |
Type of the monitoring period. More... | |
Public Member Functions | |
Consumption (PulseCounter *pulseCounter, Type type) | |
Constructor of the class. More... | |
void | update () |
Updates the variables. More... | |
int | getConsumptionCount () const |
Returns the current number of pulses detected so far within the monitoring period. More... | |
Private Attributes | |
PulseCounter * | pulseCounter |
instance of PulseCounter (input [l]) More... | |
RTCDateTime | initialDateTime |
instance of RTCDateTime (real-time module) More... | |
int | count |
number of pulses detected within the monitoring period More... | |
Type | type |
type of the monitoring period More... | |
This class is used to monitor daily, weekly, or monthly.
Definition at line 13 of file Consumption.h.
enum Consumption::Type |
Type of the monitoring period.
It is set through the constructure when creating an instance.
Enumerator | |
---|---|
DAY | daily water consumption |
WEEK | weekly water consumption |
MONTH | monthly water consumption |
Definition at line 19 of file Consumption.h.
Consumption::Consumption | ( | PulseCounter * | pulseCounter, |
Type | type | ||
) |
Constructor of the class.
pulseCounter | instance of PulseCounter (input) |
type | of the monitoring period |
Definition at line 3 of file Consumption.cpp.
References count, DateTime::getDateTime(), DateTime::getInstance(), initialDateTime, pulseCounter, and type.
int Consumption::getConsumptionCount | ( | ) | const |
Returns the current number of pulses detected so far within the monitoring period.
Definition at line 44 of file Consumption.cpp.
References count.
Referenced by DailyOverview::update().
void Consumption::update | ( | ) |
Updates the variables.
If a pulse has just been detected, it will increment the counter. Also, if the monitoring period is over, it will reset the counter. This method is supposed to be called as frequently as possible in order to achieve precise results.
Definition at line 11 of file Consumption.cpp.
References count, DAY, DateTime::getDateTime(), DateTime::getInstance(), initialDateTime, PulseCounter::isActive(), MONTH, pulseCounter, type, and WEEK.
Referenced by LeaksController::update().
|
private |
number of pulses detected within the monitoring period
Definition at line 29 of file Consumption.h.
Referenced by Consumption(), getConsumptionCount(), and update().
|
private |
instance of RTCDateTime (real-time module)
Definition at line 28 of file Consumption.h.
Referenced by Consumption(), and update().
|
private |
instance of PulseCounter (input [l])
Definition at line 27 of file Consumption.h.
Referenced by Consumption(), and update().
|
private |
type of the monitoring period
Definition at line 30 of file Consumption.h.
Referenced by Consumption(), and update().