diff --git a/_demo_procMan.py b/_demo_procMan.py index 6896a05..5c0a06c 100644 --- a/_demo_procMan.py +++ b/_demo_procMan.py @@ -11,53 +11,24 @@ """ from boswatch.processManager import ProcessManager +from boswatch.decoder.decoder import Decoder import logging.config logging.config.fileConfig("config/logger_client.ini") -dircmd = ProcessManager("dir", textMode=True) -dircmd.start(True) +# ./multimon-ng -i -a POCSAG1200 -t raw /home/schrolli/Downloads/poc1200.raw -line = dircmd.readline() -while line is not None: - if line is not "": - print(line) - line = dircmd.readline() +proc = ProcessManager("/opt/multimon/multimon-ng", textMode=True) +proc.addArgument("-i") +proc.addArgument("-a POCSAG1200") +proc.addArgument("-t raw") +proc.addArgument("./poc1200.raw") +proc.start() -dircmd.stop() +proc.skipLines(5) +while proc.isRunning: + line = proc.readline() + Decoder.decode(line) + + +proc.stop() -""" -19.09.2019 10:44:20,170 - processManager [DEBUG ] create process instance dir - textMode: True -19.09.2019 10:44:20,170 - processManager [DEBUG ] start new process: ['dir'] -19.09.2019 10:44:20,173 - processManager [DEBUG ] process started with PID 17616 -Datentr„ger in Laufwerk C: ist OS -Volumeseriennummer: ####-#### -Verzeichnis von C:\Git\BOSWatch-Core -19.09.2019 10:44 . -19.09.2019 10:44 .. -11.01.2018 11:24 .cache -19.09.2019 10:39 .git -08.03.2019 09:00 665 .gitignore -19.09.2019 10:44 .idea -19.09.2019 10:40 boswatch -11.03.2019 08:45 4.368 bw_client.py -11.03.2019 08:46 3.993 bw_server.py -11.03.2019 08:33 config -08.03.2019 09:00 35.147 LICENSE -19.09.2019 09:43 log -08.03.2019 09:00 logo -11.03.2019 08:33 module -11.03.2019 08:37 plugin -08.03.2019 09:00 521 README.md -19.09.2019 10:44 794 _demo_procMan.py -08.03.2019 09:00 test -08.03.2019 09:00 _bin -05.03.2019 09:46 _docu -11.03.2019 08:33 _gen -11.03.2019 08:33 _info -01.03.2019 13:19 __pycache__ -6 Datei(en), 45.488 Bytes -17 Verzeichnis(se), 317.487.964.160 Bytes frei -19.09.2019 10:44:20,182 - processManager [DEBUG ] stopping process: dir -19.09.2019 10:44:20,182 - processManager [DEBUG ] process not running: dir -19.09.2019 10:44:20,183 - processManager [DEBUG ] process dir returned 0 -""" diff --git a/boswatch/processManager.py b/boswatch/processManager.py index bed5c08..918d69e 100644 --- a/boswatch/processManager.py +++ b/boswatch/processManager.py @@ -90,6 +90,12 @@ class ProcessManager: return line return None + def skipLines(self, line_cnt=1): + logging.debug("Skip %d lines from output", line_cnt) + while line_cnt: + self.readline() + line_cnt -= 1 + def setStdin(self, stdin): """!Set the stdin stream instance""" self._stdin = stdin diff --git a/poc1200.raw b/poc1200.raw new file mode 100644 index 0000000..01a7f1f Binary files /dev/null and b/poc1200.raw differ