mirror of
https://github.com/BOSWatch/BW3-Core.git
synced 2026-04-06 06:43:54 +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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue