BOSWatch 3
Python Script to receive and decode German BOS Information with rtl_fm and multimon-NG
 
Loading...
Searching...
No Matches
boswatch.inputSource.inputBase.InputBase Class Reference

Base class for handling inout sources. More...

Public Member Functions

 __init__ (self, inputQueue, inputConfig, decoderConfig)
 Build a new InputSource class.
 
 start (self)
 Start the input source thread.
 
 shutdown (self)
 Stop the input source thread.
 
 addToQueue (self, data)
 Decode and add alarm data to the queue for further processing during boswatch client.
 
 getDecoderInstance (self, decoderConfig, StdIn)
 

Protected Member Functions

 _runThread (self, dataQueue, sdrConfig, decoderConfig)
 Thread routine of the input source has to be inherit.
 

Protected Attributes

 _inputThread
 
 _isRunning
 
 _inputQueue
 
 _inputConfig
 
 _decoderConfig
 

Detailed Description

Base class for handling inout sources.

Constructor & Destructor Documentation

◆ __init__()

boswatch.inputSource.inputBase.InputBase.__init__ (   self,
  inputQueue,
  inputConfig,
  decoderConfig 
)

Build a new InputSource class.

Parameters
inputQueuePython queue object to store input data
inputConfigConfigYaml object with the inoutSource config
decoderConfigConfigYaml object with the decoder config
31 def __init__(self, inputQueue, inputConfig, decoderConfig):
32 r"""!Build a new InputSource class
33
34 @param inputQueue: Python queue object to store input data
35 @param inputConfig: ConfigYaml object with the inoutSource config
36 @param decoderConfig: ConfigYaml object with the decoder config"""
37 self._inputThread = None
38 self._isRunning = False
39 self._inputQueue = inputQueue
40 self._inputConfig = inputConfig
41 self._decoderConfig = decoderConfig
42

Member Function Documentation

◆ start()

boswatch.inputSource.inputBase.InputBase.start (   self)

Start the input source thread.

43 def start(self):
44 r"""!Start the input source thread"""
45 logging.debug("starting input thread")
46 self._isRunning = True
47 self._inputThread = threading.Thread(target=self._runThread, name="inputThread",
48 args=(self._inputQueue, self._inputConfig, self._decoderConfig))
49 self._inputThread.daemon = True
50 self._inputThread.start()
51

◆ _runThread()

boswatch.inputSource.inputBase.InputBase._runThread (   self,
  dataQueue,
  sdrConfig,
  decoderConfig 
)
protected

Thread routine of the input source has to be inherit.

Reimplemented in boswatch.inputSource.lineInInput.LineInInput, boswatch.inputSource.pulseaudioInput.PulseAudioInput, and boswatch.inputSource.sdrInput.SdrInput.

53 def _runThread(self, dataQueue, sdrConfig, decoderConfig):
54 r"""!Thread routine of the input source has to be inherit"""
55

◆ shutdown()

boswatch.inputSource.inputBase.InputBase.shutdown (   self)

Stop the input source thread.

56 def shutdown(self):
57 r"""!Stop the input source thread"""
58 if self._isRunning:
59 logging.debug("wait for stopping the input thread")
60 self._isRunning = False
61 self._inputThread.join()
62 logging.debug("input thread stopped")
63

◆ addToQueue()

boswatch.inputSource.inputBase.InputBase.addToQueue (   self,
  data 
)

Decode and add alarm data to the queue for further processing during boswatch client.

64 def addToQueue(self, data):
65 r"""!Decode and add alarm data to the queue for further processing during boswatch client"""
66 bwPacket = Decoder.decode(data)
67 if bwPacket is not None:
68 self._inputQueue.put_nowait((bwPacket, time.time()))
69 logging.debug("Added received data to queue")
70

◆ getDecoderInstance()

boswatch.inputSource.inputBase.InputBase.getDecoderInstance (   self,
  decoderConfig,
  StdIn 
)
71 def getDecoderInstance(self, decoderConfig, StdIn):
72 mmProc = ProcessManager(str(decoderConfig.get("path", default="multimon-ng")), textMode=True)
73 if decoderConfig.get("fms", default=0):
74 mmProc.addArgument("-a FMSFSK")
75 if decoderConfig.get("zvei", default=0):
76 mmProc.addArgument("-a ZVEI1")
77 if decoderConfig.get("poc512", default=0):
78 mmProc.addArgument("-a POCSAG512")
79 if decoderConfig.get("poc1200", default=0):
80 mmProc.addArgument("-a POCSAG1200")
81 if decoderConfig.get("poc2400", default=0):
82 mmProc.addArgument("-a POCSAG2400")
83 if decoderConfig.get("char", default=0):
84 mmProc.addArgument("-C " + str(decoderConfig.get("char")))
85 mmProc.addArgument("-f alpha")
86 mmProc.addArgument("-t raw -")
87 mmProc.setStdin(StdIn)
88 mmProc.setStderr(open(paths.LOG_PATH + "multimon-ng.log", "a"))
89 return mmProc

Field Documentation

◆ _inputThread

boswatch.inputSource.inputBase.InputBase._inputThread
protected

◆ _isRunning

boswatch.inputSource.inputBase.InputBase._isRunning
protected

◆ _inputQueue

boswatch.inputSource.inputBase.InputBase._inputQueue
protected

◆ _inputConfig

boswatch.inputSource.inputBase.InputBase._inputConfig
protected

◆ _decoderConfig

boswatch.inputSource.inputBase.InputBase._decoderConfig
protected