forked from Schrolli91/BOSWatch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
decoder.py
49 lines (39 loc) · 1.24 KB
/
decoder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
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
@return: nothing
@exception: Exception if decoder file call failed
"""
try:
# FMS Decoder Section
# check FMS: -> check CRC -> validate -> check double alarm -> log
if "FMS:" in decoded:
logging.debug("received FMS")
from includes.decoders import fms
fms.decode(freq, decoded)
# ZVEI Decoder Section
# check ZVEI: -> validate -> check double alarm -> log
elif "ZVEI1:" in decoded:
logging.debug("received ZVEI")
from includes.decoders import zvei
zvei.decode(freq, decoded)
# POCSAG Decoder Section
# check POCSAG -> validate -> check double alarm -> log
elif "POCSAG512:" in decoded or "POCSAG1200:" in decoded or "POCSAG2400:" in decoded:
logging.debug("received POCSAG")
from includes.decoders import poc
poc.decode(freq, decoded)
except:
logging.exception("cannot start decoder")