2020-09-04 10:13:06 +00:00
|
|
|
/*
|
2022-02-12 14:28:17 +00:00
|
|
|
Copyright (C) 2020 Fredrik Öhrström (gpl-3.0-or-later)
|
2020-09-04 10:13:06 +00:00
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include"meters.h"
|
|
|
|
#include"meters_common_implementation.h"
|
|
|
|
#include"wmbus.h"
|
|
|
|
#include"wmbus_utils.h"
|
|
|
|
|
|
|
|
#include<algorithm>
|
|
|
|
#include<stdbool.h>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
2021-12-31 15:47:29 +00:00
|
|
|
struct MeterIzar3 : public virtual MeterCommonImplementation {
|
2020-09-04 11:17:09 +00:00
|
|
|
MeterIzar3(MeterInfo &mi);
|
2020-09-04 10:13:06 +00:00
|
|
|
|
|
|
|
double totalWaterConsumption(Unit u);
|
|
|
|
bool hasTotalWaterConsumption();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void processContent(Telegram *t);
|
|
|
|
double total_water_consumption_l_ {};
|
|
|
|
};
|
|
|
|
|
2021-12-31 11:27:57 +00:00
|
|
|
shared_ptr<Meter> createIzar3(MeterInfo &mi)
|
2020-09-04 10:13:06 +00:00
|
|
|
{
|
2021-12-31 15:47:29 +00:00
|
|
|
return shared_ptr<Meter>(new MeterIzar3(mi));
|
2020-09-04 10:13:06 +00:00
|
|
|
}
|
|
|
|
|
2020-09-04 11:17:09 +00:00
|
|
|
MeterIzar3::MeterIzar3(MeterInfo &mi) :
|
2022-01-02 12:08:36 +00:00
|
|
|
MeterCommonImplementation(mi, "izar3")
|
2020-09-04 10:13:06 +00:00
|
|
|
{
|
2021-12-31 15:47:29 +00:00
|
|
|
setMeterType(MeterType::WaterMeter);
|
|
|
|
|
2020-09-04 10:13:06 +00:00
|
|
|
// We do not know how to decode the IZAR r3 aka Diehl AQUARIUS!
|
|
|
|
addLinkMode(LinkMode::T1);
|
|
|
|
|
|
|
|
addPrint("total", Quantity::Volume,
|
|
|
|
[&](Unit u){ return totalWaterConsumption(u); },
|
|
|
|
"The total water consumption recorded by this meter.",
|
2022-04-11 12:01:54 +00:00
|
|
|
PrintProperty::FIELD | PrintProperty::JSON);
|
2020-09-04 10:13:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
double MeterIzar3::totalWaterConsumption(Unit u)
|
|
|
|
{
|
|
|
|
assertQuantity(u, Quantity::Volume);
|
|
|
|
return convert(total_water_consumption_l_, Unit::L, u);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool MeterIzar3::hasTotalWaterConsumption()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MeterIzar3::processContent(Telegram *t)
|
|
|
|
{
|
|
|
|
vector<uchar> frame;
|
|
|
|
t->extractFrame(&frame);
|
|
|
|
|
2021-12-07 22:56:29 +00:00
|
|
|
if (t->beingAnalyzed() == false)
|
|
|
|
{
|
|
|
|
warning("(izar3) cannot decode content of telegram!\n");
|
|
|
|
}
|
2020-09-04 10:13:06 +00:00
|
|
|
total_water_consumption_l_ = 123456789;
|
|
|
|
}
|