mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-04-05 06:25:10 +00:00
small changes in documentation
This commit is contained in:
parent
16865b2c57
commit
97e87fcae2
11 changed files with 140 additions and 128 deletions
|
|
@ -9,15 +9,15 @@ FMS Decoder
|
|||
@requires: Configuration has to be set in the config.ini
|
||||
"""
|
||||
|
||||
import logging
|
||||
import time #timestamp for doublealarm
|
||||
import re #Regex for validation
|
||||
import logging # Global logger
|
||||
import time # timestamp for doublealarm
|
||||
import re # Regex for validation
|
||||
|
||||
from includes import globals # Global variables
|
||||
|
||||
##
|
||||
#
|
||||
# FMS Decoder Function
|
||||
# FMS decoder function
|
||||
# validate -> check double alarm -> log
|
||||
#
|
||||
def decode(freq, decoded):
|
||||
|
|
@ -34,23 +34,26 @@ def decode(freq, decoded):
|
|||
@return: nothing
|
||||
@exception: Exception if FMS decode failed
|
||||
"""
|
||||
timestamp = int(time.time())#Get Timestamp
|
||||
timestamp = int(time.time()) # Get Timestamp
|
||||
|
||||
fms_service = decoded[19] #Organisation
|
||||
fms_country = decoded[36] #Bundesland
|
||||
fms_location = decoded[65:67] #Ort
|
||||
fms_vehicle = decoded[72:76] #Fahrzeug
|
||||
fms_status = decoded[84] #Status
|
||||
fms_direction = decoded[101] #Richtung
|
||||
fms_directionText = decoded[103:110] #Richtung (Text)
|
||||
fms_tsi = decoded[114:117] #Taktische Kruzinformation
|
||||
fms_service = decoded[19] # Organisation
|
||||
fms_country = decoded[36] # Bundesland
|
||||
fms_location = decoded[65:67] # Ort
|
||||
fms_vehicle = decoded[72:76] # Fahrzeug
|
||||
fms_status = decoded[84] # Status
|
||||
fms_direction = decoded[101] # Richtung
|
||||
fms_directionText = decoded[103:110] # Richtung (Text)
|
||||
fms_tsi = decoded[114:117] # Taktische Kruzinformation
|
||||
|
||||
if "CRC correct" in decoded: #check CRC is correct
|
||||
fms_id = fms_service+fms_country+fms_location+fms_vehicle+fms_status+fms_direction #build FMS id
|
||||
if re.search("[0-9a-f]{8}[0-9a-f]{1}[01]{1}", fms_id): #if FMS is valid
|
||||
if fms_id == globals.fms_id_old and timestamp < globals.fms_time_old + globals.config.getint("FMS", "double_ignore_time"): #check for double alarm
|
||||
fms_id = fms_service+fms_country+fms_location+fms_vehicle+fms_status+fms_direction # build FMS id
|
||||
# if FMS is valid
|
||||
if re.search("[0-9a-f]{8}[0-9a-f]{1}[01]{1}", fms_id):
|
||||
# check for double alarm
|
||||
if fms_id == globals.fms_id_old and timestamp < globals.fms_time_old + globals.config.getint("FMS", "double_ignore_time"):
|
||||
logging.info("FMS double alarm: %s within %s second(s)", globals.fms_id_old, timestamp-globals.fms_time_old)
|
||||
globals.fms_time_old = timestamp #in case of double alarm, fms_double_ignore_time set new
|
||||
# in case of double alarm, fms_double_ignore_time set new
|
||||
globals.fms_time_old = timestamp
|
||||
else:
|
||||
logging.info("FMS:%s Status:%s Richtung:%s TSI:%s", fms_id[0:8], fms_status, fms_direction, fms_tsi)
|
||||
data = {"fms":fms_id[0:8], "status":fms_status, "direction":fms_direction, "directionText":fms_directionText, "tsi":fms_tsi, "description":fms_id[0:8]}
|
||||
|
|
|
|||
|
|
@ -10,15 +10,15 @@ POCSAG Decoder
|
|||
@requires: Configuration has to be set in the config.ini
|
||||
"""
|
||||
|
||||
import logging
|
||||
import time #timestamp for doublealarm
|
||||
import re #Regex for validation
|
||||
import logging # Global logger
|
||||
import time # timestamp for doublealarm
|
||||
import re # Regex for validation
|
||||
|
||||
from includes import globals # Global variables
|
||||
|
||||
##
|
||||
#
|
||||
# Simple Filter
|
||||
# Simple local filter
|
||||
#
|
||||
def isAllowed(poc_id):
|
||||
"""
|
||||
|
|
@ -56,7 +56,7 @@ def isAllowed(poc_id):
|
|||
|
||||
##
|
||||
#
|
||||
# POCSAG Decoder Function
|
||||
# POCSAG decoder function
|
||||
# validate -> check double alarm -> log
|
||||
#
|
||||
def decode(freq, decoded):
|
||||
|
|
@ -104,10 +104,10 @@ def decode(freq, decoded):
|
|||
|
||||
if re.search("[0-9]{7}", poc_id): #if POC is valid
|
||||
if isAllowed(poc_id):
|
||||
#check for double alarm
|
||||
# check for double alarm
|
||||
if poc_id == globals.poc_id_old and timestamp < globals.poc_time_old + globals.config.getint("POC", "double_ignore_time"):
|
||||
logging.info("POCSAG%s double alarm: %s within %s second(s)", bitrate, globals.poc_id_old, timestamp-globals.poc_time_old)
|
||||
#in case of double alarm, poc_double_ignore_time set new
|
||||
# in case of double alarm, poc_double_ignore_time set new
|
||||
globals.poc_time_old = timestamp
|
||||
else:
|
||||
logging.info("POCSAG%s: %s %s %s ", bitrate, poc_id, poc_sub, poc_text)
|
||||
|
|
|
|||
|
|
@ -9,56 +9,16 @@ ZVEI Decoder
|
|||
@requires: Configuration has to be set in the config.ini
|
||||
"""
|
||||
|
||||
import logging
|
||||
import time #timestamp for doublealarm
|
||||
import re #Regex for validation
|
||||
import logging # Global logger
|
||||
import time # timestamp for doublealarm
|
||||
import re # Regex for validation
|
||||
|
||||
from includes import globals # Global variables
|
||||
|
||||
##
|
||||
#
|
||||
# ZVEI Decoder Function
|
||||
# validate -> check double alarm -> log
|
||||
# Local function to remove the 'F'
|
||||
#
|
||||
def decode(freq, decoded):
|
||||
"""
|
||||
Export ZVEI Information from Multimon-NG RAW String and call alarmHandler.processAlarm()
|
||||
|
||||
@type freq: string
|
||||
@param freq: frequency of the SDR Stick
|
||||
@type decoded: string
|
||||
@param decoded: RAW Information from Multimon-NG
|
||||
|
||||
@requires: Configuration has to be set in the config.ini
|
||||
|
||||
@return: nothing
|
||||
@exception: Exception if ZVEI decode failed
|
||||
"""
|
||||
timestamp = int(time.time())#Get Timestamp
|
||||
|
||||
zvei_id = decoded[7:12] #ZVEI Code
|
||||
zvei_id = removeF(zvei_id) #resolve F
|
||||
if re.search("[0-9]{5}", zvei_id): #if ZVEI is valid
|
||||
if zvei_id == globals.zvei_id_old and timestamp < globals.zvei_time_old + globals.config.getint("ZVEI", "double_ignore_time"): #check for double alarm
|
||||
logging.info("ZVEI double alarm: %s within %s second(s)", globals.zvei_id_old, timestamp-globals.zvei_time_old)
|
||||
globals.zvei_time_old = timestamp #in case of double alarm, zvei_double_ignore_time set new
|
||||
else:
|
||||
logging.info("5-Ton: %s", zvei_id)
|
||||
data = {"zvei":zvei_id, "description":zvei_id}
|
||||
# If enabled, look up description
|
||||
if globals.config.getint("ZVEI", "idDescribed"):
|
||||
from includes import descriptionList
|
||||
data["description"] = descriptionList.getDescription("ZVEI", zvei_id)
|
||||
# processing the alarm
|
||||
from includes import alarmHandler
|
||||
alarmHandler.processAlarm("ZVEI",freq,data)
|
||||
|
||||
globals.zvei_id_old = zvei_id #save last id
|
||||
globals.zvei_time_old = timestamp #save last time
|
||||
else:
|
||||
logging.warning("No valid ZVEI: %s", zvei_id)
|
||||
|
||||
|
||||
def removeF(zvei):
|
||||
"""
|
||||
Resolve the F from the repeat Tone
|
||||
|
|
@ -75,4 +35,49 @@ def removeF(zvei):
|
|||
if zvei[i] == "F":
|
||||
zvei = zvei.replace("F",zvei[i-1],1)
|
||||
logging.debug("resolve F: %s -> %s", zvei_old, zvei)
|
||||
return zvei
|
||||
return zvei
|
||||
|
||||
##
|
||||
#
|
||||
# ZVEI decoder function
|
||||
# validate -> check double alarm -> log
|
||||
#
|
||||
def decode(freq, decoded):
|
||||
"""
|
||||
Export ZVEI Information from Multimon-NG RAW String and call alarmHandler.processAlarm()
|
||||
|
||||
@type freq: string
|
||||
@param freq: frequency of the SDR Stick
|
||||
@type decoded: string
|
||||
@param decoded: RAW Information from Multimon-NG
|
||||
|
||||
@requires: Configuration has to be set in the config.ini
|
||||
|
||||
@return: nothing
|
||||
@exception: Exception if ZVEI decode failed
|
||||
"""
|
||||
timestamp = int(time.time()) # Get Timestamp
|
||||
|
||||
zvei_id = decoded[7:12] # ZVEI Code
|
||||
zvei_id = removeF(zvei_id) # resolve F
|
||||
if re.search("[0-9]{5}", zvei_id): # if ZVEI is valid
|
||||
# check for double alarm
|
||||
if zvei_id == globals.zvei_id_old and timestamp < globals.zvei_time_old + globals.config.getint("ZVEI", "double_ignore_time"):
|
||||
logging.info("ZVEI double alarm: %s within %s second(s)", globals.zvei_id_old, timestamp-globals.zvei_time_old)
|
||||
# in case of double alarm, zvei_double_ignore_time set new
|
||||
globals.zvei_time_old = timestamp
|
||||
else:
|
||||
logging.info("5-Ton: %s", zvei_id)
|
||||
data = {"zvei":zvei_id, "description":zvei_id}
|
||||
# If enabled, look up description
|
||||
if globals.config.getint("ZVEI", "idDescribed"):
|
||||
from includes import descriptionList
|
||||
data["description"] = descriptionList.getDescription("ZVEI", zvei_id)
|
||||
# processing the alarm
|
||||
from includes import alarmHandler
|
||||
alarmHandler.processAlarm("ZVEI",freq,data)
|
||||
|
||||
globals.zvei_id_old = zvei_id # save last id
|
||||
globals.zvei_time_old = timestamp # save last time
|
||||
else:
|
||||
logging.warning("No valid ZVEI: %s", zvei_id)
|
||||
Loading…
Add table
Add a link
Reference in a new issue