diff --git a/const.py b/const.py index 6c26561..5ff15c0 100755 --- a/const.py +++ b/const.py @@ -70,6 +70,7 @@ RPTO = b'RPTO' DMRA = b'DMRA' #Bridge Control commands +BC = b'BC' BCKA = b'BCKA' # Higheset peer ID permitted by HBP diff --git a/hblink.py b/hblink.py index e917908..5d62ac2 100755 --- a/hblink.py +++ b/hblink.py @@ -112,6 +112,10 @@ class OPENBRIDGE(DatagramProtocol): self._report = _report self._config = self._CONFIG['SYSTEMS'][self._system] self._laststrid = deque([], 20) + + def startProtocol(self): + self._bcka = task.LoopingCall(self.send_bcka) + self._bcka = self._bcka.start(10) def dereg(self): logger.info('(%s) is mode OPENBRIDGE. No De-Registration required, continuing shutdown', self._system) @@ -129,7 +133,7 @@ class OPENBRIDGE(DatagramProtocol): logger.error('(%s) OpenBridge system was asked to send non DMRD packet: %s', self._system, _packet) def send_bcka(self): - _packet= b'KA' + _packet= BCKA _packet = b''.join([_packet, (hmac_new(self._config['PASSPHRASE'],_packet,sha1).digest())]) self.transport.write(_packet, (self._config['TARGET_IP'], self._config['TARGET_PORT'])) logger.debug('(%s) Sent Bridge Control Keep Alive',self._system)