BOSWatch/includes/decoder.py

50 lines
1.2 KiB
Python
Raw Normal View History

2015-06-25 21:19:41 +02:00
#!/usr/bin/python
# -*- coding: UTF-8 -*-
2015-06-25 21:19:41 +02:00
"""
Search for decode string and call the right decoder function
@author: Jens Herrmann
@requires: none
"""
import logging # Global logger
def decode(freq, decoded):
"""
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
2015-07-02 09:02:49 +02:00
2015-06-25 21:19:41 +02:00
@return: nothing
@exception: Exception if decoder file call failed
"""
try:
2015-07-02 09:02:49 +02:00
# FMS Decoder Section
2015-06-25 21:19:41 +02:00
# check FMS: -> check CRC -> validate -> check double alarm -> log
2015-07-02 09:02:49 +02:00
if "FMS:" in decoded:
2017-01-16 14:03:51 +01:00
logging.debug("received FMS")
2015-06-25 21:19:41 +02:00
from includes.decoders import fms
fms.decode(freq, decoded)
2015-07-02 09:02:49 +02:00
2015-06-25 21:19:41 +02:00
# ZVEI Decoder Section
2015-07-02 09:02:49 +02:00
# check ZVEI: -> validate -> check double alarm -> log
2015-06-25 21:19:41 +02:00
elif "ZVEI2:" in decoded:
2017-01-16 14:03:51 +01:00
logging.debug("received ZVEI")
2015-06-25 21:19:41 +02:00
from includes.decoders import zvei
zvei.decode(freq, decoded)
2015-07-02 09:02:49 +02:00
2015-06-25 21:19:41 +02:00
# POCSAG Decoder Section
2015-07-02 09:02:49 +02:00
# check POCSAG -> validate -> check double alarm -> log
2015-07-01 21:57:27 +02:00
elif "POCSAG512:" in decoded or "POCSAG1200:" in decoded or "POCSAG2400:" in decoded:
2017-01-16 14:03:51 +01:00
logging.debug("received POCSAG")
2015-06-25 21:19:41 +02:00
from includes.decoders import poc
poc.decode(freq, decoded)
2015-07-02 09:02:49 +02:00
2015-06-25 21:19:41 +02:00
except:
2015-07-02 09:02:49 +02:00
logging.exception("cannot start decoder")