mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
adjusted daemon for starting rigctld
This commit is contained in:
parent
53dd156a3d
commit
c36933d622
|
@ -11,6 +11,9 @@ setActivePinia(pinia);
|
|||
import { useSettingsStore } from "../store/settingsStore.js";
|
||||
const settings = useSettingsStore(pinia);
|
||||
|
||||
import { useStateStore } from "../store/stateStore.js";
|
||||
const state = useStateStore(pinia);
|
||||
|
||||
function selectRadioControl() {
|
||||
// @ts-expect-error
|
||||
switch (event.target.id) {
|
||||
|
@ -177,6 +180,8 @@ alert("not yet implemented")
|
|||
id="hamlib_rigctld_status"
|
||||
aria-label="State"
|
||||
aria-describedby="basic-addon1"
|
||||
v-model="state.rigctld_started"
|
||||
|
||||
/>
|
||||
|
||||
<button
|
||||
|
|
|
@ -148,6 +148,7 @@ daemon.on("data", function (socketdata) {
|
|||
}
|
||||
}
|
||||
|
||||
console.log(data)
|
||||
if (data["command"] == "daemon_state") {
|
||||
let Data = {
|
||||
input_devices: data["input_devices"],
|
||||
|
@ -165,8 +166,16 @@ daemon.on("data", function (socketdata) {
|
|||
audioStore.inputDevices = data["input_devices"];
|
||||
audioStore.outputDevices = data["output_devices"];
|
||||
state.tnc_running_state = data["daemon_state"][0]["status"];
|
||||
|
||||
state.rigctld_started = data["rigctld_state"][0]["status"];
|
||||
//state.rigctld_process = data["daemon_state"][0]["rigctld_process"];
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (data["command"] == "test_hamlib") {
|
||||
let Data = {
|
||||
hamlib_result: data["result"],
|
||||
|
|
|
@ -53,6 +53,10 @@ export const useStateStore = defineStore("stateStore", () => {
|
|||
var arq_seconds_until_timeout = ref();
|
||||
var arq_seconds_until_timeout_percent = ref();
|
||||
|
||||
var rigctld_started = ref();
|
||||
var rigctld_process = ref();
|
||||
|
||||
|
||||
function updateTncState(state) {
|
||||
tnc_connection.value = state;
|
||||
|
||||
|
@ -145,6 +149,8 @@ export const useStateStore = defineStore("stateStore", () => {
|
|||
is_codec2_traffic,
|
||||
rf_level,
|
||||
heard_stations,
|
||||
beacon_state
|
||||
beacon_state,
|
||||
rigctld_started,
|
||||
rigctld_process
|
||||
};
|
||||
});
|
||||
|
|
|
@ -252,17 +252,16 @@ class DAEMON:
|
|||
elif sys.platform in ["win32", "win64"]:
|
||||
command.append("rigctld.exe")
|
||||
|
||||
options = ""
|
||||
options = "--version"
|
||||
command += options
|
||||
proc = subprocess.Popen(command)
|
||||
atexit.register(proc.kill)
|
||||
except Exception as err:
|
||||
self.log.info("[DMN] starting rigctld: ", e=err)
|
||||
|
||||
Daemon.rigctldrocess = proc
|
||||
Daemon.rigctldprocess = proc
|
||||
Daemon.rigctldstarted = True
|
||||
|
||||
|
||||
def start_tnc(self, data):
|
||||
self.log.warning("[DMN] Starting TNC", rig=data[5], port=data[6])
|
||||
|
||||
|
|
22
tnc/sock.py
22
tnc/sock.py
|
@ -956,7 +956,7 @@ class ThreadedTCPRequestHandler(socketserver.StreamRequestHandler):
|
|||
if received_json["type"] == "set" and received_json["command"] == "stop_tnc":
|
||||
self.daemon_stop_tnc(received_json)
|
||||
|
||||
if received_json["type"] == "set" and received_json["command"] == "start_rigctld":
|
||||
if received_json["type"] == "set" and received_json["command"] == "start_rigctld" and not Daemon.rigctldstarted:
|
||||
self.daemon_start_rigctld(received_json)
|
||||
|
||||
if received_json["type"] == "set" and received_json["command"] == "stop_rigctld":
|
||||
|
@ -1183,12 +1183,13 @@ class ThreadedTCPRequestHandler(socketserver.StreamRequestHandler):
|
|||
try:
|
||||
log.warning("[SCK] Stopping rigctld")
|
||||
|
||||
Daemon.rigctldprocess.kill()
|
||||
# unregister process from atexit to avoid process zombies
|
||||
atexit.unregister(Daemon.rigctldprocess.kill)
|
||||
if Daemon.rigctldstarted:
|
||||
Daemon.rigctldprocess.kill()
|
||||
# unregister process from atexit to avoid process zombies
|
||||
atexit.unregister(Daemon.rigctldprocess.kill)
|
||||
|
||||
Daemon.rigctldstarted = False
|
||||
command_response("stop_tnc", True)
|
||||
Daemon.rigctldstarted = False
|
||||
command_response("stop_rigctld", True)
|
||||
except Exception as err:
|
||||
command_response("stop_tnc", False)
|
||||
log.warning("[SCK] command execution error", e=err, command=received_json)
|
||||
|
@ -1208,13 +1209,14 @@ def send_daemon_state():
|
|||
output = {
|
||||
"command": "daemon_state",
|
||||
"daemon_state": [],
|
||||
"rigctld_state": [],
|
||||
"python_version": str(python_version),
|
||||
"input_devices": AudioParam.audio_input_devices,
|
||||
"output_devices": AudioParam.audio_output_devices,
|
||||
"serial_devices": Daemon.serial_devices,
|
||||
# 'cpu': str(psutil.cpu_percent()),
|
||||
# 'ram': str(psutil.virtual_memory().percent),
|
||||
"version": "0.1",
|
||||
"version": TNC.version,
|
||||
}
|
||||
|
||||
if Daemon.tncstarted:
|
||||
|
@ -1222,6 +1224,11 @@ def send_daemon_state():
|
|||
else:
|
||||
output["daemon_state"].append({"status": "stopped"})
|
||||
|
||||
if Daemon.rigctldstarted:
|
||||
output["rigctld_state"].append({"status": "running"})
|
||||
else:
|
||||
output["rigctld_state"].append({"status": "stopped"})
|
||||
|
||||
return json.dumps(output)
|
||||
except Exception as err:
|
||||
log.warning("[SCK] error", e=err)
|
||||
|
@ -1277,6 +1284,7 @@ def send_tnc_state():
|
|||
"hamlib_status": HamlibParam.hamlib_status,
|
||||
"listen": str(TNC.listen),
|
||||
"audio_recording": str(AudioParam.audio_record),
|
||||
|
||||
}
|
||||
|
||||
# add heard stations to heard stations object
|
||||
|
|
Loading…
Reference in a new issue