2021-07-24 07:06:22 +00:00
|
|
|
const {
|
|
|
|
ipcRenderer
|
|
|
|
} = require('electron');
|
2021-07-23 15:40:44 +00:00
|
|
|
var config = require('./config.json');
|
|
|
|
|
2021-07-17 07:03:40 +00:00
|
|
|
window.addEventListener('DOMContentLoaded', () => {
|
2021-07-24 07:06:22 +00:00
|
|
|
const replaceText = (selector, text) => {
|
|
|
|
const element = document.getElementById(selector)
|
|
|
|
if (element) element.innerText = text
|
|
|
|
}
|
2021-07-17 07:03:40 +00:00
|
|
|
|
2021-07-24 07:06:22 +00:00
|
|
|
// sendPing button clicked
|
|
|
|
document.getElementById("sendPing").addEventListener("click", () => {
|
2021-07-23 15:40:44 +00:00
|
|
|
dxcallsign = document.getElementById("dxCall").value
|
|
|
|
//sock.sendPing(dxcallsign)
|
2021-07-24 07:06:22 +00:00
|
|
|
|
|
|
|
let Data = {
|
2021-07-23 15:40:44 +00:00
|
|
|
command: "ping",
|
|
|
|
dxcallsign: document.getElementById("dxCall").value
|
|
|
|
};
|
|
|
|
ipcRenderer.send('run-tnc-command', Data);
|
2021-07-24 07:06:22 +00:00
|
|
|
})
|
2021-07-17 07:03:40 +00:00
|
|
|
|
|
|
|
|
2021-07-24 07:06:22 +00:00
|
|
|
document.getElementById("startTransmission").addEventListener("click", () => {
|
|
|
|
alert("HALLO ")
|
|
|
|
})
|
2021-07-17 07:03:40 +00:00
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-23 15:40:44 +00:00
|
|
|
ipcRenderer.on('action-update-tnc-state', (event, arg) => {
|
2021-07-17 07:03:40 +00:00
|
|
|
|
2021-07-24 07:06:22 +00:00
|
|
|
// PTT STATE
|
|
|
|
if (arg.ptt_state == 'True') {
|
|
|
|
document.getElementById("ptt_state").className = "btn btn-danger";
|
|
|
|
} else if (arg.ptt_state == 'False') {
|
|
|
|
document.getElementById("ptt_state").className = "btn btn-success";
|
|
|
|
} else {
|
|
|
|
document.getElementById("ptt_state").className = "btn btn-secondary"
|
|
|
|
}
|
|
|
|
|
|
|
|
// BUSY STATE
|
|
|
|
if (arg.busy_state == 'BUSY') {
|
|
|
|
document.getElementById("busy_state").className = "btn btn-danger";
|
|
|
|
} else if (arg.busy_state == 'IDLE') {
|
|
|
|
document.getElementById("busy_state").className = "btn btn-success";
|
|
|
|
} else {
|
|
|
|
document.getElementById("busy_state").className = "btn btn-secondary"
|
|
|
|
}
|
|
|
|
|
|
|
|
// ARQ STATE
|
|
|
|
if (arg.arq_state == 'DATA') {
|
|
|
|
document.getElementById("arq_state").className = "btn btn-warning";
|
|
|
|
} else if (arg.arq_state == 'IDLE') {
|
|
|
|
document.getElementById("arq_state").className = "btn btn-secondary";
|
|
|
|
} else {
|
|
|
|
document.getElementById("arq_state").className = "btn btn-secondary"
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHANNEL STATE
|
|
|
|
if (arg.channel_state == 'RECEIVING_SIGNALLING') {
|
|
|
|
document.getElementById("signalling_state").className = "btn btn-success";
|
|
|
|
document.getElementById("data_state").className = "btn btn-secondary";
|
|
|
|
|
|
|
|
} else if (arg.channel_state == 'SENDING_SIGNALLING') {
|
|
|
|
document.getElementById("signalling_state").className = "btn btn-danger";
|
|
|
|
document.getElementById("data_state").className = "btn btn-secondary";
|
|
|
|
|
|
|
|
} else if (arg.channel_state == 'RECEIVING_DATA') {
|
|
|
|
document.getElementById("signalling_state").className = "btn btn-secondary";
|
|
|
|
document.getElementById("data_state").className = "btn btn-success";
|
|
|
|
|
|
|
|
} else if (arg.channel_state == 'SENDING_DATA') {
|
|
|
|
document.getElementById("signalling_state").className = "btn btn-secondary";
|
|
|
|
document.getElementById("data_state").className = "btn btn-danger";
|
|
|
|
} else {
|
|
|
|
document.getElementById("signalling_state").className = "btn btn-secondary"
|
|
|
|
document.getElementById("busy_state").className = "btn btn-secondary"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
ipcRenderer.on('action-update-data-state', (event, arg) => {
|
|
|
|
|
|
|
|
});
|