From 6f9a34b0d6c33e1ef2939f234537667d7ee20a5a Mon Sep 17 00:00:00 2001 From: dj2ls Date: Fri, 26 Nov 2021 19:14:11 +0100 Subject: [PATCH] hamlib compatibility improved hamlib compatibility between v 3 and v 4. --- gui/src/index.html | 1933 +++++++++++++++++++++----------------------- tnc/daemon.py | 14 +- tnc/modem.py | 12 +- 3 files changed, 955 insertions(+), 1004 deletions(-) diff --git a/gui/src/index.html b/gui/src/index.html index f6864c8f..958dd5b0 100644 --- a/gui/src/index.html +++ b/gui/src/index.html @@ -1,599 +1,551 @@ - - - - - - - - - - - - - - - FreeDATA - - - - -
- - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
-
-
-
-
- - - - - - AUDIO SETTINGS -
-
-
- + + + + + + + + + + + + + + FreeDATA + + + + + +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+ + + + + AUDIO SETTINGS +
+
+
- -
-
- + +
+
- -
-
-
-

RX AUDIO LEVEL

-
-
- -
-
-
-
-
- - - - - RADIO SETTINGS -
-
-
- RIG - - PTT - -
- -
- Port - + - - Speed - -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
-
-
MY STATION
-
-
-
-
- - -
-
-
-
- - -
-
-
- -
-
-
-
-
-
PING & CQ
-
-
-
-
- Ping - - - ACK - 0000 km - 0 dB -
-
-
-
- -
-
-
- -
-
-
-
-
-
-
-
-
- - - - -
-
-
- - - -
-
-
-
-
- -
HEARD STATIONS
-
- - - - - - - - - - - - - - - - + + +
+
+
+
+
MY STATION +
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+ +
+
+
+
+
+
PING & CQ +
+
+
+
+
Ping + + ACK + 0000 km + 0 dB +
+
+
+
+ +
+
+
+ +
+
+
+
+
+
+
+
+
+ + + + +
+
+
+ + + +
+
+
+
+
+ +
HEARD STATIONS +
+
+ +
TimeFrequencyDXCallDXGridDistanceTypeSNROff
+ + + + + + + + + + + + + + - -
TimeFrequencyDXCallDXGridDistanceTypeSNROff
- -
-
-
-
-
-
- -
-
-
+ + + +
+
+
+
+
+
+ +
+
+
Received Files
- -
-
- - - - - - - +
TimeDXCall
+ + + + + - - - - - - + + + + - -
TimeDXCallFilename
- -
-
- -
-
-
Transmit Files
- -
-
- -
-
-
-
-
-
- DX Station -
-
-
-
-
- -
-
-
-
- - ACK - 0000 km - 0 dB -
-
-
-
-
-
- -
- -
-
-
-
- Data -
-
-
- - -
-
-
-
- -
- -
-
-
-
- Mode -
-
-
-
-
- Mode - -
-
-
-
- Frames - -
-
-
-
-
- -
- -
-
-
- -
-
- -
-
- +
+
+ +
+
+
Transmit Files
+ +
+
+ +
+
+
+
+
+
DX Station +
+
+
+
+
+ +
+
+
+
+ ACK + 0000 km + 0 dB +
+
+
+
+
+
+ +
+ +
+
+
+
Data +
+
+
+ + +
+
+
+
+ +
+ +
+
+
+
Mode +
+
+
+
+
Mode + +
+
+
+
Frames + +
+
+
+
+
+ +
+ +
+
+
+ +
+
+ +
+
+ -
-
-
-
- -
- - -
-
-
-
- - - - - - - - - - - - - - - - + PTT Speed + +
+
+ +
+
+ + + diff --git a/tnc/daemon.py b/tnc/daemon.py index 123e4c2f..c87dafa7 100755 --- a/tnc/daemon.py +++ b/tnc/daemon.py @@ -284,8 +284,17 @@ class CMDTCPRequestHandler(socketserver.BaseRequestHandler): # try to init hamlib try: + Hamlib.rig_set_debug(Hamlib.RIG_DEBUG_NONE) - my_rig = Hamlib.Rig(int(deviceid)) + + # get devicenumber by looking for deviceobject in Hamlib module + try: + devicenumber = getattr(Hamlib, deviceid) + except: + structlog.get_logger("structlog").error("[DMN] Hamlib: rig not supported...") + devicenumber = 0 + + my_rig = Hamlib.Rig(int(devicenumber)) my_rig.set_conf("rig_pathname", deviceport) my_rig.set_conf("retry", "1") my_rig.set_conf("serial_speed", serialspeed) @@ -345,8 +354,7 @@ class CMDTCPRequestHandler(socketserver.BaseRequestHandler): self.request.sendall(bytes(jsondata, encoding)) except: - structlog.get_logger("structlog").error("[DMN] Hamlib: Can't open rig") - structlog.get_logger("structlog").error("[DMN] Unexpected error", e = sys.exc_info()[0]) + structlog.get_logger("structlog").error("[DMN] Hamlib: Can't open rig", e = sys.exc_info()[0]) # exception, if JSON cant be decoded # except Exception as e: diff --git a/tnc/modem.py b/tnc/modem.py index 9b7c7a75..9539a090 100644 --- a/tnc/modem.py +++ b/tnc/modem.py @@ -185,7 +185,15 @@ class RF(): # try to init hamlib try: Hamlib.rig_set_debug(Hamlib.RIG_DEBUG_NONE) - self.my_rig = Hamlib.Rig(int(static.HAMLIB_DEVICE_ID)) + + # get devicenumber by looking for deviceobject in Hamlib module + try: + devicenumber = getattr(Hamlib, static.HAMLIB_DEVICE_ID) + except: + structlog.get_logger("structlog").error("[DMN] Hamlib: rig not supported...") + devicenumber = 0 + + self.my_rig = Hamlib.Rig(int(devicenumber)) self.my_rig.set_conf("rig_pathname", static.HAMLIB_DEVICE_PORT) self.my_rig.set_conf("retry", "5") self.my_rig.set_conf("serial_speed", static.HAMLIB_SERIAL_SPEED) @@ -234,9 +242,7 @@ class RF(): HAMLIB_THREAD.start() except: - structlog.get_logger("structlog").error("[TNC] Network error", e=sys.exc_info()[0]) structlog.get_logger("structlog").error("[TNC] Hamlib - can't open rig", e=sys.exc_info()[0]) - sys.exit("hamlib error") # --------------------------------------------------------------------------------------------------------