mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Move modem control to modem settings area
This commit is contained in:
parent
fd6e364e40
commit
99043037d9
2 changed files with 49 additions and 75 deletions
|
@ -13,40 +13,8 @@ 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>
|
||||
|
@ -59,49 +27,6 @@ function startStopModem() {
|
|||
<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>
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
</template>
|
||||
|
|
|
@ -11,13 +11,62 @@ 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
|
||||
|
|
Loading…
Reference in a new issue