implement FMS in BosMon-plugin

This commit is contained in:
JHCD 2015-05-24 23:09:38 +02:00
parent 1ccc5bb402
commit 9c3c1f5df4
3 changed files with 32 additions and 16 deletions

View file

@ -180,9 +180,13 @@ try:
#only for develop
#decoded = "ZVEI2: 25832"
#decoded = "FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=III(mit NA,ohneSIGNAL)) CRC correct\n'"
#decoded = "POCSAG1200: Address: 1234567 Function: 1 Alpha: Hello World"
#time.sleep(1)
#decoded = "FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=I (ohneNA,ohneSIGNAL)) CRC correct\n'"
#decoded = "FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 1=LST->FZG 2=I (ohneNA,ohneSIGNAL)) CRC correct\n'"
#decoded = "FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=II (ohneNA,mit SIGNAL)) CRC correct\n'"
decoded = "FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 1=LST->FZG 2=III(mit NA,ohneSIGNAL)) CRC correct\n'"
#decoded = "FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Status 3=Einsatz Ab 0=FZG->LST 2=IV (mit NA,mit SIGNAL)) CRC correct\n'"
#decoded = "POCSAG1200: Address: 1234567 Function: 1 Alpha: Hello World"
time.sleep(1)
from includes import decoder
decoder.decode(args.freq, decoded)

View file

@ -27,7 +27,7 @@ def decode(freq, decoded):
logging.info("FMS double alarm: %s within %s second(s)", globals.fms_id_old, timestamp-globals.fms_time_old)
globals.fms_time_old = timestamp #in case of double alarm, fms_double_ignore_time set new
else:
logging.info("FMS:%s Status:%s Richtung:%s TKI:%s", fms_id[0:8], fms_status, fms_direction, fms_tsi)
logging.info("FMS:%s Status:%s Richtung:%s TSI:%s", fms_id[0:8], fms_status, fms_direction, fms_tsi)
data = {"fms":fms_id[0:8], "status":fms_status, "direction":fms_direction, "tsi":fms_tsi}
from includes import alarmHandler
alarmHandler.processAlarm("FMS",freq,data)

View file

@ -43,22 +43,34 @@ def run(typ,freq,data):
logging.debug("connect to BosMon")
httprequest = httplib.HTTPConnection(globals.config.get("BosMon", "bosmon_server"), globals.config.get("BosMon", "bosmon_port"))
#debug-level to shell (0=no debug|1)
httprequest.set_debuglevel(0)
httprequest.set_debuglevel(1)
except:
logging.exception("cannot connect to BosMon")
else:
if typ == "FMS":
logging.warning("%s not supported", typ)
#logging.debug("Start FMS to BosMon")
#try:
logging.debug("Start FMS to BosMon")
try:
#BosMon-Telegramin expected assembly group, direction and tsi in one field
#structure:
#params = urllib.urlencode({'type':'fms', 'address':data["fms"], 'status':data["status"], 'info':'0', 'flags':'0'})
#logging.debug(" - Params: %s", params)
#bosMonRequest(httprequest, params, headers)
#except:
#logging.error("FMS to BosMon failed")
#structure: Byte 1: assembly group; Byte 2: Direction; Byte 3+4: tactic short info
info = 0
#assembly group:
info = info + 1 # + b0001 (Assumption: is in every time 1 (no output from multimon-ng))
#direction:
if data["direction"] == "1":
info = info + 2 # + b0010
#tsi:
if "IV" in data["tsi"]:
info = info + 12 # + b1100
elif "III" in data["tsi"]:
info = info + 8 # + b1000
elif "II" in data["tsi"]:
info = info + 4 # + b0100
params = urllib.urlencode({'type':'fms', 'address':data["fms"], 'status':data["status"], 'info':info, 'flags':'0'})
logging.debug(" - Params: %s", params)
bosMonRequest(httprequest, params, headers)
except:
logging.exception("FMS to BosMon failed")
elif typ == "ZVEI":
logging.debug("Start ZVEI to BosMon")
@ -67,7 +79,7 @@ def run(typ,freq,data):
logging.debug(" - Params: %s", params)
bosMonRequest(httprequest, params, headers)
except:
logging.error("ZVEI to BosMon failed")
logging.exception("ZVEI to BosMon failed")
elif typ == "POC":
logging.debug("Start POC to BosMon")
@ -78,7 +90,7 @@ def run(typ,freq,data):
logging.debug(" - Params: %s", params)
bosMonRequest(httprequest, params, headers)
except:
logging.error("POC to BosMon failed")
logging.exception("POC to BosMon failed")
else:
logging.warning("Invalid Typ: %s", typ)