general clean-up

This commit is contained in:
Cort Buffington 2016-08-01 21:30:40 -05:00
parent 98aac798a1
commit 237085cb09

@ -199,6 +199,9 @@ class HBMASTER(DatagramProtocol):
pass
def datagramReceived(self, _data, (_host, _port)):
# Keep This Line Commented Unless HEAVILY Debugging!
# logger.debug('(%s) RX packet from %s:%s -- %s', self._client, _host, _port, h(_data))
# Extract the command, which is various length, all but one 4 significant characters -- RPTCL
_command = _data[:4]
@ -220,8 +223,6 @@ class HBMASTER(DatagramProtocol):
# The basic purpose of a master is to repeat to the clients
if self._config['REPEAT'] == True:
for _client in self._clients:
print('client: ', h(_client))
print('radio id: ', h(_radio_id))
if _client != _radio_id:
self.send_packet(_client, _data)
logger.debug('(%s) Packet repeated to client: %s', self._master, int_id(_client))
@ -386,12 +387,15 @@ class HBCLIENT(DatagramProtocol):
def send_packet(self, _packet):
self.transport.write(_packet, (self._config['MASTER_IP'], self._config['MASTER_PORT']))
# KEEP THE FOLLOWING COMMENTED OUT UNLESS YOU'RE DEBUGGING DEEPLY!!!!
logger.debug('(%s) TX Packet to %s:%s -- %s', self._client, self._config['MASTER_IP'], self._config['MASTER_PORT'], h(_packet))
#logger.debug('(%s) TX Packet to %s:%s -- %s', self._client, self._config['MASTER_IP'], self._config['MASTER_PORT'], h(_packet))
def dmrd_received(self, _radio_id, _rf_src, _dst_id, _seq, _data):
pass
def datagramReceived(self, _data, (_host, _port)):
# Keep This Line Commented Unless HEAVILY Debugging!
# logger.debug('(%s) RX packet from %s:%s -- %s', self._client, _host, _port, h(_data))
# Validate that we receveived this packet from the master - security check!
if self._config['MASTER_IP'] == _host and self._config['MASTER_PORT'] == _port:
# Extract the command, which is various length, but only 4 significant characters
@ -421,7 +425,7 @@ class HBCLIENT(DatagramProtocol):
# Depending on the state, an RPTACK means different things, in each clause, we check and/or set the state
if self._stats['CONNECTION'] == 'RTPL_SENT': # If we've sent a login request...
_login_int32 = _data[6:10]
logger.info('(%s) Repeater Login ACK Received with 32bit ID: %s', self._client, h(_login_int32))
logger.info('(%s) Repeater Login ACK Received with 32bit ID: %s', self._client, int_id(_login_int32))
_pass_hash = sha256(_login_int32+self._config['PASSPHRASE']).hexdigest()
_pass_hash = a(_pass_hash)
self.send_packet('RPTK'+self._config['RADIO_ID']+_pass_hash)
@ -475,9 +479,6 @@ class HBCLIENT(DatagramProtocol):
else:
logger.error('(%s) Received an invalid command in packet: %s', self._client, h(_data))
# Keep This Line Commented Unless HEAVILY Debugging!
#logger.debug('(%s) Received Packet: %s', self._client, h(_data))
#************************************************
# MAIN PROGRAM LOOP STARTS HERE