Skip to content

Commit

Permalink
edit multicastAlarm
Browse files Browse the repository at this point in the history
  • Loading branch information
Schrolli91 committed Oct 3, 2017
1 parent 3220088 commit 63f2e58
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions includes/multicastAlarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

from includes import globalVars # Global variables

#
# ListStructure [0..n] = (Data, TimeStamp)
#
multiList = []

def newEntrymultiList(data):
Expand All @@ -22,22 +25,18 @@ def newEntrymultiList(data):
@return: nothing
"""
global multiList
tmpmultiList = []
timestamp = int(time.time())
# multicastAlarm processing if enabled and delimiter RIC has been received
if data['ric'] == globalVars.config.get("multicastAlarm", "multicastAlarm_delimiter_ric"):
multiList = []
logging.debug("multicastAlarm delimiter RIC received --> buffer cleared")
else:
multiList.append([data['ric'], data['function'], data['functionChar'], data['msg'].strip(), data['description'], timestamp])
multiList.append([data, timestamp])
logging.debug("Added %s to multiList", data['ric'])
# 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][5]) > timestamp-globalVars.config.getint("multicastAlarm", "multicastAlarm_ignore_time"):
tmpmultiList.append(multiList[i])
multiList = tmpmultiList
for (xData, xTimestamp) in multiList:
if xTimestamp > timestamp-globalVars.config.getint("multicastAlarm", "multicastAlarm_ignore_time"):
multiList.remove([xData, xTimestamp])


def multicastAlarmExec(freq, data):
Expand All @@ -47,12 +46,12 @@ def multicastAlarmExec(freq, data):
@return: nothing
"""
logging.debug("data before update from multiList: %s", data)
for i, _ in enumerate(multiList):
for (xData, xTimestamp) in multiList:
#update data with values multiList
data['ric'] = multiList[i][0]
data['function'] = multiList[i][1]
data['functionChar'] = multiList[i][2]
data['description'] = multiList[i][4]
data['ric'] = xData['ric']
data['function'] = xData['ric']
data['functionChar'] = xData['ric']
data['description'] = xData['ric']
logging.debug("data after update from multiList: %s", data)
try:
from includes import alarmHandler
Expand Down

0 comments on commit 63f2e58

Please sign in to comment.