General progress - untested with live traffic
This commit is contained in:
parent
fbac51b3e9
commit
26baa3c26c
19
bridge.py
19
bridge.py
|
@ -55,9 +55,10 @@ from pprint import pprint
|
|||
import sys
|
||||
from dmrlink import IPSC, systems, reporting_loop, dmr_nat, logger, hex_str_3, hex_str_4, int_id
|
||||
from dmrlink import CONFIG
|
||||
from ipsc.ipsc_const import BURST_DATA_TYPE
|
||||
|
||||
NETWORKS = CONFIG['SYSTEMS']
|
||||
REPORTS = CONFIG['REPORTS']
|
||||
#NETWORKS = CONFIG['SYSTEMS']
|
||||
#REPORTS = CONFIG['REPORTS']
|
||||
|
||||
__author__ = 'Cortney T. Buffington, N0MJS'
|
||||
__copyright__ = 'Copyright (c) 2013 - 2016 Cortney T. Buffington, N0MJS and the K0USY Group'
|
||||
|
@ -98,9 +99,9 @@ for _ipsc in RULES_FILE:
|
|||
_rule['OFF'][i] = hex_str_3(_rule['OFF'][i])
|
||||
_rule['TIMEOUT']= _rule['TIMEOUT']*60
|
||||
_rule['TIMER'] = time() + _rule['TIMEOUT']
|
||||
if _ipsc not in NETWORKS:
|
||||
if _ipsc not in CONFIG['SYSTEMS']:
|
||||
sys.exit('ERROR: Bridge rules found for an IPSC network not configured in main configuration')
|
||||
for _ipsc in NETWORKS:
|
||||
for _ipsc in CONFIG['SYSTEMS']:
|
||||
if _ipsc not in RULES_FILE:
|
||||
sys.exit('ERROR: Bridge rules not found for all IPSC network configured')
|
||||
|
||||
|
@ -432,15 +433,15 @@ if __name__ == '__main__':
|
|||
logger.info('DMRlink \'bridge.py\' (c) 2013-2015 N0MJS & the K0USY Group - SYSTEM STARTING...')
|
||||
|
||||
# INITIALIZE AN IPSC OBJECT (SELF SUSTAINING) FOR EACH CONFIGUED IPSC
|
||||
for ipsc_network in NETWORKS:
|
||||
if NETWORKS[ipsc_network]['LOCAL']['ENABLED']:
|
||||
for ipsc_network in CONFIG['SYSTEMS']:
|
||||
if CONFIG['SYSTEMS'][ipsc_network]['LOCAL']['ENABLED']:
|
||||
systems[ipsc_network] = bridgeIPSC(ipsc_network)
|
||||
reactor.listenUDP(NETWORKS[ipsc_network]['LOCAL']['PORT'], systems[ipsc_network], interface=NETWORKS[ipsc_network]['LOCAL']['IP'])
|
||||
reactor.listenUDP(CONFIG['SYSTEMS'][ipsc_network]['LOCAL']['PORT'], systems[ipsc_network], interface=CONFIG['SYSTEMS'][ipsc_network]['LOCAL']['IP'])
|
||||
|
||||
# INITIALIZE THE REPORTING LOOP IF CONFIGURED
|
||||
if REPORTS['REPORT_NETWORKS']:
|
||||
if CONFIG['REPORTS']['REPORT_NETWORKS']:
|
||||
reporting = task.LoopingCall(reporting_loop)
|
||||
reporting.start(REPORTS['REPORT_INTERVAL'])
|
||||
reporting.start(CONFIG['REPORTS']['REPORT_INTERVAL'])
|
||||
|
||||
# INITIALIZE THE REPORTING LOOP IF CONFIGURED
|
||||
rule_timer = task.LoopingCall(rule_timer_loop)
|
||||
|
|
13
dmrlink.py
13
dmrlink.py
|
@ -612,19 +612,19 @@ def print_peer_list(_network):
|
|||
#
|
||||
def print_master(_network):
|
||||
if CONFIG['SYSTEMS'][_network]['LOCAL']['MASTER_PEER']:
|
||||
print('DMRlink is the Master for %s' % _network)
|
||||
print('DMRlink is the Master for %s'.format(_network))
|
||||
else:
|
||||
_master = CONFIG['SYSTEMS'][_network]['MASTER']
|
||||
print('Master for %s' % _network)
|
||||
print('\tRADIO ID: {}' .format(int(h(_master['RADIO_ID']), 16)))
|
||||
print('\tRADIO ID: {}'.format(int(h(_master['RADIO_ID']), 16)))
|
||||
if _master['MODE_DECODE'] and CONFIG['REPORTS']['PRINT_PEERS_INC_MODE']:
|
||||
print('\t\tMode Values:')
|
||||
for name, value in _master['MODE_DECODE'].items():
|
||||
print('\t\t\t{}: {}' .format(name, value))
|
||||
print('\t\t\t{}: {}'.format(name, value))
|
||||
if _master['FLAGS_DECODE'] and CONFIG['REPORTS']['PRINT_PEERS_INC_FLAGS']:
|
||||
print('\t\tService Flags:')
|
||||
for name, value in _master['FLAGS_DECODE'].items():
|
||||
print('\t\t\t{}: {}' .format(name, value))
|
||||
print('\t\t\t{}: {}'.format(name, value))
|
||||
print('\t\tStatus: {}, KeepAlives Sent: {}, KeepAlives Outstanding: {}, KeepAlives Missed: {}' .format(_master['STATUS']['CONNECTED'], _master['STATUS']['KEEP_ALIVES_SENT'], _master['STATUS']['KEEP_ALIVES_OUTSTANDING'], _master['STATUS']['KEEP_ALIVES_MISSED']))
|
||||
print('\t\t KeepAlives Received: {}, Last KeepAlive Received at: {}' .format(_master['STATUS']['KEEP_ALIVES_RECEIVED'], _master['STATUS']['KEEP_ALIVE_RX_TIME']))
|
||||
|
||||
|
@ -645,8 +645,9 @@ if CONFIG['REPORTS']['REPORT_NETWORKS'] == 'PICKLE':
|
|||
elif CONFIG['REPORTS']['REPORT_NETWORKS'] == 'PRINT':
|
||||
def reporting_loop():
|
||||
logger.debug('Periodic Reporting Loop Started (PRINT)')
|
||||
print_master(CONFIG['SYSTEMS'])
|
||||
print_peer_list(CONFIG['SYSTEMS'])
|
||||
for system in CONFIG['SYSTEMS']:
|
||||
print_master(system)
|
||||
print_peer_list(system)
|
||||
|
||||
else:
|
||||
def reporting_loop():
|
||||
|
|
Loading…
Reference in New Issue