From a697564294331ba1539577d1e2436a3f2545f7c2 Mon Sep 17 00:00:00 2001 From: Schrolli91 Date: Fri, 8 Jan 2021 21:27:05 +0100 Subject: [PATCH 1/3] fix requirements file --- requirements.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 580f9da..5e215ff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ # for pip to install all needed -# called with 'pip -r requirements.txt' - +# called with 'pip install -r requirements.txt' pyyaml # for documentation generating From f3f188f93b9ebedeaba640b0fd732db1d590f168 Mon Sep 17 00:00:00 2001 From: Schrolli91 Date: Fri, 8 Jan 2021 21:39:41 +0100 Subject: [PATCH 2/3] move decoding to InputBase.addToQueue() --- boswatch/inputSource/inputBase.py | 10 ++++++---- bw_client.py | 7 +------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/boswatch/inputSource/inputBase.py b/boswatch/inputSource/inputBase.py index 001d102..3b1c414 100644 --- a/boswatch/inputSource/inputBase.py +++ b/boswatch/inputSource/inputBase.py @@ -20,6 +20,7 @@ import threading from abc import ABC, abstractmethod from boswatch.utils import paths from boswatch.processManager import ProcessManager +from boswatch.decoder.decoder import Decoder logging.debug("- %s loaded", __name__) @@ -61,10 +62,11 @@ class InputBase(ABC): logging.debug("input thread stopped") def addToQueue(self, data): - """!Adds alarm data to the queue for further processing during boswatch client""" - self._inputQueue.put_nowait((data, time.time())) - logging.debug("Add received data to queue") - print(data) + """!Decode and add alarm data to the queue for further processing during boswatch client""" + bwPacket = Decoder.decode(data) + if bwPacket is not None: + self._inputQueue.put_nowait((bwPacket, time.time())) + logging.debug("Added received data to queue") def getDecoderInstance(self, decoderConfig, StdIn): mmProc = ProcessManager(str(decoderConfig.get("path", default="multimon-ng")), textMode=True) diff --git a/bw_client.py b/bw_client.py index 560f05b..349790d 100644 --- a/bw_client.py +++ b/bw_client.py @@ -46,7 +46,6 @@ logging.debug("Import BOSWatch modules") from boswatch.configYaml import ConfigYAML from boswatch.network.client import TCPClient from boswatch.network.broadcast import BroadcastClient -from boswatch.decoder.decoder import Decoder from boswatch.utils import header from boswatch.utils import misc from boswatch.inputSource.sdrInput import SdrInput @@ -123,13 +122,9 @@ try: data = inputQueue.get() logging.info("get data from queue (waited %0.3f sec.)", time.time() - data[1]) logging.debug("%s packet(s) still waiting in queue", inputQueue.qsize()) - - bwPacket = Decoder.decode(data[0]) + bwPacket = data[0] inputQueue.task_done() - if bwPacket is None: - continue - bwPacket.printInfo() misc.addClientDataToPacket(bwPacket, bwConfig) From ef01fe51e851688c474b35646802d289f9a72369 Mon Sep 17 00:00:00 2001 From: Schrolli91 Date: Sat, 9 Jan 2021 09:24:10 +0100 Subject: [PATCH 3/3] add decoder for test mode --- bw_client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bw_client.py b/bw_client.py index 349790d..0a2b69a 100644 --- a/bw_client.py +++ b/bw_client.py @@ -51,6 +51,7 @@ from boswatch.utils import misc from boswatch.inputSource.sdrInput import SdrInput from boswatch.inputSource.lineInInput import LineInInput from boswatch.inputSource.pulseaudioInput import PulseAudioInput +from boswatch.decoder.decoder import Decoder # for test mode header.logoToLog() header.infoToLog() @@ -105,7 +106,8 @@ try: for testData in testFile: if (len(testData.rstrip(' \t\n\r')) > 1) and ("#" not in testData[0]): logging.info("Testdata: %s", testData.rstrip(' \t\n\r')) - inputQueue.put_nowait((testData.rstrip(' \t\n\r'), time.time())) + bwPacket = Decoder.decode(testData.rstrip(' \t\n\r')) + inputQueue.put_nowait((bwPacket, time.time())) logging.debug("finished reading testdata") bwClient = TCPClient()