diff --git a/hb_config.py b/hb_config.py index 4e69e60..14dd0f2 100755 --- a/hb_config.py +++ b/hb_config.py @@ -79,14 +79,14 @@ def build_config(_config_file): 'MASTER_IP': gethostbyname(config.get(section, 'MASTER_IP')), 'MASTER_PORT': config.getint(section, 'MASTER_PORT'), 'PASSPHRASE': config.get(section, 'PASSPHRASE'), - 'CALLSIGN': config.get(section, 'CALLSIGN').ljust(8), + 'CALLSIGN': config.get(section, 'CALLSIGN').ljust(8)[:8], 'RADIO_ID': hex(int(config.get(section, 'RADIO_ID')))[2:].rjust(8,'0').decode('hex'), - 'RX_FREQ': config.get(section, 'RX_FREQ').ljust(9), - 'TX_FREQ': config.get(section, 'TX_FREQ').ljust(9), + 'RX_FREQ': config.get(section, 'RX_FREQ').ljust(9)[:9], + 'TX_FREQ': config.get(section, 'TX_FREQ').ljust(9)[:9], 'TX_POWER': config.get(section, 'TX_POWER').rjust(2,'0'), 'COLORCODE': config.get(section, 'COLORCODE').rjust(2,'0'), - 'LATITUDE': config.get(section, 'LATITUDE').ljust(9), - 'LONGITUDE': config.get(section, 'LONGITUDE').ljust(10), + 'LATITUDE': config.get(section, 'LATITUDE').ljust(8)[:8], + 'LONGITUDE': config.get(section, 'LONGITUDE').ljust(9)[:9], 'HEIGHT': config.get(section, 'HEIGHT').rjust(3,'0'), 'LOCATION': config.get(section, 'LOCATION').ljust(20)[:20], 'DESCRIPTION': config.get(section, 'DESCRIPTION').ljust(19)[:19], @@ -148,4 +148,4 @@ if __name__ == '__main__': cli_args.CONFIG_FILE = os.path.dirname(os.path.abspath(__file__))+'/hblink.cfg' - pprint(build_config(cli_args.CONFIG_FILE)) \ No newline at end of file + pprint(build_config(cli_args.CONFIG_FILE)) diff --git a/hblink.py b/hblink.py index 492b66c..e47f6e5 100755 --- a/hblink.py +++ b/hblink.py @@ -400,6 +400,7 @@ class HBSYSTEM(DatagramProtocol): logger.info('(%s) Client is closing down: %s (%s)', self._system, self._clients[_radio_id]['CALLSIGN'], int_id(_radio_id)) self.transport.write('MSTNAK'+_radio_id, (_host, _port)) del self._clients[_radio_id] + else: _radio_id = _data[4:8] # Configure Command if _radio_id in self._clients \ @@ -414,15 +415,15 @@ class HBSYSTEM(DatagramProtocol): _this_client['TX_FREQ'] = _data[25:34] _this_client['TX_POWER'] = _data[34:36] _this_client['COLORCODE'] = _data[36:38] - _this_client['LATITUDE'] = _data[38:47] - _this_client['LONGITUDE'] = _data[47:57] - _this_client['HEIGHT'] = _data[57:60] - _this_client['LOCATION'] = _data[60:80] - _this_client['DESCRIPTION'] = _data[80:99] - _this_client['SLOTS'] = _data[99:100] - _this_client['URL'] = _data[100:224] - _this_client['SOFTWARE_ID'] = _data[224:264] - _this_client['PACKAGE_ID'] = _data[264:304] + _this_client['LATITUDE'] = _data[38:46] + _this_client['LONGITUDE'] = _data[46:55] + _this_client['HEIGHT'] = _data[55:58] + _this_client['LOCATION'] = _data[58:78] + _this_client['DESCRIPTION'] = _data[78:97] + _this_client['SLOTS'] = _data[97:98] + _this_client['URL'] = _data[98:222] + _this_client['SOFTWARE_ID'] = _data[222:262] + _this_client['PACKAGE_ID'] = _data[262:302] self.send_client(_radio_id, 'RPTACK'+_radio_id) logger.info('(%s) Client %s (%s) has sent repeater configuration', self._system, _this_client['CALLSIGN'], _this_client['RADIO_ID'])