Separate UNIT from GROUP Calls

Initial framework for processing UNIT calls
This commit is contained in:
Cort Buffington 2019-11-28 10:49:32 -06:00
parent b9dc33dae5
commit 7bf0a77e16

View File

@ -200,13 +200,11 @@ class routerOBP(OPENBRIDGE):
OPENBRIDGE.__init__(self, _name, _config, _report) OPENBRIDGE.__init__(self, _name, _config, _report)
self.STATUS = {} self.STATUS = {}
def group_recieved(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data):
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
pkt_time = time() pkt_time = time()
dmrpkt = _data[20:53] dmrpkt = _data[20:53]
_bits = _data[15] _bits = _data[15]
if _call_type == 'group':
# Is this a new call stream? # Is this a new call stream?
if (_stream_id not in self.STATUS): if (_stream_id not in self.STATUS):
# This is a new call stream # This is a new call stream
@ -393,6 +391,24 @@ class routerOBP(OPENBRIDGE):
if not removed: if not removed:
selflogger.error('(%s) *CALL END* STREAM ID: %s NOT IN LIST -- THIS IS A REAL PROBLEM', self._system, int_id(_stream_id)) selflogger.error('(%s) *CALL END* STREAM ID: %s NOT IN LIST -- THIS IS A REAL PROBLEM', self._system, int_id(_stream_id))
def unit_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data):
pkt_time = time()
dmrpkt = _data[20:53]
_bits = _data[15]
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
if _call_type == 'group':
self.group_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data)
elif _call_type == 'unit':
self.unit_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data)
elif _call_type == 'vscsbk':
logger.debug('CSBK recieved, but HBlink does not process them currently')
else:
logger.error('Unknown call type recieved -- not processed')
class routerHBP(HBSYSTEM): class routerHBP(HBSYSTEM):
def __init__(self, _name, _config, _report): def __init__(self, _name, _config, _report):
@ -405,7 +421,7 @@ class routerHBP(HBSYSTEM):
1: { 1: {
'RX_START': time(), 'RX_START': time(),
'TX_START': time(), 'TX_START': time(),
'RX_SEQ': 0, 'RX_SEQ': b'\x00',
'RX_RFS': b'\x00', 'RX_RFS': b'\x00',
'TX_RFS': b'\x00', 'TX_RFS': b'\x00',
'RX_PEER': b'\x00', 'RX_PEER': b'\x00',
@ -431,7 +447,7 @@ class routerHBP(HBSYSTEM):
2: { 2: {
'RX_START': time(), 'RX_START': time(),
'TX_START': time(), 'TX_START': time(),
'RX_SEQ': 0, 'RX_SEQ': b'\x00',
'RX_RFS': b'\x00', 'RX_RFS': b'\x00',
'TX_RFS': b'\x00', 'TX_RFS': b'\x00',
'RX_PEER': b'\x00', 'RX_PEER': b'\x00',
@ -456,13 +472,19 @@ class routerHBP(HBSYSTEM):
} }
} }
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data): # Dictionary for dynamically mapping unit (subscriber) to a system.
# This is for pruning unit-to-uint calls to not broadcast once the
# target system for a unit is identified
# format 'unit_id': ('SYSTEM', time)
self.UNIT_MAP = {}
def group_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data):
pkt_time = time() pkt_time = time()
dmrpkt = _data[20:53] dmrpkt = _data[20:53]
_bits = _data[15] _bits = _data[15]
if _call_type == 'group':
# Is this a new call stream? # Is this a new call stream?
if (_stream_id != self.STATUS[_slot]['RX_STREAM_ID']): if (_stream_id != self.STATUS[_slot]['RX_STREAM_ID']):
if (self.STATUS[_slot]['RX_TYPE'] != HBPF_SLT_VTERM) and (pkt_time < (self.STATUS[_slot]['RX_TIME'] + STREAM_TO)) and (_rf_src != self.STATUS[_slot]['RX_RFS']): if (self.STATUS[_slot]['RX_TYPE'] != HBPF_SLT_VTERM) and (pkt_time < (self.STATUS[_slot]['RX_TIME'] + STREAM_TO)) and (_rf_src != self.STATUS[_slot]['RX_RFS']):
@ -692,8 +714,6 @@ class routerHBP(HBSYSTEM):
# #
# END IN-BAND SIGNALLING # END IN-BAND SIGNALLING
# #
# Mark status variables for use later # Mark status variables for use later
self.STATUS[_slot]['RX_PEER'] = _peer_id self.STATUS[_slot]['RX_PEER'] = _peer_id
self.STATUS[_slot]['RX_SEQ'] = _seq self.STATUS[_slot]['RX_SEQ'] = _seq
@ -703,6 +723,24 @@ class routerHBP(HBSYSTEM):
self.STATUS[_slot]['RX_TIME'] = pkt_time self.STATUS[_slot]['RX_TIME'] = pkt_time
self.STATUS[_slot]['RX_STREAM_ID'] = _stream_id self.STATUS[_slot]['RX_STREAM_ID'] = _stream_id
def unit_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data):
pkt_time = time()
dmrpkt = _data[20:53]
_bits = _data[15]
print('UNIT CALL')
def dmrd_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _frame_type, _dtype_vseq, _stream_id, _data):
if _call_type == 'group':
self.group_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data)
elif _call_type == 'unit':
self.unit_received(_peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data)
elif _call_type == 'vscsbk':
logger.debug('CSBK recieved, but HBlink does not process them currently')
else:
logger.error('Unknown call type recieved -- not processed')
# #
# Socket-based reporting section # Socket-based reporting section
# #