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 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" ;
2024-02-11 07:48:49 +00:00
import { sendModemCQ } from "../js/api.js" ;
2023-11-13 16:30:23 +00:00
import { useStateStore } from "../store/stateStore.js" ;
const state = useStateStore ( pinia ) ;
2024-03-04 10:36:44 +00:00
import { useAudioStore } from "../store/audioStore" ;
const audioStore = useAudioStore ( ) ;
import { useSerialStore } from "../store/serialStore" ;
const serialStore = useSerialStore ( ) ;
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" ;
2024-03-04 10:36:44 +00:00
2023-11-13 17:50:46 +00:00
const version = import . meta . env . PACKAGE _VERSION ;
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-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" :
2024-02-11 08:21:08 +00:00
case "rigctld_bundle" :
2023-11-15 03:00:04 +00:00
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 ( ) {
2024-02-11 08:54:18 +00:00
sendModemCQ ( ) ;
2023-11-15 03:00:04 +00:00
}
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" >
2024-02-03 12:55:30 +00:00
< label class = "input-group-text w-50"
> Manual modem restart < / l a b e l
>
2023-11-13 16:30:23 +00:00
< 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 >
< / div >
2024-03-03 10:09:29 +00:00
2024-01-05 14:40:02 +00:00
<!-- Audio Input Device -- >
2024-03-04 10:42:55 +00:00
< div class = "input-group input-group-sm mb-1" >
< label class = "input-group-text w-50"
> Audio Input device < / l a b e l
>
< select
class = "form-select form-select-sm"
aria - label = ".form-select-sm"
@ change = "onChange"
v - model = "settings.remote.AUDIO.input_device"
>
< option
v - for = "device in audioStore.audioInputs"
: value = "device.id"
>
{ { device . name } } [ { { device . api } } ]
< / option >
< / select >
< / div >
2023-11-13 16:30:23 +00:00
2023-11-13 16:41:56 +00:00
<!-- Audio Output Device -- >
2024-03-04 10:42:55 +00:00
< div class = "input-group input-group-sm mb-1" >
< label class = "input-group-text w-50"
> Audio Output device < / l a b e l
>
< select
class = "form-select form-select-sm"
aria - label = ".form-select-sm"
@ change = "onChange"
v - model = "settings.remote.AUDIO.output_device"
>
< option
v - for = "device in audioStore.audioOutputs"
: value = "device.id"
>
{ { device . name } } [ { { device . api } } ]
< / option >
< / select >
< / 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 >
2024-02-11 08:55:56 +00:00
< option selected value = "rigctld" >
Rigctld ( external Hamlib )
< / option >
< option selected value = "rigctld_bundle" >
Rigctld ( internal Hamlib )
< / option >
2023-11-15 03:00:04 +00:00
< 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 = "
2024-02-11 08:55:56 +00:00
settings . remote . RADIO . control == 'rigctld_bundle'
? ''
: 'd-none'
2023-11-18 17:05:57 +00:00
"
2023-11-15 03:01:19 +00:00
>
<!-- Shown when rigctld is selected -- >
< 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
2024-03-04 10:42:55 +00:00
< select
@ change = "onChange"
v - model = "settings.remote.RADIO.serial_port"
class = "form-select form-select-sm"
>
< option
v - for = "device in serialStore.serialDevices"
: value = "device.port"
: key = "device.port"
>
{ { device . description } }
< / option >
< / select >
2023-11-15 03:00:04 +00:00
< / div >
2024-02-11 07:48:49 +00:00
< div class = "input-group input-group-sm mb-1" >
2024-02-11 08:55:56 +00:00
< label class = "input-group-text w-25" > Rigctld Test < / label >
2024-02-11 07:48:49 +00:00
< 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."
>
Send a CQ
< / button >
< / label >
< / div >
2023-11-15 03:00:04 +00:00
< / 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
< / 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 >
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 >