Completed!
This commit is contained in:
parent
76b43f027a
commit
22a71f0f52
6
RS129.py
6
RS129.py
|
@ -96,7 +96,7 @@ def RS129_encode(_msg):
|
||||||
return [parity[2], parity[1], parity[0]]
|
return [parity[2], parity[1], parity[0]]
|
||||||
|
|
||||||
# Apply DMR XOR MASK
|
# Apply DMR XOR MASK
|
||||||
def xor_mask(_parity):
|
def RS129_mask(_parity):
|
||||||
xor = [0,0,0]
|
xor = [0,0,0]
|
||||||
for i in range(len(_parity)):
|
for i in range(len(_parity)):
|
||||||
xor[i] = _parity[i] ^ MASK[i]
|
xor[i] = _parity[i] ^ MASK[i]
|
||||||
|
@ -106,8 +106,8 @@ def xor_mask(_parity):
|
||||||
def DMR_RS129_LC_FEC(_message):
|
def DMR_RS129_LC_FEC(_message):
|
||||||
bin_message = bytearray(_message)
|
bin_message = bytearray(_message)
|
||||||
parity = RS129_encode(bin_message)
|
parity = RS129_encode(bin_message)
|
||||||
xor_parity = xor_mask(parity)
|
masked_parity = RS129_mask(parity)
|
||||||
return chr(xor_parity[0]) + chr(xor_parity[1]) + chr(xor_parity[2])
|
return chr(masked_parity[0]) + chr(masked_parity[1]) + chr(masked_parity[2])
|
||||||
|
|
||||||
|
|
||||||
# For testing the code
|
# For testing the code
|
||||||
|
|
Loading…
Reference in New Issue