55 lines
1.1 KiB
Python
Executable File
55 lines
1.1 KiB
Python
Executable File
#!/usr/bin/python
|
|
|
|
__author__ = "Daniel Egger, Michael Rest"
|
|
__date__ = "2006/02/15"
|
|
__email__ = "michi@rosstein.de"
|
|
__version__ = "$Revision: 1.1 $"[11:-2]
|
|
|
|
from telegram import TEL_LEBE, TEL_TAUF, TEL_TQUI, TEL_SCLS, TEL_STAT, TEL_IPKT
|
|
|
|
__all__ = ["decode_packet"]
|
|
|
|
|
|
def decode_LEBE (data):
|
|
from LEBE_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
def decode_TQUI (data):
|
|
from TQUI_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
def decode_SCLS (data):
|
|
from SCLS_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
def decode_STAT (data):
|
|
from STAT_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
def decode_IPKT (data):
|
|
from IPKT_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
def decode_TAUF (data):
|
|
from TAUF_tel import fromstring
|
|
return fromstring (data)
|
|
|
|
decoderlist = {
|
|
'LEBE': decode_LEBE,
|
|
'TQUI': decode_TQUI,
|
|
'SCLS': decode_SCLS,
|
|
'STAT': decode_STAT,
|
|
'IPKT': decode_IPKT,
|
|
'TAUF': decode_TAUF
|
|
}
|
|
|
|
|
|
def decodetelegram (data):
|
|
type = data[6:10]
|
|
if type in decoderlist:
|
|
return decoderlist[type](data)
|
|
else:
|
|
print ("Unhandled telegramtype %s" %type)
|
|
raise Warning, "Undhandled packettype"
|
|
return
|