added placeholder for dataclasses

This commit is contained in:
DJ2LS 2023-04-26 18:23:49 +02:00
parent afeea49ba6
commit e14b16f3cf
12 changed files with 65 additions and 2 deletions

View file

@ -22,6 +22,7 @@ import modem
import numpy as np import numpy as np
import sock import sock
import static import static
from static import ARQ, Audio, Beacon, Channel, Daemon, Hamlib, Modem, Station, TCI, TNC
import structlog import structlog
import stats import stats
import ujson as json import ujson as json
@ -30,6 +31,7 @@ from exceptions import NoCallsign
from queues import DATA_QUEUE_RECEIVED, DATA_QUEUE_TRANSMIT, RX_BUFFER from queues import DATA_QUEUE_RECEIVED, DATA_QUEUE_TRANSMIT, RX_BUFFER
from static import FRAME_TYPE as FR_TYPE from static import FRAME_TYPE as FR_TYPE
TESTMODE = False TESTMODE = False

View file

@ -13,6 +13,8 @@ import time
import ujson as json import ujson as json
import structlog import structlog
import static import static
from static import ARQ, Audio, Beacon, Channel, Daemon, Hamlib, Modem, Station, TCI, TNC
log = structlog.get_logger("explorer") log = structlog.get_logger("explorer")

View file

@ -8,6 +8,7 @@ import time
from datetime import datetime,timezone from datetime import datetime,timezone
import crcengine import crcengine
import static import static
from static import ARQ, Audio, Beacon, Channel, Daemon, Hamlib, Modem, Station, TCI, TNC
import structlog import structlog
import numpy as np import numpy as np
import threading import threading

View file

@ -29,6 +29,7 @@ import helpers
import log_handler import log_handler
import modem import modem
import static import static
from static import ARQ, Audio, Beacon, Channel, Daemon, Hamlib, Modem, Station, TCI, TNC
import structlog import structlog
import explorer import explorer
import json import json
@ -394,7 +395,7 @@ if __name__ == "__main__":
log.error("[DMN] logger init error", exception=err) log.error("[DMN] logger init error", exception=err)
log.info( log.info(
"[TNC] Starting FreeDATA", author="DJ2LS", version=static.VERSION "[TNC] Starting FreeDATA", author="DJ2LS", version=TNC.version
) )
# start data handler # start data handler

View file

@ -23,6 +23,7 @@ import numpy as np
import sock import sock
import sounddevice as sd import sounddevice as sd
import static import static
from static import ARQ, Audio, Beacon, Channel, Daemon, Hamlib, Modem, Station, TCI, TNC
from static import FRAME_TYPE from static import FRAME_TYPE
import structlog import structlog
import ujson as json import ujson as json

View file

@ -3,6 +3,7 @@ Hold queues used by more than one module to eliminate cyclic imports.
""" """
import queue import queue
import static import static
from static import ARQ, Audio, Beacon, Channel, Daemon, Hamlib, Modem, Station, TCI, TNC
DATA_QUEUE_TRANSMIT = queue.Queue() DATA_QUEUE_TRANSMIT = queue.Queue()
DATA_QUEUE_RECEIVED = queue.Queue() DATA_QUEUE_RECEIVED = queue.Queue()

View file

@ -10,6 +10,7 @@ import time
import structlog import structlog
import threading import threading
import static import static
from static import ARQ, Audio, Beacon, Channel, Daemon, Hamlib, Modem, Station, TCI, TNC
# set global hamlib version # set global hamlib version
hamlib_version = 0 hamlib_version = 0

View file

@ -7,6 +7,8 @@ simple TNC self tests
# pylint: disable=import-outside-toplevel, attribute-defined-outside-init # pylint: disable=import-outside-toplevel, attribute-defined-outside-init
import sys import sys
import structlog import structlog
from static import ARQ, Audio, Beacon, Channel, Daemon, Hamlib, Modem, Station, TCI, TNC
log = structlog.get_logger("selftest") log = structlog.get_logger("selftest")

View file

@ -27,6 +27,7 @@ import time
import wave import wave
import helpers import helpers
import static import static
from static import ARQ, Audio, Beacon, Channel, Daemon, Hamlib, Modem, Station, TCI, TNC
import structlog import structlog
from random import randrange from random import randrange
import ujson as json import ujson as json

View file

@ -8,11 +8,15 @@ Here we are saving application wide variables and stats, which have to be access
Not nice, suggestions are appreciated :-) Not nice, suggestions are appreciated :-)
""" """
from dataclasses import dataclass, field
from typing import List
import subprocess import subprocess
from enum import Enum from enum import Enum
CHANNEL_BUSY_SLOT = [False] * 5 CHANNEL_BUSY_SLOT = [False] * 5
VERSION = "0.9.0-alpha-exp.5"
ENABLE_EXPLORER = False ENABLE_EXPLORER = False
ENABLE_STATS = False ENABLE_STATS = False
@ -173,3 +177,48 @@ class FRAME_TYPE(Enum):
FEC = 251 FEC = 251
IDENT = 254 IDENT = 254
TEST_FRAME = 255 TEST_FRAME = 255
# TODO: Move settings above to dataclasses
@dataclass
class ARQ:
pass
@dataclass
class Audio:
pass
@dataclass
class Beacon:
pass
@dataclass
class Channel:
pass
@dataclass
class Daemon:
pass
@dataclass
class Hamlib:
pass
@dataclass
class Modem:
pass
@dataclass
class Station:
pass
@dataclass
class TCI:
pass
@dataclass
class TNC:
version = "0.9.0-alpha-exp.5"

View file

@ -13,6 +13,7 @@ import time
import ujson as json import ujson as json
import structlog import structlog
import static import static
from static import ARQ, Audio, Beacon, Channel, Daemon, Hamlib, Modem, Station, TCI, TNC
log = structlog.get_logger("stats") log = structlog.get_logger("stats")

View file

@ -7,6 +7,7 @@ import websocket
import numpy as np import numpy as np
import time import time
from queues import AUDIO_TRANSMIT_QUEUE, AUDIO_RECEIVED_QUEUE from queues import AUDIO_TRANSMIT_QUEUE, AUDIO_RECEIVED_QUEUE
from static import ARQ, Audio, Beacon, Channel, Daemon, Hamlib, Modem, Station, TCI, TNC
class TCI: class TCI:
def __init__(self, hostname='127.0.0.1', port=50001): def __init__(self, hostname='127.0.0.1', port=50001):