FreeDATA/tnc/static.py

193 lines
3.9 KiB
Python
Raw Normal View History

2020-12-23 16:48:54 +00:00
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 23 11:13:57 2020
@author: DJ2LS
2020-12-23 16:48:54 +00:00
"""
2021-07-09 17:26:02 +00:00
# DAEMON
DAEMONPORT = 3001
TNCSTARTED = False
TNCPROCESS = 0
2021-02-16 13:23:57 +00:00
# Operator Defaults
2021-02-16 21:41:06 +00:00
MYCALLSIGN = b'AA0AA'
MYCALLSIGN_CRC8 = b'A'
2021-02-16 21:41:06 +00:00
DXCALLSIGN = b'AA0AA'
DXCALLSIGN_CRC8 = b'A'
2021-02-16 13:23:57 +00:00
MYGRID = b''
2021-05-14 06:48:51 +00:00
DXGRID = b''
2021-02-19 08:50:04 +00:00
2021-03-12 13:14:36 +00:00
# ---------------------------------
2021-02-16 13:23:57 +00:00
# Server Defaults
HOST = "0.0.0.0"
2021-02-16 13:23:57 +00:00
PORT = 3000
SOCKET_TIMEOUT = 3 # seconds
2021-03-12 13:14:36 +00:00
# ---------------------------------
# HAMLIB DEFAULTS
2021-03-12 13:14:36 +00:00
# RIG_PTT_NONE
# No PTT available
2021-03-12 13:14:36 +00:00
# RIG_PTT_RIG
# Legacy PTT
2021-03-12 13:14:36 +00:00
# RIG_PTT_SERIAL_DTR
# PTT control through serial DTR signal
2021-03-12 13:14:36 +00:00
# RIG_PTT_SERIAL_RTS
# PTT control through serial RTS signal
2021-03-12 13:14:36 +00:00
# RIG_PTT_PARALLEL
# PTT control through parallel port
2021-03-12 13:14:36 +00:00
# RIG_PTT_RIG_MICDATA
# Legacy PTT, supports RIG_PTT_ON_MIC/RIG_PTT_ON_DATA
2021-03-12 13:14:36 +00:00
# RIG_PTT_CM108
# PTT control through CM108 GPIO pin
HAMLIB_PTT_TYPE = 'RTS'
PTT_STATE = False
2021-05-14 06:48:51 +00:00
HAMLIB_DEVICE_ID = 0
HAMLIB_DEVICE_PORT = '/dev/ttyUSB0'
2021-07-25 14:34:28 +00:00
HAMLIB_SERIAL_SPEED = '9600'
2021-05-29 20:18:11 +00:00
HAMLIB_FREQUENCY = 0
2021-05-29 21:19:50 +00:00
HAMLIB_MODE = ''
HAMLIB_BANDWITH = 0
2021-03-12 13:14:36 +00:00
# -------------------------
2020-12-23 16:48:54 +00:00
# FreeDV Defaults
2021-02-05 13:40:32 +00:00
FREEDV_RECEIVE = True
2021-02-04 14:25:15 +00:00
FREEDV_SIGNALLING_MODE = 14
2021-01-20 21:51:14 +00:00
FREEDV_DATA_BYTES_PER_FRAME = 0
FREEDV_DATA_PAYLOAD_PER_FRAME = 0
FREEDV_SIGNALLING_BYTES_PER_FRAME = 0
FREEDV_SIGNALLING_PAYLOAD_PER_FRAME = 0
2021-02-28 18:34:36 +00:00
BER = 0
2021-03-16 15:37:23 +00:00
SNR = 0
2021-03-12 13:14:36 +00:00
# ---------------------------------
2020-12-23 16:48:54 +00:00
2021-03-12 13:14:36 +00:00
# Audio Defaults
2020-12-23 16:48:54 +00:00
AUDIO_INPUT_DEVICE = 1
AUDIO_OUTPUT_DEVICE = 1
2021-02-04 16:51:01 +00:00
#TX_SAMPLE_STATE = None
#RX_SAMPLE_STATE = None
2021-01-07 08:28:26 +00:00
AUDIO_SAMPLE_RATE_RX = 48000
AUDIO_SAMPLE_RATE_TX = 48000
2021-03-12 13:14:36 +00:00
MODEM_SAMPLE_RATE = 8000 # 8000
AUDIO_FRAMES_PER_BUFFER = 8192 # 256 # 512 # 1024 #2048 --> nicht 880 # 128 gut, 256, 1024 16384
2020-12-23 16:48:54 +00:00
AUDIO_CHANNELS = 1
2021-03-09 15:45:27 +00:00
AUDIO_RMS = 0
2021-07-09 17:26:02 +00:00
FFT = []
2021-03-12 13:14:36 +00:00
# ---------------------------------
2021-03-12 13:14:36 +00:00
# ARQ DEFAULTS
2021-03-18 14:29:51 +00:00
TX_N_MAX_RETRIES = 3
2021-01-20 21:51:14 +00:00
TX_N_RETRIES = 0
2021-01-20 22:42:45 +00:00
2021-01-20 21:51:14 +00:00
ARQ_TX_N_FRAMES_PER_BURST = 0
ARQ_TX_N_BURSTS = 0
ARQ_PAYLOAD_PER_FRAME = 0
2021-02-16 13:23:57 +00:00
ARQ_RX_BURST_BUFFER = []
ARQ_RX_FRAME_BUFFER = []
2020-12-30 17:16:32 +00:00
ARQ_RX_FRAME_N_BURSTS = 0
2021-02-04 16:51:01 +00:00
2021-03-12 13:14:36 +00:00
# TX
2021-02-05 13:40:32 +00:00
ARQ_TX_N_CURRENT_ARQ_FRAME = 0
ARQ_TX_N_TOTAL_ARQ_FRAMES = 0
##
2021-03-12 13:14:36 +00:00
# RX
ARQ_N_ARQ_FRAMES_PER_DATA_FRAME = 0 # total number of arq frames per data frame
2021-02-05 13:40:32 +00:00
ARQ_RX_N_CURRENT_ARQ_FRAME = 0
##
2021-03-12 13:14:36 +00:00
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
2021-03-12 13:14:36 +00:00
ARQ_ACK_RECEIVED = False # set to 1 if ACK received
ARQ_RX_ACK_TIMEOUT = False # set to 1 if timeut reached
ARQ_RX_ACK_TIMEOUT_SECONDS = 7.0 # timeout for waiting for ACK frames
2021-02-10 14:05:03 +00:00
2021-03-12 13:14:36 +00:00
ARQ_FRAME_ACK_RECEIVED = False # set to 1 if FRAME ACK received
2021-02-10 14:05:03 +00:00
ARQ_RX_FRAME_TIMEOUT = False
2021-02-16 13:23:57 +00:00
ARQ_RX_FRAME_TIMEOUT_SECONDS = 10.0
2021-02-10 14:05:03 +00:00
2021-02-09 13:27:36 +00:00
ARQ_RX_RPT_TIMEOUT = False
2021-02-16 13:23:57 +00:00
ARQ_RX_RPT_TIMEOUT_SECONDS = 10.0
2021-03-12 13:14:36 +00:00
ARQ_RPT_RECEIVED = False # indicate if RPT frame has been received
ARQ_RPT_FRAMES = [] # buffer for frames which are requested to repeat
FRAME_CRC = b''
2021-03-12 13:14:36 +00:00
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
2021-03-12 13:14:36 +00:00
ARQ_N_SENT_FRAMES = 0 # counter for already sent frames
2021-01-02 08:41:58 +00:00
2021-01-20 13:31:28 +00:00
# ARQ STATES:
# IDLE
# RECEIVING_DATA
# SENDING_DATA
2021-02-09 13:27:36 +00:00
# RECEIVING_SIGNALLING
2021-01-20 13:31:28 +00:00
# SENDING_ACK
2021-01-20 22:42:45 +00:00
# ACK_RECEIVED
2021-02-24 15:47:52 +00:00
2021-03-16 10:39:22 +00:00
# DATA
ARQ_STATE = 'IDLE'
2020-12-30 17:16:32 +00:00
2021-02-24 15:47:52 +00:00
# RECEIVING_SIGNALLING
# RECEIVING_DATA_10
# RECEIVING_DATA_11
# RECEIVING_DATA_12
CHANNEL_STATE = 'RECEIVING_SIGNALLING'
# IDLE
2021-02-28 14:24:14 +00:00
# BUSY
2021-02-24 16:41:14 +00:00
TNC_STATE = 'IDLE'
2021-02-24 15:47:52 +00:00
2021-02-28 14:24:14 +00:00
# MODE FOR SENDING AN RECEIVING DATA DURING ARQ SESSION
2021-03-18 14:29:51 +00:00
ARQ_OPEN_DATA_CHANNEL_RETRIES = 3
2021-02-28 14:24:14 +00:00
ARQ_READY_FOR_DATA = False
2021-03-17 10:22:06 +00:00
ARQ_DATA_CHANNEL_MODE = 0
ARQ_DATA_CHANNEL_LAST_RECEIVED = 0
2021-02-28 14:24:14 +00:00
2021-03-17 10:22:06 +00:00
# BIT RATE MESSUREMENT
ARQ_START_OF_TRANSMISSION = 0
ARQ_START_OF_BURST = 0
2021-03-17 10:22:06 +00:00
#ARQ_END_OF_TRANSMISSION = 0
ARQ_BITS_PER_SECOND = 0
ARQ_BYTES_PER_MINUTE = 0
2021-02-24 15:47:52 +00:00
2020-12-26 10:02:14 +00:00
# ------- TX BUFFER
TX_BUFFER_SIZE = 0
2021-01-20 21:51:14 +00:00
TX_BUFFER = []
2020-12-30 17:16:32 +00:00
# ------- RX BUFFER
RX_BUFFER = []
2021-01-20 21:51:14 +00:00
RX_BUFFER_SIZE = 0
2020-12-26 10:02:14 +00:00
2021-03-11 19:04:31 +00:00
# ------- HEARD STATIOS BUFFER
HEARD_STATIONS = []