2018-04-01 06:53:37 +00:00
|
|
|
/*
|
2020-01-27 08:29:40 +00:00
|
|
|
Copyright (C) 2017-2020 Fredrik Öhrström
|
2018-04-01 06:53:37 +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/>.
|
|
|
|
*/
|
2017-08-09 10:00:11 +00:00
|
|
|
|
|
|
|
#include"meters.h"
|
2018-03-05 10:29:25 +00:00
|
|
|
#include"meters_common_implementation.h"
|
2019-05-04 11:07:37 +00:00
|
|
|
#include"units.h"
|
2019-05-04 15:38:10 +00:00
|
|
|
#include"wmbus.h"
|
|
|
|
#include"wmbus_utils.h"
|
2017-08-09 10:00:11 +00:00
|
|
|
|
2019-05-04 14:37:35 +00:00
|
|
|
#include<algorithm>
|
2018-03-05 10:29:25 +00:00
|
|
|
#include<memory.h>
|
2017-08-09 10:00:11 +00:00
|
|
|
|
2019-05-21 12:19:54 +00:00
|
|
|
MeterCommonImplementation::MeterCommonImplementation(WMBus *bus, MeterInfo &mi,
|
2019-06-06 15:28:20 +00:00
|
|
|
MeterType type, int manufacturer) :
|
|
|
|
type_(type), name_(mi.name), bus_(bus)
|
2018-03-05 10:29:25 +00:00
|
|
|
{
|
2019-09-16 14:32:24 +00:00
|
|
|
ids_ = splitMatchExpressions(mi.id);
|
2020-02-06 12:14:46 +00:00
|
|
|
if (mi.key.length() > 0)
|
|
|
|
{
|
2020-01-27 08:29:40 +00:00
|
|
|
hex2bin(mi.key, &meter_keys_.confidentiality_key);
|
2018-03-05 10:29:25 +00:00
|
|
|
}
|
2020-02-06 12:14:46 +00:00
|
|
|
if (bus->type() == DEVICE_SIMULATOR)
|
|
|
|
{
|
|
|
|
meter_keys_.simulation = true;
|
|
|
|
}
|
2019-04-01 21:49:24 +00:00
|
|
|
if (manufacturer) {
|
|
|
|
manufacturers_.insert(manufacturer);
|
|
|
|
}
|
2019-05-21 12:19:54 +00:00
|
|
|
for (auto s : mi.shells) {
|
|
|
|
addShell(s);
|
|
|
|
}
|
2019-10-20 17:19:17 +00:00
|
|
|
for (auto j : mi.jsons) {
|
|
|
|
addJson(j);
|
|
|
|
}
|
2020-01-27 08:29:40 +00:00
|
|
|
MeterCommonImplementation::bus()->onTelegram([this](vector<uchar>input_frame){return this->handleTelegram(input_frame);});
|
2018-03-05 10:29:25 +00:00
|
|
|
}
|
|
|
|
|
2019-05-04 11:55:52 +00:00
|
|
|
void MeterCommonImplementation::addConversions(std::vector<Unit> cs)
|
|
|
|
{
|
|
|
|
for (Unit c : cs)
|
|
|
|
{
|
|
|
|
conversions_.push_back(c);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-21 12:19:54 +00:00
|
|
|
void MeterCommonImplementation::addShell(string cmdline)
|
|
|
|
{
|
|
|
|
shell_cmdlines_.push_back(cmdline);
|
|
|
|
}
|
|
|
|
|
2019-10-20 17:19:17 +00:00
|
|
|
void MeterCommonImplementation::addJson(string json)
|
|
|
|
{
|
|
|
|
jsons_.push_back(json);
|
|
|
|
}
|
|
|
|
|
2019-05-21 12:19:54 +00:00
|
|
|
vector<string> &MeterCommonImplementation::shellCmdlines()
|
|
|
|
{
|
|
|
|
return shell_cmdlines_;
|
|
|
|
}
|
|
|
|
|
2019-10-20 17:19:17 +00:00
|
|
|
vector<string> &MeterCommonImplementation::additionalJsons()
|
|
|
|
{
|
|
|
|
return jsons_;
|
|
|
|
}
|
|
|
|
|
2018-03-05 10:29:25 +00:00
|
|
|
MeterType MeterCommonImplementation::type()
|
|
|
|
{
|
|
|
|
return type_;
|
|
|
|
}
|
|
|
|
|
2019-03-05 20:19:05 +00:00
|
|
|
vector<int> MeterCommonImplementation::media()
|
2018-03-05 10:29:25 +00:00
|
|
|
{
|
|
|
|
return media_;
|
|
|
|
}
|
|
|
|
|
2019-03-05 20:19:05 +00:00
|
|
|
void MeterCommonImplementation::addMedia(int m)
|
2018-03-05 10:29:25 +00:00
|
|
|
{
|
2019-03-05 20:19:05 +00:00
|
|
|
media_.push_back(m);
|
|
|
|
}
|
|
|
|
|
2019-06-06 15:28:20 +00:00
|
|
|
void MeterCommonImplementation::addLinkMode(LinkMode lm)
|
|
|
|
{
|
|
|
|
link_modes_.addLinkMode(lm);
|
|
|
|
}
|
|
|
|
|
2019-05-04 11:55:52 +00:00
|
|
|
void MeterCommonImplementation::addPrint(string vname, Quantity vquantity,
|
2019-05-04 17:56:17 +00:00
|
|
|
function<double(Unit)> getValueFunc, string help, bool field, bool json)
|
2019-05-04 11:55:52 +00:00
|
|
|
{
|
2019-05-04 17:56:17 +00:00
|
|
|
prints_.push_back( { vname, vquantity, defaultUnitForQuantity(vquantity), getValueFunc, NULL, help, field, json });
|
|
|
|
}
|
|
|
|
|
|
|
|
void MeterCommonImplementation::addPrint(string vname, Quantity vquantity,
|
|
|
|
function<string()> getValueFunc,
|
|
|
|
string help, bool field, bool json)
|
|
|
|
{
|
|
|
|
prints_.push_back( { vname, vquantity, defaultUnitForQuantity(vquantity), NULL, getValueFunc, help, field, json } );
|
2019-05-04 11:55:52 +00:00
|
|
|
}
|
|
|
|
|
2019-04-01 21:49:24 +00:00
|
|
|
void MeterCommonImplementation::addManufacturer(int m)
|
|
|
|
{
|
|
|
|
manufacturers_.insert(m);
|
|
|
|
}
|
|
|
|
|
2019-03-05 20:19:05 +00:00
|
|
|
vector<string> MeterCommonImplementation::ids()
|
|
|
|
{
|
|
|
|
return ids_;
|
2018-03-05 10:29:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
string MeterCommonImplementation::name()
|
|
|
|
{
|
|
|
|
return name_;
|
|
|
|
}
|
|
|
|
|
|
|
|
WMBus *MeterCommonImplementation::bus()
|
|
|
|
{
|
|
|
|
return bus_;
|
|
|
|
}
|
|
|
|
|
2019-03-05 20:19:05 +00:00
|
|
|
void MeterCommonImplementation::onUpdate(function<void(Telegram*,Meter*)> cb)
|
2018-03-05 10:29:25 +00:00
|
|
|
{
|
|
|
|
on_update_.push_back(cb);
|
|
|
|
}
|
|
|
|
|
|
|
|
int MeterCommonImplementation::numUpdates()
|
|
|
|
{
|
|
|
|
return num_updates_;
|
|
|
|
}
|
|
|
|
|
|
|
|
string MeterCommonImplementation::datetimeOfUpdateHumanReadable()
|
|
|
|
{
|
|
|
|
char datetime[40];
|
|
|
|
memset(datetime, 0, sizeof(datetime));
|
|
|
|
strftime(datetime, 20, "%Y-%m-%d %H:%M.%S", localtime(&datetime_of_update_));
|
|
|
|
return string(datetime);
|
|
|
|
}
|
|
|
|
|
|
|
|
string MeterCommonImplementation::datetimeOfUpdateRobot()
|
|
|
|
{
|
|
|
|
char datetime[40];
|
|
|
|
memset(datetime, 0, sizeof(datetime));
|
|
|
|
// This is the date time in the Greenwich timezone (Zulu time), dont get surprised!
|
|
|
|
strftime(datetime, sizeof(datetime), "%FT%TZ", gmtime(&datetime_of_update_));
|
|
|
|
return string(datetime);
|
|
|
|
}
|
|
|
|
|
2019-05-04 08:52:18 +00:00
|
|
|
string toMeterName(MeterType mt)
|
|
|
|
{
|
|
|
|
#define X(mname,link,info,type,cname) if (mt == MeterType::type) return #mname;
|
|
|
|
LIST_OF_METERS
|
|
|
|
#undef X
|
|
|
|
return "unknown";
|
|
|
|
}
|
|
|
|
|
|
|
|
MeterType toMeterType(string& t)
|
|
|
|
{
|
2019-06-06 15:28:20 +00:00
|
|
|
#define X(mname,linkmodes,info,type,cname) if (t == #mname) return MeterType::type;
|
2019-05-04 08:52:18 +00:00
|
|
|
LIST_OF_METERS
|
|
|
|
#undef X
|
|
|
|
return MeterType::UNKNOWN;
|
2018-11-01 16:17:23 +00:00
|
|
|
}
|
|
|
|
|
2019-06-06 15:28:20 +00:00
|
|
|
LinkModeSet toMeterLinkModeSet(string& t)
|
2019-05-04 08:52:18 +00:00
|
|
|
{
|
2019-06-06 15:28:20 +00:00
|
|
|
#define X(mname,linkmodes,info,type,cname) if (t == #mname) return LinkModeSet(linkmodes);
|
2019-05-04 08:52:18 +00:00
|
|
|
LIST_OF_METERS
|
|
|
|
#undef X
|
2019-06-06 15:28:20 +00:00
|
|
|
return LinkModeSet();
|
2019-05-04 08:52:18 +00:00
|
|
|
}
|
2018-03-05 10:29:25 +00:00
|
|
|
|
|
|
|
bool MeterCommonImplementation::isTelegramForMe(Telegram *t)
|
|
|
|
{
|
2019-03-05 20:19:05 +00:00
|
|
|
debug("(meter) %s: for me? %s\n", name_.c_str(), t->id.c_str());
|
|
|
|
|
2019-09-16 14:32:24 +00:00
|
|
|
bool id_match = doesIdMatchExpressions(t->id, ids_);
|
2019-03-05 20:19:05 +00:00
|
|
|
|
|
|
|
if (!id_match) {
|
2019-03-19 20:32:28 +00:00
|
|
|
// The id must match.
|
2019-03-05 20:19:05 +00:00
|
|
|
debug("(meter) %s: not for me: not my id\n", name_.c_str());
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-01-30 14:45:37 +00:00
|
|
|
if (manufacturers_.count(t->dll_mfct) == 0) {
|
2019-03-19 20:32:28 +00:00
|
|
|
// We are not that strict for the manufacturer.
|
|
|
|
// Simply warn.
|
|
|
|
warning("(meter) %s: probably not for me since manufacturer differs\n", name_.c_str());
|
2019-03-05 17:38:54 +00:00
|
|
|
}
|
2019-03-05 20:19:05 +00:00
|
|
|
|
|
|
|
bool media_match = false;
|
|
|
|
for (auto m : media_) {
|
2020-01-27 08:29:40 +00:00
|
|
|
if (m == t->dll_type) {
|
2019-03-05 20:19:05 +00:00
|
|
|
media_match = true;
|
|
|
|
break;
|
|
|
|
}
|
2019-03-05 17:38:54 +00:00
|
|
|
}
|
2019-03-05 20:19:05 +00:00
|
|
|
|
|
|
|
if (!media_match) {
|
2019-03-19 20:32:28 +00:00
|
|
|
warning("(meter) %s: probably not for me since media does not match\n", name_.c_str());
|
2019-03-05 17:38:54 +00:00
|
|
|
}
|
2019-03-05 20:19:05 +00:00
|
|
|
|
|
|
|
debug("(meter) %s: yes for me\n", name_.c_str());
|
|
|
|
return true;
|
2018-03-05 10:29:25 +00:00
|
|
|
}
|
|
|
|
|
2020-01-27 08:29:40 +00:00
|
|
|
MeterKeys *MeterCommonImplementation::meterKeys()
|
2018-03-05 10:29:25 +00:00
|
|
|
{
|
2020-01-27 08:29:40 +00:00
|
|
|
return &meter_keys_;
|
2018-03-05 10:29:25 +00:00
|
|
|
}
|
|
|
|
|
2018-04-20 09:42:46 +00:00
|
|
|
vector<string> MeterCommonImplementation::getRecords()
|
|
|
|
{
|
|
|
|
vector<string> recs;
|
|
|
|
for (auto& p : values_)
|
|
|
|
{
|
|
|
|
recs.push_back(p.first);
|
|
|
|
}
|
|
|
|
return recs;
|
|
|
|
}
|
|
|
|
|
|
|
|
double MeterCommonImplementation::getRecordAsDouble(string record)
|
|
|
|
{
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint16_t MeterCommonImplementation::getRecordAsUInt16(string record)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-03-05 10:29:25 +00:00
|
|
|
void MeterCommonImplementation::triggerUpdate(Telegram *t)
|
|
|
|
{
|
|
|
|
datetime_of_update_ = time(NULL);
|
|
|
|
num_updates_++;
|
2019-03-05 20:19:05 +00:00
|
|
|
for (auto &cb : on_update_) if (cb) cb(t, this);
|
2018-03-05 10:29:25 +00:00
|
|
|
t->handled = true;
|
|
|
|
}
|
2019-05-04 14:37:35 +00:00
|
|
|
|
|
|
|
string concatFields(Meter *m, Telegram *t, char c, vector<Print> &prints, vector<Unit> &cs, bool hr)
|
|
|
|
{
|
|
|
|
string s;
|
|
|
|
s = "";
|
|
|
|
s += m->name() + c;
|
|
|
|
s += t->id + c;
|
|
|
|
for (Print p : prints)
|
|
|
|
{
|
|
|
|
if (p.field)
|
|
|
|
{
|
2019-05-04 17:56:17 +00:00
|
|
|
if (p.getValueDouble)
|
|
|
|
{
|
|
|
|
Unit u = replaceWithConversionUnit(p.default_unit, cs);
|
|
|
|
double v = p.getValueDouble(u);
|
|
|
|
if (hr) {
|
|
|
|
s += valueToString(v, u);
|
|
|
|
s += " "+unitToStringHR(u);
|
|
|
|
} else {
|
|
|
|
s += to_string(v);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (p.getValueString)
|
|
|
|
{
|
|
|
|
s += p.getValueString();
|
2019-05-04 14:37:35 +00:00
|
|
|
}
|
|
|
|
s += c;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
s += m->datetimeOfUpdateHumanReadable();
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2020-01-27 08:29:40 +00:00
|
|
|
bool MeterCommonImplementation::handleTelegram(vector<uchar> input_frame)
|
2019-05-04 15:38:10 +00:00
|
|
|
{
|
2020-01-27 08:29:40 +00:00
|
|
|
Telegram t;
|
|
|
|
bool ok = t.parseHeader(input_frame);
|
|
|
|
|
|
|
|
if (!ok || !isTelegramForMe(&t))
|
|
|
|
{
|
2019-05-04 15:38:10 +00:00
|
|
|
// This telegram is not intended for this meter.
|
2020-01-27 08:29:40 +00:00
|
|
|
return false;
|
2019-05-04 15:38:10 +00:00
|
|
|
}
|
|
|
|
|
2020-02-06 18:01:48 +00:00
|
|
|
if (isDebugEnabled())
|
|
|
|
{
|
|
|
|
string msg = bin2hex(input_frame);
|
|
|
|
debug("(meter) %s %s \"%s\"\n", name().c_str(), t.id.c_str(), msg.c_str());
|
|
|
|
}
|
|
|
|
|
2020-02-03 17:39:07 +00:00
|
|
|
ok = t.parse(input_frame, &meter_keys_);
|
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
// Ignoring telegram since it could not be parsed.
|
|
|
|
return false;
|
|
|
|
}
|
2019-05-04 15:38:10 +00:00
|
|
|
|
2020-01-27 08:29:40 +00:00
|
|
|
t.expectVersion(meterName().c_str(), expectedVersion());
|
2019-05-04 15:38:10 +00:00
|
|
|
|
|
|
|
char log_prefix[256];
|
|
|
|
snprintf(log_prefix, 255, "(%s) log", meterName().c_str());
|
2020-01-27 15:53:18 +00:00
|
|
|
logTelegram(log_prefix, t.frame, t.header_size, t.suffix_size);
|
2019-05-04 15:38:10 +00:00
|
|
|
|
|
|
|
// Invoke meter specific parsing!
|
2020-01-27 08:29:40 +00:00
|
|
|
processContent(&t);
|
2019-05-04 15:38:10 +00:00
|
|
|
// All done....
|
|
|
|
|
|
|
|
if (isDebugEnabled())
|
|
|
|
{
|
|
|
|
char log_prefix[256];
|
|
|
|
snprintf(log_prefix, 255, "(%s)", meterName().c_str());
|
2020-01-27 08:29:40 +00:00
|
|
|
t.explainParse(log_prefix, 0);
|
2019-05-04 15:38:10 +00:00
|
|
|
}
|
2020-01-27 08:29:40 +00:00
|
|
|
triggerUpdate(&t);
|
|
|
|
return true;
|
2019-05-04 15:38:10 +00:00
|
|
|
}
|
|
|
|
|
2019-05-04 14:37:35 +00:00
|
|
|
void MeterCommonImplementation::printMeter(Telegram *t,
|
|
|
|
string *human_readable,
|
|
|
|
string *fields, char separator,
|
|
|
|
string *json,
|
2019-10-20 17:19:17 +00:00
|
|
|
vector<string> *envs,
|
|
|
|
vector<string> *more_json)
|
2019-05-04 14:37:35 +00:00
|
|
|
{
|
|
|
|
*human_readable = concatFields(this, t, '\t', prints_, conversions_, true);
|
|
|
|
*fields = concatFields(this, t, separator, prints_, conversions_, false);
|
|
|
|
|
|
|
|
string s;
|
|
|
|
s += "{";
|
2020-01-27 08:29:40 +00:00
|
|
|
s += "\"media\":\""+mediaTypeJSON(t->dll_type)+"\",";
|
2019-05-04 14:37:35 +00:00
|
|
|
s += "\"meter\":\""+meterName()+"\",";
|
|
|
|
s += "\"name\":\""+name()+"\",";
|
|
|
|
s += "\"id\":\""+t->id+"\",";
|
|
|
|
for (Print p : prints_)
|
|
|
|
{
|
2019-05-04 17:56:17 +00:00
|
|
|
if (p.json)
|
2019-05-04 14:37:35 +00:00
|
|
|
{
|
|
|
|
string default_unit = unitToStringLowerCase(p.default_unit);
|
|
|
|
string var = p.vname;
|
2019-05-04 17:56:17 +00:00
|
|
|
if (p.getValueString) {
|
|
|
|
s += "\""+var+"\":\""+p.getValueString()+"\",";
|
|
|
|
}
|
|
|
|
if (p.getValueDouble) {
|
|
|
|
s += "\""+var+"_"+default_unit+"\":"+valueToString(p.getValueDouble(p.default_unit), p.default_unit)+",";
|
|
|
|
|
|
|
|
Unit u = replaceWithConversionUnit(p.default_unit, conversions_);
|
|
|
|
if (u != p.default_unit)
|
|
|
|
{
|
|
|
|
string unit = unitToStringLowerCase(u);
|
|
|
|
s += "\""+var+"_"+unit+"\":"+valueToString(p.getValueDouble(u), u)+",";
|
|
|
|
}
|
2019-05-04 14:37:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
s += "\"timestamp\":\""+datetimeOfUpdateRobot()+"\"";
|
2019-10-20 17:19:17 +00:00
|
|
|
for (string add_json : additionalJsons())
|
|
|
|
{
|
|
|
|
s += ",";
|
|
|
|
s += makeQuotedJson(add_json);
|
|
|
|
}
|
|
|
|
for (string add_json : *more_json)
|
|
|
|
{
|
|
|
|
s += ",";
|
|
|
|
s += makeQuotedJson(add_json);
|
|
|
|
}
|
2019-05-04 14:37:35 +00:00
|
|
|
s += "}";
|
|
|
|
*json = s;
|
|
|
|
|
|
|
|
envs->push_back(string("METER_JSON=")+*json);
|
|
|
|
envs->push_back(string("METER_TYPE=")+meterName());
|
2019-11-21 08:25:39 +00:00
|
|
|
envs->push_back(string("METER_NAME=")+name());
|
2019-05-04 14:37:35 +00:00
|
|
|
envs->push_back(string("METER_ID=")+t->id);
|
|
|
|
|
|
|
|
for (Print p : prints_)
|
|
|
|
{
|
2019-05-04 17:56:17 +00:00
|
|
|
if (p.json)
|
2019-05-04 14:37:35 +00:00
|
|
|
{
|
|
|
|
string default_unit = unitToStringUpperCase(p.default_unit);
|
|
|
|
string var = p.vname;
|
2019-05-04 18:52:05 +00:00
|
|
|
std::transform(var.begin(), var.end(), var.begin(), ::toupper);
|
2019-05-04 17:56:17 +00:00
|
|
|
if (p.getValueString) {
|
2019-05-04 18:52:05 +00:00
|
|
|
string envvar = "METER_"+var+"="+p.getValueString();
|
|
|
|
envs->push_back(envvar);
|
2019-05-04 17:56:17 +00:00
|
|
|
}
|
|
|
|
if (p.getValueDouble) {
|
|
|
|
string envvar = "METER_"+var+"_"+default_unit+"="+valueToString(p.getValueDouble(p.default_unit), p.default_unit);
|
2019-05-04 14:37:35 +00:00
|
|
|
envs->push_back(envvar);
|
2019-05-04 17:56:17 +00:00
|
|
|
|
|
|
|
Unit u = replaceWithConversionUnit(p.default_unit, conversions_);
|
|
|
|
if (u != p.default_unit)
|
|
|
|
{
|
|
|
|
string unit = unitToStringUpperCase(u);
|
|
|
|
string envvar = "METER_"+var+"_"+unit+"="+valueToString(p.getValueDouble(u), u);
|
|
|
|
envs->push_back(envvar);
|
|
|
|
}
|
2019-05-04 14:37:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
envs->push_back(string("METER_TIMESTAMP=")+datetimeOfUpdateRobot());
|
2019-10-20 17:19:17 +00:00
|
|
|
// If the configuration has supplied json_address=Roodroad 123
|
|
|
|
// then the env variable METER_address will available and have the content "Roodroad 123"
|
|
|
|
for (string add_json : additionalJsons())
|
|
|
|
{
|
|
|
|
envs->push_back(string("METER_")+add_json);
|
|
|
|
}
|
|
|
|
for (string add_json : *more_json)
|
|
|
|
{
|
|
|
|
envs->push_back(string("METER_")+add_json);
|
|
|
|
}
|
2019-05-04 14:37:35 +00:00
|
|
|
}
|
2019-05-04 15:38:10 +00:00
|
|
|
|
|
|
|
double WaterMeter::totalWaterConsumption(Unit u) { return -47.11; }
|
|
|
|
bool WaterMeter::hasTotalWaterConsumption() { return false; }
|
|
|
|
double WaterMeter::targetWaterConsumption(Unit u) { return -47.11; }
|
|
|
|
bool WaterMeter::hasTargetWaterConsumption() { return false; }
|
|
|
|
double WaterMeter::maxFlow(Unit u) { return -47.11; }
|
|
|
|
bool WaterMeter::hasMaxFlow() { return false; }
|
|
|
|
double WaterMeter::flowTemperature(Unit u) { return -47.11; }
|
|
|
|
bool WaterMeter::hasFlowTemperature() { return false; }
|
|
|
|
double WaterMeter::externalTemperature(Unit u) { return -47.11; }
|
|
|
|
bool WaterMeter::hasExternalTemperature() { return false; }
|
|
|
|
|
|
|
|
string WaterMeter::statusHumanReadable() { return "-47.11"; }
|
|
|
|
string WaterMeter::status() { return "-47.11"; }
|
|
|
|
string WaterMeter::timeDry() { return "-47.11"; }
|
|
|
|
string WaterMeter::timeReversed() { return "-47.11"; }
|
|
|
|
string WaterMeter::timeLeaking() { return "-47.11"; }
|
|
|
|
string WaterMeter::timeBursting() { return "-47.11"; }
|
|
|
|
|
|
|
|
double HeatMeter::totalEnergyConsumption(Unit u) { return -47.11; }
|
|
|
|
double HeatMeter::currentPeriodEnergyConsumption(Unit u) { return -47.11; }
|
|
|
|
double HeatMeter::previousPeriodEnergyConsumption(Unit u) { return -47.11; }
|
|
|
|
double HeatMeter::currentPowerConsumption(Unit u) { return -47.11; }
|
|
|
|
double HeatMeter::totalVolume(Unit u) { return -47.11; }
|
|
|
|
|
2019-05-04 18:52:05 +00:00
|
|
|
double ElectricityMeter::totalEnergyConsumption(Unit u) { return -47.11; }
|
|
|
|
double ElectricityMeter::currentPowerConsumption(Unit u) { return -47.11; }
|
|
|
|
double ElectricityMeter::totalEnergyProduction(Unit u) { return -47.11; }
|
|
|
|
double ElectricityMeter::currentPowerProduction(Unit u) { return -47.11; }
|
2019-05-04 15:38:10 +00:00
|
|
|
|
2019-05-04 18:52:05 +00:00
|
|
|
double HeatCostMeter::currentConsumption(Unit u) { return -47.11; }
|
2019-05-04 15:38:10 +00:00
|
|
|
string HeatCostMeter::setDate() { return "47.11"; }
|
2019-05-04 18:52:05 +00:00
|
|
|
double HeatCostMeter::consumptionAtSetDate(Unit u) { return -47.11; }
|
2019-05-04 17:56:17 +00:00
|
|
|
|
2020-01-27 08:29:40 +00:00
|
|
|
void MeterCommonImplementation::setExpectedTPLSecurityMode(TPLSecurityMode tsm)
|
|
|
|
{
|
|
|
|
expected_tpl_sec_mode_ = tsm;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MeterCommonImplementation::setExpectedELLSecurityMode(ELLSecurityMode dsm)
|
|
|
|
{
|
|
|
|
expected_ell_sec_mode_ = dsm;
|
|
|
|
}
|
|
|
|
|
|
|
|
TPLSecurityMode MeterCommonImplementation::expectedTPLSecurityMode()
|
2019-05-04 17:56:17 +00:00
|
|
|
{
|
2020-01-27 08:29:40 +00:00
|
|
|
return expected_tpl_sec_mode_;
|
2019-05-04 17:56:17 +00:00
|
|
|
}
|
|
|
|
|
2020-01-27 08:29:40 +00:00
|
|
|
ELLSecurityMode MeterCommonImplementation::expectedELLSecurityMode()
|
2019-05-04 17:56:17 +00:00
|
|
|
{
|
2020-01-27 08:29:40 +00:00
|
|
|
return expected_ell_sec_mode_;
|
2019-05-04 17:56:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MeterCommonImplementation::setExpectedVersion(int version)
|
|
|
|
{
|
|
|
|
expected_meter_version_ = version;
|
|
|
|
}
|
|
|
|
|
|
|
|
int MeterCommonImplementation::expectedVersion()
|
|
|
|
{
|
|
|
|
return expected_meter_version_;
|
|
|
|
}
|