DRASTICALLY sped up text/number lookup times.
added a function to do it the *right* way.
This commit is contained in:
parent
ae16d096f8
commit
6b1b074628
33
ipsc.py
33
ipsc.py
@ -74,7 +74,7 @@ for section in config.sections():
|
|||||||
'PEER_OPER': True,
|
'PEER_OPER': True,
|
||||||
'PEER_MODE': 'DIGITAL',
|
'PEER_MODE': 'DIGITAL',
|
||||||
'FLAGS': '',
|
'FLAGS': '',
|
||||||
'MAX_MISSED': 5,
|
'MAX_MISSED': 10,
|
||||||
'NUM_PEERS': 0,
|
'NUM_PEERS': 0,
|
||||||
'STATUS': {
|
'STATUS': {
|
||||||
'ACTIVE': False
|
'ACTIVE': False
|
||||||
@ -144,33 +144,34 @@ def group_voice(_network, _data):
|
|||||||
_src_ipsc = int(binascii.b2a_hex(_data[1:5]), 16)
|
_src_ipsc = int(binascii.b2a_hex(_data[1:5]), 16)
|
||||||
_call = binascii.b2a_hex(_data[17:18])
|
_call = binascii.b2a_hex(_data[17:18])
|
||||||
|
|
||||||
for id in ids:
|
|
||||||
if int(id[1]) == _src_sub:
|
|
||||||
_src_sub = id[0]
|
|
||||||
|
|
||||||
if int(id[1]) == _src_group:
|
|
||||||
_src_group = id[0]
|
|
||||||
|
|
||||||
if int(id[1]) == _src_ipsc:
|
|
||||||
_src_ipsc = id[0]
|
|
||||||
|
|
||||||
|
|
||||||
if _call == '00':
|
if _call == '00':
|
||||||
if (_network, 'Slot 1') not in ACTIVE_CALLS:
|
if (_network, 'Slot 1') not in ACTIVE_CALLS:
|
||||||
ACTIVE_CALLS.append((_network, 'Slot 1'))
|
ACTIVE_CALLS.append((_network, 'Slot 1'))
|
||||||
|
_src_group = get_info(_src_group)
|
||||||
|
_src_ipsc = get_info(_src_ipsc)
|
||||||
|
_src_sub = get_info(_src_sub)
|
||||||
print('({}) CALL START Group Voice: \n\tIPSC Source:\t{}\n\tSubscriber:\t{}\n\tDestination:\t{}\n\tTimeslot\t1' .format(_network, _src_ipsc, _src_sub, _src_group))
|
print('({}) CALL START Group Voice: \n\tIPSC Source:\t{}\n\tSubscriber:\t{}\n\tDestination:\t{}\n\tTimeslot\t1' .format(_network, _src_ipsc, _src_sub, _src_group))
|
||||||
|
|
||||||
if _call == '20':
|
if _call == '20':
|
||||||
if (_network, 'Slot 2') not in ACTIVE_CALLS:
|
if (_network, 'Slot 2') not in ACTIVE_CALLS:
|
||||||
ACTIVE_CALLS.append((_network, 'Slot 2'))
|
ACTIVE_CALLS.append((_network, 'Slot 2'))
|
||||||
|
_src_group = get_info(_src_group)
|
||||||
|
_src_ipsc = get_info(_src_ipsc)
|
||||||
|
_src_sub = get_info(_src_sub)
|
||||||
print('({}) CALL START Group Voice: \n\tIPSC Source:\t{}\n\tSubscriber:\t{}\n\tDestination:\t{}\n\tTimeslot\t2' .format(_network, _src_ipsc, _src_sub, _src_group))
|
print('({}) CALL START Group Voice: \n\tIPSC Source:\t{}\n\tSubscriber:\t{}\n\tDestination:\t{}\n\tTimeslot\t2' .format(_network, _src_ipsc, _src_sub, _src_group))
|
||||||
|
|
||||||
if _call == '40':
|
if _call == '40':
|
||||||
ACTIVE_CALLS.remove((_network, 'Slot 1'))
|
ACTIVE_CALLS.remove((_network, 'Slot 1'))
|
||||||
|
_src_group = get_info(_src_group)
|
||||||
|
_src_ipsc = get_info(_src_ipsc)
|
||||||
|
_src_sub = get_info(_src_sub)
|
||||||
print('({}) CALL END Group Voice: \n\tIPSC Source:\t{}\n\tSubscriber:\t{}\n\tDestination:\t{}\n\tTimeslot\t1 \a' .format(_network, _src_ipsc, _src_sub, _src_group))
|
print('({}) CALL END Group Voice: \n\tIPSC Source:\t{}\n\tSubscriber:\t{}\n\tDestination:\t{}\n\tTimeslot\t1 \a' .format(_network, _src_ipsc, _src_sub, _src_group))
|
||||||
|
|
||||||
if _call == '60':
|
if _call == '60':
|
||||||
ACTIVE_CALLS.remove((_network, 'Slot 2'))
|
ACTIVE_CALLS.remove((_network, 'Slot 2'))
|
||||||
|
_src_group = get_info(_src_group)
|
||||||
|
_src_ipsc = get_info(_src_ipsc)
|
||||||
|
_src_sub = get_info(_src_sub)
|
||||||
print('({}) CALL END Group Voice: \n\tIPSC Source:\t{}\n\tSubscriber:\t{}\n\tDestination:\t{}\n\tTimeslot\t2 \a' .format(_network, _src_ipsc, _src_sub, _src_group))
|
print('({}) CALL END Group Voice: \n\tIPSC Source:\t{}\n\tSubscriber:\t{}\n\tDestination:\t{}\n\tTimeslot\t2 \a' .format(_network, _src_ipsc, _src_sub, _src_group))
|
||||||
|
|
||||||
'''
|
'''
|
||||||
@ -210,6 +211,14 @@ def unknown_message():
|
|||||||
# UTILITY FUNCTIONS FOR INTERNAL USE
|
# UTILITY FUNCTIONS FOR INTERNAL USE
|
||||||
#************************************************
|
#************************************************
|
||||||
|
|
||||||
|
# Lookup text data for numeric IDs
|
||||||
|
#
|
||||||
|
def get_info(_id):
|
||||||
|
for id in ids:
|
||||||
|
if int(id[1]) == _id:
|
||||||
|
return id[0]
|
||||||
|
return _id
|
||||||
|
|
||||||
# Remove the hash from a paket and return the payload
|
# Remove the hash from a paket and return the payload
|
||||||
#
|
#
|
||||||
def strip_hash(_data):
|
def strip_hash(_data):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user