added hamlib connection state indicator

This commit is contained in:
DJ2LS 2022-11-18 13:08:37 +01:00
parent 70bdd59847
commit 5774c642ec
7 changed files with 21 additions and 2 deletions

View file

@ -1459,6 +1459,14 @@ ipcRenderer.on('action-update-tnc-state', (event, arg) => {
}
// HAMLIB STATUS
if (arg.hamlib_status == 'connected') {
document.getElementById("rigctld_state").className = "btn btn-success btn-sm";
} else {
document.getElementById("rigctld_state").className = "btn btn-secondary btn-sm";
}
// BEACON STATE

View file

@ -221,6 +221,7 @@ client.on('data', function(socketdata) {
arq_transmission_percent: data['arq_transmission_percent'],
stations: data['stations'],
beacon_state: data['beacon_state'],
hamlib_status: data['hamlib_status'],
};
ipcRenderer.send('request-update-tnc-state', Data);

View file

@ -1074,6 +1074,10 @@
<div class="btn-group btn-group-sm me-2" role="group">
<button class="btn btn-sm btn-secondary" id="arq_state" type="button" data-bs-placement="top" data-bs-toggle="tooltip" data-bs-html="true" title="DATA-CHANNEL state: <strong class='text-warning'>OPEN</strong>"> <i class="bi bi-file-earmark-binary" style="font-size: 0.8rem; color: white;"></i> </button>
</div>
<div class="btn-group btn-group-sm me-2" role="group">
<button class="btn btn-sm btn-secondary" id="rigctld_state" type="button" data-bs-placement="top" data-bs-toggle="tooltip" data-bs-html="true" title="rigctld state:<strong class='text-success'>CONNECTED</strong> / <strong class='text-secondary'>UNKNOWN</strong>"> <i class="bi bi-usb-symbol" style="font-size: 0.8rem; color: white;"></i> </button>
</div>
</div>
<div class="container-fluid p-0" style="width:15rem">
<div class="input-group input-group-sm">

View file

@ -830,10 +830,11 @@ class RF:
- static.HAMLIB_BANDWIDTH
"""
while True:
threading.Event().wait(0.5)
threading.Event().wait(1.0)
static.HAMLIB_FREQUENCY = self.hamlib.get_frequency()
static.HAMLIB_MODE = self.hamlib.get_mode()
static.HAMLIB_BANDWIDTH = self.hamlib.get_bandwidth()
static.HAMLIB_STATUS = self.hamlib.get_status()
def calculate_fft(self) -> None:
"""

View file

@ -6,7 +6,7 @@
import socket
import time
import static
import structlog
# set global hamlib version
@ -136,6 +136,9 @@ class radio:
return b""
def get_status(self):
""" """
return "connected" if self.connected else "unknown/disconnected"
def get_mode(self):
""" """
try:

View file

@ -551,6 +551,7 @@ def send_tnc_state():
"mycallsign": str(static.MYCALLSIGN, encoding),
"dxcallsign": str(static.DXCALLSIGN, encoding),
"dxgrid": str(static.DXGRID, encoding),
"hamlib_status": str(static.HAMLIB_STATUS, encoding),
}
# add heard stations to heard stations object

View file

@ -60,6 +60,7 @@ HAMLIB_RADIOCONTROL: str = "direct"
HAMLIB_RIGCTLD_IP: str = "127.0.0.1"
HAMLIB_RIGCTLD_PORT: str = "4532"
HAMLIB_STATUS: str = "unknown/disconnected"
HAMLIB_FREQUENCY: int = 0
HAMLIB_MODE: str = ""
HAMLIB_BANDWIDTH: int = 0