mirror of https://github.com/kf7eel/hbnet
add DASHBOARD_ONLY for FreeDMR and HBLink, initial commit
This commit is contained in:
parent
0872ca716e
commit
abccaa06ea
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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'),
|
||||
})
|
||||
|
||||
|
|
|
|||
10
web/app.py
10
web/app.py
|
|
@ -5084,6 +5084,11 @@ Name: <strong>''' + p.name + '''</strong> - Port: <strong>''' + str(
|
|||
<p style="text-align: center;"> </p>
|
||||
'''
|
||||
else:
|
||||
dash_only_data_gateway_link = ''
|
||||
if mode == 'DASH_ONLY':
|
||||
dash_only_data_gateway_link = '''
|
||||
<p style="text-align: center;"><a href="/unit/DATA_GATEWAY"><strong>DATA_GATEWAY Unit Table</strong></a></p>
|
||||
'''
|
||||
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: <strong>''' + p.name + '''</strong> - Port: <strong>''' + str(
|
|||
<tr>
|
||||
<td style="text-align: center;"><a href="manage_servers?add=new"><button type="button" class="btn btn-success">Add Server Config</button></a></td>
|
||||
</tr>
|
||||
|
||||
''' + dash_only_data_gateway_link + '''
|
||||
</tbody>
|
||||
</table>
|
||||
<p> </p>
|
||||
|
|
@ -7295,7 +7302,8 @@ Name: <strong>''' + p.name + '''</strong> - Port: <strong>''' + 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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue