diff --git a/CHANGELOG.md b/CHANGELOG.md index 06c965af..e46f86f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Changelog +- [24-12-14] Changed method of detecting fldigi QSOs. See docs. - [24-12-12] Add a try exception for a unicode decode error. - [24-12-11-1] Add RTC to RAC Canada Day, ARRL VHF, ARRL Field Day, ARRL SS, ARRL DX, 10 10 - [24-12-11] Add RTC to IARU HF, IARU Field Day, DARC XMAS, CQ WW, CQ WPX diff --git a/README.md b/README.md index ef0f33cf..16736e8f 100644 --- a/README.md +++ b/README.md @@ -208,6 +208,7 @@ generated, 'cause I'm lazy, list of those who've submitted PR's. ## Recent Changes (Polishing the Turd) +- [24-12-14] Changed method of detecting fldigi QSOs. See docs. - [24-12-12] Add a try exception for a unicode decode error. - [24-12-11-1] Add RTC to RAC Canada Day, ARRL VHF, ARRL Field Day, ARRL SS, ARRL DX, 10 10 - [24-12-11] Add RTC to IARU HF, IARU Field Day, DARC XMAS, CQ WW, CQ WPX @@ -607,9 +608,13 @@ On the Options TAB you can: not1mm listens for WSJT-X UDP traffic on the Multicast address 224.0.0.1:2237. No setup is needed to be done on not1mm's side. That's good because I'm lazy. -not1mm polls for fldigi QSOs via it's XMLRPC interface. It does this in a rather stupid +~~not1mm polls for fldigi QSOs via it's XMLRPC interface. It does this in a rather stupid way. It just keeps asking what was the last QSO and compares it to the previous response. -If it's different, it's new. +If it's different, it's new.~~ + +not1mm watches for fldigi qso's by watching for UDP traffic from fldigi on 127.0.0.1:9876. + +![fldigi configuration dialog](https://github.com/mbridak/not1mm/blob/master/pic/fldigi_adif_udp.png?raw=true) The F1-F12 function keys be sent to fldigi via XMLRPC. Fldigi will be placed into TX mode, the message will be sent and a ^r will be tacked onto the end to place it back into diff --git a/not1mm/__main__.py b/not1mm/__main__.py index e465456c..e361ac72 100644 --- a/not1mm/__main__.py +++ b/not1mm/__main__.py @@ -33,7 +33,7 @@ print(exception) print("portaudio is not installed") sd = None -from PyQt6 import QtCore, QtGui, QtWidgets, uic +from PyQt6 import QtCore, QtGui, QtWidgets, uic, QtNetwork from PyQt6.QtCore import QDir, Qt, QThread, QSettings, QCoreApplication from PyQt6.QtGui import QFontDatabase, QColorConstants, QPalette, QColor, QPixmap from PyQt6.QtWidgets import QFileDialog, QSplashScreen, QApplication @@ -66,7 +66,6 @@ from not1mm.lib.version import __version__ from not1mm.lib.versiontest import VersionTest from not1mm.lib.ft8_watcher import FT8Watcher -from not1mm.lib.fldigi_watcher import FlDigiWatcher from not1mm.lib.fldigi_sendstring import FlDigi_Comm import not1mm.fsutils as fsutils @@ -174,10 +173,8 @@ class MainWindow(QtWidgets.QMainWindow): radio_thread = QThread() voice_thread = QThread() - fldigi_thread = QThread() rtc_thread = QThread() - fldigi_watcher = None rig_control = None log_window = None check_window = None @@ -668,14 +665,6 @@ def __init__(self, splash): self.show_splash_msg("Reading macros.") self.read_macros() - self.show_splash_msg("Starting FlDigi watcher.") - self.fldigi_watcher = FlDigiWatcher() - self.fldigi_watcher.moveToThread(self.fldigi_thread) - self.fldigi_thread.started.connect(self.fldigi_watcher.run) - self.fldigi_thread.finished.connect(self.fldigi_watcher.deleteLater) - self.fldigi_watcher.poll_callback.connect(self.fldigi_qso) - self.fldigi_thread.start() - self.show_splash_msg("Restoring window states.") self.settings = QSettings("K6GTE", "not1mm") if self.settings.value("windowState") is not None: @@ -718,6 +707,20 @@ def __init__(self, splash): "You can udate to the current version by using:\npip install -U not1mm" ) + self.udp_socket = QtNetwork.QUdpSocket() + b_result = self.udp_socket.bind( + QtNetwork.QHostAddress.SpecialAddress.AnyIPv4, 9876 + ) + logger.info(f"bind {b_result}") + self.udp_socket.readyRead.connect(self.fldigi_on_udp_socket_ready_read) + + def fldigi_on_udp_socket_ready_read(self): + """""" + datagram, sender_host, sender_port_number = self.udp_socket.readDatagram( + self.udp_socket.pendingDatagramSize() + ) + self.fldigi_qso(datagram.decode()) + def load_call_history(self) -> None: """Display filepicker and load chosen call history file.""" filename = self.filepicker("other") diff --git a/not1mm/lib/fldigi_watcher.py b/not1mm/lib/fldigi_watcher.py deleted file mode 100644 index 1a7d1b00..00000000 --- a/not1mm/lib/fldigi_watcher.py +++ /dev/null @@ -1,33 +0,0 @@ -import xmlrpc.client -from PyQt6.QtCore import QObject, pyqtSignal, QThread, QEventLoop - - -class FlDigiWatcher(QObject): - """fldigi watcher""" - - poll_callback = pyqtSignal(str) - time_to_quit = False - - def __init__(self): - super().__init__() - ... - - self.target = "http://127.0.0.1:7362" - self.payload = "" - self.response = "" - - def run(self): - while not self.time_to_quit: - try: - server = xmlrpc.client.ServerProxy(self.target) - self.response = server.logbook.last_record() - except OSError: - QThread.msleep(100) - continue - if self.payload != self.response: - self.payload = self.response - try: - self.poll_callback.emit(self.payload) - except QEventLoop: - ... - QThread.msleep(100) diff --git a/not1mm/lib/version.py b/not1mm/lib/version.py index 9b55fccd..1d94a452 100644 --- a/not1mm/lib/version.py +++ b/not1mm/lib/version.py @@ -1,3 +1,3 @@ """It's the version""" -__version__ = "24.12.12" +__version__ = "24.12.14" diff --git a/pic/fldigi_adif_udp.png b/pic/fldigi_adif_udp.png new file mode 100644 index 00000000..334aa9b4 Binary files /dev/null and b/pic/fldigi_adif_udp.png differ diff --git a/pyproject.toml b/pyproject.toml index 54f605d0..dd2860b1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "not1mm" -version = "24.12.12" +version = "24.12.14" description = "NOT1MM Logger" readme = "README.md" requires-python = ">=3.9"