updated other signalling frams with callsign crc8

This commit is contained in:
DJ2LS 2021-03-09 14:01:54 +01:00 committed by GitHub
parent 69809a9145
commit 42c10c5780
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 23 deletions

View file

@ -84,9 +84,14 @@ def arq_data_received(data_in):
logging.info("ARQ | TX | BURST ACK")
#BUILDING ACK FRAME FOR BURST -----------------------------------------------
ack_payload = b'ACK'
ack_frame = b'<' + ack_payload # < = 60
#ack_payload = b'ACK'
#ack_frame = b'<' + ack_payload # < = 60
ack_frame = bytearray(14)
ack_frame[:1] = bytes([60])
ack_frame[1:2] = static.DXCALLSIGN_CRC8
ack_frame[2:3] = static.MYCALLSIGN_CRC8
#TRANSMIT ACK FRAME FOR BURST-----------------------------------------------
modem.transmit_signalling(ack_frame)
static.CHANNEL_STATE = 'RECEIVING_DATA'
@ -118,9 +123,14 @@ def arq_data_received(data_in):
logging.warning("ARQ | TX | RPT ARQ FRAMES [" + str(missing_frames) + "] [BER."+str(static.BER)+"]")
#BUILDING RPT FRAME FOR BURST -----------------------------------------------
rpt_payload = missing_frames
rpt_frame = b'>' + rpt_payload #> = 63 --> 62?!?!?!?!
#rpt_payload = missing_frames
#rpt_frame = b'>' + rpt_payload #> = 63 --> 62?!?!?!?!
rpt_frame = bytearray(14)
rpt_frame[:1] = bytes([63])
rpt_frame[1:2] = static.DXCALLSIGN_CRC8
rpt_frame[2:3] = static.MYCALLSIGN_CRC8
rpt_frame[3:9] = missing_frames
#TRANSMIT RPT FRAME FOR BURST-----------------------------------------------
modem.transmit_signalling(rpt_frame)
static.CHANNEL_STATE = 'RECEIVING_DATA'
@ -173,8 +183,13 @@ def arq_data_received(data_in):
static.RX_BUFFER.append(complete_data_frame)
#BUILDING ACK FRAME FOR DATA FRAME -----------------------------------------------
ack_payload = b'FRAME_ACK'
ack_frame = b'='+ ack_payload + bytes(static.FRAME_CRC) # < = 61
#ack_payload = b'FRAME_ACK'
#ack_frame = b'='+ ack_payload + bytes(static.FRAME_CRC) # < = 61
ack_frame = bytearray(14)
ack_frame[:1] = bytes([61])
ack_frame[1:2] = static.DXCALLSIGN_CRC8
ack_frame[2:3] = static.MYCALLSIGN_CRC8
#TRANSMIT ACK FRAME FOR BURST-----------------------------------------------
time.sleep(1) #0.5
@ -613,14 +628,19 @@ async def arq_disconnect():
static.ARQ_SEND_KEEP_ALIVE == False
static.ARQ_STATE = 'DISCONNECTING'
logging.info("DISC ["+ str(static.MYCALLSIGN, 'utf-8') + "] <-> ["+ str(static.DXCALLSIGN, 'utf-8') + "] [BER."+str(static.BER)+"]")
frame_type = bytes([222])
disconnection_frame = frame_type + static.MYCALLSIGN
#frame_type = bytes([222])
#disconnection_frame = frame_type + static.MYCALLSIGN
disc_frame = bytearray(14)
disc_frame[:1] = bytes([222])
disc_frame[1:2] = static.DXCALLSIGN_CRC8
disc_frame[2:3] = static.MYCALLSIGN_CRC8
while static.CHANNEL_STATE == 'SENDING_SIGNALLING':
time.sleep(0.01)
await asyncio.sleep(5)
modem.transmit_signalling(disconnection_frame)
modem.transmit_signalling(disc_frame)
logging.info("DISC ["+ str(static.MYCALLSIGN, 'utf-8') + "]< X >["+ str(static.DXCALLSIGN, 'utf-8') + "] [BER."+str(static.BER)+"]")
static.ARQ_STATE = 'IDLE'
@ -657,6 +677,7 @@ def transmit_ping(callsign):
while static.CHANNEL_STATE == 'SENDING_SIGNALLING':
time.sleep(0.01)
modem.transmit_signalling(ping_frame)
def received_ping(data_in):
@ -693,7 +714,7 @@ async def transmit_cq():
cq_frame = bytearray(14)
cq_frame[:1] = bytes([200])
cq_frame[1:2] = b'\x01' #b'\x00'
cq_frame[1:2] = b'\x01'
cq_frame[2:3] = static.MYCALLSIGN_CRC8
cq_frame[3:9] = static.MYCALLSIGN

View file

@ -75,7 +75,6 @@ class RF():
self.my_rig = Hamlib.Rig(Hamlib.RIG_MODEL_DUMMY)
self.my_rig.set_conf("rig_pathname", "/dev/Rig")
self.my_rig.set_conf("retry", "5")
self.my_rig.open ()
@ -135,9 +134,8 @@ class RF():
txbuffer += bytes(mod_out_preamble)
txbuffer += bytes(mod_out)
# -------------- transmit audio twice
logging.debug("SEND SIGNALLING FRAME " + str(ack_buffer))
# -------------- transmit audio
logging.debug("SENDING SIGNALLING FRAME " + str(ack_buffer))
self.stream_tx.write(bytes(txbuffer))
self.my_rig.set_ptt(self.hamlib_ptt_type,0)

View file

@ -11,13 +11,14 @@ import threading
import logging
import time
import json
import asyncio
import static
import data_handler
import helpers
import fec
import asyncio
class CMDTCPRequestHandler(socketserver.BaseRequestHandler):

View file

@ -62,7 +62,7 @@ PTT_STATE = False
# FreeDV Defaults
FREEDV_RECEIVE = True
FREEDV_DATA_MODE = 12
FREEDV_DATA_MODE = 12 #check if we can delete this
FREEDV_SIGNALLING_MODE = 14
FREEDV_DATA_BYTES_PER_FRAME = 0
@ -161,10 +161,6 @@ CHANNEL_STATE = 'RECEIVING_SIGNALLING'
TNC_STATE = 'IDLE'
# MODE FOR SENDING AN RECEIVING DATA DURING ARQ SESSION
# 0 = NOT WAITING FOR DATA
# 1 = TELL DX STATION WE WANT TO SEND DATA
# 2 = DX STATION IS READY FOR DATA
# 3 = DX STATION SAID, THEY ARE READY FOR DATA
ARQ_READY_FOR_DATA = False
ARQ_DATA_CHANNEL_MODE = 12