From 37521fc7f1f853227b93c47818061d2548115a26 Mon Sep 17 00:00:00 2001 From: KF7EEL Date: Wed, 25 Nov 2020 12:02:58 -0800 Subject: [PATCH] implement custom UNIT time --- bridge.py | 16 ++++++++++++---- rules_SAMPLE.py | 8 ++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/bridge.py b/bridge.py index 0047820..ae302d1 100755 --- a/bridge.py +++ b/bridge.py @@ -56,6 +56,9 @@ import pickle import logging logger = logging.getLogger(__name__) +# Import UNIT time from rules.py +from rules import UNIT_TIME + # Does anybody read this stuff? There's a PEP somewhere that says I should do this. __author__ = 'Cortney T. Buffington, N0MJS' @@ -152,11 +155,11 @@ def rule_timer_loop(): else: logger.debug('(ROUTER) Conference Bridge NO ACTION: System: %s, Bridge: %s, TS: %s, TGID: %s', _system['SYSTEM'], _bridge, _system['TS'], int_id(_system['TGID'])) - _then = _now - 60 + _then = _now - 60 * UNIT_TIME remove_list = [] for unit in UNIT_MAP: - if UNIT_MAP[unit][1] < (_then): - remove_list.append(unit) + if UNIT_MAP[unit][1] < (_then): + remove_list.append(unit) for unit in remove_list: del UNIT_MAP[unit] @@ -575,8 +578,12 @@ class routerOBP(OPENBRIDGE): self.group_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data) elif _call_type == 'unit': self.unit_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data) - elif _call_type == 'vscsbk': + elif _call_type == 'vcsbk': + # Route CSBK packets to destination TG. Necessary for group data to work with GPS/Data decoder. logger.debug('CSBK recieved, but HBlink does not process them currently') + self.group_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data) + logger.debug('CSBK recieved, but HBlink does not process them currently. Packets routed to talkgroup.') + else: logger.error('Unknown call type recieved -- not processed') @@ -1052,6 +1059,7 @@ class routerHBP(HBSYSTEM): self.unit_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data) elif _call_type == 'vcsbk': # Route CSBK packets to destination TG. Necessary for group data to work with GPS/Data decoder. + logger.debug('CSBK recieved, but HBlink does not process them currently') self.group_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data) logger.debug('CSBK recieved, but HBlink does not process them currently. Packets routed to talkgroup.') else: diff --git a/rules_SAMPLE.py b/rules_SAMPLE.py index b46a46a..6f234c0 100755 --- a/rules_SAMPLE.py +++ b/rules_SAMPLE.py @@ -53,6 +53,14 @@ list the names of each system that should bridge unit to unit (individual) calls UNIT = ['ONE', 'TWO'] +''' +The amount of time to keep sending private calls to a system before flooding again +''' +UNIT_TIME = 15 + +''' +''' +#UNIT_STATIC = {b'0\x1e\xb7': ('HOTSPOT', 1924991999)} ''' This is for testing the syntax of the file. It won't eliminate all errors, but running this file like it were a Python program itself will tell you if the syntax is correct!