mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
updated other signalling frams with callsign crc8
This commit is contained in:
parent
69809a9145
commit
42c10c5780
4 changed files with 39 additions and 23 deletions
|
@ -84,8 +84,13 @@ def arq_data_received(data_in):
|
||||||
logging.info("ARQ | TX | BURST ACK")
|
logging.info("ARQ | TX | BURST ACK")
|
||||||
|
|
||||||
#BUILDING ACK FRAME FOR BURST -----------------------------------------------
|
#BUILDING ACK FRAME FOR BURST -----------------------------------------------
|
||||||
ack_payload = b'ACK'
|
#ack_payload = b'ACK'
|
||||||
ack_frame = b'<' + ack_payload # < = 60
|
#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-----------------------------------------------
|
#TRANSMIT ACK FRAME FOR BURST-----------------------------------------------
|
||||||
modem.transmit_signalling(ack_frame)
|
modem.transmit_signalling(ack_frame)
|
||||||
|
@ -118,8 +123,13 @@ def arq_data_received(data_in):
|
||||||
logging.warning("ARQ | TX | RPT ARQ FRAMES [" + str(missing_frames) + "] [BER."+str(static.BER)+"]")
|
logging.warning("ARQ | TX | RPT ARQ FRAMES [" + str(missing_frames) + "] [BER."+str(static.BER)+"]")
|
||||||
|
|
||||||
#BUILDING RPT FRAME FOR BURST -----------------------------------------------
|
#BUILDING RPT FRAME FOR BURST -----------------------------------------------
|
||||||
rpt_payload = missing_frames
|
#rpt_payload = missing_frames
|
||||||
rpt_frame = b'>' + rpt_payload #> = 63 --> 62?!?!?!?!
|
#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-----------------------------------------------
|
#TRANSMIT RPT FRAME FOR BURST-----------------------------------------------
|
||||||
modem.transmit_signalling(rpt_frame)
|
modem.transmit_signalling(rpt_frame)
|
||||||
|
@ -173,8 +183,13 @@ def arq_data_received(data_in):
|
||||||
static.RX_BUFFER.append(complete_data_frame)
|
static.RX_BUFFER.append(complete_data_frame)
|
||||||
|
|
||||||
#BUILDING ACK FRAME FOR DATA FRAME -----------------------------------------------
|
#BUILDING ACK FRAME FOR DATA FRAME -----------------------------------------------
|
||||||
ack_payload = b'FRAME_ACK'
|
#ack_payload = b'FRAME_ACK'
|
||||||
ack_frame = b'='+ ack_payload + bytes(static.FRAME_CRC) # < = 61
|
#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-----------------------------------------------
|
#TRANSMIT ACK FRAME FOR BURST-----------------------------------------------
|
||||||
time.sleep(1) #0.5
|
time.sleep(1) #0.5
|
||||||
|
@ -613,14 +628,19 @@ async def arq_disconnect():
|
||||||
static.ARQ_SEND_KEEP_ALIVE == False
|
static.ARQ_SEND_KEEP_ALIVE == False
|
||||||
static.ARQ_STATE = 'DISCONNECTING'
|
static.ARQ_STATE = 'DISCONNECTING'
|
||||||
logging.info("DISC ["+ str(static.MYCALLSIGN, 'utf-8') + "] <-> ["+ str(static.DXCALLSIGN, 'utf-8') + "] [BER."+str(static.BER)+"]")
|
logging.info("DISC ["+ str(static.MYCALLSIGN, 'utf-8') + "] <-> ["+ str(static.DXCALLSIGN, 'utf-8') + "] [BER."+str(static.BER)+"]")
|
||||||
frame_type = bytes([222])
|
#frame_type = bytes([222])
|
||||||
disconnection_frame = frame_type + static.MYCALLSIGN
|
#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':
|
while static.CHANNEL_STATE == 'SENDING_SIGNALLING':
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
|
|
||||||
await asyncio.sleep(5)
|
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)+"]")
|
logging.info("DISC ["+ str(static.MYCALLSIGN, 'utf-8') + "]< X >["+ str(static.DXCALLSIGN, 'utf-8') + "] [BER."+str(static.BER)+"]")
|
||||||
static.ARQ_STATE = 'IDLE'
|
static.ARQ_STATE = 'IDLE'
|
||||||
|
@ -658,6 +678,7 @@ def transmit_ping(callsign):
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
modem.transmit_signalling(ping_frame)
|
modem.transmit_signalling(ping_frame)
|
||||||
|
|
||||||
|
|
||||||
def received_ping(data_in):
|
def received_ping(data_in):
|
||||||
|
|
||||||
static.DXCALLSIGN_CRC8 = bytes(data_in[2:3])
|
static.DXCALLSIGN_CRC8 = bytes(data_in[2:3])
|
||||||
|
@ -693,7 +714,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] = b'\x01' #b'\x00'
|
cq_frame[1:2] = b'\x01'
|
||||||
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
|
||||||
|
|
||||||
|
|
6
modem.py
6
modem.py
|
@ -75,7 +75,6 @@ class RF():
|
||||||
self.my_rig = Hamlib.Rig(Hamlib.RIG_MODEL_DUMMY)
|
self.my_rig = Hamlib.Rig(Hamlib.RIG_MODEL_DUMMY)
|
||||||
self.my_rig.set_conf("rig_pathname", "/dev/Rig")
|
self.my_rig.set_conf("rig_pathname", "/dev/Rig")
|
||||||
self.my_rig.set_conf("retry", "5")
|
self.my_rig.set_conf("retry", "5")
|
||||||
|
|
||||||
self.my_rig.open ()
|
self.my_rig.open ()
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,9 +134,8 @@ class RF():
|
||||||
txbuffer += bytes(mod_out_preamble)
|
txbuffer += bytes(mod_out_preamble)
|
||||||
txbuffer += bytes(mod_out)
|
txbuffer += bytes(mod_out)
|
||||||
|
|
||||||
# -------------- transmit audio twice
|
# -------------- transmit audio
|
||||||
|
logging.debug("SENDING SIGNALLING FRAME " + str(ack_buffer))
|
||||||
logging.debug("SEND SIGNALLING FRAME " + str(ack_buffer))
|
|
||||||
self.stream_tx.write(bytes(txbuffer))
|
self.stream_tx.write(bytes(txbuffer))
|
||||||
|
|
||||||
self.my_rig.set_ptt(self.hamlib_ptt_type,0)
|
self.my_rig.set_ptt(self.hamlib_ptt_type,0)
|
||||||
|
|
5
sock.py
5
sock.py
|
@ -11,13 +11,14 @@ import threading
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
|
import asyncio
|
||||||
|
|
||||||
import static
|
import static
|
||||||
import data_handler
|
import data_handler
|
||||||
import helpers
|
import helpers
|
||||||
import fec
|
|
||||||
|
|
||||||
import asyncio
|
|
||||||
|
|
||||||
|
|
||||||
class CMDTCPRequestHandler(socketserver.BaseRequestHandler):
|
class CMDTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ PTT_STATE = False
|
||||||
# FreeDV Defaults
|
# FreeDV Defaults
|
||||||
FREEDV_RECEIVE = True
|
FREEDV_RECEIVE = True
|
||||||
|
|
||||||
FREEDV_DATA_MODE = 12
|
FREEDV_DATA_MODE = 12 #check if we can delete this
|
||||||
FREEDV_SIGNALLING_MODE = 14
|
FREEDV_SIGNALLING_MODE = 14
|
||||||
|
|
||||||
FREEDV_DATA_BYTES_PER_FRAME = 0
|
FREEDV_DATA_BYTES_PER_FRAME = 0
|
||||||
|
@ -161,10 +161,6 @@ CHANNEL_STATE = 'RECEIVING_SIGNALLING'
|
||||||
TNC_STATE = 'IDLE'
|
TNC_STATE = 'IDLE'
|
||||||
|
|
||||||
# MODE FOR SENDING AN RECEIVING DATA DURING ARQ SESSION
|
# 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_READY_FOR_DATA = False
|
||||||
ARQ_DATA_CHANNEL_MODE = 12
|
ARQ_DATA_CHANNEL_MODE = 12
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue