kopia lustrzana https://github.com/weetmuts/wmbusmeters
Adaptor now perhaps extracts a volume.
rodzic
957eb4ead6
commit
c439af109b
|
@ -107,7 +107,7 @@ void MeterApator162::handleTelegram(Telegram *t)
|
|||
t->a_field_version);
|
||||
}
|
||||
|
||||
if (t->isEncrypted() && !useAes()) {
|
||||
if (t->isEncrypted() && !useAes() && !t->isSimulated()) {
|
||||
warning("(apator162) warning: telegram is encrypted but no key supplied!\n");
|
||||
}
|
||||
if (useAes()) {
|
||||
|
@ -135,10 +135,23 @@ void MeterApator162::processContent(Telegram *t)
|
|||
map<string,pair<int,DVEntry>> values;
|
||||
parseDV(t, t->content, t->content.begin(), t->content.size(), &values);
|
||||
|
||||
// Unfortunately, the at-wmbus-16-2 is mostly a proprieatary protocol
|
||||
// simple wrapped inside a wmbus telegram. Thus the parsing above ends
|
||||
// immediately with a 0x0f dif which means: from now on, its vendor specific
|
||||
// data structures.
|
||||
|
||||
// By examining some telegrams though, it looks like the total consumption
|
||||
// counter is on offset 25. So we can fake a parse here, to make it easier
|
||||
// to extract using the existing tools.
|
||||
map<string,pair<int,DVEntry>> vendor_values;
|
||||
|
||||
string total;
|
||||
strprintf(total, "%02x%02x%02x%02x", t->content[25], t->content[26], t->content[27], t->content[28]);
|
||||
vendor_values["0413"] = { 25, DVEntry(0x13, 0, 0, 0, total) };
|
||||
int offset;
|
||||
string key;
|
||||
if(findKey(ValueInformation::Volume, 0, &key, &values)) {
|
||||
extractDVdouble(&values, key, &offset, &total_water_consumption_);
|
||||
if(findKey(ValueInformation::Volume, 0, &key, &vendor_values)) {
|
||||
extractDVdouble(&vendor_values, key, &offset, &total_water_consumption_);
|
||||
t->addMoreExplanation(offset, " total consumption (%f m3)", total_water_consumption_);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ void MeterIperl::handleTelegram(Telegram *t)
|
|||
t->a_field_version);
|
||||
}
|
||||
|
||||
if (t->isEncrypted() && !useAes()) {
|
||||
if (t->isEncrypted() && !useAes() && !t->isSimulated()) {
|
||||
warning("(iperl) warning: telegram is encrypted but no key supplied!\n");
|
||||
}
|
||||
if (useAes()) {
|
||||
|
|
|
@ -84,7 +84,7 @@ void MeterMultical302::handleTelegram(Telegram *t) {
|
|||
t->a_field_address[0], t->a_field_address[1], t->a_field_address[2],
|
||||
t->a_field_address[3]);
|
||||
|
||||
if (t->isEncrypted() && !useAes()) {
|
||||
if (t->isEncrypted() && !useAes() && !t->isSimulated()) {
|
||||
warning("(multical302) warning: telegram is encrypted but no key supplied!\n");
|
||||
}
|
||||
if (useAes()) {
|
||||
|
|
|
@ -83,7 +83,7 @@ void MeterOmnipower::handleTelegram(Telegram *t) {
|
|||
manufacturerFlag(t->m_field).c_str(), t->a_field_version);
|
||||
}
|
||||
|
||||
if (t->isEncrypted() && !useAes()) {
|
||||
if (t->isEncrypted() && !useAes() && !t->isSimulated()) {
|
||||
warning("(omnipower) warning: telegram is encrypted but no key supplied!\n");
|
||||
}
|
||||
if (useAes()) {
|
||||
|
|
|
@ -98,7 +98,7 @@ void MeterQCaloric::handleTelegram(Telegram *t) {
|
|||
manufacturerFlag(t->m_field).c_str(), t->a_field_version);
|
||||
}
|
||||
|
||||
if (t->isEncrypted() && !useAes()) {
|
||||
if (t->isEncrypted() && !useAes() && !t->isSimulated()) {
|
||||
warning("(qcaloric) warning: telegram is encrypted but no key supplied!\n");
|
||||
}
|
||||
if (useAes()) {
|
||||
|
|
|
@ -107,7 +107,7 @@ void MeterSupercom587::handleTelegram(Telegram *t)
|
|||
t->a_field_version);
|
||||
}
|
||||
|
||||
if (t->isEncrypted() && !useAes()) {
|
||||
if (t->isEncrypted() && !useAes() && !t->isSimulated()) {
|
||||
warning("(supercom587) warning: telegram is encrypted but no key supplied!\n");
|
||||
}
|
||||
if (useAes()) {
|
||||
|
|
|
@ -107,10 +107,14 @@ struct Telegram {
|
|||
void explainParse(string intro, int from);
|
||||
|
||||
bool isEncrypted() { return is_encrypted_; }
|
||||
bool isSimulated() { return is_simulated_; }
|
||||
|
||||
void markAsSimulated() { is_simulated_ = true; }
|
||||
|
||||
private:
|
||||
|
||||
bool is_encrypted_ {};
|
||||
bool is_simulated_ {};
|
||||
};
|
||||
|
||||
struct WMBus {
|
||||
|
|
|
@ -180,6 +180,7 @@ void WMBusSimulator::simulate()
|
|||
}
|
||||
Telegram t;
|
||||
t.parse(payload);
|
||||
t.markAsSimulated();
|
||||
for (auto f : telegram_listeners_) {
|
||||
if (f) f(&t);
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue