Merge branch 'develop' into ls-arq

This commit is contained in:
DJ2LS 2023-11-03 17:11:09 +01:00 committed by GitHub
commit 3afdcbe6c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 89 additions and 104 deletions

View file

@ -131,6 +131,8 @@ function stopAllTransmissions() {
<div class="col-sm min-vh-100 m-0 p-0">
<!-- content -->
<main_top_navbar />
<div class="tab-content" id="nav-tabContent-settings">
<div
class="tab-pane fade show active"
@ -139,8 +141,6 @@ function stopAllTransmissions() {
aria-labelledby="list-modem-list"
>
<!-- TOP NAVBAR -->
<main_top_navbar />
<div
id="blurdiv"
style="

View file

@ -1,5 +1,4 @@
<script setup lang="ts">
import { setActivePinia } from "pinia";
import pinia from "../store/index";
setActivePinia(pinia);
@ -13,95 +12,21 @@ const settings = useSettingsStore(pinia);
import { useAudioStore } from "../store/audioStore.js";
const audioStore = useAudioStore(pinia);
import { startModem, stopModem } from "../js/daemon";
import { saveSettingsToFile } from "../js/settingsHandler";
function startStopModem() {
switch (state.modem_running_state) {
case "stopped":
let startupInputDeviceValue = parseInt((<HTMLSelectElement>document.getElementById("audio_input_selectbox")).value);
let startupOutputDeviceValue = parseInt((<HTMLSelectElement>document.getElementById("audio_output_selectbox")).value);
let startupInputDeviceIndex = (<HTMLSelectElement>document.getElementById("audio_input_selectbox")).selectedIndex;
let startupOutputDeviceIndex = (<HTMLSelectElement>document.getElementById("audio_output_selectbox")).selectedIndex;
audioStore.startupInputDevice = startupInputDeviceValue
audioStore.startupOutputDevice = startupOutputDeviceValue
// get full name of audio device
settings.rx_audio = (<HTMLSelectElement>document.getElementById("audio_input_selectbox")).options[startupInputDeviceIndex].text;
settings.tx_audio = (<HTMLSelectElement>document.getElementById("audio_output_selectbox")).options[startupOutputDeviceIndex].text;
saveSettingsToFile();
startModem();
break;
case "running":
stopModem();
break;
default:
}
}
</script>
<template>
<nav class="navbar bg-body-tertiary border-bottom">
<div class="mx-auto">
<span class="badge bg-secondary me-4"
>Modem location | {{ settings.modem_host }}</span
>
<span class="badge bg-secondary me-4"
>Service | {{ state.modem_running_state }}</span
>
<div class="btn-group" role="group"></div>
<div class="btn-group me-4" role="group">
<button
type="button"
id="startModem"
class="btn btn-sm btn-outline-success"
data-bs-toggle="tooltip"
data-bs-trigger="hover"
data-bs-html="false"
title="Start the Modem. Please set your audio and radio settings first!"
@click="startStopModem()"
v-bind:class="{ disabled: state.modem_running_state === 'running' }"
>
<i class="bi bi-play-fill"></i>
<span class="ms-2">start modem</span>
</button>
<button
type="button"
id="stopModem"
class="btn btn-sm btn-outline-danger"
data-bs-toggle="tooltip"
data-bs-trigger="hover"
data-bs-html="false"
title="Stop the Modem."
@click="startStopModem()"
v-bind:class="{ disabled: state.modem_running_state === 'stopped' }"
>
<i class="bi bi-stop-fill"></i>
<span class="ms-2">stop modem</span>
</button>
</div>
<button
type="button"
id="openHelpModalStartStopModem"
data-bs-toggle="modal"
data-bs-target="#startStopModemHelpModal"
class="btn me-4 p-0 border-0"
>
<i class="bi bi-question-circle" style="font-size: 1rem"></i>
</button>
<span class="badge bg-secondary me-4">
Modem Connection {{ state.modem_connection }}
</span>
<span class="badge bg-secondary me-4">
Modem {{ state.modem_running_state }}
</span>
<span class="badge bg-secondary me-4">
RIG Control {{ state.rigctld_started }}
</span>
</div>
</nav>
</nav>
</template>

View file

@ -11,13 +11,61 @@ const settings = useSettingsStore(pinia);
import { useAudioStore } from "../store/audioStore.js";
const audio = useAudioStore(pinia);
import { useStateStore } from "../store/stateStore.js";
const state = useStateStore(pinia);
import { startModem, stopModem } from "../js/daemon";
function startStopModem() {
switch (state.modem_running_state) {
case "stopped":
startModem();
break;
case "running":
stopModem();
break;
default:
}
}
function saveSettings() {
saveSettingsToFile();
}
</script>
<template>
<div>
<button
type="button"
id="startModem"
class="btn btn-sm btn-outline-success"
data-bs-toggle="tooltip"
data-bs-trigger="hover"
data-bs-html="false"
title="Start the Modem. Please set your audio and radio settings first!"
@click="startStopModem()"
v-bind:class="{ disabled: state.modem_running_state === 'running' }"
>
<i class="bi bi-play-fill"></i>
<span class="ms-2">start modem</span>
</button>
<button
type="button"
id="stopModem"
class="btn btn-sm btn-outline-danger"
data-bs-toggle="tooltip"
data-bs-trigger="hover"
data-bs-html="false"
title="Stop the Modem."
@click="startStopModem()"
v-bind:class="{ disabled: state.modem_running_state === 'stopped' }"
>
<i class="bi bi-stop-fill"></i>
<span class="ms-2">stop modem</span>
</button>
</div>
<div class="input-group input-group-sm mb-1">
<span class="input-group-text" style="width: 180px">Modem port</span>
<input
@ -49,26 +97,26 @@ function saveSettings() {
<div class="input-group input-group-sm mb-1">
<label class="input-group-text w-50">Audio Input device</label>
<select
class="form-select form-select-sm"
id="audio_input_selectbox"
aria-label=".form-select-sm"
@change="saveSettings"
v-html="audio.getInputDevices()"
>
</select>
class="form-select form-select-sm"
id="rx_audio"
aria-label=".form-select-sm"
@change="saveSettings"
v-model="settings.rx_audio"
v-html="audio.getInputDevices()"
></select>
</div>
<!-- Audio Output Device -->
<div class="input-group input-group-sm mb-1">
<label class="input-group-text w-50">Audio Output device</label>
<select
class="form-select form-select-sm"
id="audio_output_selectbox"
aria-label=".form-select-sm"
@change="saveSettings"
v-html="audio.getOutputDevices()"
>
</select>
class="form-select form-select-sm"
id="tx_audio"
aria-label=".form-select-sm"
@change="saveSettings"
v-model="settings.tx_audio"
v-html="audio.getOutputDevices()"
></select>
</div>
<div class="input-group input-group-sm mb-1">

View file

@ -37,6 +37,7 @@ function connectDAEMON() {
daemon.on("connect", function () {
console.log("daemon connection established");
state.modem_connection = "connected";
daemonShowConnectStateError = 1;
});
@ -147,6 +148,16 @@ daemon.on("data", function (socketdata) {
if (data["command"] == "test_hamlib") {
//
}
if (data["command_response"] == "stop_modem") {
switch (data["status"]) {
case "OK":
state.modem_running_state = "running";
break;
default:
state.modem_running_state = "stopped";
}
}
}
//finally delete message buffer
@ -164,8 +175,8 @@ export function startModem() {
{
mycall: settings.mycall + "-" + settings.myssid,
mygrid: settings.mygrid,
rx_audio: audioStore.startupInputDevice,
tx_audio: audioStore.startupOutputDevice,
rx_audio: settings.rx_audio,
tx_audio: settings.tx_audio,
radiocontrol: settings.radiocontrol,
devicename: settings.hamlib_deviceid,
deviceport: settings.hamlib_deviceport,

View file

@ -127,6 +127,7 @@ export const useStateStore = defineStore("stateStore", () => {
arq_seconds_until_finish,
arq_seconds_until_timeout,
arq_seconds_until_timeout_percent,
modem_connection,
modem_running_state,
arq_session_state,
is_codec2_traffic,