mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-01-20 15:20:16 +01:00
edit pocsag (512/1200/2400 support)
This commit is contained in:
parent
4656fd571e
commit
736d358e88
113
boswatch.py
113
boswatch.py
|
|
@ -236,6 +236,7 @@ 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: XXMSG MEfeweffsjh"
|
||||
#time.sleep(1)
|
||||
|
||||
|
||||
|
|
@ -296,73 +297,57 @@ try:
|
|||
logging.warning("No valid ZVEI: %s", zvei_id)
|
||||
|
||||
|
||||
#POCSAG512 Decoder Section
|
||||
#check POCSAG512: -> validate -> check double alarm -> log
|
||||
#POCSAG512: Address: 1234567 Function: 1 Alpha: XXMSG MEfeweffsjh
|
||||
if "POCSAG512:" in decoded:
|
||||
logging.debug("recieved POCSAG512")
|
||||
#POCSAG Decoder Section
|
||||
#check POCSAG -> validate -> check double alarm -> log
|
||||
if "POCSAG" in decoded:
|
||||
logging.debug("recieved POCSAG")
|
||||
bitrate = 0
|
||||
|
||||
poc_id = decoded[20:27] #POC Code
|
||||
poc_sub = decoded[39].replace("3", "4").replace("2", "3").replace("1", "2").replace("0", "1")
|
||||
if "Alpha:" in decoded: #check if there is a text message
|
||||
poc_text = decoded.split('Alpha: ')[1].strip().rstrip('<EOT>').strip()
|
||||
else:
|
||||
poc_text = ""
|
||||
|
||||
if re.search("[0-9]{7}", poc_id): #if POC is valid
|
||||
if poc_id >= globals.config.getint("BOSWatch", "poc_filter_range_start"):
|
||||
if poc_id <= globals.config.getint("BOSWatch", "poc_filter_range_end"):
|
||||
if poc_id == poc_id_old and timestamp < poc_time_old + globals.config.getint("BOSWatch", "poc_double_ignore_time"): #check for double alarm
|
||||
logging.warning("POC512 double alarm: %s within %s second(s)", poc_id_old, timestamp-poc_time_old)
|
||||
poc_time_old = timestamp #in case of double alarm, poc_double_ignore_time set new
|
||||
else:
|
||||
logging.info("POCSAG512: %s %s %s ", poc_id, poc_sub, poc_text)
|
||||
data = {"ric":poc_id, "function":poc_sub, "msg":poc_text}
|
||||
throwAlarm("POC",data)
|
||||
|
||||
poc_id_old = poc_id #save last id
|
||||
poc_time_old = timestamp #save last time
|
||||
else:
|
||||
logging.warning("POCSAG512: %s out of filter range (high)", poc_id)
|
||||
else:
|
||||
logging.warning("POCSAG512: %s out of filter range (low)", poc_id)
|
||||
else:
|
||||
logging.warning("No valid POCSAG512: %s", poc_id)
|
||||
|
||||
|
||||
#POCSAG1200 Decoder Section
|
||||
#check POCSAG1200: -> validate -> check double alarm -> log
|
||||
#POCSAG1200: Address: 1234567 Function: 1 Alpha: XXMSG MEfeweffsjh
|
||||
if "POCSAG1200:" in decoded:
|
||||
logging.debug("recieved POCSAG1200")
|
||||
|
||||
poc_id = decoded[21:28] #POC Code
|
||||
poc_sub = decoded[40].replace("3", "4").replace("2", "3").replace("1", "2").replace("0", "1")
|
||||
if "Alpha:" in decoded: #check if there is a text message
|
||||
poc_text = decoded.split('Alpha: ')[1].strip().rstrip('<EOT>').strip()
|
||||
else:
|
||||
poc_text = ""
|
||||
if "POCSAG512:" in decoded:
|
||||
bitrate = 512
|
||||
poc_id = decoded[20:27]
|
||||
poc_sub = decoded[39].replace("3", "4").replace("2", "3").replace("1", "2").replace("0", "1")
|
||||
|
||||
if re.search("[0-9]{7}", poc_id): #if POC is valid
|
||||
if poc_id >= globals.config.getint("BOSWatch", "poc_filter_range_start"):
|
||||
if poc_id <= globals.config.getint("BOSWatch", "poc_filter_range_end"):
|
||||
if poc_id == poc_id_old and timestamp < poc_time_old + globals.config.getint("BOSWatch", "poc_double_ignore_time"): #check for double alarm
|
||||
logging.warning("POC1200 double alarm: %s within %s second(s)", poc_id_old, timestamp-poc_time_old)
|
||||
poc_time_old = timestamp #in case of double alarm, poc_double_ignore_time set new
|
||||
else:
|
||||
logging.info("POCSAG1200: %s %s %s", poc_id, poc_sub, poc_text)
|
||||
data = {"ric":poc_id, "function":poc_sub, "msg":poc_text}
|
||||
throwAlarm("POC",data)
|
||||
|
||||
poc_id_old = poc_id #save last id
|
||||
poc_time_old = timestamp #save last time
|
||||
else:
|
||||
logging.warning("POCSAG1200: %s out of filter range", poc_id)
|
||||
else:
|
||||
logging.warning("POCSAG1200: %s out of filter range", poc_id)
|
||||
elif "POCSAG1200:" in decoded:
|
||||
bitrate = 1200
|
||||
poc_id = decoded[21:28]
|
||||
poc_sub = decoded[40].replace("3", "4").replace("2", "3").replace("1", "2").replace("0", "1")
|
||||
|
||||
elif "POCSAG2400:" in decoded:
|
||||
bitrate = 2400
|
||||
poc_id = decoded[21:28]
|
||||
poc_sub = decoded[40].replace("3", "4").replace("2", "3").replace("1", "2").replace("0", "1")
|
||||
|
||||
if bitrate is 0:
|
||||
logging.warning("POCSAG Bitrate not found")
|
||||
else:
|
||||
logging.warning("No valid POCSAG1200: %s", poc_id)
|
||||
|
||||
logging.debug("POCSAG Bitrate: %s", bitrate)
|
||||
|
||||
if "Alpha:" in decoded: #check if there is a text message
|
||||
poc_text = decoded.split('Alpha: ')[1].strip().rstrip('<EOT>').strip()
|
||||
else:
|
||||
poc_text = ""
|
||||
|
||||
if re.search("[0-9]{7}", poc_id): #if POC is valid
|
||||
if int(poc_id) >= globals.config.getint("BOSWatch", "poc_filter_range_start"):
|
||||
if int(poc_id) <= globals.config.getint("BOSWatch", "poc_filter_range_end"):
|
||||
if poc_id == poc_id_old and timestamp < poc_time_old + globals.config.getint("BOSWatch", "poc_double_ignore_time"): #check for double alarm
|
||||
logging.warning("POCSAG%s double alarm: %s within %s second(s)", bitrate, poc_id_old, timestamp-poc_time_old)
|
||||
poc_time_old = timestamp #in case of double alarm, poc_double_ignore_time set new
|
||||
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}
|
||||
throwAlarm("POC",data)
|
||||
|
||||
poc_id_old = poc_id #save last id
|
||||
poc_time_old = timestamp #save last time
|
||||
else:
|
||||
logging.warning("POCSAG%s: %s out of filter range (high)", bitrate, poc_id)
|
||||
else:
|
||||
logging.warning("POCSAG%s: %s out of filter range (low)",bitrate, poc_id)
|
||||
else:
|
||||
logging.warning("No valid POCSAG: %s", poc_id)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
logging.warning("Keyboard Interrupt")
|
||||
except:
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ POCSAG:
|
|||
- ric
|
||||
- function
|
||||
- msg
|
||||
- bitrate
|
||||
|
||||
|
||||
Es stehen folgende globale Objecte zur Verfügung:
|
||||
|
|
|
|||
Loading…
Reference in a new issue