From d200c2844baffdd2be842611a8ca4cd24b39f9f9 Mon Sep 17 00:00:00 2001 From: Cort Buffington Date: Mon, 15 Aug 2016 17:18:16 -0500 Subject: [PATCH] additional voice decoding --- hb_routing_rules.py | 2 +- hblink.py | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/hb_routing_rules.py b/hb_routing_rules.py index 9649108..0e446f5 100644 --- a/hb_routing_rules.py +++ b/hb_routing_rules.py @@ -22,7 +22,7 @@ RULES = { # This rule can be enabled by transmitting on TGID 8 # This rule can be disabled by transmitting on TGID 9 or 10 # Repeat the above line for as many rules for this IPSC network as you want. - ] + ] }, }, } \ No newline at end of file diff --git a/hblink.py b/hblink.py index 0fa25df..40c7953 100755 --- a/hblink.py +++ b/hblink.py @@ -216,9 +216,23 @@ class HBMASTER(DatagramProtocol): and self._clients[_radio_id]['CONNECTION'] == 'YES' \ and self._clients[_radio_id]['IP'] == _host \ and self._clients[_radio_id]['PORT'] == _port: - _seq = _data[4:5] + _seq = _data[4] _rf_src = _data[5:8] _dst_id = _data[8:11] + _bits = int_id(_data[15]) + _slot = 2 if (_bits & 0x40) else 1 + _call_type = 'group' if (_bits & 0x40) else 'unit' + _raw_frame_type = (_bits & 0x30) >> 4 + if _raw_frame_type == 0b00: + _frame_type = 'voice' + elif _raw_frame_type == 0b01: + _frame_type = 'voice_sync' + elif _raw_frame_type == 0b10: + _frame_type = 'data_sync' + else: + _frame_type = 'none' + _stream_id = _data[16:20] + #logger.debug('(%s) DMRD - Seqence: %s, RF Source: %s, Destination ID: %s', self._master, int_id(_seq), int_id(_rf_src), int_id(_dst_id)) # If AMBE audio exporting is configured...