mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
6adf7db483
no working, but with tooo much debugging output furthermore the frame ACK is not working correctly on the TX side
122 lines
2.5 KiB
Python
122 lines
2.5 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
Created on Wed Dec 23 11:13:57 2020
|
|
|
|
@author: DJ2LS
|
|
"""
|
|
# ADDITION MESSUREMENT:
|
|
#AUDIO TIME: 7.451462268829346 #12 # 1 FRAME + PREAMBLE
|
|
#MODULATION TIME: 0.002051115036010742 #12 # 1 FRAME + PREAMBLE
|
|
|
|
#MODULATION TIME: 0.004580974578857422 #12 # 2 FRAME + PREAMBLE
|
|
#AUDIO TIME: 14.750595331192017 #12 # 2 FRAME + PREAMBLE
|
|
|
|
|
|
MYCALLSIGN = b''
|
|
MYCALLSIGN_CRC8 = b''
|
|
|
|
DXCALLSIGN = b''
|
|
DXCALLSIGN_CRC8 = b''
|
|
|
|
|
|
|
|
|
|
|
|
# FreeDV Defaults
|
|
FREEDV_RECEIVE = True
|
|
|
|
FREEDV_DATA_MODE = 10
|
|
FREEDV_SIGNALLING_MODE = 14
|
|
|
|
FREEDV_DATA_BYTES_PER_FRAME = 0
|
|
FREEDV_DATA_PAYLOAD_PER_FRAME = 0
|
|
FREEDV_SIGNALLING_BYTES_PER_FRAME = 0
|
|
FREEDV_SIGNALLING_PAYLOAD_PER_FRAME = 0
|
|
|
|
# Server Defaults
|
|
HOST = "localhost"
|
|
PORT = 3000
|
|
|
|
|
|
#AUdio Defaults
|
|
AUDIO_INPUT_DEVICE = 1
|
|
AUDIO_OUTPUT_DEVICE = 1
|
|
#TX_SAMPLE_STATE = None
|
|
#RX_SAMPLE_STATE = None
|
|
|
|
#AUDIO_SAMPLE_RATE_RX = 44100
|
|
#AUDIO_SAMPLE_RATE_TX = 44100
|
|
MODEM_SAMPLE_RATE = 8000 #8000
|
|
AUDIO_FRAMES_PER_BUFFER = 2048
|
|
AUDIO_CHANNELS = 1
|
|
|
|
|
|
#TNC DEFAULTS
|
|
# ARQ
|
|
TX_N_MAX_RETRIES = 3
|
|
TX_N_RETRIES = 0
|
|
|
|
|
|
|
|
ARQ_TX_N_FRAMES_PER_BURST = 0
|
|
ARQ_TX_N_BURSTS = 0
|
|
|
|
ARQ_PAYLOAD_PER_FRAME = 0
|
|
ARQ_ACK_WAITING_FOR_ID = 0
|
|
ARQ_RX_BURST_BUFFER = []
|
|
ARQ_RX_FRAME_BUFFER = []
|
|
ARQ_RX_FRAME_N_BURSTS = 0
|
|
|
|
## TX
|
|
ARQ_TX_N_CURRENT_ARQ_FRAME = 0
|
|
ARQ_TX_N_TOTAL_ARQ_FRAMES = 0
|
|
##
|
|
|
|
## RX
|
|
ARQ_N_ARQ_FRAMES_PER_DATA_FRAME = 0 #total number of arq frames per data frame
|
|
ARQ_RX_N_CURRENT_ARQ_FRAME = 0
|
|
##
|
|
|
|
ARQ_N_RX_ARQ_FRAMES = 0 # total number of received frames
|
|
|
|
ARQ_N_RX_FRAMES_PER_BURSTS = 0 # NUMBER OF FRAMES WE ARE WAITING FOR --> GOT DATA FROM RECEIVED FRAME
|
|
ARQ_ACK_PAYLOAD_PER_FRAME = 0 # PAYLOAD per ACK frame
|
|
ARQ_ACK_RECEIVED = 0 # set to 1 if ACK received
|
|
ARQ_FRAME_ACK_RECEIVED = 0 # set to 1 if FRAME ACK received
|
|
ARQ_ACK_TIMEOUT = 0 # set to 1 if timeut reached
|
|
ARQ_ACK_TIMEOUT_SECONDS = 4.0 #timeout for waiting for ACK frames
|
|
|
|
ARQ_RPT_TIMEOUT = False
|
|
ARQ_RPT_TIMEOUT_SECONDS = 4.0
|
|
ARQ_RPT_RECEIVED = False #indicate if RPT frame has been received
|
|
ARQ_RPT_FRAMES = []
|
|
|
|
FRAME_CRC = b''
|
|
FRAME_BOF = b'\xAA\xAA' #here we define 2 bytes for the BOF
|
|
FRAME_EOF = b'\xFF\xFF' #here we define 2 bytes for the EOF
|
|
ARQ_FRAME_BOF_RECEIVED = False # status, if we received a BOF of a data frame
|
|
ARQ_FRAME_EOF_RECEIVED = False # status, if we received a EOF of a data frame
|
|
|
|
ARQ_N_SENT_FRAMES = 0 #counter for already sent frames
|
|
|
|
|
|
# ARQ STATES:
|
|
# IDLE
|
|
# RECEIVING_DATA
|
|
# SENDING_DATA
|
|
# RECEIVING_ACK
|
|
# SENDING_ACK
|
|
# ACK_RECEIVED
|
|
#
|
|
#
|
|
#
|
|
ARQ_STATE = 'RECEIVING_DATA'
|
|
|
|
# ------- TX BUFFER
|
|
TX_BUFFER_SIZE = 0
|
|
TX_BUFFER = []
|
|
# ------- RX BUFFER
|
|
RX_BUFFER = []
|
|
RX_BUFFER_SIZE = 0
|
|
|