diff --git a/hb_config.py b/hb_config.py index c0b5c5d..2f3e1a3 100755 --- a/hb_config.py +++ b/hb_config.py @@ -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 diff --git a/hblink-SAMPLE.cfg b/hblink-SAMPLE.cfg index 41bbfc8..9a717f9 100644 --- a/hblink-SAMPLE.cfg +++ b/hblink-SAMPLE.cfg @@ -101,4 +101,5 @@ DESCRIPTION: This is a cool repeater URL: www.w1abc.org SOFTWARE_ID: HBlink PACKAGE_ID: v0.1 -GROUP_HANGTIME: 5 \ No newline at end of file +GROUP_HANGTIME: 5 +OPTIONS: \ No newline at end of file diff --git a/hblink.py b/hblink.py index 0d09631..1600920 100755 --- a/hblink.py +++ b/hblink.py @@ -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)