-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multicastAlarm added as function #307
Merged
Merged
Changes from 29 commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
f31532d
Add files via upload
f-kessler c52c76a
Delete expressAlarm.py
f-kessler 5503ac0
Delete config.template.ini
f-kessler 990ef0f
Delete poc.py
f-kessler 3532a64
Delete testdata.txt
f-kessler e770937
Add files via upload
f-kessler fbc3e53
Delete testdata.txt
f-kessler 9ffa872
Add files via upload
f-kessler 81a146b
Add files via upload
f-kessler 46a53dd
Add files via upload
f-kessler f171bda
Add files via upload
f-kessler 70d7698
Update testdata.txt
f-kessler 7fd88a4
Update config.template.ini
f-kessler 55f5529
Update README.md
f-kessler 4a89ed4
Merge branch 'develop' into dev-express-alarm
Schrolli91 f73e6f2
edit changelog
Schrolli91 6af6981
changes for codacy
Schrolli91 0ed8df0
add ExpressAlarm to logging
Schrolli91 ae03473
Update config.template.ini
f-kessler 0fc12ab
Changed naming and description
f-kessler 07f42e1
Changed naming
f-kessler d30eee5
Updated naming
f-kessler 06d36b3
Changed EA to multicastAlarm
f-kessler bd733b6
changed logging to multicastAlarm
f-kessler 736d0f9
Update CHANGELOG.md
Schrolli91 f6e4c8d
Update testdata.txt
Schrolli91 d45ff3b
Merge branch 'develop' into dev-express-alarm
Schrolli91 8069ded
enumerate() instead of range(len())
f-kessler 00e4e52
Update multicastAlarm.py
f-kessler 3aa0b38
edit changelog with link
Schrolli91 fed717a
Merge branch 'develop' into dev-express-alarm
Schrolli91 c54bd55
change to data-field at checks
Schrolli91 b6077d5
enumerate value correction
f-kessler 166dd3e
changed data buffering and updating for alarms
f-kessler 6bcba28
changed to send complete data to multicastAlarm for buffering
f-kessler 9aa163d
text for multicastAlarm config updated
f-kessler b52d972
edit debug msg
Schrolli91 f701b6a
del typ and freq in adding routine
Schrolli91 9c446b0
del typ and freq in adding routine
Schrolli91 9aaa8aa
remove typ from adding
Schrolli91 3220088
update indexes after remove of typ from multiList
f-kessler 63f2e58
edit multicastAlarm
Schrolli91 fa90ba1
Merge branch 'develop' into dev-express-alarm
Schrolli91 03cd002
Merge branch 'develop' into dev-express-alarm
Schrolli91 fca69b9
add placeholder (unused var)
Schrolli91 578750a
fix global definition issue
Schrolli91 bcdac6e
exclude netIdent_ric from multicastAlarm
f-kessler b7141d9
fixed remove of old RICs and replacement of data for calling alarmHan…
f-kessler fb82b18
edit CL
Schrolli91 3b22750
Merge branch 'develop' into dev-express-alarm
Schrolli91 59b78a4
multi delimiter and text RICs
f-kessler e9b7cf1
Merge branch 'develop' into dev-express-alarm
Schrolli91 568ead7
Merge branch 'develop' into dev-express-alarm
Schrolli91 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
|
||
""" | ||
multicastAlarm is the function to enable BOSwatch to deal networks that optimise the transmission of POCSAG telegrams | ||
|
||
@author: Fabian Kessler | ||
|
||
@requires: Configuration has to be set in the config.ini | ||
""" | ||
|
||
import logging # Global logger | ||
import time # timestamp for multicastAlarm | ||
|
||
from includes import globalVars # Global variables | ||
|
||
multiList = [] | ||
|
||
def newEntrymultiList(eatyp, eapoc_id, eapoc_sub, eapoc_text): | ||
""" | ||
add entry to multi alarm list and remove old entries | ||
|
||
@return: nothing | ||
""" | ||
global multiList | ||
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"): | ||
multiList = [] | ||
logging.debug("multicastAlarm delimiter RIC received --> buffer cleared %s %s %s ", eapoc_id, eapoc_sub, eapoc_text) | ||
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) | ||
# check for old entries in multiList | ||
for i,j 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"): | ||
tmpmultiList.append(multiList[i]) | ||
multiList = tmpmultiList | ||
|
||
|
||
def multicastAlarmExec(typ, freq, data): | ||
""" | ||
call alarmHandler for every entry in multiList | ||
|
||
@return: nothing | ||
""" | ||
logging.debug("data before update from multiList: %s", data) | ||
for i,j in enumerate(multiList): | ||
#update with eapoc_id (RIC) | ||
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] | ||
logging.debug("data after update from multiList: %s", data) | ||
try: | ||
from includes import alarmHandler | ||
alarmHandler.processAlarmHandler(typ, freq, data) | ||
except: | ||
logging.error("processing alarm failed") | ||
logging.debug("processing alarm failed", exc_info=True) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wieso hast du das "j" extra noch hinzugefügt, wenn es doch gar nicht benutzt wird?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Das ist eine gute Frage. Leider hatte ich gestern nicht mehr genug Zeit mich damit auseinander zu setzen. Ich habe enumerate() so verstanden, dass es immer den Index und Wert zurück gibt. Den Wert brauche ich nicht, aber wenn ich keine variable zuweise erhalte ich eine Fehlermeldung. Ich hoffe, mich huete Abend nochmal damit beschäftigen zu können.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@f-kessler Dafür wird meist ein "Unterstrich" benutzt
oder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2teres hatte Codacy ja eben angemeckert, weil scheinbar schlechter Stil ;-)
siehe: 8069ded (enumerate() instead of range(len()))