113 lines
2.3 KiB
Python
Executable File
113 lines
2.3 KiB
Python
Executable File
#!/usr/bin/python
|
|
|
|
__author__ = "Michael Rest"
|
|
__date__ = "2016/09/01"
|
|
__email__ = "mr@mir.systems"
|
|
__version__ = "$Revision: 1.1 $"[11:-2]
|
|
|
|
from telegram import TEL_PD01, TEL_STAT
|
|
|
|
__all__ = ["decode_packet"]
|
|
|
|
#Decoder
|
|
def decode_DM01 (data):
|
|
from DM01_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
def decode_PD01 (data):
|
|
from PD01_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
def decode_PD02 (data):
|
|
from PD02_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
def decode_PD05 (data):
|
|
from PD05_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
def decode_PD06 (data):
|
|
from PD06_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
def decode_PD07 (data):
|
|
from PD07_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
def decode_PD08 (data):
|
|
from PD08_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
def decode_DM09 (data):
|
|
from DM09_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
def decode_PD09 (data):
|
|
from PD09_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
def decode_PD10 (data):
|
|
from PD10_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
def decode_DM20 (data):
|
|
from DM20_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
def decode_PD20 (data):
|
|
from PD20_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
def decode_DM30 (data):
|
|
from DM30_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
def decode_PD30 (data):
|
|
from PD30_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
|
|
def decode_PD98 (data):
|
|
from PD98_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
def decode_PD99 (data):
|
|
from PD99_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
|
|
def decode_STAT (data):
|
|
from STAT_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
decoderlist = {
|
|
b'PD01': decode_PD01,
|
|
b'DM01': decode_DM01,
|
|
b'PD02': decode_PD02,
|
|
b'PD03': decode_PD02,
|
|
b'PD05': decode_PD05,
|
|
b'PD06': decode_PD06,
|
|
b'PD07': decode_PD07,
|
|
b'PD08': decode_PD08,
|
|
b'DM09': decode_DM09,
|
|
b'PD09': decode_PD09,
|
|
b'PD98': decode_PD98,
|
|
b'PD99': decode_PD99,
|
|
b'PD10': decode_PD10,
|
|
b'DM20': decode_DM20,
|
|
b'PD20': decode_PD20,
|
|
b'DM30': decode_DM30,
|
|
b'PD30': decode_PD30,
|
|
b'STAT': decode_STAT
|
|
}
|
|
|
|
|
|
def decodetelegram (data):
|
|
teltype = data[6:10]
|
|
if teltype in decoderlist:
|
|
return decoderlist[teltype](data)
|
|
else:
|
|
print ("Unhandled telegramtype %s" % teltype)
|
|
raise Warning ("Undhandled packettype")
|
|
return
|