From 09e1d7f36a641e368a6d63cf2a6d3e268457be26 Mon Sep 17 00:00:00 2001 From: Cort Buffington Date: Wed, 30 Oct 2013 07:57:17 -0500 Subject: [PATCH] Working on RSSI Added easy-change capabilities (IPSC flags) to dmrlink.py Working with XCMP/XNL and RSSI in log.py --- dmrlink.py | 4 +++- log.py | 12 +++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dmrlink.py b/dmrlink.py index 848e60b..efaa53c 100644 --- a/dmrlink.py +++ b/dmrlink.py @@ -139,7 +139,9 @@ for section in config.sections(): }) if NETWORK[section]['LOCAL']['AUTH_ENABLED']: - NETWORK[section]['LOCAL']['FLAGS'] = '\x00\x00\x00\x1C' + # 0x1C - Voice and Data calls only, 0xDC - Voice, Data and XCMP/XNL + #NETWORK[section]['LOCAL']['FLAGS'] = '\x00\x00\x00\x1C' + NETWORK[section]['LOCAL']['FLAGS'] = '\x00\x00\x00\xDC' else: NETWORK[section]['LOCAL']['FLAGS'] = '\x00\x00\x00\x0C' diff --git a/log.py b/log.py index 4209173..613b2d6 100644 --- a/log.py +++ b/log.py @@ -37,17 +37,15 @@ class logIPSC(IPSC): print('({}) Call Control Type 3 Packet Received' .format(_network)) def xcmp_xnl(self, _network, _data): - print('({}) XCMP/XNL Packet Received From: {}' .format(_network, _src_sub)) + print('({}) XCMP/XNL Packet Received From: {}' .format(_network, binascii.b2a_hex(_data))) def group_voice(self, _network, _src_sub, _dst_sub, _ts, _end, _peerid, _data): # _log = logger.debug if _data[30:31] == '\x01': - rssi = struct.unpack('h', _data[-2:]) - rssi1 = struct.unpack('b', _data[-1]) - rssi2 = struct.unpack('b', _data[-2:-1]) - print('RSSI: ', rssi) - print('RSSI1: ', rssi1) - print('RSSI2: ', rssi2) + rssi1 = struct.unpack('B', _data[-1])[0] + rssi2 = struct.unpack('B', _data[-2:-1])[0] + rssi = (rssi1 + (((rssi2*1000)+128)/256000)) + print('RSSI (not quite correct yet): ', rssi) if (_ts not in self.ACTIVE_CALLS) or _end: _time = time.strftime('%m/%d/%y %H:%M:%S') _dst_sub = get_info(int_id(_dst_sub))