From 539d4b852a030001b504a086c86850bb74016cc7 Mon Sep 17 00:00:00 2001 From: Cort Buffington Date: Thu, 25 Aug 2016 21:27:10 -0500 Subject: [PATCH 1/3] Now it works --- hb_router.py | 10 +++++----- hblink.py | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/hb_router.py b/hb_router.py index 7a3e149..f84458e 100755 --- a/hb_router.py +++ b/hb_router.py @@ -72,7 +72,7 @@ class routerMASTER(HBMASTER): _target = rule['DST_NET'] if _target in RULES: systems[_target].send_system(_data) - logger.debug('(%s) Packet routed %s to system: %s', self._master, CONFIG[_target]['MODE'], _target) + logger.debug('(%s) Packet routed %s to system: %s', self._master, CONFIG['SYSTEMS'][_target]['MODE'], _target) else: logger.debug('(%s) Packet router found no target for packet. Destination was: %s on target network %s', self._master, _dst_id, _target) @@ -85,8 +85,8 @@ class routerCLIENT(HBCLIENT): for rule in RULES[self._client]['GROUP_VOICE']: _target = rule['DST_NET'] if _target in RULES: - system[_target].send_system(_data) - logger.debug('(%s) Packet routed to %s system: %s', self._client, CONFIG[_target]['MODE'], _target) + systems[_target].send_system(_data) + logger.debug('(%s) Packet routed to %s system: %s', self._client, CONFIG['SYSTEMS'][_target]['MODE'], _target) else: logger.debug('(%s) Packet router found no target for packet. Destination was: %s on target network %s', self._client, _dst_id, _target) @@ -103,9 +103,9 @@ if __name__ == '__main__': for system in CONFIG['SYSTEMS']: if CONFIG['SYSTEMS'][system]['ENABLED']: if CONFIG['SYSTEMS'][system]['MODE'] == 'MASTER': - systems[system] = HBMASTER(system) + systems[system] = routerMASTER(system) elif CONFIG['SYSTEMS'][system]['MODE'] == 'CLIENT': - systems[system] = HBCLIENT(system) + systems[system] = routerCLIENT(system) reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP']) logger.debug('%s instance created: %s, %s', CONFIG['SYSTEMS'][system]['MODE'], system, systems[system]) diff --git a/hblink.py b/hblink.py index 0d1f359..1003187 100755 --- a/hblink.py +++ b/hblink.py @@ -235,7 +235,6 @@ class HBMASTER(DatagramProtocol): else: _frame_type = 'none' _stream_id = _data[16:20] - #logger.debug('(%s) DMRD - Seqence: %s, RF Source: %s, Destination ID: %s', self._master, int_id(_seq), int_id(_rf_src), int_id(_dst_id)) # If AMBE audio exporting is configured... From 4dbb541845d47b648f3e0eec87435c91b11b020a Mon Sep 17 00:00:00 2001 From: Cort Buffington Date: Thu, 25 Aug 2016 21:29:58 -0500 Subject: [PATCH 2/3] preparing to merge master --- .gitignore | 1 + hb_router.py | 2 +- hb_routing_rules-SAMPLE.py | 28 ++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 hb_routing_rules-SAMPLE.py diff --git a/.gitignore b/.gitignore index dacd793..561881f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ Icon *.lcl *.conf hblink.cfg +hb_routing_rules.py *.config *.json *.pickle diff --git a/hb_router.py b/hb_router.py index f84458e..70e8d02 100755 --- a/hb_router.py +++ b/hb_router.py @@ -72,7 +72,7 @@ class routerMASTER(HBMASTER): _target = rule['DST_NET'] if _target in RULES: systems[_target].send_system(_data) - logger.debug('(%s) Packet routed %s to system: %s', self._master, CONFIG['SYSTEMS'][_target]['MODE'], _target) + logger.debug('(%s) Packet routed to %s system: %s', self._master, CONFIG['SYSTEMS'][_target]['MODE'], _target) else: logger.debug('(%s) Packet router found no target for packet. Destination was: %s on target network %s', self._master, _dst_id, _target) diff --git a/hb_routing_rules-SAMPLE.py b/hb_routing_rules-SAMPLE.py new file mode 100644 index 0000000..164a495 --- /dev/null +++ b/hb_routing_rules-SAMPLE.py @@ -0,0 +1,28 @@ +RULES = { + 'MASTER-1': { + 'GROUP_HANGTIME': 5, + 'GROUP_VOICE': [ + {'NAME': 'STATEWIDE', 'ACTIVE': False, 'ON': [8,], 'OFF': [9,10], 'SRC_TS': 1, 'SRC_GROUP': 1, 'DST-TYPE': 'CLIENT', 'DST_NET': 'REPEATER-1', 'DST_TS': 2, 'DST_GROUP': 2}, + # When DMRD received on this MASTER, Time Slot 1, Talk Group 1; send to CLIENT-1 on Time Slot 2 Talk Group 2 + # This rule is NOT enabled by default + # This rule can be enabled by transmitting on TGID 8 + # This rule can be disabled by transmitting on TGID 9 or 10 + # Repeat the above line for as many rules for this IPSC network as you want. + ] + }, + 'REPEATER-1': { + 'GROUP_HANGTIME': 5, + 'GROUP_VOICE': [ + {'NAME': 'STATEWIDE', 'ACTIVE': False, 'ON': [8,], 'OFF': [9,10], 'SRC_TS': 1, 'SRC_GROUP': 1, 'DST-TYPE': 'MASTER', 'DST_NET': 'MASTER-1', 'DST_TS': 2, 'DST_GROUP': 2}, + # When DMRD received on this CLIENT, Time Slot 1, Talk Group 1; send to MASTER-1 on Time Slot 2 Talk Group 2 + # This rule is NOT enabled by default + # This rule can be enabled by transmitting on TGID 8 + # This rule can be disabled by transmitting on TGID 9 or 10 + # Repeat the above line for as many rules for this IPSC network as you want. + ] + }, +} + +if __name__ == '__main__': + from pprint import pprint + pprint(RULES) \ No newline at end of file From 5760db55fa4fc96974ad325c66831ce364a2fffa Mon Sep 17 00:00:00 2001 From: Cort Buffington Date: Thu, 25 Aug 2016 21:30:57 -0500 Subject: [PATCH 3/3] Delete hb_routing_rules.py --- hb_routing_rules.py | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 hb_routing_rules.py diff --git a/hb_routing_rules.py b/hb_routing_rules.py deleted file mode 100644 index 164a495..0000000 --- a/hb_routing_rules.py +++ /dev/null @@ -1,28 +0,0 @@ -RULES = { - 'MASTER-1': { - 'GROUP_HANGTIME': 5, - 'GROUP_VOICE': [ - {'NAME': 'STATEWIDE', 'ACTIVE': False, 'ON': [8,], 'OFF': [9,10], 'SRC_TS': 1, 'SRC_GROUP': 1, 'DST-TYPE': 'CLIENT', 'DST_NET': 'REPEATER-1', 'DST_TS': 2, 'DST_GROUP': 2}, - # When DMRD received on this MASTER, Time Slot 1, Talk Group 1; send to CLIENT-1 on Time Slot 2 Talk Group 2 - # This rule is NOT enabled by default - # This rule can be enabled by transmitting on TGID 8 - # This rule can be disabled by transmitting on TGID 9 or 10 - # Repeat the above line for as many rules for this IPSC network as you want. - ] - }, - 'REPEATER-1': { - 'GROUP_HANGTIME': 5, - 'GROUP_VOICE': [ - {'NAME': 'STATEWIDE', 'ACTIVE': False, 'ON': [8,], 'OFF': [9,10], 'SRC_TS': 1, 'SRC_GROUP': 1, 'DST-TYPE': 'MASTER', 'DST_NET': 'MASTER-1', 'DST_TS': 2, 'DST_GROUP': 2}, - # When DMRD received on this CLIENT, Time Slot 1, Talk Group 1; send to MASTER-1 on Time Slot 2 Talk Group 2 - # This rule is NOT enabled by default - # This rule can be enabled by transmitting on TGID 8 - # This rule can be disabled by transmitting on TGID 9 or 10 - # Repeat the above line for as many rules for this IPSC network as you want. - ] - }, -} - -if __name__ == '__main__': - from pprint import pprint - pprint(RULES) \ No newline at end of file