implement static routes for unit calls

This commit is contained in:
KF7EEL 2020-11-25 14:39:28 -08:00
parent ee40ad1e34
commit 471feee9c3
2 changed files with 16 additions and 2 deletions

View File

@ -57,7 +57,7 @@ import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
# Import UNIT time from rules.py # Import UNIT time from rules.py
from rules import UNIT_TIME from rules import UNIT_TIME, STATIC_UNIT
# Does anybody read this stuff? There's a PEP somewhere that says I should do this. # Does anybody read this stuff? There's a PEP somewhere that says I should do this.
@ -76,6 +76,12 @@ __email__ = 'n0mjs@me.com'
# format 'unit_id': ('SYSTEM', time) # format 'unit_id': ('SYSTEM', time)
UNIT_MAP = {} UNIT_MAP = {}
# UNIX time for end of year 2060. This is used to keep subscribers in UNIT_MAP indefinitely to accomplish static routes for unit calls
time_2060 = 2871763199.0000000
# Build a UNIT_MAP based on values in STATIC_MAP.
for i in STATIC_UNIT:
UNIT_MAP[i[0]] = i[1], time_2060
# Timed loop used for reporting HBP status # Timed loop used for reporting HBP status
# #
@ -157,6 +163,7 @@ def rule_timer_loop():
_then = _now - 60 * UNIT_TIME _then = _now - 60 * UNIT_TIME
remove_list = [] remove_list = []
#logger.info(UNIT_MAP)
for unit in UNIT_MAP: for unit in UNIT_MAP:
if UNIT_MAP[unit][1] < (_then): if UNIT_MAP[unit][1] < (_then):
remove_list.append(unit) remove_list.append(unit)

View File

@ -59,8 +59,15 @@ The amount of time to keep sending private calls to a system before flooding aga
UNIT_TIME = 15 UNIT_TIME = 15
''' '''
Input the DMR ID and SYSTEM of a subscriber that you would like to have always have private calls routed. This will not flood all systems.
''' '''
#UNIT_STATIC = {b'0\x1e\xb7': ('HOTSPOT', 1924991999)} STATIC_UNIT = [
[ 123, 'CLIENT-1'],
[ 456 'CLIENT-1'],
[ 789, 'MASTER-1']
]
''' '''
This is for testing the syntax of the file. It won't eliminate all errors, but running this file 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! like it were a Python program itself will tell you if the syntax is correct!