mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
selective repeating
first try
This commit is contained in:
parent
f78d3fed15
commit
cbdbd30c39
|
@ -643,6 +643,7 @@ def arq_disconnect_received(data_in):
|
||||||
|
|
||||||
def transmit_ping(callsign):
|
def transmit_ping(callsign):
|
||||||
static.DXCALLSIGN = bytes(callsign, 'utf-8')
|
static.DXCALLSIGN = bytes(callsign, 'utf-8')
|
||||||
|
static.DXCALLSIGN_CRC8 = helpers.get_crc_8(static.DXCALLSIGN)
|
||||||
logging.info("PING ["+ str(static.MYCALLSIGN, 'utf-8') + "] >>> [" + str(static.DXCALLSIGN, 'utf-8') + "] [BER."+str(static.BER)+"]")
|
logging.info("PING ["+ str(static.MYCALLSIGN, 'utf-8') + "] >>> [" + str(static.DXCALLSIGN, 'utf-8') + "] [BER."+str(static.BER)+"]")
|
||||||
|
|
||||||
ping_frame = bytearray(14)
|
ping_frame = bytearray(14)
|
||||||
|
@ -692,7 +693,7 @@ async def transmit_cq():
|
||||||
|
|
||||||
cq_frame = bytearray(14)
|
cq_frame = bytearray(14)
|
||||||
cq_frame[:1] = bytes([200])
|
cq_frame[:1] = bytes([200])
|
||||||
cq_frame[1:2] = bytes(1) #b'\x00'
|
cq_frame[1:2] = b'\x01' #b'\x00'
|
||||||
cq_frame[2:3] = static.MYCALLSIGN_CRC8
|
cq_frame[2:3] = static.MYCALLSIGN_CRC8
|
||||||
cq_frame[3:9] = static.MYCALLSIGN
|
cq_frame[3:9] = static.MYCALLSIGN
|
||||||
|
|
||||||
|
@ -704,7 +705,8 @@ async def transmit_cq():
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
def received_cq(data_in):
|
def received_cq(data_in):
|
||||||
|
static.DXCALLSIGN = b''
|
||||||
|
static.DXCALLSIGN_CRC8 = b''
|
||||||
logging.info("CQ [" + str(bytes(data_in[3:9]), 'utf-8') + "] [BER."+str(static.BER)+"]")
|
logging.info("CQ [" + str(bytes(data_in[3:9]), 'utf-8') + "] [BER."+str(static.BER)+"]")
|
||||||
|
|
||||||
async def transmit_beacon():
|
async def transmit_beacon():
|
||||||
|
|
9
modem.py
9
modem.py
|
@ -337,8 +337,8 @@ class RF():
|
||||||
stuck_in_sync_10_counter = 0
|
stuck_in_sync_10_counter = 0
|
||||||
#-----------------------------------
|
#-----------------------------------
|
||||||
|
|
||||||
|
# forward data only if broadcast or we are the receiver
|
||||||
if nbytes == bytes_per_frame:##########################################################FREEDV_DATA_BYTES_PER_FRAME
|
if nbytes == bytes_per_frame and bytes(bytes_out[1:2]) == static.MYCALLSIGN_CRC8 or bytes(bytes_out[1:2]) == b'\x01':
|
||||||
self.calculate_ber(freedv)
|
self.calculate_ber(freedv)
|
||||||
|
|
||||||
# counter reset for stuck in sync counter
|
# counter reset for stuck in sync counter
|
||||||
|
@ -436,6 +436,11 @@ class RF():
|
||||||
self.c_lib.freedv_set_sync(freedv, 0) #FORCE UNSYNC
|
self.c_lib.freedv_set_sync(freedv, 0) #FORCE UNSYNC
|
||||||
|
|
||||||
|
|
||||||
|
# clear bytes_out buffer to be ready for next frames after successfull decoding
|
||||||
|
|
||||||
|
bytes_out = (ctypes.c_ubyte * bytes_per_frame)
|
||||||
|
bytes_out = bytes_out() #get pointer to bytes_out
|
||||||
|
|
||||||
def calculate_ber(self,freedv):
|
def calculate_ber(self,freedv):
|
||||||
Tbits = self.c_lib.freedv_get_total_bits(freedv)
|
Tbits = self.c_lib.freedv_get_total_bits(freedv)
|
||||||
Terrs = self.c_lib.freedv_get_total_bit_errors(freedv)
|
Terrs = self.c_lib.freedv_get_total_bit_errors(freedv)
|
||||||
|
|
14
sock.py
14
sock.py
|
@ -37,18 +37,14 @@ class CMDTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||||
|
|
||||||
# SOCKETTEST ---------------------------------------------------
|
# SOCKETTEST ---------------------------------------------------
|
||||||
if data == 'SOCKETTEST':
|
if data == 'SOCKETTEST':
|
||||||
cur_thread = threading.current_thread()
|
#cur_thread = threading.current_thread()
|
||||||
response = bytes("WELL DONE! YOU ARE ABLE TO COMMUNICATE WITH THE TNC", encoding)
|
response = bytes("WELL DONE! YOU ARE ABLE TO COMMUNICATE WITH THE TNC", encoding)
|
||||||
self.request.sendall(response)
|
self.request.sendall(response)
|
||||||
|
|
||||||
# CQ CQ CQ -----------------------------------------------------
|
# CQ CQ CQ -----------------------------------------------------
|
||||||
if data == 'CQCQCQ':
|
if data == 'CQCQCQ':
|
||||||
for i in range(0,3):
|
|
||||||
asyncio.run(data_handler.transmit_cq())
|
asyncio.run(data_handler.transmit_cq())
|
||||||
#self.request.sendall(bytes("CALLING CQ"))
|
self.request.sendall(b'CALLING CQ')
|
||||||
while static.ARQ_STATE == 'SENDING_SIGNALLING':
|
|
||||||
time.sleep(0.1)
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
# PING ----------------------------------------------------------
|
# PING ----------------------------------------------------------
|
||||||
|
@ -141,9 +137,9 @@ class CMDTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||||
if data == 'GET:TNC_STATE':
|
if data == 'GET:TNC_STATE':
|
||||||
output = {
|
output = {
|
||||||
"PTT_STATE": str(static.PTT_STATE),
|
"PTT_STATE": str(static.PTT_STATE),
|
||||||
"CHANNEL_STATE": static.CHANNEL_STATE,
|
"CHANNEL_STATE": str(static.CHANNEL_STATE),
|
||||||
"TNC_STATE": static.TNC_STATE,
|
"TNC_STATE": str(static.TNC_STATE),
|
||||||
"ARQ_STATE": static.ARQ_STATE
|
"ARQ_STATE": str(static.ARQ_STATE)
|
||||||
}
|
}
|
||||||
jsondata = json.dumps(output)
|
jsondata = json.dumps(output)
|
||||||
self.request.sendall(bytes(jsondata, encoding))
|
self.request.sendall(bytes(jsondata, encoding))
|
||||||
|
|
Loading…
Reference in a new issue