mirror of
https://github.com/BOSWatch/BW3-Core.git
synced 2025-12-06 07:12:04 +01:00
edit processManager demo
This commit is contained in:
parent
2da9bfbe0c
commit
c4b9f54df6
|
|
@ -13,26 +13,32 @@
|
|||
from boswatch.processManager import ProcessManager
|
||||
from boswatch.decoder.decoder import Decoder
|
||||
import logging.config
|
||||
import subprocess
|
||||
logging.config.fileConfig("config/logger_client.ini")
|
||||
|
||||
import time
|
||||
|
||||
sdrProc = ProcessManager("/usr/bin/rtl_fm")
|
||||
sdrProc.addArgument("-f 85M")
|
||||
sdrProc.addArgument("-m fm")
|
||||
sdrProc.start(True)
|
||||
# sdrProc.addArgument("-M fm")
|
||||
if not sdrProc.start():
|
||||
exit(0)
|
||||
|
||||
sdrProc.skipLines(20)
|
||||
|
||||
mmProc = ProcessManager("/opt/multimon/multimon-ng", textMode=True)
|
||||
# mmProc.addArgument("-i")
|
||||
# mmProc.addArgument("-a POCSAG1200 -a FMSFSK -a ZVEI1")
|
||||
mmProc.addArgument("-f alpha")
|
||||
mmProc.addArgument("-t raw /dev/stdin -")
|
||||
mmProc.addArgument("-a FMSFSK -a POCSAG512 -a POCSAG1200 -a POCSAG2400")
|
||||
# mmProc.addArgument("-f alpha")
|
||||
mmProc.addArgument("-t raw -")
|
||||
mmProc.setStdin(sdrProc.stdout)
|
||||
mmProc.start(True)
|
||||
mmProc.skipLines(5)
|
||||
mmProc.start()
|
||||
# mmProc.skipLines(5)
|
||||
while 1:
|
||||
if not mmProc.isRunning:
|
||||
logging.warning("multimon was down - try to restart")
|
||||
mmProc.start()
|
||||
mmProc.skipLines(5)
|
||||
# mmProc.skipLines(5)
|
||||
line = mmProc.readline()
|
||||
if line:
|
||||
print(line)
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ class ProcessManager:
|
|||
self._processHandle = None
|
||||
self._textMode = textMode
|
||||
|
||||
def __del__(self):
|
||||
self.stop()
|
||||
|
||||
def addArgument(self, arg):
|
||||
"""!add a new argument
|
||||
|
||||
|
|
@ -44,7 +47,7 @@ class ProcessManager:
|
|||
"""!clear all arguments"""
|
||||
self._args = self._args[0:1] # kept first element (process name)
|
||||
|
||||
def start(self, startAsShell=False):
|
||||
def start(self):
|
||||
"""!start the new process
|
||||
|
||||
@return: True or False"""
|
||||
|
|
@ -55,7 +58,7 @@ class ProcessManager:
|
|||
stdout=self._stdout,
|
||||
stderr=self._stderr,
|
||||
universal_newlines=self._textMode,
|
||||
shell=startAsShell)
|
||||
shell=False)
|
||||
if not self.isRunning:
|
||||
logging.error("cannot start")
|
||||
return False
|
||||
|
|
|
|||
Loading…
Reference in a new issue