FreeDATA/gui/src/components/main_rig_control.vue

261 lines
8.4 KiB
Vue
Raw Normal View History

2023-09-05 09:22:00 +00:00
<script setup lang="ts">
2023-10-03 13:15:17 +00:00
import { setActivePinia } from "pinia";
import pinia from "../store/index";
2023-09-05 17:35:54 +00:00
setActivePinia(pinia);
2023-11-18 15:53:54 +00:00
import { settingsStore as settings} from "../store/settingsStore.js";
2023-09-05 17:35:54 +00:00
2023-10-08 20:09:09 +00:00
import { useStateStore } from "../store/stateStore.js";
const state = useStateStore(pinia);
2023-10-17 10:11:27 +00:00
function startStopRigctld() {
switch (state.rigctld_started) {
case "stopped":
2024-01-05 22:20:21 +00:00
settings.remote.RADIO.serial_port = (<HTMLInputElement>document.getElementById("hamlib_deviceport")).value;
2023-10-17 10:11:27 +00:00
2024-01-05 22:30:03 +00:00
//startRigctld();
2023-10-17 10:11:27 +00:00
break;
case "running":
2024-01-07 05:16:39 +00:00
//stopRigctld();
2023-10-27 20:57:43 +00:00
// dirty hack for calling this command twice, otherwise modem won't stop rigctld from time to time
2024-01-05 22:30:03 +00:00
//stopRigctld();
2023-10-17 10:11:27 +00:00
break;
default:
}
}
2023-10-04 17:54:50 +00:00
function selectRadioControl() {
2023-10-04 18:08:40 +00:00
// @ts-expect-error
2023-10-03 13:15:17 +00:00
switch (event.target.id) {
case "list-rig-control-none-list":
2024-01-05 22:20:21 +00:00
settings.remote.RADIO.control = "disabled";
2023-10-03 13:15:17 +00:00
break;
case "list-rig-control-rigctld-list":
2024-01-05 22:20:21 +00:00
settings.remote.RADIO.control = "rigctld";
2023-10-03 13:15:17 +00:00
break;
case "list-rig-control-tci-list":
2024-01-05 22:20:21 +00:00
settings.remote.RADIO.control = "tci";
2023-10-03 13:15:17 +00:00
break;
default:
console.log("default=!==");
2024-01-05 22:20:21 +00:00
settings.remote.RADIO.control = "disabled";
2023-10-03 13:15:17 +00:00
}
2024-01-07 05:16:39 +00:00
//saveSettingsToFile();
2023-09-06 20:20:18 +00:00
}
2023-10-04 17:54:50 +00:00
function testHamlib(){
console.log("not yet implemented")
alert("not yet implemented")
}
2023-09-05 09:22:00 +00:00
</script>
2023-09-02 12:03:50 +00:00
<template>
<div class="mb-3">
<div class="card mb-1">
<div class="card-header p-1">
2023-10-03 13:15:17 +00:00
<div class="container">
<div class="row">
<div class="col-1">
<i class="bi bi-projector" style="font-size: 1.2rem"></i>
</div>
<div class="col-4">
<strong class="fs-5">Rig control</strong>
</div>
<div class="col-6">
<div
2023-10-25 15:20:39 +00:00
class="list-group bg-body-tertiary list-group-horizontal w-75"
2023-10-03 13:15:17 +00:00
id="rig-control-list-tab"
role="rig-control-tablist"
>
<a
2023-10-25 15:20:39 +00:00
class="p-1 list-group-item list-group-item-dark list-group-item-action"
2023-10-03 13:15:17 +00:00
id="list-rig-control-none-list"
data-bs-toggle="list"
href="#list-rig-control-none"
role="tab"
aria-controls="list-rig-control-none"
2024-01-05 22:20:21 +00:00
v-bind:class="{ active: settings.remote.RADIO.control === 'disabled' }"
2023-10-03 13:15:17 +00:00
@click="selectRadioControl()"
2023-10-27 21:26:54 +00:00
>None</a
2023-10-03 13:15:17 +00:00
>
<a
2023-10-25 15:20:39 +00:00
class="p-1 list-group-item list-group-item-dark list-group-item-action"
2023-10-03 13:15:17 +00:00
id="list-rig-control-rigctld-list"
data-bs-toggle="list"
href="#list-rig-control-rigctld"
role="tab"
aria-controls="list-rig-control-rigctld"
2024-01-05 22:20:21 +00:00
v-bind:class="{ active: settings.remote.RADIO.control === 'rigctld' }"
2023-10-03 13:15:17 +00:00
@click="selectRadioControl()"
>Rigctld</a
>
<a
2023-10-25 15:20:39 +00:00
class="p-1 list-group-item list-group-item-dark list-group-item-action"
2023-10-03 13:15:17 +00:00
id="list-rig-control-tci-list"
data-bs-toggle="list"
href="#list-rig-control-tci"
role="tab"
aria-controls="list-rig-control-tci"
2024-01-05 22:20:21 +00:00
v-bind:class="{ active: settings.remote.RADIO.control === 'tci' }"
2023-10-03 13:15:17 +00:00
@click="selectRadioControl()"
>TCI</a
>
</div>
</div>
<div class="col-1 text-end">
<button
type="button"
id="openHelpModalRigControl"
data-bs-toggle="modal"
data-bs-target="#rigcontrolHelpModal"
class="btn m-0 p-0 border-0"
>
<i class="bi bi-question-circle" style="font-size: 1rem"></i>
</button>
</div>
</div>
</div>
2023-09-05 13:28:58 +00:00
</div>
2023-10-03 13:15:17 +00:00
<div class="card-body p-2" style="height: 100px">
<div class="tab-content" id="rig-control-nav-tabContent">
<div
class="tab-pane fade"
2024-01-05 22:20:21 +00:00
v-bind:class="{ 'show active': settings.remote.RADIO.control === 'disabled' }"
2023-10-03 13:15:17 +00:00
id="list-rig-control-none"
role="tabpanel"
aria-labelledby="list-rig-control-none-list"
>
<p class="small">
2023-10-20 11:47:42 +00:00
Modem will not utilize rig control and features will be limited. While
2023-10-27 21:26:54 +00:00
functional; it is recommended to configure hamlib. <br>
Use this setting also for <strong> VOX </strong>
2023-10-03 13:15:17 +00:00
</p>
</div>
<div
class="tab-pane fade"
id="list-rig-control-rigctld"
2024-01-05 22:20:21 +00:00
v-bind:class="{ 'show active': settings.remote.RADIO.control === 'rigctld' }"
2023-10-03 13:15:17 +00:00
role="tabpanel"
aria-labelledby="list-rig-control-rigctld-list"
>
<div class="input-group input-group-sm mb-1">
2023-09-05 13:28:58 +00:00
2023-10-03 13:15:17 +00:00
<div class="input-group input-group-sm mb-1">
2023-10-15 05:37:28 +00:00
<span class="input-group-text">Rigctld service</span>
2023-10-03 13:15:17 +00:00
<button
class="btn btn-outline-success"
type="button"
id="hamlib_rigctld_start"
2023-10-17 10:11:27 +00:00
@click="startStopRigctld"
2023-10-03 13:15:17 +00:00
>
Start
</button>
<button
class="btn btn-outline-danger"
type="button"
id="hamlib_rigctld_stop"
2023-10-17 10:11:27 +00:00
@click="startStopRigctld"
2023-10-03 13:15:17 +00:00
>
Stop
</button>
<input
type="text"
class="form-control"
placeholder="Status"
id="hamlib_rigctld_status"
aria-label="State"
aria-describedby="basic-addon1"
2023-10-08 20:09:09 +00:00
v-model="state.rigctld_started"
2023-10-03 13:15:17 +00:00
/>
<button
type="button"
id="testHamlib"
class="btn btn-sm btn-outline-secondary ms-1"
data-bs-placement="bottom"
data-bs-toggle="tooltip"
data-bs-trigger="hover"
data-bs-html="true"
@click="testHamlib"
title="Test your hamlib settings and toggle PTT once. Button will become <strong class='text-success'>green</strong> on success and <strong class='text-danger'>red</strong> if fails."
>
PTT Test
</button>
</div>
</div>
</div>
<div
class="tab-pane fade"
id="list-rig-control-tci"
2024-01-05 22:20:21 +00:00
v-bind:class="{ 'show active': settings.remote.RADIO.control === 'tci' }"
2023-10-03 13:15:17 +00:00
role="tabpanel"
aria-labelledby="list-rig-control-tci-list"
>
<div class="input-group input-group-sm mb-1">
<div class="input-group input-group-sm mb-1">
<span class="input-group-text">TCI</span>
<span class="input-group-text">Address</span>
<input
type="text"
class="form-control"
placeholder="tci IP"
id="tci_ip"
aria-label="Device IP"
2024-01-05 22:20:21 +00:00
v-model="settings.remote.TCI.tci_ip"
2023-10-03 13:15:17 +00:00
/>
</div>
2023-09-05 13:28:58 +00:00
2023-10-03 13:15:17 +00:00
<div class="input-group input-group-sm mb-1">
<span class="input-group-text">Port</span>
<input
type="text"
class="form-control"
placeholder="tci port"
id="tci_port"
aria-label="Device Port"
2024-01-05 22:20:21 +00:00
v-model="settings.remote.TCI.tci_port"
2023-10-03 13:15:17 +00:00
/>
</div>
</div>
</div>
</div>
<!-- RADIO CONTROL DISABLED -->
<div id="radio-control-disabled"></div>
<!-- RADIO CONTROL RIGCTLD -->
<div id="radio-control-rigctld"></div>
<!-- RADIO CONTROL TCI-->
<div id="radio-control-tci"></div>
<!-- RADIO CONTROL HELP -->
<div id="radio-control-help">
<!--
2023-09-02 12:03:50 +00:00
<strong>VOX:</strong> Use rig control mode 'none'
<br />
<strong>HAMLIB locally:</strong> configure in settings, then
start/stop service.
<br />
<strong>HAMLIB remotely:</strong> Enter IP/Port, connection
happens automatically.
2023-09-05 13:28:58 +00:00
-->
2023-10-03 13:15:17 +00:00
</div>
</div>
<!--<div class="card-footer text-muted small" id="hamlib_info_field">
2023-10-20 11:47:42 +00:00
Define Modem rig control mode (none/hamlib)
2023-09-02 12:03:50 +00:00
</div>
-->
2023-10-03 13:15:17 +00:00
</div>
</div>
2023-10-03 13:15:17 +00:00
</template>