2023-11-13 08:39:15 +00:00
< script setup lang = "ts" >
2023-11-13 12:48:24 +00:00
import { Modal } from "bootstrap" ;
import { onMounted } from "vue" ;
2023-11-13 12:48:02 +00:00
2023-11-13 08:39:15 +00:00
import infoScreen _updater from "./infoScreen_updater.vue" ;
2023-11-13 12:48:02 +00:00
2023-11-13 16:30:23 +00:00
import { setActivePinia } from "pinia" ;
import pinia from "../store/index" ;
setActivePinia ( pinia ) ;
2023-11-18 13:27:19 +00:00
import { settingsStore as settings , onChange } from "../store/settingsStore.js" ;
2023-11-13 16:30:23 +00:00
import { useStateStore } from "../store/stateStore.js" ;
const state = useStateStore ( pinia ) ;
2023-11-18 16:03:00 +00:00
import {
getVersion ,
setConfig ,
startModem ,
stopModem ,
2023-11-18 17:05:57 +00:00
getModemState ,
2023-11-18 16:03:00 +00:00
} from "../js/api" ;
import { audioInputOptions , audioOutputOptions } from "../js/deviceFormHelper" ;
2023-11-19 03:25:13 +00:00
import { serialDeviceOptions } from "../js/deviceFormHelper" ;
2023-11-13 20:02:41 +00:00
2023-11-13 17:50:46 +00:00
const version = import . meta . env . PACKAGE _VERSION ;
2023-11-15 22:04:18 +00:00
var updateAvailable = process . env . FDUpdateAvail ;
2023-11-13 17:50:46 +00:00
2023-11-13 12:48:02 +00:00
// start modemCheck modal once on startup
onMounted ( ( ) => {
2023-11-23 06:31:28 +00:00
getVersion ( ) . then ( ( res ) => {
state . modem _version = res ;
} ) ;
2023-11-13 12:48:24 +00:00
new Modal ( "#modemCheck" , { } ) . show ( ) ;
} ) ;
2023-11-13 16:30:23 +00:00
2023-11-23 06:04:04 +00:00
function refreshModem ( ) {
getModemState ( ) ;
}
2023-11-18 16:58:34 +00:00
function getModemStateLocal ( ) {
2023-11-13 16:30:23 +00:00
// Returns active/inactive if modem is running for modem status label
2023-11-13 16:41:56 +00:00
if ( state . is _modem _running == true ) return "Active" ;
else return "Inactive" ;
2023-11-13 16:30:23 +00:00
}
2023-11-13 19:07:31 +00:00
function getNetworkState ( ) {
// Returns active/inactive if modem is running for modem status label
if ( state . modem _connection === "connected" ) return "Connected" ;
else return "Disconnected" ;
}
2023-11-15 03:00:04 +00:00
function getRigControlStuff ( ) {
2023-11-18 13:27:19 +00:00
switch ( settings . remote . RADIO . control ) {
2023-11-15 03:00:04 +00:00
case "disabled" :
return true ;
case "rigctld" :
case "tci" :
2023-11-19 04:08:43 +00:00
return state . radio _status ;
2023-11-15 03:01:19 +00:00
default :
2023-11-18 15:58:17 +00:00
console . error (
2023-11-18 16:58:34 +00:00
"Unknown radio control mode " + settings . remote . RADIO . control ,
2023-11-18 15:58:17 +00:00
) ;
2023-11-18 22:50:40 +00:00
return "Unknown control type" + settings . remote . RADIO . control ;
2023-11-15 03:00:04 +00:00
}
}
2023-11-15 03:01:19 +00:00
function testHamlib ( ) {
2023-11-15 03:00:04 +00:00
alert ( "Not yet implemented." ) ;
}
2023-11-13 08:39:15 +00:00
< / script >
2023-11-13 06:20:46 +00:00
< template >
2023-11-13 06:21:13 +00:00
< div
2023-11-13 16:30:23 +00:00
class = "modal modal-lg fade"
2023-11-13 08:39:15 +00:00
id = "modemCheck"
2023-11-13 06:21:13 +00:00
data - bs - backdrop = "static"
data - bs - keyboard = "false"
tabindex = "-1"
aria - hidden = "true"
>
< div class = "modal-dialog" >
< div class = "modal-content" >
< div class = "modal-header" >
2023-11-13 08:39:15 +00:00
< h1 class = "modal-title fs-5" > Modem check < / h1 >
2023-11-13 06:21:13 +00:00
< button
type = "button"
class = "btn-close"
data - bs - dismiss = "modal"
aria - label = "Close"
> < / button >
< / div >
< div class = "modal-body" >
2023-11-13 12:48:02 +00:00
< div class = "accordion" id = "startupCheckAccordion" >
<!-- Network Section -- >
2023-11-13 06:21:13 +00:00
< div class = "accordion-item" >
< h2 class = "accordion-header" >
< button
class = "accordion-button collapsed"
type = "button"
2023-11-13 12:48:02 +00:00
data - bs - target = "#networkStatusCollapse"
2023-11-13 06:21:13 +00:00
data - bs - toggle = "collapse"
>
2023-11-13 19:12:09 +00:00
Network
< span
class = "badge ms-2 bg-success"
: class = "
2023-11-13 19:07:31 +00:00
state . modem _connection === 'connected'
? 'bg-success'
: 'bg-danger'
"
2023-11-13 19:12:09 +00:00
> { { getNetworkState ( ) } } < / s p a n
>
2023-11-13 06:21:13 +00:00
< / button >
< / h2 >
2023-11-13 12:48:24 +00:00
< div
id = "networkStatusCollapse"
class = "accordion-collapse collapse"
>
2023-11-13 06:21:13 +00:00
< div class = "accordion-body" >
2023-11-13 19:07:31 +00:00
< div class = "input-group input-group-sm mb-1" >
2023-11-13 21:30:22 +00:00
< span class = "input-group-text w-25" > Modem port < / span >
2023-11-13 19:12:09 +00:00
< input
type = "text"
class = "form-control"
2023-11-13 20:18:59 +00:00
placeholder = "modem port (def 5000)"
2023-11-13 19:12:09 +00:00
id = "modem_port"
maxlength = "5"
max = "65534"
min = "1025"
2023-11-18 11:57:36 +00:00
v - model = "settings.local.port"
2023-11-13 19:12:09 +00:00
/ >
< / div >
2023-11-13 19:07:31 +00:00
2023-11-13 19:12:09 +00:00
< div class = "input-group input-group-sm mb-1" >
2023-11-13 21:30:22 +00:00
< span class = "input-group-text w-25" > Modem host < / span >
2023-11-13 19:12:09 +00:00
< input
type = "text"
class = "form-control"
2023-11-13 20:18:59 +00:00
placeholder = "modem host (default 127.0.0.1)"
2023-11-13 19:12:09 +00:00
id = "modem_port"
2023-11-18 11:57:36 +00:00
v - model = "settings.local.host"
2023-11-13 19:12:09 +00:00
/ >
< / div >
2023-11-13 06:21:13 +00:00
< / div >
< / div >
< / div >
2023-11-13 12:48:02 +00:00
<!-- Modem Section -- >
2023-11-13 06:21:13 +00:00
< div class = "accordion-item" >
< h2 class = "accordion-header" >
< button
class = "accordion-button collapsed"
type = "button"
2023-11-13 12:48:02 +00:00
data - bs - target = "#modemStatusCollapse"
2023-11-13 06:21:13 +00:00
data - bs - toggle = "collapse"
>
2023-11-13 16:41:56 +00:00
Modem
< span
class = "badge ms-2"
: class = "
state . is _modem _running === true
? 'bg-success'
: 'bg-danger'
"
2023-11-18 16:58:34 +00:00
> { { getModemStateLocal ( ) } } < / s p a n
2023-11-13 16:41:56 +00:00
>
2023-11-13 06:21:13 +00:00
< / button >
< / h2 >
2023-11-13 12:48:02 +00:00
< div id = "modemStatusCollapse" class = "accordion-collapse collapse" >
2023-11-13 06:21:13 +00:00
< div class = "accordion-body" >
2023-11-13 16:30:23 +00:00
< div class = "input-group input-group-sm mb-1" >
< label class = "input-group-text w-25" > Modem control < / label >
< label class = "input-group-text" >
2023-11-13 16:41:56 +00:00
< 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 = "startModem"
v - bind : class = " {
disabled : state . is _modem _running === true ,
} "
>
< i class = "bi bi-play-fill" > < / i >
< / button > < / l a b e l
> < label class = "input-group-text" >
< 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 = "stopModem"
v - bind : class = " {
disabled : state . is _modem _running === false ,
} "
>
< i class = "bi bi-stop-fill" > < / i >
< / button >
< / label >
2023-11-23 06:04:04 +00:00
< label class = "input-group-text" >
< button
type = "button"
id = "refreshModem"
class = "btn btn-sm btn-outline-secondary"
data - bs - toggle = "tooltip"
data - bs - trigger = "hover"
data - bs - html = "false"
title = "Refresh modem status."
@ click = "refreshModem"
>
< i class = "bi bi-bullseye" > < / i >
< / button >
< / label >
2023-11-13 16:41:56 +00:00
< / div >
<!-- Audio Input Device -- >
< div class = "input-group input-group-sm mb-1" >
< label class = "input-group-text w-25" > Input device < / label >
< select
class = "form-select form-select-sm"
id = "rx_audio"
aria - label = ".form-select-sm"
2023-11-18 13:27:19 +00:00
@ change = "onChange"
2023-11-18 11:57:36 +00:00
v - model = "settings.remote.AUDIO.input_device"
2023-11-18 16:03:00 +00:00
>
2023-11-18 17:05:57 +00:00
< option
v - for = "option in audioInputOptions()"
v - bind : value = "option.id"
>
2023-11-18 16:03:00 +00:00
{ { option . name } }
< / option >
< / select >
2023-11-13 16:30:23 +00:00
< / div >
2023-11-13 16:41:56 +00:00
<!-- Audio Output Device -- >
< div class = "input-group input-group-sm mb-1" >
< label class = "input-group-text w-25" > Output device < / label >
< select
class = "form-select form-select-sm"
id = "tx_audio"
aria - label = ".form-select-sm"
2023-11-18 15:56:39 +00:00
@ change = "setConfig"
2023-11-18 16:03:00 +00:00
v - model = "settings.remote.AUDIO.output_device"
>
2023-11-18 17:05:57 +00:00
< option
v - for = "option in audioOutputOptions()"
v - bind : value = "option.id"
>
2023-11-18 16:03:00 +00:00
{ { option . name } }
< / option >
< / select >
2023-11-13 16:41:56 +00:00
< / div >
2023-11-13 06:21:13 +00:00
< / div >
< / div >
< / div >
2023-11-13 12:48:02 +00:00
<!-- Radio Control Section -- >
2023-11-13 06:21:13 +00:00
< div class = "accordion-item" >
< h2 class = "accordion-header" >
< button
class = "accordion-button collapsed"
type = "button"
2023-11-13 12:48:02 +00:00
data - bs - target = "#radioControlCollapse"
2023-11-13 06:21:13 +00:00
data - bs - toggle = "collapse"
>
Radio control
2023-11-15 03:01:19 +00:00
< span
class = "badge ms-2"
: class = "
getRigControlStuff ( ) === true ? 'bg-success' : 'bg-danger'
"
> { {
getRigControlStuff ( ) === true ? "Online" : "Offline"
} } < / s p a n
>
2023-11-13 06:21:13 +00:00
< / button >
< / h2 >
2023-11-13 12:48:24 +00:00
< div
id = "radioControlCollapse"
class = "accordion-collapse collapse"
>
2023-11-13 06:21:13 +00:00
< div class = "accordion-body" >
2023-11-15 03:00:04 +00:00
< div class = "input-group input-group-sm mb-1" >
2023-11-15 03:01:19 +00:00
< span class = "input-group-text" style = "width: 180px"
> Rig control method < / s p a n
>
2023-11-15 03:00:04 +00:00
< select
class = "form-select form-select-sm"
aria - label = ".form-select-sm"
id = "rigcontrol_radiocontrol"
2023-11-18 13:27:19 +00:00
@ change = "onChange"
2023-11-18 11:57:36 +00:00
v - model = "settings.remote.RADIO.control"
2023-11-15 03:00:04 +00:00
>
< option selected value = "disabled" >
Disabled ( no rig control ; use with VOX )
< / option >
< option selected value = "rigctld" > Rigctld ( Hamlib ) < / option >
< option selected value = "tci" > TCI < / option >
< / select >
< / div >
2023-11-15 03:01:19 +00:00
< div
2023-11-18 17:05:57 +00:00
: class = "
settings . remote . RADIO . control == 'rigctld' ? '' : 'd-none'
"
2023-11-15 03:01:19 +00:00
>
<!-- Shown when rigctld is selected -- >
< div class = "input-group input-group-sm mb-1" >
< label class = "input-group-text w-25"
> Rigctld control < / l a b e l
2023-11-15 03:00:04 +00:00
>
2023-11-15 03:01:19 +00:00
< label class = "input-group-text" >
< button
type = "button"
class = "btn btn-sm btn-outline-success"
data - bs - toggle = "tooltip"
data - bs - trigger = "hover"
data - bs - html = "false"
title = "Start rigctld"
v - bind : class = " {
disabled : state . rigctld _started == 'true' ,
} "
>
< i class = "bi bi-play-fill" > < / i >
< / button > < / l a b e l
> < label class = "input-group-text" >
< button
type = "button"
class = "btn btn-sm btn-outline-danger"
data - bs - toggle = "tooltip"
data - bs - trigger = "hover"
data - bs - html = "false"
title = "Stop rigctld"
v - bind : class = " {
disabled :
state . rigctld _started == 'false' ||
state . rigctld _started === undefined ,
} "
>
< i class = "bi bi-stop-fill" > < / i >
< / button >
< / label >
< label class = "input-group-text" >
< button
type = "button"
id = "testHamlib"
class = "btn btn-sm btn-outline-secondary"
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 >
< / label >
< / div >
2023-11-15 03:00:04 +00:00
2023-11-15 03:01:19 +00:00
< div class = "input-group input-group-sm mb-1" >
< span class = "input-group-text" style = "width: 180px"
> Radio port < / s p a n
>
2023-11-15 03:00:04 +00:00
< select
2023-11-19 04:08:43 +00:00
class = "form-select form-select-sm"
aria - label = ".form-select-sm"
id = "hamlib_deviceport"
style = "width: 7rem"
@ change = "onChange"
v - model = "settings.remote.RADIO.serial_port"
2023-11-19 03:25:13 +00:00
>
2023-11-19 04:08:43 +00:00
< option
v - for = "option in serialDeviceOptions()"
v - bind : value = "option.port"
>
2023-12-19 01:46:19 +00:00
{ { option . description } }
2023-11-19 04:08:43 +00:00
< / option >
< / select >
2023-11-15 03:00:04 +00:00
< / div >
< / div >
2023-11-18 17:05:57 +00:00
< div
: class = "
settings . remote . RADIO . control == 'tci' ? '' : 'd-none'
"
>
2023-11-15 03:00:04 +00:00
<!-- Shown when tci is selected -- >
2023-11-15 03:01:19 +00:00
2023-11-15 03:00:04 +00:00
< div class = "input-group input-group-sm mb-1" >
< span class = "input-group-text w-25" > TCI IP address < / span >
< input
type = "text"
class = "form-control"
placeholder = "TCI IP"
id = "rigcontrol_tci_ip"
aria - label = "Device IP"
2023-11-18 16:58:34 +00:00
v - model = "settings.remote.TCI.tci_ip"
2023-11-18 13:27:19 +00:00
@ change = "onChange"
2023-11-15 03:00:04 +00:00
/ >
< / div >
< div class = "input-group input-group-sm mb-1" >
< span class = "input-group-text w-25" > TCI port < / span >
< input
type = "text"
class = "form-control"
placeholder = "TCI port"
id = "rigcontrol_tci_port"
aria - label = "Device Port"
2023-11-18 16:58:34 +00:00
v - model = "settings.remote.TCI.tci_port"
2023-11-18 13:27:19 +00:00
@ change = "onChange"
2023-11-15 03:00:04 +00:00
/ >
< / div >
< / div >
2023-11-13 06:21:13 +00:00
< / div >
< / div >
< / div >
2023-11-13 18:02:04 +00:00
<!-- Version Section -- >
< div class = "accordion-item" >
2023-11-13 17:50:46 +00:00
< h2 class = "accordion-header" >
< button
class = "accordion-button collapsed"
type = "button"
data - bs - target = "#versionCheckCollapse"
data - bs - toggle = "collapse"
>
Version
2023-11-15 22:04:48 +00:00
< span
class = "badge ms-2"
: class = "
updateAvailable === '1' ? 'bg-warning' : 'bg-success'
"
>
{ {
updateAvailable === "1"
? "Update available ! ! ! !"
: "Current"
} } < / s p a n
>
2023-11-13 17:50:46 +00:00
< / button >
< / h2 >
< div
id = "versionCheckCollapse"
class = "accordion-collapse collapse"
>
< div class = "accordion-body" >
< button
2023-11-13 18:02:04 +00:00
class = "btn btn-secondary btn-sm ms-1 me-1"
type = "button"
disabled
>
GUI version | { { version } }
< / button >
2023-11-13 17:50:46 +00:00
2023-11-13 18:02:04 +00:00
< button
class = "btn btn-secondary btn-sm ms-1 me-1"
type = "button"
disabled
>
Modem version | { { state . modem _version } }
< / button >
2023-11-15 22:04:18 +00:00
< div : class = "updateAvailable === '1' ? '' : 'd-none'" >
2023-11-15 22:04:48 +00:00
< infoScreen_updater / >
< / div >
2023-11-15 22:04:18 +00:00
< / div >
2023-11-13 17:50:46 +00:00
< / div >
< / div >
2023-11-13 06:21:13 +00:00
< / div >
< / div >
< div class = "modal-footer" >
2023-11-13 08:39:34 +00:00
< button type = "button" class = "btn btn-primary" data -bs -dismiss = " modal " >
Continue
< / button >
2023-11-13 06:21:13 +00:00
< / div >
2023-11-13 06:20:46 +00:00
< / div >
< / div >
< / div >
2023-11-13 12:48:24 +00:00
< / template >