From 219e6830ea346e5b909e312928d072f0fd5792e5 Mon Sep 17 00:00:00 2001 From: MrMurdog Date: Wed, 17 Jan 2024 10:26:53 +0100 Subject: [PATCH] =?UTF-8?q?ab=C3=A4nderung=20Daten=C3=A4nderung=20FMS=20mo?= =?UTF-8?q?dul?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/bosmon.py | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/plugin/bosmon.py b/plugin/bosmon.py index 25a6b40..8fac542 100644 --- a/plugin/bosmon.py +++ b/plugin/bosmon.py @@ -100,9 +100,29 @@ class BoswatchPlugin(PluginBase): def _BosmonRequest_FMS(self, BM_hostname, BM_port, BM_user, BM_passwd, BM_channel, get_FMS, get_status, get_direction, get_tacticalInfo): + + # BosMon-Telegramin expected assembly group, direction and tsi in one field + # structure (binary as hex in base10): + # 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 get_direction == "1": + info = info + 2 # + b0010 + # tsi: + if "IV" in get_tacticalInfo: + info = info + 12 # + b1100 + elif "III" in get_tacticalInfo: + info = info + 8 # + b1000 + elif "II" in get_tacticalInfo: + info = info + 4 # + b0100 + # "I" is nothing to do + b0000 + + url = 'http://'+BM_hostname+':'+BM_port+'/telegramin/'+BM_channel+'/input.xml' - payload = 'type=fms&address='+get_FMS+'&flags=0&status='+get_status+'&info='+_getInfo(get_tacticalInfo, get_direction) + payload = 'type=fms&address='+get_FMS+'&flags=0&status='+get_status+'&info='+info headers = { 'Content-Type': 'application/x-www-form-urlencoded', @@ -110,28 +130,7 @@ class BoswatchPlugin(PluginBase): } requests.request("POST", url, headers=headers, data=payload) - - def _getInfo(get_tacticalInfo2, get_direction2): - - # BosMon-Telegramin expected assembly group, direction and tsi in one field - # structure (binary as hex in base10): - # 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 get_direction2 == "1": - info = info + 2 # + b0010 - # tsi: - if "IV" in get_tacticalInfo2: - info = info + 12 # + b1100 - elif "III" in get_tacticalInfo2: - info = info + 8 # + b1000 - elif "II" in get_tacticalInfo2: - info = info + 4 # + b0100 - # "I" is nothing to do + b0000 - - return info + def _BosmonRequest_Zvei(self, BM_hostname, BM_port, BM_user, BM_passwd, BM_channel, get_zvei_adress):