some little improvements

This commit is contained in:
Bastian Schroll 2018-02-03 22:32:28 +01:00
parent 4f72691c65
commit fd501c23dc
7 changed files with 15 additions and 13 deletions

View file

@ -27,7 +27,7 @@ class Fms:
"""!FMS decoder class """!FMS decoder class
This class decodes FMS data. This class decodes FMS data.
First step is to validate the data and check if the format is correct. First step is to validate the data and _check if the format is correct.
In the last step a valid BOSWatch packet is created and returned""" In the last step a valid BOSWatch packet is created and returned"""
def __init__(self): def __init__(self):

View file

@ -27,7 +27,7 @@ class Pocsag:
"""!POCSAG decoder class """!POCSAG decoder class
This class decodes POCSAG data. This class decodes POCSAG data.
First step is to validate the data and check if the format is correct. First step is to validate the data and _check if the format is correct.
In the last step a valid BOSWatch packet is created and returned""" In the last step a valid BOSWatch packet is created and returned"""
def __init__(self): def __init__(self):

View file

@ -27,7 +27,7 @@ class Zvei:
"""!ZVEI decoder class """!ZVEI decoder class
This class decodes ZVEI data. This class decodes ZVEI data.
First step is to validate the data and check if the format is correct. First step is to validate the data and _check if the format is correct.
After that the double-tone-sign 'E' is replaced. After that the double-tone-sign 'E' is replaced.
In the last step a valid BOSWatch packet is created and returned""" In the last step a valid BOSWatch packet is created and returned"""

View file

@ -53,9 +53,9 @@ class DoubleFilter:
logging.debug("scanWord for '%s' is '%s'", bwPacket.get("mode"), scanWord) logging.debug("scanWord for '%s' is '%s'", bwPacket.get("mode"), scanWord)
return self.check(bwPacket, scanWord) return self._check(bwPacket, scanWord)
def check(self, bwPacket, scanWord): def _check(self, bwPacket, scanWord):
self._filterLists[bwPacket.get("mode")].insert(0, bwPacket) self._filterLists[bwPacket.get("mode")].insert(0, bwPacket)
# delete entrys that are to old # delete entrys that are to old

View file

@ -21,10 +21,12 @@ import time
logging.debug("- %s loaded", __name__) logging.debug("- %s loaded", __name__)
_dataPackets = [] # module wide global list for received data sets # module wide global list for received data sets
_dataPackets = []
_lockDataPackets = threading.Lock() _lockDataPackets = threading.Lock()
_clients = {} # module wide global list for all currently connected clients
_clients = {} # _clients[ThreadName] = {"address", "timestamp"}
_lockClients = threading.Lock() _lockClients = threading.Lock()
@ -138,7 +140,7 @@ class TCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
return _clients return _clients
@staticmethod @staticmethod
def getData(): def getDataFromQueue():
"""!Function to get the data packages from server """!Function to get the data packages from server
must be polled by main program must be polled by main program

View file

@ -36,7 +36,7 @@ class Packet:
logging.debug("create bwPacket from string") logging.debug("create bwPacket from string")
try: try:
self._packet = eval(str(bwPacket.strip())) self._packet = eval(str(bwPacket.strip()))
except: except: # pragma: no cover
# todo can we repair the packet anyway? # todo can we repair the packet anyway?
logging.exception("error while create packet from string") logging.exception("error while create packet from string")

View file

@ -149,10 +149,10 @@ class Test_ServerClient:
# recv all # recv all
assert self.testClient1.receive() == "[ack]" assert self.testClient1.receive() == "[ack]"
assert self.testClient2.receive() == "[ack]" assert self.testClient2.receive() == "[ack]"
# check server output data # _check server output data
assert useServer.getData()[1] == "test1" assert useServer.getDataFromQueue()[1] == "test1"
assert useServer.getData()[1] == "test2" assert useServer.getDataFromQueue()[1] == "test2"
assert useServer.getData() is None # Last check must be None assert useServer.getDataFromQueue() is None # Last _check must be None
# disconnect all # disconnect all
assert self.testClient1.disconnect() assert self.testClient1.disconnect()
assert self.testClient2.disconnect() assert self.testClient2.disconnect()