2020-12-23 16:48:54 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
Created on Wed Dec 23 11:13:57 2020
|
|
|
|
|
2021-01-06 12:17:17 +00:00
|
|
|
@author: DJ2LS
|
2021-09-27 15:33:59 +00:00
|
|
|
Here we are saving application wide variables and stats, which have to be accessed everywhere.
|
2022-05-09 00:41:49 +00:00
|
|
|
Not nice, suggestions are appreciated :-)
|
2020-12-23 16:48:54 +00:00
|
|
|
"""
|
2022-02-08 14:27:34 +00:00
|
|
|
|
2022-05-28 02:17:15 +00:00
|
|
|
import subprocess
|
2022-06-19 12:33:10 +00:00
|
|
|
from enum import Enum
|
2022-05-28 02:17:15 +00:00
|
|
|
|
2023-01-21 14:16:47 +00:00
|
|
|
VERSION = "0.6.11-alpha.4"
|
2022-02-08 14:27:34 +00:00
|
|
|
|
2022-11-05 21:27:33 +00:00
|
|
|
ENABLE_EXPLORER = False
|
|
|
|
|
|
|
|
|
2021-07-09 17:26:02 +00:00
|
|
|
# DAEMON
|
2022-05-28 02:17:15 +00:00
|
|
|
DAEMONPORT: int = 3001
|
|
|
|
TNCSTARTED: bool = False
|
|
|
|
TNCPROCESS: subprocess.Popen
|
2021-07-09 17:26:02 +00:00
|
|
|
|
2021-02-16 13:23:57 +00:00
|
|
|
# Operator Defaults
|
2022-05-28 02:17:15 +00:00
|
|
|
MYCALLSIGN: bytes = b"AA0AA"
|
|
|
|
MYCALLSIGN_CRC: bytes = b"A"
|
2021-02-08 15:33:11 +00:00
|
|
|
|
2022-12-04 08:43:32 +00:00
|
|
|
DXCALLSIGN: bytes = b"ZZ9YY"
|
2022-05-28 02:17:15 +00:00
|
|
|
DXCALLSIGN_CRC: bytes = b"A"
|
2021-02-08 15:33:11 +00:00
|
|
|
|
2022-05-28 02:17:15 +00:00
|
|
|
MYGRID: bytes = b""
|
|
|
|
DXGRID: bytes = b""
|
2021-02-19 08:50:04 +00:00
|
|
|
|
2022-05-28 02:17:15 +00:00
|
|
|
SSID_LIST: list = [] # ssid list we are responding to
|
2022-03-19 11:42:10 +00:00
|
|
|
|
2022-05-28 12:08:33 +00:00
|
|
|
LOW_BANDWIDTH_MODE: bool = False
|
2021-03-12 13:14:36 +00:00
|
|
|
# ---------------------------------
|
2021-02-08 15:33:11 +00:00
|
|
|
|
2021-02-16 13:23:57 +00:00
|
|
|
# Server Defaults
|
2022-05-28 02:17:15 +00:00
|
|
|
HOST: str = "0.0.0.0"
|
|
|
|
PORT: int = 3000
|
|
|
|
SOCKET_TIMEOUT: int = 1 # seconds
|
2021-03-12 13:14:36 +00:00
|
|
|
# ---------------------------------
|
2022-05-28 02:17:15 +00:00
|
|
|
SERIAL_DEVICES: list = []
|
2022-01-22 19:39:37 +00:00
|
|
|
# ---------------------------------
|
2022-12-01 09:05:24 +00:00
|
|
|
LISTEN: bool = True
|
2022-05-28 02:17:15 +00:00
|
|
|
PTT_STATE: bool = False
|
|
|
|
TRANSMITTING: bool = False
|
|
|
|
|
|
|
|
HAMLIB_VERSION: str = "0"
|
|
|
|
HAMLIB_PTT_TYPE: str = "RTS"
|
|
|
|
HAMLIB_DEVICE_NAME: str = "RIG_MODEL_DUMMY_NOVFO"
|
|
|
|
HAMLIB_DEVICE_PORT: str = "/dev/ttyUSB0"
|
|
|
|
HAMLIB_SERIAL_SPEED: str = "9600"
|
|
|
|
HAMLIB_PTT_PORT: str = "/dev/ttyUSB0"
|
|
|
|
HAMLIB_STOP_BITS: str = "1"
|
|
|
|
HAMLIB_DATA_BITS: str = "8"
|
|
|
|
HAMLIB_HANDSHAKE: str = "None"
|
|
|
|
HAMLIB_RADIOCONTROL: str = "direct"
|
|
|
|
HAMLIB_RIGCTLD_IP: str = "127.0.0.1"
|
|
|
|
HAMLIB_RIGCTLD_PORT: str = "4532"
|
|
|
|
|
2022-11-18 12:08:37 +00:00
|
|
|
HAMLIB_STATUS: str = "unknown/disconnected"
|
2022-05-28 02:17:15 +00:00
|
|
|
HAMLIB_FREQUENCY: int = 0
|
|
|
|
HAMLIB_MODE: str = ""
|
2022-05-28 12:08:33 +00:00
|
|
|
HAMLIB_BANDWIDTH: int = 0
|
2021-03-12 13:14:36 +00:00
|
|
|
# -------------------------
|
2020-12-23 16:48:54 +00:00
|
|
|
# FreeDV Defaults
|
2021-02-24 13:16:29 +00:00
|
|
|
|
2022-05-28 02:17:15 +00:00
|
|
|
SNR: float = 0
|
|
|
|
FREQ_OFFSET: float = 0
|
|
|
|
SCATTER: list = []
|
|
|
|
ENABLE_SCATTER: bool = False
|
2022-12-05 16:37:09 +00:00
|
|
|
ENABLE_FSK: bool = False
|
2022-05-28 02:17:15 +00:00
|
|
|
RESPOND_TO_CQ: bool = False
|
2022-12-04 15:56:32 +00:00
|
|
|
RESPOND_TO_CALL: bool = True # respond to cq, ping, connection request, file request if not in session
|
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
|
2022-05-28 02:17:15 +00:00
|
|
|
TX_AUDIO_LEVEL: int = 50
|
|
|
|
AUDIO_INPUT_DEVICES: list = []
|
|
|
|
AUDIO_OUTPUT_DEVICES: list = []
|
|
|
|
AUDIO_INPUT_DEVICE: int = -2
|
|
|
|
AUDIO_OUTPUT_DEVICE: int = -2
|
2022-12-26 11:11:59 +00:00
|
|
|
AUDIO_RECORD: bool = False
|
|
|
|
AUDIO_RECORD_FILE = ''
|
2022-05-28 02:17:15 +00:00
|
|
|
BUFFER_OVERFLOW_COUNTER: list = [0, 0, 0, 0, 0]
|
|
|
|
|
2022-11-18 14:19:41 +00:00
|
|
|
AUDIO_DBFS: int = 0
|
2022-05-28 02:17:15 +00:00
|
|
|
FFT: list = [0]
|
2022-12-05 16:37:09 +00:00
|
|
|
ENABLE_FFT: bool = True
|
2022-05-28 02:17:15 +00:00
|
|
|
CHANNEL_BUSY: bool = False
|
2020-12-25 21:55:56 +00:00
|
|
|
|
2022-02-08 14:27:34 +00:00
|
|
|
# ARQ PROTOCOL VERSION
|
2022-12-28 16:06:55 +00:00
|
|
|
ARQ_PROTOCOL_VERSION: int = 5
|
2022-02-08 14:27:34 +00:00
|
|
|
|
2021-09-26 15:51:11 +00:00
|
|
|
# ARQ statistics
|
2023-01-12 23:14:42 +00:00
|
|
|
SPEED_LIST: list = []
|
2022-05-28 02:17:15 +00:00
|
|
|
ARQ_BYTES_PER_MINUTE_BURST: int = 0
|
|
|
|
ARQ_BYTES_PER_MINUTE: int = 0
|
|
|
|
ARQ_BITS_PER_SECOND_BURST: int = 0
|
|
|
|
ARQ_BITS_PER_SECOND: int = 0
|
|
|
|
ARQ_COMPRESSION_FACTOR: int = 0
|
|
|
|
ARQ_TRANSMISSION_PERCENT: int = 0
|
2022-12-31 11:38:46 +00:00
|
|
|
ARQ_SECONDS_UNTIL_FINISH: int = 0
|
2022-05-28 02:17:15 +00:00
|
|
|
ARQ_SPEED_LEVEL: int = 0
|
|
|
|
TOTAL_BYTES: int = 0
|
2022-12-26 09:25:50 +00:00
|
|
|
# set save to folder state for allowing downloading files to local file system
|
|
|
|
ARQ_SAVE_TO_FOLDER: bool = False
|
2021-02-24 15:47:52 +00:00
|
|
|
|
2022-05-23 11:11:16 +00:00
|
|
|
# CHANNEL_STATE = 'RECEIVING_SIGNALLING'
|
2022-05-28 02:17:15 +00:00
|
|
|
TNC_STATE: str = "IDLE"
|
|
|
|
ARQ_STATE: bool = False
|
|
|
|
ARQ_SESSION: bool = False
|
|
|
|
# disconnected, connecting, connected, disconnecting, failed
|
|
|
|
ARQ_SESSION_STATE: str = "disconnected"
|
2021-09-27 15:33:59 +00:00
|
|
|
|
2021-12-06 19:16:14 +00:00
|
|
|
# BEACON STATE
|
2022-05-28 02:17:15 +00:00
|
|
|
BEACON_STATE: bool = False
|
|
|
|
BEACON_PAUSE: bool = False
|
2021-09-26 15:51:11 +00:00
|
|
|
|
2020-12-30 17:16:32 +00:00
|
|
|
# ------- RX BUFFER
|
2022-05-28 02:17:15 +00:00
|
|
|
RX_MSG_BUFFER: list = []
|
|
|
|
RX_BURST_BUFFER: list = []
|
|
|
|
RX_FRAME_BUFFER: bytes = b""
|
2022-09-05 09:54:50 +00:00
|
|
|
RX_BUFFER_SIZE: int = 16
|
2020-12-26 10:02:14 +00:00
|
|
|
|
2022-05-23 11:11:16 +00:00
|
|
|
# ------- HEARD STATIONS BUFFER
|
2022-05-28 02:17:15 +00:00
|
|
|
HEARD_STATIONS: list = []
|
2021-10-07 19:04:23 +00:00
|
|
|
|
|
|
|
# ------- INFO MESSAGE BUFFER
|
2022-05-28 02:17:15 +00:00
|
|
|
INFO: list = []
|
2022-03-19 11:42:10 +00:00
|
|
|
|
|
|
|
# ------- CODEC2 SETTINGS
|
2022-05-28 02:17:15 +00:00
|
|
|
TUNING_RANGE_FMIN: float = -50.0
|
|
|
|
TUNING_RANGE_FMAX: float = 50.0
|
2022-06-19 12:33:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
class FRAME_TYPE(Enum):
|
|
|
|
"""Lookup for frame types"""
|
|
|
|
|
|
|
|
BURST_01 = 10
|
2022-06-21 22:33:55 +00:00
|
|
|
# ...
|
|
|
|
BURST_51 = 50
|
2022-06-24 13:48:50 +00:00
|
|
|
BURST_ACK = 60
|
2022-06-19 12:33:10 +00:00
|
|
|
FR_ACK = 61
|
|
|
|
FR_REPEAT = 62
|
|
|
|
FR_NACK = 63
|
|
|
|
BURST_NACK = 64
|
|
|
|
CQ = 200
|
|
|
|
QRV = 201
|
|
|
|
PING = 210
|
|
|
|
PING_ACK = 211
|
|
|
|
ARQ_SESSION_OPEN = 221
|
|
|
|
ARQ_SESSION_HB = 222
|
|
|
|
ARQ_SESSION_CLOSE = 223
|
|
|
|
ARQ_DC_OPEN_W = 225
|
|
|
|
ARQ_DC_OPEN_ACK_W = 226
|
|
|
|
ARQ_DC_OPEN_N = 227
|
|
|
|
ARQ_DC_OPEN_ACK_N = 228
|
|
|
|
ARQ_STOP = 249
|
|
|
|
BEACON = 250
|
2022-10-21 19:59:26 +00:00
|
|
|
IDENT = 254
|
2022-06-21 00:11:07 +00:00
|
|
|
TEST_FRAME = 255
|