From abccaa06eabe469f0694b03015432bf889722484 Mon Sep 17 00:00:00 2001 From: KF7EEL Date: Thu, 17 Mar 2022 09:41:11 -0700 Subject: [PATCH] add DASHBOARD_ONLY for FreeDMR and HBLink, initial commit --- data_gateway-SAMPLE.cfg | 5 ++++- data_gateway.py | 15 ++++++--------- data_gateway_config.py | 1 + web/app.py | 10 +++++++++- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/data_gateway-SAMPLE.cfg b/data_gateway-SAMPLE.cfg index 35e5c7b..3a943c8 100644 --- a/data_gateway-SAMPLE.cfg +++ b/data_gateway-SAMPLE.cfg @@ -110,10 +110,13 @@ STALE_DAYS: 7 THIS_SERVER_NAME: DATA_GATEWAY # This must be set to True in order to use the web service an any mode. REMOTE_CONFIG_ENABLED: False +# FreeDMR and HBLink - set DASHBOARD_ONLY to True, leave THIS_SERVER_NAME and SHARED_SECRET as DATA_GATEWAY +# HBNet - set DASHBOARD_ONLY to False +DASHBOARD_ONLY: False # URL of the user managment server URL: http://localhost:8080/svr ### Secret used to authenticate with web service -SHARED_SECRET: test +SHARED_SECRET: DATA_GATEWAY [DATA_CONFIG] DATA_DMR_ID: 9099 diff --git a/data_gateway.py b/data_gateway.py index f2ea29d..905f72c 100644 --- a/data_gateway.py +++ b/data_gateway.py @@ -1395,14 +1395,14 @@ def send_sms(csbk, to_id, from_id, peer_id, call_type, msg, snd_slot = 1): systems[UNIT_MAP[bytes.fromhex(to_id)][0]].send_system(d) # Sleep to prevent overflowing of Pi-Star buffer sleep(pistar_overflow) - logger.info('Sending on TS: ' + str(slot)) + logger.info('User in map. Sending on TS: ' + str(slot + 1)) elif CONFIG['SYSTEMS'][UNIT_MAP[bytes.fromhex(to_id)][0]]['MODE'] == 'OPENBRIDGE' and CONFIG['SYSTEMS'][UNIT_MAP[bytes.fromhex(to_id)][0]]['BOTH_SLOTS'] == True or CONFIG['SYSTEMS'][UNIT_MAP[bytes.fromhex(to_id)][0]]['MODE'] != 'OPENBRIDGE' and CONFIG['SYSTEMS'][UNIT_MAP[bytes.fromhex(to_id)][0]]['ENABLED'] == True: snd_seq_lst = create_sms_seq(to_id, from_id, peer_id, int(slot), call_type, snd_sms) for d in snd_seq_lst: systems[UNIT_MAP[bytes.fromhex(to_id)][0]].send_system(d) # Sleep to prevent overflowing of Pi-Star buffer sleep(pistar_overflow) - logger.info('Sending on TS: ' + str(slot)) + logger.info('User in map. Sending on TS: ' + str(slot + 1)) # We don't know where the user is elif bytes.fromhex(to_id) not in UNIT_MAP: for s in CONFIG['SYSTEMS']: @@ -1413,14 +1413,14 @@ def send_sms(csbk, to_id, from_id, peer_id, call_type, msg, snd_slot = 1): systems[s].send_system(d) # Sleep to prevent overflowing of Pi-Star buffer sleep(pistar_overflow) - logger.info('User not in map. Sending on TS: ' + str(slot)) + logger.info('User not in map. Sending on TS: ' + str(slot + 1)) elif CONFIG['SYSTEMS'][s]['MODE'] == 'OPENBRIDGE' and CONFIG['SYSTEMS'][s]['BOTH_SLOTS'] == True and CONFIG['SYSTEMS'][s]['ENABLED'] == True or CONFIG['SYSTEMS'][s]['MODE'] != 'OPENBRIDGE' and CONFIG['SYSTEMS'][s]['ENABLED'] == True: snd_seq_lst = create_sms_seq(to_id, from_id, peer_id, int(slot), call_type, snd_sms) for d in snd_seq_lst: systems[s].send_system(d) # Sleep to prevent overflowing of Pi-Star buffer sleep(pistar_overflow) - logger.info('User not in map. Sending on TS: ' + str(slot)) + logger.info('User not in map. Sending on TS: ' + str(slot + 1)) if ascii_call_type == 'group': snd_seq_lst = create_sms_seq(to_id, from_id, peer_id, int(slot), 0, snd_sms) for s in CONFIG['SYSTEMS']: @@ -1890,7 +1890,6 @@ def data_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _fr logger.info('\n\n' + 'Received SMS from ' + str(get_alias(int_id(_rf_src), subscriber_ids)) + ', DMR ID: ' + str(int_id(_rf_src)) + ': ' + str(msg_found) + '\n') if int_id(_dst_id) in data_id: - print('process sms') process_sms(_rf_src, msg_found, _call_type, UNIT_MAP[_rf_src][0]) if int_id(_dst_id) not in data_id: dashboard_sms_write(str(get_alias(int_id(_rf_src), subscriber_ids)), str(get_alias(int_id(_dst_id), subscriber_ids)), int_id(_dst_id), int_id(_rf_src), msg_found, time(), UNIT_MAP[_rf_src][0]) @@ -2028,12 +2027,9 @@ class OBP(OPENBRIDGE): def svrd_received(self, _mode, _data): logger.debug('SVRD RCV') - print(_mode) if _mode == b'UNIT': UNIT_MAP[_data] = (self._system, time()) if _mode == b'APRS': -## print(_data) -## print(self._system) peer_aprs[self._system] = ast.literal_eval(_data.decode('utf-8')) if _mode == b'DATA' or _mode == b'MDAT': @@ -2140,7 +2136,8 @@ if __name__ == '__main__': if CONFIG['WEB_SERVICE']['REMOTE_CONFIG_ENABLED']: - CONFIG = download_config(CONFIG, cli_args.CONFIG_FILE) + if CONFIG['WEB_SERVICE']['DASHBOARD_ONLY'] == False: + CONFIG = download_config(CONFIG, cli_args.CONFIG_FILE) data_id_str = str('[' + CONFIG['DATA_CONFIG']['DATA_DMR_ID'] + ']') data_id = ast.literal_eval(data_id_str) diff --git a/data_gateway_config.py b/data_gateway_config.py index edb1591..8d5cff5 100644 --- a/data_gateway_config.py +++ b/data_gateway_config.py @@ -162,6 +162,7 @@ def build_config(_config_file): 'THIS_SERVER_NAME': config.get(section, 'THIS_SERVER_NAME'), 'URL': config.get(section, 'URL'), 'REMOTE_CONFIG_ENABLED': config.getboolean(section, 'REMOTE_CONFIG_ENABLED'), + 'DASHBOARD_ONLY': config.getboolean(section, 'DASHBOARD_ONLY'), 'SHARED_SECRET': config.get(section, 'SHARED_SECRET'), }) diff --git a/web/app.py b/web/app.py index 224ed60..db04a66 100644 --- a/web/app.py +++ b/web/app.py @@ -5084,6 +5084,11 @@ Name: ''' + p.name + '''  -  Port: ''' + str(

 

''' else: + dash_only_data_gateway_link = '' + if mode == 'DASH_ONLY': + dash_only_data_gateway_link = ''' +

DATA_GATEWAY Unit Table

+''' all_s = ServerList.query.all() pl = Misc.query.filter_by(field_1='ping_list').first() ping_list = ast.literal_eval(pl.field_2) @@ -5095,6 +5100,8 @@ Name: ''' + p.name + '''  -  Port: ''' + str( + +''' + dash_only_data_gateway_link + '''

 

@@ -7295,7 +7302,8 @@ Name: ''' + p.name + '''  -  Port: ''' + str( def svr_endpoint(): hblink_req = request.json print((hblink_req)) - if hblink_req['secret'] in shared_secrets(): + # 'd3967357e0b5788a03a1a61acefa72af8d2dbfe282d8718809f90fcc6f4aca41' = DATA_GATEWAY + if hblink_req['secret'] in shared_secrets() or hblink_req['secret'] == 'd3967357e0b5788a03a1a61acefa72af8d2dbfe282d8718809f90fcc6f4aca41' and mode == 'DASH_ONLY': try: if hblink_req['ping']: pl = Misc.query.filter_by(field_1='ping_list').first()