mirror of
https://github.com/BOSWatch/BW3-Core.git
synced 2025-12-06 07:12:04 +01:00
Merge pull request #65 from BOSWatch/fix_offline_timestamp_problem
Fix offline timestamp problem
This commit is contained in:
commit
6c4424e22f
|
|
@ -20,6 +20,7 @@ import threading
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from boswatch.utils import paths
|
from boswatch.utils import paths
|
||||||
from boswatch.processManager import ProcessManager
|
from boswatch.processManager import ProcessManager
|
||||||
|
from boswatch.decoder.decoder import Decoder
|
||||||
|
|
||||||
logging.debug("- %s loaded", __name__)
|
logging.debug("- %s loaded", __name__)
|
||||||
|
|
||||||
|
|
@ -61,10 +62,11 @@ class InputBase(ABC):
|
||||||
logging.debug("input thread stopped")
|
logging.debug("input thread stopped")
|
||||||
|
|
||||||
def addToQueue(self, data):
|
def addToQueue(self, data):
|
||||||
"""!Adds alarm data to the queue for further processing during boswatch client"""
|
"""!Decode and add alarm data to the queue for further processing during boswatch client"""
|
||||||
self._inputQueue.put_nowait((data, time.time()))
|
bwPacket = Decoder.decode(data)
|
||||||
logging.debug("Add received data to queue")
|
if bwPacket is not None:
|
||||||
print(data)
|
self._inputQueue.put_nowait((bwPacket, time.time()))
|
||||||
|
logging.debug("Added received data to queue")
|
||||||
|
|
||||||
def getDecoderInstance(self, decoderConfig, StdIn):
|
def getDecoderInstance(self, decoderConfig, StdIn):
|
||||||
mmProc = ProcessManager(str(decoderConfig.get("path", default="multimon-ng")), textMode=True)
|
mmProc = ProcessManager(str(decoderConfig.get("path", default="multimon-ng")), textMode=True)
|
||||||
|
|
|
||||||
11
bw_client.py
11
bw_client.py
|
|
@ -46,12 +46,12 @@ logging.debug("Import BOSWatch modules")
|
||||||
from boswatch.configYaml import ConfigYAML
|
from boswatch.configYaml import ConfigYAML
|
||||||
from boswatch.network.client import TCPClient
|
from boswatch.network.client import TCPClient
|
||||||
from boswatch.network.broadcast import BroadcastClient
|
from boswatch.network.broadcast import BroadcastClient
|
||||||
from boswatch.decoder.decoder import Decoder
|
|
||||||
from boswatch.utils import header
|
from boswatch.utils import header
|
||||||
from boswatch.utils import misc
|
from boswatch.utils import misc
|
||||||
from boswatch.inputSource.sdrInput import SdrInput
|
from boswatch.inputSource.sdrInput import SdrInput
|
||||||
from boswatch.inputSource.lineInInput import LineInInput
|
from boswatch.inputSource.lineInInput import LineInInput
|
||||||
from boswatch.inputSource.pulseaudioInput import PulseAudioInput
|
from boswatch.inputSource.pulseaudioInput import PulseAudioInput
|
||||||
|
from boswatch.decoder.decoder import Decoder # for test mode
|
||||||
|
|
||||||
header.logoToLog()
|
header.logoToLog()
|
||||||
header.infoToLog()
|
header.infoToLog()
|
||||||
|
|
@ -106,7 +106,8 @@ try:
|
||||||
for testData in testFile:
|
for testData in testFile:
|
||||||
if (len(testData.rstrip(' \t\n\r')) > 1) and ("#" not in testData[0]):
|
if (len(testData.rstrip(' \t\n\r')) > 1) and ("#" not in testData[0]):
|
||||||
logging.info("Testdata: %s", testData.rstrip(' \t\n\r'))
|
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")
|
logging.debug("finished reading testdata")
|
||||||
|
|
||||||
bwClient = TCPClient()
|
bwClient = TCPClient()
|
||||||
|
|
@ -123,13 +124,9 @@ try:
|
||||||
data = inputQueue.get()
|
data = inputQueue.get()
|
||||||
logging.info("get data from queue (waited %0.3f sec.)", time.time() - data[1])
|
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())
|
logging.debug("%s packet(s) still waiting in queue", inputQueue.qsize())
|
||||||
|
bwPacket = data[0]
|
||||||
bwPacket = Decoder.decode(data[0])
|
|
||||||
inputQueue.task_done()
|
inputQueue.task_done()
|
||||||
|
|
||||||
if bwPacket is None:
|
|
||||||
continue
|
|
||||||
|
|
||||||
bwPacket.printInfo()
|
bwPacket.printInfo()
|
||||||
misc.addClientDataToPacket(bwPacket, bwConfig)
|
misc.addClientDataToPacket(bwPacket, bwConfig)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
# for pip to install all needed
|
# for pip to install all needed
|
||||||
# called with 'pip -r requirements.txt'
|
# called with 'pip install -r requirements.txt'
|
||||||
|
|
||||||
pyyaml
|
pyyaml
|
||||||
|
|
||||||
# for documentation generating
|
# for documentation generating
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue