kopia lustrzana https://github.com/weetmuts/wmbusmeters
Cleanups.
rodzic
8a858999eb
commit
81f1fd448b
|
@ -78,10 +78,7 @@ void MeterAmiplus::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->a_field_version != 0x02) {
|
||||
warning("(amiplus) expected telegram from APA meter with version 0x01, but got \"%s\" version 0x2x !\n",
|
||||
manufacturerFlag(t->m_field).c_str(), t->a_field_version);
|
||||
}
|
||||
t->expectVersion("amiplus", 0x02);
|
||||
|
||||
if (t->isEncrypted() && !useAes() && !t->isSimulated()) {
|
||||
warning("(amiplus) warning: telegram is encrypted but no key supplied!\n");
|
||||
|
|
|
@ -99,13 +99,7 @@ void MeterApator162::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->a_field_version != 0x05) {
|
||||
warning("(%s) expected telegram from APA meter with version 0x%02x, "
|
||||
"but got \"%s\" meter with version 0x%02x !\n", "apator162",
|
||||
0x05,
|
||||
manufacturerFlag(t->m_field).c_str(),
|
||||
t->a_field_version);
|
||||
}
|
||||
t->expectVersion("apator162", 0x05);
|
||||
|
||||
if (t->isEncrypted() && !useAes() && !t->isSimulated()) {
|
||||
warning("(apator162) warning: telegram is encrypted but no key supplied!\n");
|
||||
|
|
|
@ -101,13 +101,7 @@ void MeterIperl::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->a_field_version != 0x68) {
|
||||
warning("(%s) expected telegram from SEN meter with version 0x%02x, "
|
||||
"but got \"%s\" meter with version 0x%02x !\n", "iperl",
|
||||
0x68,
|
||||
manufacturerFlag(t->m_field).c_str(),
|
||||
t->a_field_version);
|
||||
}
|
||||
t->expectVersion("iperl", 0x68);
|
||||
|
||||
if (t->isEncrypted() && !useAes() && !t->isSimulated()) {
|
||||
warning("(iperl) warning: telegram is encrypted but no key supplied!\n");
|
||||
|
|
|
@ -202,13 +202,7 @@ void MeterMultical21::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->a_field_version != expected_version_) {
|
||||
warning("(%s) expected telegram from KAM meter with version 0x%02x, "
|
||||
"but got \"%s\" meter with version 0x%02x !\n", meter_name_,
|
||||
expected_version_,
|
||||
manufacturerFlag(t->m_field).c_str(),
|
||||
t->a_field_version);
|
||||
}
|
||||
t->expectVersion(name().c_str(), expected_version_);
|
||||
|
||||
if (useAes()) {
|
||||
vector<uchar> aeskey = key();
|
||||
|
|
|
@ -78,10 +78,7 @@ void MeterOmnipower::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->a_field_version != 0x01) {
|
||||
warning("(omnipower) expected telegram from KAM meter with version 0x01, but got \"%s\" version 0x2x !\n",
|
||||
manufacturerFlag(t->m_field).c_str(), t->a_field_version);
|
||||
}
|
||||
t->expectVersion("omnipower", 0x01);
|
||||
|
||||
if (t->isEncrypted() && !useAes() && !t->isSimulated()) {
|
||||
warning("(omnipower) warning: telegram is encrypted but no key supplied!\n");
|
||||
|
|
|
@ -93,10 +93,7 @@ void MeterQCaloric::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->a_field_version != 0x35) {
|
||||
warning("(qcaloric) expected telegram from QDS meter with version 0x35, but got \"%s\" version 0x%02x !\n",
|
||||
manufacturerFlag(t->m_field).c_str(), t->a_field_version);
|
||||
}
|
||||
t->expectVersion("qcaloric", 0x35);
|
||||
|
||||
if (t->isEncrypted() && !useAes() && !t->isSimulated()) {
|
||||
warning("(qcaloric) warning: telegram is encrypted but no key supplied!\n");
|
||||
|
|
|
@ -99,13 +99,7 @@ void MeterSupercom587::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->a_field_version != 0x3c) {
|
||||
warning("(%s) expected telegram from SON meter with version 0x%02x, "
|
||||
"but got \"%s\" meter with version 0x%02x !\n", "supercom587",
|
||||
0x3c,
|
||||
manufacturerFlag(t->m_field).c_str(),
|
||||
t->a_field_version);
|
||||
}
|
||||
t->expectVersion("supercom587", 0x3c);
|
||||
|
||||
if (t->isEncrypted() && !useAes() && !t->isSimulated()) {
|
||||
warning("(supercom587) warning: telegram is encrypted but no key supplied!\n");
|
||||
|
|
|
@ -150,13 +150,15 @@ bool MeterCommonImplementation::isTelegramForMe(Telegram *t)
|
|||
}
|
||||
|
||||
if (!id_match) {
|
||||
// The id must match.
|
||||
debug("(meter) %s: not for me: not my id\n", name_.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (manufacturer_ != 0 && t->m_field != manufacturer_) {
|
||||
debug("(meter) %s: not for me: manufacturer differs\n", name_.c_str());
|
||||
return false;
|
||||
// We are not that strict for the manufacturer.
|
||||
// Simply warn.
|
||||
warning("(meter) %s: probably not for me since manufacturer differs\n", name_.c_str());
|
||||
}
|
||||
|
||||
bool media_match = false;
|
||||
|
@ -168,8 +170,7 @@ bool MeterCommonImplementation::isTelegramForMe(Telegram *t)
|
|||
}
|
||||
|
||||
if (!media_match) {
|
||||
debug("(meter) %s: not for me: no media match\n", name_.c_str());
|
||||
return false;
|
||||
warning("(meter) %s: probably not for me since media does not match\n", name_.c_str());
|
||||
}
|
||||
|
||||
debug("(meter) %s: yes for me\n", name_.c_str());
|
||||
|
|
|
@ -458,6 +458,13 @@ void Telegram::explainParse(string intro, int from)
|
|||
debug("%s %s\n", intro.c_str(), hex.c_str());
|
||||
}
|
||||
|
||||
void Telegram::expectVersion(const char *info, int v)
|
||||
{
|
||||
if (a_field_version != v) {
|
||||
warning("(%s) expected telegram with version 0x%02x, but got version 0x%02x !\n", info, v, a_field_version);
|
||||
}
|
||||
}
|
||||
|
||||
string cType(int c_field)
|
||||
{
|
||||
switch (c_field) {
|
||||
|
|
|
@ -111,6 +111,8 @@ struct Telegram {
|
|||
|
||||
void markAsSimulated() { is_simulated_ = true; }
|
||||
|
||||
void expectVersion(const char *info, int v);
|
||||
|
||||
private:
|
||||
|
||||
bool is_encrypted_ {};
|
||||
|
|
Ładowanie…
Reference in New Issue