|
|
|
@ -25,6 +25,11 @@ |
|
|
|
|
# https://thomask.sdf.org/blog/2018/12/15/sending-raw-ax25-python.html |
|
|
|
|
# |
|
|
|
|
# TODO: remove escapes on decoding |
|
|
|
|
# |
|
|
|
|
# Changes by PE1RXF |
|
|
|
|
# |
|
|
|
|
# 2022-01-23: - in encode_address() added correct handling of has_been_repeated flag '*' |
|
|
|
|
# |
|
|
|
|
|
|
|
|
|
import struct |
|
|
|
|
|
|
|
|
@ -44,7 +49,16 @@ def encode_address(s, final): |
|
|
|
|
if len(call) < 6: |
|
|
|
|
call = call + b" "*(6 - len(call)) # pad with spaces |
|
|
|
|
encoded_call = [x << 1 for x in call[0:6]] |
|
|
|
|
encoded_ssid = (int(ssid) << 1) | 0b01100000 | (0b00000001 if final else 0) |
|
|
|
|
|
|
|
|
|
encoded_ssid = 0b00000000 |
|
|
|
|
# If ssid ends with *, the message has been repeated, so we have to set the 'has_been_repeated' flag and remove the * from the ssid |
|
|
|
|
if ssid[-1] == 42: |
|
|
|
|
# print("Message has been repeated") |
|
|
|
|
ssid = ssid[:-1] |
|
|
|
|
encoded_ssid |= 0b10000000 |
|
|
|
|
|
|
|
|
|
encoded_ssid |= (int(ssid) << 1) | 0b01100000 | (0b00000001 if final else 0) |
|
|
|
|
|
|
|
|
|
return encoded_call + [encoded_ssid] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|