move creation of ric-sub as char to poc-decoder

This commit is contained in:
JHCD 2015-06-05 11:26:01 +02:00
parent 2d8c5e4bf5
commit 300675a0e3
6 changed files with 12 additions and 10 deletions

View file

@ -194,7 +194,7 @@ try:
except:
logging.exception("cannot read config file")
else:
# initialization of was fine, continue with main program...
# initialization was fine, continue with main program...
try:
#
@ -261,7 +261,7 @@ try:
# ZVEI2: 25832
# FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST2=III(mit NA,ohneSIGNAL)) CRC correct\n'
# POCSAG1200: Address: 1234567 Function: 1 Alpha: Hello World
#decoded = str(multimon_ng.stdout.readline()) #Get line data from multimon stdout
decoded = str(multimon_ng.stdout.readline()) #Get line data from multimon stdout
# Test-strings only for develop
#decoded = "ZVEI2: 25832"

View file

@ -149,11 +149,11 @@ zvei_message = %TIME%: %ZVEI%
# %RIC% = Pocsag RIC
# %FUNC% = Pocsac function/Subric (1-4)
# %FUNCD% = Pocsac function/Subric (a-d)
# %FUNCCHAR% = Pocsac function/Subric als character (a-d)
# %MSG% = Message of the Pocsag telegram
# %BITRATE% = Bitrate of the Pocsag telegram
# %TIME% = Date/Time (by script)
poc_subject = Alarm: %RIC%%FUNCD%
poc_subject = Alarm: %RIC%%FUNCCHAR%
poc_message = %TIME%: %MSG%

View file

@ -111,6 +111,8 @@ def decode(freq, decoded):
else:
logging.info("POCSAG%s: %s %s %s ", bitrate, poc_id, poc_sub, poc_text)
data = {"ric":poc_id, "function":poc_sub, "msg":poc_text, "bitrate":bitrate}
# Add function as character a-d to dataset
data["functionChar"] = data["function"].replace("1", "a").replace("2", "b").replace("3", "c").replace("4", "d")
from includes import alarmHandler
alarmHandler.processAlarm("POC",freq,data)

View file

@ -157,8 +157,7 @@ def run(typ,freq,data):
logging.debug("Start POC to BosMon")
try:
# BosMon-Telegramin expected "a-d" as RIC-sub/function
data["function"] = data["function"].replace("1", "a").replace("2", "b").replace("3", "c").replace("4", "d")
params = urllib.urlencode({'type':'pocsag', 'address':data["ric"], 'flags':'0', 'function':data["function"], 'message':data["msg"]})
params = urllib.urlencode({'type':'pocsag', 'address':data["ric"], 'flags':'0', 'function':data["functionChar"], 'message':data["msg"]})
logging.debug(" - Params: %s", params)
# dispatch the BosMon-request
bosMonRequest(httprequest, params, headers)

View file

@ -156,16 +156,16 @@ def run(typ,freq,data):
elif typ == "POC":
logging.debug("Start POC to eMail")
try:
# replace 1-4 with a-d for use as %FUNCD%
data["functionD"] = data["function"].replace("1", "a").replace("2", "b").replace("3", "c").replace("4", "d")
# read subject-structure from config.ini
subject = globals.config.get("eMail", "poc_subject")
subject = subject.replace("%RIC%", data["ric"]).replace("%FUNC%", data["function"]).replace("%FUNCD%", data["functionD"]) #replace Wildcards
subject = subject.replace("%RIC%", data["ric"]) #replace Wildcards
subject = subject.replace("%FUNC%", data["function"]).replace("%FUNCCHAR%", data["functionChar"]) #replace Wildcards
subject = subject.replace("%MSG%", data["msg"]).replace("%BITRATE%", str(data["bitrate"])) #replace Wildcards
subject = subject.replace("%TIME%", curtime()) # replace Wildcards
# read mailtext-structure from config.ini
mailtext = globals.config.get("eMail", "poc_message")
mailtext = mailtext.replace("%RIC%", data["ric"]).replace("%FUNC%", data["function"]).replace("%FUNCD%", data["functionD"]) #replace Wildcards
mailtext = mailtext.replace("%RIC%", data["ric"]) #replace Wildcards
mailtext = mailtext.replace("%FUNC%", data["function"]).replace("%FUNCCHAR%", data["functionChar"]) #replace Wildcards
mailtext = mailtext.replace("%MSG%", data["msg"]).replace("%BITRATE%", str(data["bitrate"])) #replace Wildcards
mailtext = mailtext.replace("%TIME%", curtime()) # replace Wildcards
# send eMail

View file

@ -20,6 +20,7 @@ FMS:
POCSAG:
- ric
- function
- functionChar
- msg
- bitrate