From 0907b7f81ba1f85446afe43db8b87ebe3fff7ab7 Mon Sep 17 00:00:00 2001 From: weetmuts Date: Thu, 28 Feb 2019 16:53:09 +0100 Subject: [PATCH] Added check for 2F2F --- src/main.cc | 2 ++ src/meter_iperl.cc | 3 +++ test.sh | 2 ++ wmbusmeters.1 | 17 ++++++++++------- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/main.cc b/src/main.cc index 1746c22..5494b4f 100644 --- a/src/main.cc +++ b/src/main.cc @@ -139,6 +139,8 @@ void startUsingCommandline(Configuration *config) logTelegramsEnabled(config->logtelegrams); debugEnabled(config->debug); + debug("(wmbusmeters) version: " WMBUSMETERS_VERSION "\n"); + if (config->exitafter != 0) { verbose("(config) wmbusmeters will exit after %d seconds\n", config->exitafter); } diff --git a/src/meter_iperl.cc b/src/meter_iperl.cc index da3400c..3ea8bd1 100644 --- a/src/meter_iperl.cc +++ b/src/meter_iperl.cc @@ -119,6 +119,9 @@ void MeterIperl::handleTelegram(Telegram *t) } else { t->content = t->payload; } + if (t->content[0] != 0x2f || t->content[1] != 0x2f) { + warning("(meter_iperl) warning: telegram payload does not start with 2F2F (did you use the correct encryption key?)\n"); + } char log_prefix[256]; snprintf(log_prefix, 255, "(%s) log", "iperl"); logTelegram(log_prefix, t->parsed, t->content); diff --git a/test.sh b/test.sh index fcaa2bd..7411231 100755 --- a/test.sh +++ b/test.sh @@ -14,3 +14,5 @@ tests/test_shell.sh $PROG tests/test_meterfiles.sh $PROG tests/test_config1.sh $PROG tests/test_logfile.sh $PROG + +tests/test_listen_to_all.sh $PROG diff --git a/wmbusmeters.1 b/wmbusmeters.1 index 93ec969..c0eb84c 100644 --- a/wmbusmeters.1 +++ b/wmbusmeters.1 @@ -1,6 +1,6 @@ .TH BEAK 1 .SH NAME -wmbusmeters \- read the wireless mbus protocol to acquire and relay utility meter readings. +wmbusmeters \- listen to wireless mbus radio traffic and relay the decoded telegrams to other software .SH SYNOPSIS .B wmbusmeters [options] ( meter_key>)* @@ -9,13 +9,16 @@ wmbusmeters \- read the wireless mbus protocol to acquire and relay utility mete .SH DESCRIPTION -Wmbusmeters acquires wmbus telegrams, parses them and relays them to some other software for further processing. -It can for example listen to radio traffic using dedicated wmbus dongles like (im871a/amb8465) or -a generic software defined radio dongle (rtl_sdr). +Wmbusmeters acquires wmbus telegrams, decodes them and relays them to +some other software for further processing. It can for example listen +to radio traffic using dedicated wmbus dongles like (im871a/amb8465) +or a generic software defined radio dongle (rtl_sdr). -After the received telegram has been decrypted and parsed, it is relayed using a shell command, or stored in a log file. -The shell commands can for example relay the telegram using MQTT (eg mqtt_publish) sent to a REST API (eg curl) -or store it in a database (eg psql). +After the received telegram has been decrypted and parsed, it can then +be relayed using a shell command, or stored in a log file. The shell +commands can for example relay the telegram using MQTT (eg +mqtt_publish) sent to a REST API (eg curl) or store it in a database +(eg psql). .SH OPTIONS \fB\--c1\fR listen to C1 messages when no meters are supplied