From 13c4ee0764463a876e269e5c8d803520d3fa87a2 Mon Sep 17 00:00:00 2001 From: MrMurdog Date: Wed, 17 Jan 2024 09:44:39 +0100 Subject: [PATCH] Zweiter Versuch FMS Debug --- plugin/bosmon.py | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/plugin/bosmon.py b/plugin/bosmon.py index ec01cb2..b07008d 100644 --- a/plugin/bosmon.py +++ b/plugin/bosmon.py @@ -111,7 +111,27 @@ 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): @@ -123,26 +143,4 @@ class BoswatchPlugin(PluginBase): 'Authorization': encode(BM_user, BM_passwd) } - requests.request("POST", url, headers=headers, data=payload) - - def _getInfo(get_tacticalInfo, get_direction): - - # 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 - - return info \ No newline at end of file + requests.request("POST", url, headers=headers, data=payload) \ No newline at end of file