kopia lustrzana https://github.com/weetmuts/wmbusmeters
Make safe copy of Telegram for each potential meter listener.
rodzic
c29c67276e
commit
f48b182dfb
|
@ -94,15 +94,15 @@ void MeterApator162::processContent(Telegram *t)
|
|||
string total;
|
||||
// Current assumption of this proprietary protocol is that byte 13 tells
|
||||
// us where the current total water consumption is located.
|
||||
if (t->content[13] == 0x83 || t->content[13] == 0x82) {
|
||||
if ((t->content[13] & 0x80) == 0x80) {
|
||||
strprintf(total, "%02x%02x%02x%02x", t->content[25], t->content[26], t->content[27], t->content[28]);
|
||||
debug("(apator162) Found 0x83 at offset 13 expect location of current total to be at offset 25: %s\n", total.c_str());
|
||||
debug("(apator162) Found 0x80 bit set at offset 13 expect location of current total to be at offset 25: %s\n", total.c_str());
|
||||
}
|
||||
else if (t->content[13] == 0x10) {
|
||||
else if ((t->content[13] & 0x10) == 0x10) {
|
||||
strprintf(total, "%02x%02x%02x%02x", t->content[14], t->content[15], t->content[16], t->content[17]);
|
||||
debug("(apator162) Found 0x10 at offset 13 expect location of current total to be at offset 14: %s\n", total.c_str());
|
||||
debug("(apator162) Found bit 0x10 set at offset 13 expect location of current total to be at offset 14: %s\n", total.c_str());
|
||||
} else {
|
||||
warning("(apator162) Unknown value in proprietary(unknown) apator162 protocol. Found 0x%02x expected 0x10 or 0x83\n", t->content[13]);
|
||||
warning("(apator162) Unknown value in proprietary(unknown) apator162 protocol. Found 0x%02x expected bit 0x10 or 0x80 to be set.\n", t->content[13]);
|
||||
}
|
||||
vendor_values["0413"] = { 25, DVEntry(0x13, 0, 0, 0, total) };
|
||||
int offset;
|
||||
|
|
|
@ -371,11 +371,16 @@ void WMBusAmber::handleMessage(int msgid, vector<uchar> &frame)
|
|||
{
|
||||
Telegram t;
|
||||
t.parse(frame);
|
||||
for (auto f : telegram_listeners_) {
|
||||
if (f) f(&t);
|
||||
if (isVerboseEnabled() && !t.handled) {
|
||||
verbose("(amb8465) telegram ignored by all configured meters!\n");
|
||||
}
|
||||
bool handled = false;
|
||||
for (auto f : telegram_listeners_)
|
||||
{
|
||||
Telegram copy = t;
|
||||
if (f) f(©);
|
||||
if (copy.handled) handled = true;
|
||||
}
|
||||
if (isVerboseEnabled() && !handled)
|
||||
{
|
||||
verbose("(amb8465) telegram ignored by all configured meters!\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -528,11 +528,15 @@ void WMBusIM871A::handleRadioLink(int msgid, vector<uchar> &payload)
|
|||
{
|
||||
Telegram t;
|
||||
t.parse(payload);
|
||||
bool handled = false;
|
||||
|
||||
for (auto f : telegram_listeners_) {
|
||||
if (f) f(&t);
|
||||
Telegram copy = t;
|
||||
if (f) f(©);
|
||||
if (copy.handled) handled = true;
|
||||
}
|
||||
if (isVerboseEnabled() && !t.handled) {
|
||||
if (isVerboseEnabled() && !handled)
|
||||
{
|
||||
verbose("(im871a) telegram ignored by all configured meters!\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -176,12 +176,16 @@ void WMBusRTLWMBUS::handleMessage(vector<uchar> &frame)
|
|||
{
|
||||
Telegram t;
|
||||
t.parse(frame);
|
||||
bool handled = false;
|
||||
for (auto f : telegram_listeners_)
|
||||
{
|
||||
if (f) f(&t);
|
||||
if (isVerboseEnabled() && !t.handled) {
|
||||
verbose("(rtlwmbus) telegram ignored by all configured meters!\n");
|
||||
}
|
||||
Telegram copy = t;
|
||||
if (f) f(©);
|
||||
if (copy.handled) handled = true;
|
||||
}
|
||||
if (isVerboseEnabled() && !handled)
|
||||
{
|
||||
verbose("(rtlwmbus) telegram ignored by all configured meters!\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -186,10 +186,14 @@ void WMBusSimulator::simulate()
|
|||
Telegram t;
|
||||
t.parse(payload);
|
||||
t.markAsSimulated();
|
||||
bool handled = false;
|
||||
for (auto f : telegram_listeners_) {
|
||||
if (f) f(&t);
|
||||
Telegram copy = t;
|
||||
if (f) f(©);
|
||||
if (copy.handled) handled = true;
|
||||
}
|
||||
if (isVerboseEnabled() && !t.handled) {
|
||||
if (isVerboseEnabled() && !handled)
|
||||
{
|
||||
verbose("(wmbus simulator) telegram ignored by all configured meters!\n");
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue