diff --git a/FreeDMR-SAMPLE.cfg b/FreeDMR-SAMPLE.cfg index 2ccd262..ee8b28b 100755 --- a/FreeDMR-SAMPLE.cfg +++ b/FreeDMR-SAMPLE.cfg @@ -184,3 +184,4 @@ VOICE_IDENT: True TS1_STATIC: TS2_STATIC: DEFAULT_REFLECTOR: 0 +GENERATOR: 1 diff --git a/bridge_master.py b/bridge_master.py index 440e193..8418f9a 100755 --- a/bridge_master.py +++ b/bridge_master.py @@ -1888,10 +1888,30 @@ if __name__ == '__main__': listeningPorts = {} + generator = {} + systemdelete = [] + for system in CONFIG['SYSTEMS']: + if CONFIG['SYSTEMS'][system]['ENABLED']: + if CONFIG['SYSTEMS'][system]['MODE'] == 'MASTER' and (CONFIG['SYSTEMS'][system]['GENERATOR'] > 1): + for count in range(CONFIG['SYSTEMS'][system]['GENERATOR']): + _systemname = system+'-'+str(count) + generator[_systemname] = CONFIG['SYSTEMS'][system].copy() + generator[_systemname]['PORT'] = generator[_systemname]['PORT'] + count + logger.debug('(GLOBAL) Generator - generated system %s',_systemname) + systemdelete.append(system) + + for _system in generator: + CONFIG['SYSTEMS'][_system] = generator[_system] + for _system in systemdelete: + CONFIG['SYSTEMS'].pop(_system) + + del generator + del systemdelete + for system in CONFIG['SYSTEMS']: if CONFIG['SYSTEMS'][system]['ENABLED']: if CONFIG['SYSTEMS'][system]['MODE'] == 'OPENBRIDGE': - systems[system] = routerOBP(system, CONFIG, report_server) + systems[system] = routerOBP(system, CONFIG, report_server) else: systems[system] = routerHBP(system, CONFIG, report_server) listeningPorts[system] = reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP']) diff --git a/config.py b/config.py index 638aad6..790ebc1 100755 --- a/config.py +++ b/config.py @@ -283,6 +283,7 @@ def build_config(_config_file): 'TS1_STATIC': config.get(section,'TS1_STATIC'), 'TS2_STATIC': config.get(section,'TS2_STATIC'), 'DEFAULT_REFLECTOR': config.getint(section, 'DEFAULT_REFLECTOR'), + 'GENERATOR': config.getint(section, 'GENERATOR') }}) CONFIG['SYSTEMS'][section].update({'PEERS': {}})