People Can't Convert DEC to HEX

Added a simple function to convert decimal values into the necessary
TGID hexadecimal strings. Seems like everyone contacting me with
trouble using bridge.py has trouble doing this.
This commit is contained in:
Cort Buffington 2014-04-10 22:15:44 -05:00
parent dbe69bb15e
commit 31ecf3b733

View File

@ -14,10 +14,14 @@ THIS EXAMPLE WILL NOT WORK AS IT IS - YOU MUST SPECIFY NAMES AND GROUP IDS!!!
NOTE: Timeslot transcoding does not yet work (SRC_TS) and (DST_TS) are ignored
'''
def id(_id):
# Create a 3 byte TGID or UID from an integer
return hex(_id)[2:].rjust(6,'0').decode('hex')
RULES = {
'IPSC_FOO': {
'GROUP_VOICE': [
{'SRC_GROUP': b'\x00\x00\x01', 'SRC_TS': 1, 'DST_NET': 'IPSC_BAR', 'DST_GROUP': b'\x00\x00\x02', 'DST_TS': 1},
{'SRC_GROUP': id(1), 'SRC_TS': 1, 'DST_NET': 'IPSC_BAR', 'DST_GROUP': id(2), 'DST_TS': 1},
# Repeat the above line for as many rules for this IPSC network as you want.
],
'PRIVATE_VOICE': [
@ -29,7 +33,7 @@ RULES = {
},
'IPSC_BAR:' {
'GROUP_VOICE': [
{'SRC_GROUP': b'\x00\x00\x02', 'SRC_TS': 1, 'DST_NET': 'IPSC_FOO', 'DST_GROUP': b'\x00\x00\x01', 'DST_TS': 1},
{'SRC_GROUP': id(2), 'SRC_TS': 1, 'DST_NET': 'IPSC_FOO', 'DST_GROUP': id(1), 'DST_TS': 1},
# Repeat the above line for as many rules for this IPSC network as you want.
],
'PRIVATE_VOICE': [