mirror of
https://github.com/BOSWatch/BW3-Core.git
synced 2026-04-05 14:25:45 +00:00
make decoder classes <<static>>
This commit is contained in:
parent
a6542f0b63
commit
f1bf468c2a
6 changed files with 60 additions and 69 deletions
|
|
@ -23,18 +23,21 @@ from boswatch.decoder.zveidecoder import ZveiDecoder
|
|||
logging.debug("- %s loaded", __name__)
|
||||
|
||||
|
||||
def decode(data):
|
||||
"""!Choose the right decoder and return a bwPacket instance
|
||||
class Decoder:
|
||||
|
||||
@param data: data to decode
|
||||
@return bwPacket instance"""
|
||||
logging.debug("search decoder")
|
||||
if "FMS" in data:
|
||||
return FmsDecoder.decode(data)
|
||||
elif "POCSAG" in data:
|
||||
return PocsagDecoder.decode(data)
|
||||
elif "ZVEI" in data:
|
||||
return ZveiDecoder.decode(data)
|
||||
else:
|
||||
logging.error("no decoder found for: %s", data)
|
||||
return None
|
||||
@staticmethod
|
||||
def decode(data):
|
||||
"""!Choose the right decoder and return a bwPacket instance
|
||||
|
||||
@param data: data to decode
|
||||
@return bwPacket instance"""
|
||||
logging.debug("search decoder")
|
||||
if "FMS" in data:
|
||||
return FmsDecoder.decode(data)
|
||||
elif "POCSAG" in data:
|
||||
return PocsagDecoder.decode(data)
|
||||
elif "ZVEI" in data:
|
||||
return ZveiDecoder.decode(data)
|
||||
else:
|
||||
logging.error("no decoder found for: %s", data)
|
||||
return None
|
||||
|
|
|
|||
|
|
@ -30,10 +30,6 @@ class FmsDecoder:
|
|||
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"""
|
||||
|
||||
def __init__(self):
|
||||
"""!Create a new instance"""
|
||||
logging.debug("FMS decoder started")
|
||||
|
||||
@staticmethod
|
||||
def decode(data):
|
||||
"""!Decodes FMS
|
||||
|
|
|
|||
|
|
@ -30,10 +30,6 @@ class PocsagDecoder:
|
|||
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"""
|
||||
|
||||
def __init__(self):
|
||||
"""!Create a new instance"""
|
||||
logging.debug("POCSAG decoder started")
|
||||
|
||||
@staticmethod
|
||||
def decode(data):
|
||||
"""!Decodes POCSAG
|
||||
|
|
|
|||
|
|
@ -31,10 +31,6 @@ class ZveiDecoder:
|
|||
After that the double-tone-sign 'E' is replaced.
|
||||
In the last step a valid BOSWatch packet is created and returned"""
|
||||
|
||||
def __init__(self):
|
||||
"""!Create a new instance"""
|
||||
logging.debug("ZVEI decoder started")
|
||||
|
||||
@staticmethod
|
||||
def decode(data):
|
||||
"""!Decodes ZVEI
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue