From 19f49d4e7ad20ea2e3949cfa538b2538b486deac Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 3 Nov 2021 01:51:21 +0000 Subject: [PATCH] Send inbound unit data to DATA_GATEWAY --- bridge_master.py | 39 +++++++++++++++++++++++++++++++++++++++ config.py | 3 ++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/bridge_master.py b/bridge_master.py index d600e07..a1b100a 100644 --- a/bridge_master.py +++ b/bridge_master.py @@ -1418,6 +1418,25 @@ class routerOBP(OPENBRIDGE): #logger.info('(%s) UNIT Data Bridged to OBP System: %s DST_ID: %s', self._system, system,_int_dst_id) #if CONFIG['REPORTS']['REPORT']: #systems[system]._report.send_bridgeEvent('UNIT DATA,START,TX,{},{},{},{},{},{}'.format(system, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), 1, _int_dst_id).encode(encoding='utf-8', errors='ignore')) + + #This allow careful daisychaining to reach a DATA_GATEWAY + #Send UNIT data to data gateway + if CONFIG['GLOBAL']['DATA_GATEWAY'] and CONFIG['GLOBAL']['DATA_GATEWAY'] in systems \ + and CONFIG['SYSTEMS'][CONFIG['SYSTEMS']['DATA_GATEWAY']]['MODE'] == OPENBRIDGE: + #Clear the TS bit -- all OpenBridge streams are effectively on TS1 + _tmp_bits = _bits & ~(1 << 7) + #Assemble transmit HBP packet header + _tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]]) + _tmp_data = b''.join([_tmp_data, dmrpkt]) + systems[system].send_system(_tmp_data) + logger.info('(%s) UNIT Data Bridged to DATA_GATEWAY: %s DST_ID: %s', self._system,CONFIG['GLOBAL']['DATA_GATEWAY'],_int_dst_id) + if CONFIG['REPORTS']['REPORT']: + systems[system]._report.send_bridgeEvent('UNIT DATA,START,TX,{},{},{},{},{},{}'.format(system, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), 1, _int_dst_id).encode(encoding='utf-8', errors='ignore')) + else: + if not CONFIG['GLOBAL']['DATA_GATEWAY']: + logger.info('(%s) UNIT Data not Bridged - no DATA_GATEWAY: %s DST_ID: %s',self._system,_int_dst_id) + else: + logger.info('(%s) UNIT Data not Bridged - Problem with DATA_GATEWAY: %s DST_ID: %s',self._system,_int_dst_id) if _call_type == 'group' or _call_type == 'vcsbk': @@ -1881,6 +1900,26 @@ class routerHBP(HBSYSTEM): #logger.info('(%s) UNIT Data Bridged to OBP System: %s DST_ID: %s', self._system, system,_int_dst_id) #if CONFIG['REPORTS']['REPORT']: #systems[system]._report.send_bridgeEvent('UNIT DATA,START,TX,{},{},{},{},{},{}'.format(system, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), 1, _int_dst_id).encode(encoding='utf-8', errors='ignore')) + + #Send UNIT data to data gateway + if CONFIG['GLOBAL']['DATA_GATEWAY'] and CONFIG['GLOBAL']['DATA_GATEWAY'] in systems \ + and CONFIG['SYSTEMS'][CONFIG['SYSTEMS']['DATA_GATEWAY']]['MODE'] == OPENBRIDGE: + #Clear the TS bit -- all OpenBridge streams are effectively on TS1 + _tmp_bits = _bits & ~(1 << 7) + #Assemble transmit HBP packet header + _tmp_data = b''.join([_data[:15], _tmp_bits.to_bytes(1, 'big'), _data[16:20]]) + _tmp_data = b''.join([_tmp_data, dmrpkt]) + systems[system].send_system(_tmp_data) + logger.info('(%s) UNIT Data Bridged to DATA_GATEWAY: %s DST_ID: %s', self._system,CONFIG['GLOBAL']['DATA_GATEWAY'],_int_dst_id) + if CONFIG['REPORTS']['REPORT']: + systems[system]._report.send_bridgeEvent('UNIT DATA,START,TX,{},{},{},{},{},{}'.format(system, int_id(_stream_id), int_id(_peer_id), int_id(_rf_src), 1, _int_dst_id).encode(encoding='utf-8', errors='ignore')) + else: + if not CONFIG['GLOBAL']['DATA_GATEWAY']: + logger.info('(%s) UNIT Data not Bridged - no DATA_GATEWAY: %s DST_ID: %s',self._system,_int_dst_id) + else: + logger.info('(%s) UNIT Data not Bridged - Problem with DATA_GATEWAY: %s DST_ID: %s',self._system,_int_dst_id) + + diff --git a/config.py b/config.py index 51b6c4e..cecd047 100755 --- a/config.py +++ b/config.py @@ -145,7 +145,8 @@ def build_config(_config_file): 'GEN_STAT_BRIDGES': config.getboolean(section, 'GEN_STAT_BRIDGES'), 'ALLOW_NULL_PASSPHRASE': config.getboolean(section, 'ALLOW_NULL_PASSPHRASE'), 'ANNOUNCEMENT_LANGUAGES': config.get(section, 'ANNOUNCEMENT_LANGUAGES'), - 'SERVER_ID': config.getint(section, 'SERVER_ID').to_bytes(4, 'big') + 'SERVER_ID': config.getint(section, 'SERVER_ID').to_bytes(4, 'big'), + 'DATA_GATEWAY': config.get(section, 'DATA_GATEWAY') }) if not CONFIG['GLOBAL']['ANNOUNCEMENT_LANGUAGES']: