2023-09-09 17:01:10 +00:00
< script setup lang = "ts" >
2023-10-03 13:15:17 +00:00
import { saveSettingsToFile } from "../js/settingsHandler" ;
2023-09-09 17:01:10 +00:00
2023-10-03 13:15:17 +00:00
import { setActivePinia } from "pinia" ;
import pinia from "../store/index" ;
2023-09-09 17:01:10 +00:00
setActivePinia ( pinia ) ;
2023-10-03 13:15:17 +00:00
import { useSettingsStore } from "../store/settingsStore.js" ;
2023-09-09 17:01:10 +00:00
const settings = useSettingsStore ( pinia ) ;
2023-10-03 13:15:17 +00:00
import { useStateStore } from "../store/stateStore.js" ;
2023-09-09 17:01:10 +00:00
const state = useStateStore ( pinia ) ;
2023-11-09 09:37:45 +00:00
import { postToServer } from "../js/rest.js" ;
2023-09-10 13:05:28 +00:00
2023-10-03 13:15:17 +00:00
function transmitCQ ( ) {
2023-11-13 20:11:50 +00:00
postToServer ( settings . modem _host , settings . modem _port , "modem/cqcqcq" , null ) ;
2023-09-10 13:05:28 +00:00
}
2023-10-03 13:15:17 +00:00
function transmitPing ( ) {
2023-11-09 14:48:10 +00:00
let command = { "dxcall" : ( < HTMLInputElement > document . getElementById ( "dxCall" ) ) . value }
2023-11-13 20:11:50 +00:00
postToServer ( settings . modem _host , settings . modem _port , "modem/ping_ping" , command ) ;
2023-09-10 13:05:28 +00:00
}
2023-10-03 13:15:17 +00:00
function startStopBeacon ( ) {
switch ( state . beacon _state ) {
case "False" :
2023-11-13 20:11:50 +00:00
postToServer ( settings . modem _host , settings . modem _port , "modem/beacon" , { "enabled" : "True" } ) ;
2023-11-09 14:48:10 +00:00
2023-09-10 13:05:28 +00:00
2023-10-03 13:15:17 +00:00
break ;
case "True" :
2023-11-13 20:11:50 +00:00
postToServer ( settings . modem _host , settings . modem _port , "modem/beacon" , { "enabled" : "False" } ) ;
2023-11-09 14:48:10 +00:00
2023-09-10 13:05:28 +00:00
2023-10-03 13:15:17 +00:00
break ;
default :
}
2023-09-10 13:05:28 +00:00
}
2023-09-09 17:01:10 +00:00
< / script >
< template >
2023-10-03 13:15:17 +00:00
< div class = "card mb-1" >
< div class = "card-header p-1" >
< div class = "container" >
< div class = "row" >
< div class = "col-1" >
< i class = "bi bi-broadcast" style = "font-size: 1.2rem" > < / i >
< / div >
< div class = "col-10" >
< strong class = "fs-5" > Broadcasts < / strong >
< / div >
< div class = "col-1 text-end" >
< button
type = "button"
id = "openHelpModalBroadcasts"
data - bs - toggle = "modal"
data - bs - target = "#broadcastsHelpModal"
class = "btn m-0 p-0 border-0"
>
< i class = "bi bi-question-circle" style = "font-size: 1rem" > < / i >
< / button >
< / div >
< / div >
< / div >
< / div >
< div class = "card-body p-2" >
< div class = "row" >
< div class = "col-md-auto" >
< div class = "input-group input-group-sm mb-0" >
< input
type = "text"
class = "form-control"
style = "max-width: 6rem; text-transform: uppercase"
placeholder = "DXcall"
pattern = "[A-Z]*"
id = "dxCall"
maxlength = "11"
aria - label = "Input group"
aria - describedby = "btnGroupAddon"
/ >
< button
class = "btn btn-sm btn-outline-secondary ms-1"
id = "sendPing"
type = "button"
data - bs - placement = "bottom"
data - bs - toggle = "tooltip"
data - bs - trigger = "hover"
data - bs - html = "false"
title = "Send a ping request to a remote station"
@ click = "transmitPing()"
>
Ping
< / button >
< button
class = "btn btn-sm btn-outline-secondary ms-1"
id = "sendCQ"
type = "button"
title = "Send a CQ to the world"
@ click = "transmitCQ()"
>
Call CQ
< / button >
< button
type = "button"
id = "startBeacon"
class = "btn btn-sm ms-1"
@ click = "startStopBeacon()"
v - bind : class = " {
'btn-success' : state . beacon _state === 'True' ,
'btn-outline-secondary' : state . beacon _state === 'False' ,
} "
title = "Toggle beacon mode. The interval can be set in settings. While sending a beacon, you can receive ping requests and open a datachannel. If a datachannel is opened, the beacon pauses."
>
< i class = "bi bi-soundwave" > < / i > Toggle beacon
< / button >
< / div >
< / div >
< / div >
<!-- end of row -- >
< / div >
< / div >
2023-09-09 17:01:10 +00:00
< / template >