BOSWatch/includes/decoder.py

53 lines
1.4 KiB
Python
Raw Normal View History

#!/usr/bin/python
# -*- coding: cp1252 -*-
2015-05-27 07:48:24 +02:00
"""
Search for decode String and call the right decoder Funtion
@author: Jens Herrmann
@requires: none
"""
import logging
2015-05-22 17:44:34 +02:00
def decode(freq, decoded):
2015-05-27 07:48:24 +02:00
"""
Search for decode String and call the right decoder Function
@type freq: string
@param freq: frequency of the SDR Stick
@type decoded: string
@param decoded: RAW Information from Multimon-NG
@return: nothing
@exception: Exception if decoder File call failed
"""
2015-05-26 09:14:04 +02:00
try:
# FMS Decoder Section
# check FMS: -> check CRC -> validate -> check double alarm -> log
2015-05-26 09:14:04 +02:00
if "FMS:" in decoded:
logging.debug("recieved FMS")
from includes.decoders import fms
fms.decode(freq, decoded)
# ZVEI Decoder Section
# check ZVEI: -> validate -> check double alarm -> log
elif "ZVEI2:" in decoded:
2015-05-26 09:14:04 +02:00
logging.debug("recieved ZVEI")
from includes.decoders import zvei
zvei.decode(freq, decoded)
# For POCSAG we have to ignore the first multimon-ng line
elif "Enabled demodulators:" in decoded:
pass
# POCSAG Decoder Section
# check POCSAG -> validate -> check double alarm -> log
elif "POCSAG" in decoded:
2015-05-26 09:14:04 +02:00
logging.debug("recieved POCSAG")
from includes.decoders import poc
poc.decode(freq, decoded)
except:
2015-05-26 11:41:05 +02:00
logging.exception("cannot start decoder")