mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-02-02 13:24:19 +01:00
Merge branch 'develop' of https://github.com/Schrolli91/BOSWatch
Conflicts: CHANGELOG.md config/config.template.ini
This commit is contained in:
commit
ebeeec467a
|
|
@ -4,6 +4,7 @@
|
|||
### __[v2.5.3]__ - unreleased
|
||||
##### Added
|
||||
- Functionality to fill coordinate values in POC data structure (lat, lon) based on configured locations that match a regular expression in POC message [#510](https://github.com/Schrolli91/BOSWatch/pull/510)
|
||||
- Extending POC data-structure by Regex named groups matching. [#508](https://github.com/Schrolli91/BOSWatch/pull/508)
|
||||
##### Changed
|
||||
##### Deprecated
|
||||
##### Removed
|
||||
|
|
|
|||
|
|
@ -127,6 +127,23 @@ geo_enable = 0
|
|||
geo_format = #C(\d{2})(\d{5}),(\d{2})(\d{5})#
|
||||
geo_order = LON, lon, LAT, lat
|
||||
|
||||
# Analyze message and associate data to named fields
|
||||
# If the regular expression matches the POC message, the "named groups" defined in schemaRegex will be added to the data structure.
|
||||
# You can check this by looking at the value in data["has_schema_fields"]. If it is True, then the regular expression has been hit and the additional fields are available.
|
||||
# E.g. POC message is "TESTALARM Person in Zwangslage;H2.04;Neustadt;Königsbach;Weinstraße 1;VS Winzerheim;;Dortige Baustelle..Treppensturz"
|
||||
#
|
||||
# Without the schemaRegex, data will look like this (RIC, SubRIC and Bitrate are random):
|
||||
# {'function': '1', 'has_geo': False, 'description': '1234567', 'has_schema_fields': False, 'msg': 'TESTALARM Person in Zwangslage;H2.04;Neustadt;Königsbach;Weinstraße 1;VS Winzerheim;;Dortige Baustelle..Treppensturz', 'bitrate': 1200, 'ric': '1234567'}
|
||||
#
|
||||
# When using the schemaRegex from below, data will look like this:
|
||||
# {'function': '1', 'has_geo': False, 'description': '1234567', 'has_schema_fields': True, 'msg': 'TESTALARM Person in Zwangslage;H2.04;Neustadt;Königsbach;Weinstraße 1;VS Winzerheim;;Dortige Baustelle..Treppensturz', 'bitrate': 1200, 'ric': '1234567, 'Objekt': 'VS Winzerheim', 'StichwortLang': 'TESTALARM Person in Zwangslage', 'Ort': 'Neustadt', 'Bemerkung1': '', 'Adresse': 'Weinstraße 1', 'Bemerkung2': 'Dortige Baustelle..Treppensturz', 'StichwortKurz': 'H2.04', 'Ortsteil': 'Königsbach'}
|
||||
#
|
||||
# Attention: If you define named groups with names of fields that that are already present in POC decoder's standard data-structure, the content of the respective fields will be overwritten
|
||||
# with data evaluated by this regex (if the regex finds a match). E.g. if you define a named group like "...(?P<ric>.*)..." and the regex will be hit,
|
||||
# then data["ric"] will get filled with the content evaluated by the regex.
|
||||
#schemaRegex = ^(?P<StichwortLang>.*?);(?P<StichwortKurz>.*?);(?P<Ort>.*?);(?P<Ortsteil>.*?);(?P<Adresse>.*?);(?P<Objekt>.*?);(?P<Bemerkung1>.*?);(?P<Bemerkung2>.*?)$
|
||||
|
||||
|
||||
[LocationCoordinates]
|
||||
# Regex Coordinate replacement (only for POC)
|
||||
# All fields in data structure can be used, also dynamically added fields that have been evaluated in "schemaPOCMsg".
|
||||
|
|
|
|||
|
|
@ -158,7 +158,20 @@ def decode(freq, decoded):
|
|||
|
||||
# check for double alarm
|
||||
if doubleFilter.checkID("POC", poc_id+poc_sub, poc_text):
|
||||
data = {"ric":poc_id, "function":poc_sub, "msg":poc_text, "bitrate":bitrate, "description":poc_id, "has_geo":has_geo}
|
||||
data = {"ric":poc_id, "function":poc_sub, "msg":poc_text, "bitrate":bitrate, "description":poc_id, "has_geo":has_geo, "has_schema_fields":False}
|
||||
|
||||
# if a schema is defined, analyze and associate
|
||||
if globalVars.config.has_option("POC", "schemaRegex"):
|
||||
logging.debug("schemaRegex found")
|
||||
m = re.match(globalVars.config.get("POC", "schemaRegex"), poc_text)
|
||||
if m:
|
||||
logging.debug("POC Schema match")
|
||||
# enrich data structure by regex groups
|
||||
data.update(m.groupdict())
|
||||
data["has_schema_fields"] = True
|
||||
else:
|
||||
logging.debug("No POC Schema match")
|
||||
|
||||
if has_geo == True:
|
||||
data["lon"] = lon
|
||||
data["lat"] = lat
|
||||
|
|
@ -182,7 +195,7 @@ def decode(freq, decoded):
|
|||
logging.debug(" - multicastAlarm without msg")
|
||||
from includes import multicastAlarm
|
||||
multicastAlarm.newEntrymultiList(data)
|
||||
|
||||
|
||||
# multicastAlarm processing if enabled and alarm message has been received
|
||||
elif globalVars.config.getint("multicastAlarm", "multicastAlarm") and data["msg"] != "" and data["ric"] in globalVars.config.get("multicastAlarm", "multicastAlarm_ric"):
|
||||
logging.debug(" - multicastAlarm with message")
|
||||
|
|
|
|||
Loading…
Reference in a new issue