mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-01-09 09:59:58 +01:00
changed data buffering and updating for alarms
This commit is contained in:
parent
b6077d522d
commit
166dd3e3f8
|
|
@ -2,7 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
multicastAlarm is the function to enable BOSwatch to deal networks that optimise the transmission of POCSAG telegrams
|
||||
multicastAlarm is the function to enable BOSwatch to work in networks that optimise the transmission of POCSAG telegrams
|
||||
|
||||
@author: Fabian Kessler
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ from includes import globalVars # Global variables
|
|||
|
||||
multiList = []
|
||||
|
||||
def newEntrymultiList(eatyp, eapoc_id, eapoc_sub, eapoc_text):
|
||||
def newEntrymultiList(typ, freq, data):
|
||||
"""
|
||||
add entry to multi alarm list and remove old entries
|
||||
|
||||
|
|
@ -26,16 +26,16 @@ def newEntrymultiList(eatyp, eapoc_id, eapoc_sub, eapoc_text):
|
|||
tmpmultiList = []
|
||||
timestamp = int(time.time())
|
||||
# multicastAlarm processing if enabled and delimiter RIC has been received
|
||||
if eapoc_id == globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric"):
|
||||
if data['ric'] == globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric"):
|
||||
multiList = []
|
||||
logging.debug("multicastAlarm delimiter RIC received --> buffer cleared %s %s %s ", eapoc_id, eapoc_sub, eapoc_text)
|
||||
logging.debug("multicastAlarm delimiter RIC received --> buffer cleared %s ", data)
|
||||
else:
|
||||
multiList.append([eatyp, eapoc_id, eapoc_sub, eapoc_text.strip(), timestamp])
|
||||
logging.debug("Added %s %s %s to multiList", eapoc_id, eapoc_sub, eapoc_text)
|
||||
multiList.append([typ, data['ric'], data['function'], data['functionChar'], data['msg'].strip(), data['description'], timestamp])
|
||||
logging.debug("Added %s %s %s %s to multiList", data['ric'], data['function'], data['functionChar'], data['msg'].strip())
|
||||
# check for old entries in multiList
|
||||
for i, _ in enumerate(multiList):
|
||||
# we have to remove entries older than timestamp - ignore time
|
||||
if int(multiList[i][4]) > timestamp-globalVars.config.getint("multicastAlarm", "multicastAlarm_ignore_time"):
|
||||
if int(multiList[i][6]) > timestamp-globalVars.config.getint("multicastAlarm", "multicastAlarm_ignore_time"):
|
||||
tmpmultiList.append(multiList[i])
|
||||
multiList = tmpmultiList
|
||||
|
||||
|
|
@ -48,14 +48,11 @@ def multicastAlarmExec(typ, freq, data):
|
|||
"""
|
||||
logging.debug("data before update from multiList: %s", data)
|
||||
for i, _ in enumerate(multiList):
|
||||
#update with eapoc_id (RIC)
|
||||
#update data with values multiList
|
||||
data['ric'] = multiList[i][1]
|
||||
#update with eapoc_sub (Sub RIC)
|
||||
data['function'] = multiList[i][2]
|
||||
# Add function as character a-d to dataset (reused from includes/poc.py)
|
||||
data["functionChar"] = data["function"].replace("1", "a").replace("2", "b").replace("3", "c").replace("4", "d")
|
||||
#update with eapoc_id (RIC)
|
||||
data['description'] = multiList[i][1]
|
||||
data['functionChar'] = multiList[i][3]
|
||||
data['description'] = multiList[i][5]
|
||||
logging.debug("data after update from multiList: %s", data)
|
||||
try:
|
||||
from includes import alarmHandler
|
||||
|
|
|
|||
Loading…
Reference in a new issue