From aafb321f8ab02acd2959103218ef04581fb36d3a Mon Sep 17 00:00:00 2001 From: Rob Date: Mon, 26 Dec 2016 10:47:34 -0500 Subject: [PATCH 1/2] Added ability to send options to master --- hb_config.py | 3 ++- hblink-SAMPLE.cfg | 3 ++- hblink.py | 16 +++++++++++++++- 3 files changed, 19 insertions(+), 3 deletions(-) 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..43798e6 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: '+self._config['OPTIONS'], self._system) + 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) From 9cb014a55cd4cebf1a0a1417b1f67f4f805a9482 Mon Sep 17 00:00:00 2001 From: Rob Date: Mon, 26 Dec 2016 21:36:22 -0500 Subject: [PATCH 2/2] Added ability to send options to master --- hblink.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hblink.py b/hblink.py index 43798e6..1600920 100755 --- a/hblink.py +++ b/hblink.py @@ -425,10 +425,10 @@ 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'] != "": + 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: '+self._config['OPTIONS'], self._system) + 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)