Merge pull request #13 from z28cueball/master

Added ability to send options to master - Thanks WX1N
This commit is contained in:
Cort Buffington 2016-12-27 08:26:23 -06:00 committed by GitHub
commit 8c552faae9
3 changed files with 19 additions and 3 deletions

View File

@ -114,7 +114,8 @@ def build_config(_config_file):
'URL': config.get(section, 'URL').ljust(124)[:124],
'SOFTWARE_ID': config.get(section, 'SOFTWARE_ID').ljust(40)[:40],
'PACKAGE_ID': config.get(section, 'PACKAGE_ID').ljust(40)[:40],
'GROUP_HANGTIME': config.getint(section, 'GROUP_HANGTIME')
'GROUP_HANGTIME': config.getint(section, 'GROUP_HANGTIME'),
'OPTIONS': config.get(section, 'OPTIONS')
}})
CONFIG['SYSTEMS'][section].update({'STATS': {
'CONNECTION': 'NO', # NO, RTPL_SENT, AUTHENTICATED, CONFIG-SENT, YES

View File

@ -101,4 +101,5 @@ DESCRIPTION: This is a cool repeater
URL: www.w1abc.org
SOFTWARE_ID: HBlink
PACKAGE_ID: v0.1
GROUP_HANGTIME: 5
GROUP_HANGTIME: 5
OPTIONS:

View File

@ -425,8 +425,22 @@ class HBSYSTEM(DatagramProtocol):
elif self._stats['CONNECTION'] == 'CONFIG-SENT': # If we've sent out configuration to the master
if _data[6:10] == self._config['RADIO_ID']:
self._logger.info('(%s) Repeater Configuration Accepted', self._system)
if self._config['OPTIONS']:
self.send_master('RPTO'+self._config['RADIO_ID']+self._config['OPTIONS'])
self._stats['CONNECTION'] = 'OPTIONS-SENT'
self._logger.info('(%s) Sent options: (%s)', self._system, self._config['OPTIONS'])
else:
self._stats['CONNECTION'] = 'YES'
self._logger.info('(%s) Connection to Master Completed', self._system)
else:
self._stats['CONNECTION'] = 'NO'
self._logger.error('(%s) Master ACK Contained wrong ID - Connection Reset', self._system)
elif self._stats['CONNECTION'] == 'OPTIONS-SENT': # If we've sent out options to the master
if _data[6:10] == self._config['RADIO_ID']:
self._logger.info('(%s) Repeater Options Accepted', self._system)
self._stats['CONNECTION'] = 'YES'
self._logger.info('(%s) Connection to Master Completed', self._system)
self._logger.info('(%s) Connection to Master Completed with options', self._system)
else:
self._stats['CONNECTION'] = 'NO'
self._logger.error('(%s) Master ACK Contained wrong ID - Connection Reset', self._system)