use only memory settings instead for daemon and sock

This commit is contained in:
DJ2LS 2023-09-06 15:36:54 +02:00
parent 6c661d9863
commit 03778ba002
8 changed files with 4820 additions and 70 deletions

View file

@ -37,24 +37,24 @@ function useLoading() {
@keyframes square-spin { @keyframes square-spin {
0% { 0% {
transform: rotate(0deg); transform: rotate(0deg);
background-image: url('../public/icon_cube_border.png'); /* Replace with the URL of your image */ background-image: url('icon_cube_border.png'); /* Replace with the URL of your image */
background-size: cover; /* Scale the image to cover the entire container */ background-size: cover; /* Scale the image to cover the entire container */
} }
25% { transform: perspective(100px) rotateX(180deg) rotateY(0); 25% { transform: perspective(100px) rotateX(180deg) rotateY(0);
background-image: url('../public/icon_cube_border.png'); /* Replace with the URL of your image */ background-image: url('icon_cube_border.png'); /* Replace with the URL of your image */
background-size: cover; /* Scale the image to cover the entire container */ background-size: cover; /* Scale the image to cover the entire container */
} }
50% { transform: perspective(100px) rotateX(180deg) rotateY(180deg); 50% { transform: perspective(100px) rotateX(180deg) rotateY(180deg);
background-image: url('../public/icon_cube_border.png'); /* Replace with the URL of your image */ background-image: url('icon_cube_border.png'); /* Replace with the URL of your image */
background-size: cover; /* Scale the image to cover the entire container */ background-size: cover; /* Scale the image to cover the entire container */
} }
75% { transform: perspective(100px) rotateX(0) rotateY(180deg); 75% { transform: perspective(100px) rotateX(0) rotateY(180deg);
background-image: url('../public/icon_cube_border.png'); /* Replace with the URL of your image */ background-image: url('icon_cube_border.png'); /* Replace with the URL of your image */
background-size: cover; /* Scale the image to cover the entire container */ background-size: cover; /* Scale the image to cover the entire container */
} }
100% { transform: perspective(100px) rotateX(0) rotateY(0); 100% { transform: perspective(100px) rotateX(0) rotateY(0);
background-image: url('../public/icon_cube_border.png'); /* Replace with the URL of your image */ background-image: url('icon_cube_border.png'); /* Replace with the URL of your image */
background-size: cover; /* Scale the image to cover the entire container */ background-size: cover; /* Scale the image to cover the entire container */
} }
} }
@ -63,7 +63,7 @@ function useLoading() {
width: 50px; width: 50px;
height: 50px; height: 50px;
background: #fff; background: #fff;
animation: square-spin 6s 0s cubic-bezier(0.09, 0.57, 0.49, 0.9) infinite; animation: square-spin 3s 0s cubic-bezier(0.09, 0.57, 0.49, 0.9) infinite;
} }
.app-loading-wrap { .app-loading-wrap {
position: fixed; position: fixed;
@ -107,4 +107,4 @@ window.onmessage = ev => {
ev.data.payload === 'removeLoading' && removeLoading() ev.data.payload === 'removeLoading' && removeLoading()
} }
setTimeout(removeLoading, 4999) setTimeout(removeLoading, 3000)

363
gui_vue/src/js/daemon.js Normal file
View file

@ -0,0 +1,363 @@
//var net = require("net");
var net = require('node:net');
const path = require("path");
const { ipcRenderer } = require("electron");
// ----------------- init pinia stores -------------
import { setActivePinia } from 'pinia';
import pinia from '../store/index';
setActivePinia(pinia);
import { useAudioStore } from '../store/audioStore.js';
const audioStore = useAudioStore(pinia);
import { useSettingsStore } from '../store/settingsStore.js';
const settings = useSettingsStore(pinia);
var daemon = new net.Socket();
var socketchunk = ""; // Current message, per connection.
// global to keep track of daemon connection error emissions
var daemonShowConnectStateError = 1;
setTimeout(connectDAEMON, 500);
function connectDAEMON() {
if (daemonShowConnectStateError == 1) {
console.log("connecting to daemon");
}
//clear message buffer after reconnecting or initial connection
socketchunk = "";
if (settings.tnclocation == "localhost") {
daemon.connect(3001, "127.0.0.1");
} else {
daemon.connect(daemon_port, daemon_host);
}
//client.setTimeout(5000);
}
daemon.on("connect", function (err) {
console.log("daemon connection established");
let Data = {
daemon_connection: daemon.readyState,
};
ipcRenderer.send("request-update-daemon-connection", Data);
daemonShowConnectStateError = 1;
});
daemon.on("error", function (err) {
if (daemonShowConnectStateError == 1) {
console.log("daemon connection error");
console.log("Make sure the daemon is started.");
console.log('Run "python daemon.py" in the tnc directory.');
daemonShowConnectStateError = 0;
}
setTimeout(connectDAEMON, 500);
daemon.destroy();
let Data = {
daemon_connection: daemon.readyState,
};
ipcRenderer.send("request-update-daemon-connection", Data);
});
/*
client.on('close', function(data) {
console.log(' TNC connection closed');
setTimeout(connectTNC, 2000)
let Data = {
daemon_connection: daemon.readyState,
};
ipcRenderer.send('request-update-daemon-connection', Data);
});
*/
daemon.on("end", function (data) {
daemonLog.warn("daemon connection ended");
daemon.destroy();
setTimeout(connectDAEMON, 500);
let Data = {
daemon_connection: daemon.readyState,
};
ipcRenderer.send("request-update-daemon-connection", Data);
});
//exports.writeDaemonCommand = function(command){
//writeDaemonCommand = function (command) {
function writeDaemonCommand(command) {
// we use the writingCommand function to update our TCPIP state because we are calling this function a lot
// if socket opened, we are able to run commands
if (daemon.readyState == "open") {
//uiMain.setDAEMONconnection('open')
daemon.write(command + "\n");
}
if (daemon.readyState == "closed") {
//uiMain.setDAEMONconnection('closed')
}
if (daemon.readyState == "opening") {
//uiMain.setDAEMONconnection('opening')
}
let Data = {
daemon_connection: daemon.readyState,
};
ipcRenderer.send("request-update-daemon-connection", Data);
};
// "https://stackoverflow.com/questions/9070700/nodejs-net-createserver-large-amount-of-data-coming-in"
daemon.on("data", function (socketdata) {
/*
inspired by:
stackoverflow.com questions 9070700 nodejs-net-createserver-large-amount-of-data-coming-in
*/
socketdata = socketdata.toString("utf8"); // convert data to string
socketchunk += socketdata; // append data to buffer so we can stick long data together
// check if we received begin and end of json data
if (socketchunk.startsWith('{"') && socketchunk.endsWith('"}\n')) {
var data = "";
// split data into chunks if we received multiple commands
socketchunk = socketchunk.split("\n");
data = JSON.parse(socketchunk[0]);
// search for empty entries in socketchunk and remove them
for (var i = 0; i < socketchunk.length; i++) {
if (socketchunk[i] === "") {
socketchunk.splice(i, 1);
}
}
//iterate through socketchunks array to execute multiple commands in row
for (i = 0; i < socketchunk.length; i++) {
//check if data is not empty
if (socketchunk[i].length > 0) {
//try to parse JSON
try {
data = JSON.parse(socketchunk[i]);
} catch (e) {
console.log(e); // "SyntaxError
daemonLog.debug(socketchunk[i]);
socketchunk = "";
}
}
if (data["command"] == "daemon_state") {
let Data = {
input_devices: data["input_devices"],
output_devices: data["output_devices"],
python_version: data["python_version"],
hamlib_version: data["hamlib_version"],
serial_devices: data["serial_devices"],
tnc_running_state: data["daemon_state"][0]["status"],
ram_usage: data["ram"],
cpu_usage: data["cpu"],
version: data["version"],
};
// update audio devices by putting them to audio store
audioStore.inputDevices = data["input_devices"];
audioStore.outputDevices = data["output_devices"];
}
if (data["command"] == "test_hamlib") {
let Data = {
hamlib_result: data["result"],
};
ipcRenderer.send("request-update-hamlib-test", Data);
}
}
//finally delete message buffer
socketchunk = "";
}
});
function hexToBytes(hex) {
for (var bytes = [], c = 0; c < hex.length; c += 2)
bytes.push(parseInt(hex.substr(c, 2), 16));
return bytes;
}
//exports.getDaemonState = function () {
function getDaemonState() {
//function getDaemonState(){
command = '{"type" : "get", "command" : "daemon_state"}';
writeDaemonCommand(command);
};
// START TNC
// ` `== multi line string
function startTNC(
//exports.startTNC = function (
mycall,
mygrid,
rx_audio,
tx_audio,
radiocontrol,
devicename,
deviceport,
pttprotocol,
pttport,
serialspeed,
data_bits,
stop_bits,
handshake,
rigctld_ip,
rigctld_port,
enable_fft,
enable_scatter,
low_bandwidth_mode,
tuning_range_fmin,
tuning_range_fmax,
enable_fsk,
tx_audio_level,
respond_to_cq,
rx_buffer_size,
enable_explorer,
explorer_stats,
auto_tune,
tx_delay,
tci_ip,
tci_port,
enable_mesh,
) {
var json_command = JSON.stringify({
type: "set",
command: "start_tnc",
parameter: [
{
mycall: mycall,
mygrid: mygrid,
rx_audio: rx_audio,
tx_audio: tx_audio,
radiocontrol: radiocontrol,
devicename: devicename,
deviceport: deviceport,
pttprotocol: pttprotocol,
pttport: pttport,
serialspeed: serialspeed,
data_bits: data_bits,
stop_bits: stop_bits,
handshake: handshake,
rigctld_port: rigctld_port,
rigctld_ip: rigctld_ip,
enable_scatter: enable_scatter,
enable_fft: enable_fft,
enable_fsk: enable_fsk,
low_bandwidth_mode: low_bandwidth_mode,
tuning_range_fmin: tuning_range_fmin,
tuning_range_fmax: tuning_range_fmax,
tx_audio_level: tx_audio_level,
respond_to_cq: respond_to_cq,
rx_buffer_size: rx_buffer_size,
enable_explorer: enable_explorer,
enable_stats: explorer_stats,
enable_auto_tune: auto_tune,
tx_delay: tx_delay,
tci_ip: tci_ip,
tci_port: tci_port,
enable_mesh: enable_mesh,
},
],
});
daemonLog.debug(json_command);
writeDaemonCommand(json_command);
};
// STOP TNC
//exports.stopTNC = function () {
function stopTNC() {
command = '{"type" : "set", "command": "stop_tnc" , "parameter": "---" }';
writeDaemonCommand(command);
};
// TEST HAMLIB
function testHamlib(
//exports.testHamlib = function (
radiocontrol,
devicename,
deviceport,
serialspeed,
pttprotocol,
pttport,
data_bits,
stop_bits,
handshake,
rigctld_ip,
rigctld_port,
) {
var json_command = JSON.stringify({
type: "get",
command: "test_hamlib",
parameter: [
{
radiocontrol: radiocontrol,
devicename: devicename,
deviceport: deviceport,
pttprotocol: pttprotocol,
pttport: pttport,
serialspeed: serialspeed,
data_bits: data_bits,
stop_bits: stop_bits,
handshake: handshake,
rigctld_port: rigctld_port,
rigctld_ip: rigctld_ip,
},
],
});
daemonLog.debug(json_command);
writeDaemonCommand(json_command);
};
//Save myCall
function saveMyCall(callsign){
//exports.saveMyCall = function (callsign) {
command =
'{"type" : "set", "command": "mycallsign" , "parameter": "' +
callsign +
'"}';
writeDaemonCommand(command);
};
// Save myGrid
//exports.saveMyGrid = function (grid) {
function saveMyGrid(grid){
command =
'{"type" : "set", "command": "mygrid" , "parameter": "' + grid + '"}';
writeDaemonCommand(command);
};
ipcRenderer.on("action-update-daemon-ip", (event, arg) => {
daemon.destroy();
let Data = {
busy_state: "-",
arq_state: "-",
//channel_state: "-",
frequency: "-",
mode: "-",
bandwidth: "-",
dbfs_level: 0,
};
ipcRenderer.send("request-update-tnc-state", Data);
daemon_port = arg.port;
daemon_host = arg.adress;
connectDAEMON();
});

View file

@ -0,0 +1,37 @@
const fs = require("fs");
const { ipcRenderer } = require("electron");
/**
* Save config and update config setting globally
* @param {string} config - config data
* @param {string} configPath
*/
exports.saveConfig = function (config, configPath) {
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
ipcRenderer.send("set-config-global", config);
};
/**
* Binary to ASCII replacement
* @param {string} data in normal/usual utf-8 format
* @returns base64 encoded string
*/
exports.btoa_FD = function (data) {
return Buffer.from(data, "utf-8").toString("base64");
};
/**
* ASCII to Binary replacement
* @param {string} data in base64 encoding
* @returns utf-8 normal/usual string
*/
exports.atob_FD = function (data) {
return Buffer.from(data, "base64").toString("utf-8");
};
/**
* UTF8 to ASCII btoa
* @param {string} data in base64 encoding
* @returns base64 bota compatible data for use in browser
*/
exports.atob = function (data) {
return window.btoa(Buffer.from(data, "base64").toString("utf8"));
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,186 @@
const path = require("path");
const { ipcRenderer } = require("electron");
// https://stackoverflow.com/a/26227660
var appDataFolder =
process.env.APPDATA ||
(process.platform == "darwin"
? process.env.HOME + "/Library/Application Support"
: process.env.HOME + "/.config");
var configFolder = path.join(appDataFolder, "FreeDATA");
var configPath = path.join(configFolder, "config.json");
const config = require(configPath);
// WINDOW LISTENER
window.addEventListener("DOMContentLoaded", () => {
document
.getElementById("enable_filter_info")
.addEventListener("click", () => {
if (document.getElementById("enable_filter_info").checked) {
display_class("table-info", true);
} else {
display_class("table-info", false);
}
});
document
.getElementById("enable_filter_debug")
.addEventListener("click", () => {
if (document.getElementById("enable_filter_debug").checked) {
display_class("table-debug", true);
} else {
display_class("table-debug", false);
}
});
document
.getElementById("enable_filter_warning")
.addEventListener("click", () => {
if (document.getElementById("enable_filter_warning").checked) {
display_class("table-warning", true);
} else {
display_class("table-warning", false);
}
});
document
.getElementById("enable_filter_error")
.addEventListener("click", () => {
if (document.getElementById("enable_filter_error").checked) {
display_class("table-danger", true);
} else {
display_class("table-danger", false);
}
});
});
function display_class(class_name, state) {
var collection = document.getElementsByClassName(class_name);
console.log(collection);
for (let i = 0; i < collection.length; i++) {
if (state == true) {
collection[i].style.display = "table-row";
} else {
collection[i].style.display = "None";
}
}
}
ipcRenderer.on("action-update-log", (event, arg) => {
var entry = arg.entry;
// remove ANSI characters from string, caused by color logging
// https://stackoverflow.com/a/29497680
entry = entry.replace(
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,
"",
);
var tbl = document.getElementById("log");
var row = document.createElement("tr");
var timestamp = document.createElement("td");
var timestampText = document.createElement("span");
//datetime = new Date();
//timestampText.innerText = datetime.toISOString();
timestampText.innerText = entry.slice(0, 19);
timestamp.appendChild(timestampText);
var type = document.createElement("td");
var typeText = document.createElement("span");
// typeText.innerText = entry.slice(10, 30).match(/[\[](.*)[^\]]/g);
console.log(entry.match(/\[[^\]]+\]/g));
try {
typeText.innerText = entry.match(/\[[^\]]+\]/g)[0];
} catch (e) {
typeText.innerText = "-";
}
// let res = str.match(/[\[](.*)[^\]]/g);
type.appendChild(typeText);
var area = document.createElement("td");
var areaText = document.createElement("span");
//areaText.innerText = entry.slice(10, 50).match(/[\] \[](.*)[^\]]/g);
//areaText.innerText = entry.match(/\[[^\]]+\]/g)[1];
try {
areaText.innerText = entry.match(/\[[^\]]+\]/g)[1];
} catch (e) {
areaText.innerText = "-";
}
area.appendChild(areaText);
var logEntry = document.createElement("td");
var logEntryText = document.createElement("span");
try {
logEntryText.innerText = entry.split("]")[2];
} catch (e) {
logEntryText.innerText = "-";
}
logEntry.appendChild(logEntryText);
row.appendChild(timestamp);
row.appendChild(type);
row.appendChild(area);
row.appendChild(logEntry);
//row.classList.add("table-blablubb");
/*
if (logEntryText.innerText.includes('ALSA lib pcm')) {
row.classList.add("table-secondary");
}
*/
if (typeText.innerText.includes("info")) {
row.classList.add("table-info");
}
if (typeText.innerText.includes("debug")) {
row.classList.add("table-secondary");
}
if (typeText.innerText.includes("warning")) {
row.classList.add("table-warning");
}
if (typeText.innerText.includes("error")) {
row.classList.add("table-danger");
}
if (document.getElementById("enable_filter_info").checked) {
row.style.display = "table-row";
display_class("table-info", true);
} else {
row.style.display = "None";
display_class("table-info", false);
}
if (document.getElementById("enable_filter_debug").checked) {
row.style.display = "table-row";
display_class("table-secondary", true);
} else {
row.style.display = "None";
display_class("table-secondary", false);
}
if (document.getElementById("enable_filter_warning").checked) {
row.style.display = "table-row";
display_class("table-warning", true);
} else {
row.style.display = "None";
display_class("table-warning", false);
}
if (document.getElementById("enable_filter_error").checked) {
row.style.display = "table-row";
display_class("table-danger", true);
} else {
row.style.display = "None";
display_class("table-danger", false);
}
tbl.appendChild(row);
// scroll to bottom of page
// https://stackoverflow.com/a/11715670
window.scrollTo(0, document.body.scrollHeight);
});

View file

@ -0,0 +1,231 @@
const path = require("path");
const { ipcRenderer } = require("electron");
// https://stackoverflow.com/a/26227660
var appDataFolder =
process.env.APPDATA ||
(process.platform == "darwin"
? process.env.HOME + "/Library/Application Support"
: process.env.HOME + "/.config");
var configFolder = path.join(appDataFolder, "FreeDATA");
var configPath = path.join(configFolder, "config.json");
const config = require(configPath);
var callsignPath = path.join(configFolder, "callsigns.json");
const callsigns = require(callsignPath);
// WINDOW LISTENER
window.addEventListener("DOMContentLoaded", () => {
// startPing button clicked
document
.getElementById("transmit_mesh_ping")
.addEventListener("click", () => {
var dxcallsign = document
.getElementById("dxCallMesh")
.value.toUpperCase();
if (dxcallsign == "" || dxcallsign == null || dxcallsign == undefined)
return;
//pauseButton(document.getElementById("transmit_mesh_ping"), 2000);
ipcRenderer.send("run-tnc-command", {
command: "mesh_ping",
dxcallsign: dxcallsign,
});
});
});
ipcRenderer.on("action-update-mesh-table", (event, arg) => {
var routes = arg.routing_table;
if (typeof routes == "undefined") {
return;
}
var tbl = document.getElementById("mesh-table");
if (tbl !== null) {
tbl.innerHTML = "";
}
for (i = 0; i < routes.length; i++) {
var row = document.createElement("tr");
var datetime = new Date(routes[i]["timestamp"] * 1000).toLocaleString(
navigator.language,
{
hourCycle: "h23",
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
},
);
var timestamp = document.createElement("td");
var timestampText = document.createElement("span");
timestampText.innerText = datetime;
timestamp.appendChild(timestampText);
var dxcall = document.createElement("td");
var dxcallText = document.createElement("span");
dxcallText.innerText = routes[i]["dxcall"];
// check for callsign in callsign list, else use checksum
for (let call in callsigns) {
if (callsigns[call] == routes[i]["dxcall"]) {
dxcallText.innerText += " (" + call + ")";
continue;
}
}
dxcall.appendChild(dxcallText);
var router = document.createElement("td");
var routerText = document.createElement("span");
routerText.innerText = routes[i]["router"];
// check for callsign in callsign list, else use checksum
for (let call in callsigns) {
if (callsigns[call] == routes[i]["router"]) {
routerText.innerHTML += `<span class="badge ms-2 bg-secondary">${call}</span>`;
continue;
}
}
router.appendChild(routerText);
var hops = document.createElement("td");
var hopsText = document.createElement("span");
hopsText.innerText = routes[i]["hops"];
hops.appendChild(hopsText);
var score = document.createElement("td");
var scoreText = document.createElement("span");
scoreText.innerText = routes[i]["score"];
score.appendChild(scoreText);
var snr = document.createElement("td");
var snrText = document.createElement("span");
snrText.innerText = routes[i]["snr"];
snr.appendChild(snrText);
row.appendChild(timestamp);
row.appendChild(dxcall);
row.appendChild(router);
row.appendChild(hops);
row.appendChild(score);
row.appendChild(snr);
tbl.appendChild(row);
}
/*-------------------------------------------*/
var routes = arg.mesh_signalling_table;
//console.log(routes);
if (typeof routes == "undefined") {
return;
}
var tbl = document.getElementById("mesh-signalling-table");
if (tbl !== null) {
tbl.innerHTML = "";
}
for (i = 0; i < routes.length; i++) {
var row = document.createElement("tr");
var datetime = new Date(routes[i]["timestamp"] * 1000).toLocaleString(
navigator.language,
{
hourCycle: "h23",
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
},
);
var timestamp = document.createElement("td");
var timestampText = document.createElement("span");
timestampText.innerText = datetime;
timestamp.appendChild(timestampText);
var destination = document.createElement("td");
var destinationText = document.createElement("span");
destinationText.innerText = routes[i]["destination"];
// check for callsign in callsign list, else use checksum
for (let call in callsigns) {
if (callsigns[call] == routes[i]["destination"]) {
destinationText.innerHTML += `<span class="badge ms-2 bg-secondary">${call}</span>`;
continue;
}
}
destination.appendChild(destinationText);
var origin = document.createElement("td");
var originText = document.createElement("span");
originText.innerText = routes[i]["origin"];
// check for callsign in callsign list, else use checksum
for (let call in callsigns) {
if (callsigns[call] == routes[i]["origin"]) {
originText.innerHTML += `<span class="badge ms-2 bg-secondary">${call}</span>`;
continue;
}
}
origin.appendChild(originText);
var frametype = document.createElement("td");
var frametypeText = document.createElement("span");
frametypeText.innerText = routes[i]["frametype"];
frametype.appendChild(frametypeText);
var payload = document.createElement("td");
var payloadText = document.createElement("span");
payloadText.innerText = routes[i]["payload"];
payload.appendChild(payloadText);
var attempt = document.createElement("td");
var attemptText = document.createElement("span");
attemptText.innerText = routes[i]["attempt"];
attempt.appendChild(attemptText);
var status = document.createElement("td");
var statusText = document.createElement("span");
//statusText.innerText = routes[i]["status"];
switch (routes[i]["status"]) {
case "acknowledged":
var status_icon = '<i class="bi bi-check-circle-fill"></i>';
var status_color = "bg-success";
break;
case "acknowledging":
var status_icon = '<i class="bi bi-check-circle"></i>';
var status_color = "bg-warning";
break;
case "forwarding":
var status_icon = '<i class="bi bi-arrow-left-right"></i>';
var status_color = "bg-secondary";
break;
case "awaiting_ack":
var status_icon = '<i class="bi bi-clock-history"></i>';
var status_color = "bg-info";
break;
default:
var status_icon = '<i class="bi bi-question-circle-fill"></i>';
var status_color = "bg-primary";
break;
}
statusText.innerHTML = `
<span class="badge ${status_color}">${status_icon}</span>
<span class="badge ${status_color}">${routes[i]["status"]}</span>
`;
status.appendChild(statusText);
row.appendChild(timestamp);
row.appendChild(destination);
row.appendChild(origin);
row.appendChild(frametype);
row.appendChild(payload);
row.appendChild(attempt);
row.appendChild(status);
tbl.appendChild(row);
}
});

957
gui_vue/src/js/sock.js Normal file
View file

@ -0,0 +1,957 @@
var net = require("net");
const path = require("path");
const { ipcRenderer } = require("electron");
const FD = require("./src/js/freedata.js");
//import FD from './freedata.js';
// ----------------- init pinia stores -------------
import { setActivePinia } from 'pinia';
import pinia from '../store/index';
setActivePinia(pinia);
import { useStateStore } from '../store/stateStore.js';
const stateStore = useStateStore(pinia);
import { useSettingsStore } from '../store/settingsStore.js';
const settings = useSettingsStore(pinia);
var client = new net.Socket();
var socketchunk = ""; // Current message, per connection.
// split character
//const split_char = "\0;\1;";
const split_char = "0;1;";
// globals for getting new data only if available so we are saving bandwidth
var rxBufferLengthTnc = 0;
var rxBufferLengthGui = 0;
//var rxMsgBufferLengthTnc = 0;
//var rxMsgBufferLengthGui = 0;
// global to keep track of TNC connection error emissions
var tncShowConnectStateError = 1;
// network connection Timeout
setTimeout(connectTNC, 2000);
function connectTNC() {
//exports.connectTNC = function(){
//console.log('connecting to TNC...')
//clear message buffer after reconnecting or initial connection
socketchunk = "";
if (settings.tnclocation == "localhost") {
client.connect(3000, "127.0.0.1");
} else {
client.connect(settings.tnc_port, settings.tnc_host);
}
}
client.on("connect", function (data) {
console.log("TNC connection established");
stateStore.busy_state = "-";
stateStore.arq_state = "-";
stateStore.frequency = "-";
stateStore.mode = "-";
stateStore.bandwidth = "-";
stateStore.dbfs_level = 0;
stateStore.updateTncState(client.readyState)
tncShowConnectStateError = 1;
});
client.on("error", function (data) {
if (tncShowConnectStateError == 1) {
console.log("TNC connection error");
tncShowConnectStateError = 0;
}
setTimeout(connectTNC, 500);
client.destroy();
stateStore.busy_state = "-";
stateStore.arq_state = "-";
stateStore.frequency = "-";
stateStore.mode = "-";
stateStore.bandwidth = "-";
stateStore.dbfs_level = 0;
stateStore.updateTncState(client.readyState)
});
/*
client.on('close', function(data) {
console.log(' TNC connection closed');
setTimeout(connectTNC, 2000)
});
*/
client.on("end", function (data) {
console.log("TNC connection ended");
stateStore.busy_state = "-";
stateStore.arq_state = "-";
stateStore.frequency = "-";
stateStore.mode = "-";
stateStore.bandwidth = "-";
stateStore.dbfs_level = 0;
stateStore.updateTncState(client.readyState)
client.destroy();
setTimeout(connectTNC, 500);
});
//exports.writeTncCommand = function (command) {
//writeTncCommand = function (command) {
function writeTncCommand(command) {
//console.log(command)
// we use the writingCommand function to update our TCPIP state because we are calling this function a lot
// if socket opened, we are able to run commands
if (client.readyState == "open") {
client.write(command + "\n");
}
if (client.readyState == "closed") {
console.log("CLOSED!");
}
if (client.readyState == "opening") {
console.log("connecting to TNC...");
}
};
client.on("data", function (socketdata) {
stateStore.updateTncState(client.readyState)
/*
inspired by:
stackoverflow.com questions 9070700 nodejs-net-createserver-large-amount-of-data-coming-in
*/
socketdata = socketdata.toString("utf8"); // convert data to string
socketchunk += socketdata; // append data to buffer so we can stick long data together
// check if we received begin and end of json data
if (socketchunk.startsWith('{"') && socketchunk.endsWith('"}\n')) {
var data = "";
// split data into chunks if we received multiple commands
socketchunk = socketchunk.split("\n");
//don't think this is needed anymore
//data = JSON.parse(socketchunk[0])
// search for empty entries in socketchunk and remove them
for (var i = 0; i < socketchunk.length; i++) {
if (socketchunk[i] === "") {
socketchunk.splice(i, 1);
}
}
//iterate through socketchunks array to execute multiple commands in row
for (var i = 0; i < socketchunk.length; i++) {
//check if data is not empty
if (socketchunk[i].length > 0) {
//try to parse JSON
try {
data = JSON.parse(socketchunk[i]);
} catch (e) {
console.log("Throwing away data!!!!\n" + e); // "SyntaxError
//console.log(e); // "SyntaxError
console.log(socketchunk[i]);
socketchunk = "";
//If we're here, I don't think we want to process any data that may be in data variable
continue;
}
}
if (data["command"] == "tnc_state") {
//console.log(data)
// set length of RX Buffer to global variable
rxBufferLengthTnc = data["rx_buffer_length"];
//rxMsgBufferLengthTnc = data["rx_msg_buffer_length"];
let Data = {
mycallsign: data["mycallsign"],
mygrid: data["mygrid"],
ptt_state: data["ptt_state"],
busy_state: data["tnc_state"],
arq_state: data["arq_state"],
arq_session: data["arq_session"],
//channel_state: data['CHANNEL_STATE'],
frequency: data["frequency"],
speed_level: data["speed_level"],
mode: data["mode"],
bandwidth: data["bandwidth"],
dbfs_level: data["audio_dbfs"],
fft: data["fft"],
channel_busy: data["channel_busy"],
channel_busy_slot: data["channel_busy_slot"],
scatter: data["scatter"],
info: data["info"],
rx_buffer_length: data["rx_buffer_length"],
rx_msg_buffer_length: data["rx_msg_buffer_length"],
tx_n_max_retries: data["tx_n_max_retries"],
arq_tx_n_frames_per_burst: data["arq_tx_n_frames_per_burst"],
arq_tx_n_bursts: data["arq_tx_n_bursts"],
arq_tx_n_current_arq_frame: data["arq_tx_n_current_arq_frame"],
arq_tx_n_total_arq_frames: data["arq_tx_n_total_arq_frames"],
arq_rx_frame_n_bursts: data["arq_rx_frame_n_bursts"],
arq_rx_n_current_arq_frame: data["arq_rx_n_current_arq_frame"],
arq_n_arq_frames_per_data_frame:
data["arq_n_arq_frames_per_data_frame"],
arq_bytes_per_minute: data["arq_bytes_per_minute"],
arq_seconds_until_finish: data["arq_seconds_until_finish"],
arq_compression_factor: data["arq_compression_factor"],
total_bytes: data["total_bytes"],
arq_transmission_percent: data["arq_transmission_percent"],
stations: data["stations"],
routing_table: data["routing_table"],
mesh_signalling_table: data["mesh_signalling_table"],
beacon_state: data["beacon_state"],
hamlib_status: data["hamlib_status"],
listen: data["listen"],
audio_recording: data["audio_recording"],
speed_list: data["speed_list"],
strength: data["strength"],
is_codec2_traffic: data["is_codec2_traffic"],
//speed_table: [{"bpm" : 5200, "snr": -3, "timestamp":1673555399},{"bpm" : 2315, "snr": 12, "timestamp":1673555500}],
};
ipcRenderer.send("request-update-tnc-state", Data);
//continue to next for loop iteration, nothing else needs to be done here
continue;
}
// ----------- catch tnc messages START -----------
if (data["freedata"] == "tnc-message") {
switch (data["fec"]) {
case "is_writing":
// RX'd FECiswriting
ipcRenderer.send("request-show-fec-toast-iswriting", {
data: [data],
});
break;
case "broadcast":
// RX'd FEC BROADCAST
var encoded_data = FD.atob_FD(data["data"]);
var splitted_data = encoded_data.split(split_char);
var messageArray = [];
if (splitted_data[0] == "m") {
messageArray.push(data);
console.log(data);
}
let Messages = {
data: messageArray,
};
ipcRenderer.send("request-new-msg-received", Messages);
break;
}
switch (data["cq"]) {
case "transmitting":
// CQ TRANSMITTING
ipcRenderer.send("request-show-cq-toast-transmitting", {
data: [data],
});
break;
case "received":
// CQ RECEIVED
ipcRenderer.send("request-show-cq-toast-received", {
data: [data],
});
break;
}
switch (data["qrv"]) {
case "transmitting":
// QRV TRANSMITTING
ipcRenderer.send("request-show-qrv-toast-transmitting", {
data: [data],
});
break;
case "received":
// QRV RECEIVED
ipcRenderer.send("request-show-qrv-toast-received", {
data: [data],
});
break;
}
switch (data["beacon"]) {
case "transmitting":
// BEACON TRANSMITTING
ipcRenderer.send("request-show-beacon-toast-transmitting", {
data: [data],
});
break;
case "received":
// BEACON RECEIVED
ipcRenderer.send("request-show-beacon-toast-received", {
data: [data],
});
ipcRenderer.send("request-new-msg-received", { data: [data] });
break;
}
switch (data["ping"]) {
case "transmitting":
// PING TRANSMITTING
ipcRenderer.send("request-show-ping-toast-transmitting", {
data: [data],
});
break;
case "received":
// PING RECEIVED
ipcRenderer.send("request-show-ping-toast-received", {
data: [data],
});
ipcRenderer.send("request-new-msg-received", { data: [data] });
break;
case "acknowledge":
// PING ACKNOWLEDGE
ipcRenderer.send("request-show-ping-toast-received-ack", {
data: [data],
});
ipcRenderer.send("request-new-msg-received", { data: [data] });
break;
}
// ARQ SESSION && freedata == tnc-message
if (data["arq"] == "session") {
switch (data["status"]) {
case "connecting":
// ARQ Open
ipcRenderer.send("request-show-arq-toast-session-connecting", {
data: [data],
});
break;
case "connected":
// ARQ Opening
ipcRenderer.send("request-show-arq-toast-session-connected", {
data: [data],
});
break;
case "waiting":
// ARQ Opening
ipcRenderer.send("request-show-arq-toast-session-waiting", {
data: [data],
});
break;
case "close":
// ARQ Closing
ipcRenderer.send("request-show-arq-toast-session-close", {
data: [data],
});
break;
case "failed":
// ARQ Failed
ipcRenderer.send("request-show-arq-toast-session-failed", {
data: [data],
});
break;
}
}
// ARQ TRANSMISSION && freedata == tnc-message
if (data["arq"] == "transmission") {
switch (data["status"]) {
case "opened":
// ARQ Open
ipcRenderer.send("request-show-arq-toast-datachannel-opened", {
data: [data],
});
break;
case "opening":
// ARQ Opening IRS/ISS
if (data["irs"] == "False") {
ipcRenderer.send("request-show-arq-toast-datachannel-opening", {
data: [data],
});
ipcRenderer.send("request-update-transmission-status", {
data: [data],
});
} else {
ipcRenderer.send(
"request-show-arq-toast-datachannel-received-opener",
{ data: [data] },
);
ipcRenderer.send("request-update-reception-status", {
data: [data],
});
}
break;
case "waiting":
// ARQ waiting
ipcRenderer.send("request-show-arq-toast-datachannel-waiting", {
data: [data],
});
break;
case "receiving":
// ARQ RX
ipcRenderer.send("request-update-reception-status", {
data: [data],
});
break;
case "failed":
// ARQ TX Failed
if (data["reason"] == "protocol version missmatch") {
ipcRenderer.send(
"request-show-arq-toast-transmission-failed-ver",
{ data: [data] },
);
} else {
ipcRenderer.send("request-show-arq-toast-transmission-failed", {
data: [data],
});
}
switch (data["irs"]) {
case "True":
ipcRenderer.send("request-update-reception-status", {
data: [data],
});
break;
default:
ipcRenderer.send("request-update-transmission-status", {
data: [data],
});
break;
}
break;
case "received":
// ARQ Received
ipcRenderer.send("request-show-arq-toast-transmission-received", {
data: [data],
});
ipcRenderer.send("request-update-reception-status", {
data: [data],
});
dataArray = [];
messageArray = [];
console.log(data);
// we need to encode here to do a deep check for checking if file or message
//var encoded_data = atob(data['data'])
var encoded_data = FD.atob_FD(data["data"]);
var splitted_data = encoded_data.split(split_char);
if (splitted_data[0] == "f") {
dataArray.push(data);
}
if (splitted_data[0] == "m") {
messageArray.push(data);
console.log(data);
}
rxBufferLengthGui = dataArray.length;
let Files = {
data: dataArray,
};
ipcRenderer.send("request-update-rx-buffer", Files);
ipcRenderer.send("request-new-msg-received", Files);
//rxMsgBufferLengthGui = messageArray.length;
let Messages = {
data: messageArray,
};
ipcRenderer.send("request-new-msg-received", Messages);
break;
case "transmitting":
// ARQ transmitting
ipcRenderer.send(
"request-show-arq-toast-transmission-transmitting",
{ data: [data] },
);
ipcRenderer.send("request-update-transmission-status", {
data: [data],
});
break;
case "transmitted":
// ARQ transmitted
ipcRenderer.send(
"request-show-arq-toast-transmission-transmitted",
{ data: [data] },
);
ipcRenderer.send("request-update-transmission-status", {
data: [data],
});
break;
}
}
}
// ----------- catch tnc info messages END -----------
// if we manually checking for the rx buffer we are getting an array of multiple data
if (data["command"] == "rx_buffer") {
console.log(data);
// iterate through buffer list and sort it to file or message array
dataArray = [];
messageArray = [];
for (var i = 0; i < data["data-array"].length; i++) {
try {
// we need to encode here to do a deep check for checking if file or message
//var encoded_data = atob(data['data-array'][i]['data'])
var encoded_data = FD.atob_FD(data["data-array"][i]["data"]);
var splitted_data = encoded_data.split(split_char);
if (splitted_data[0] == "f") {
dataArray.push(data["data-array"][i]);
}
if (splitted_data[0] == "m") {
messageArray.push(data["data-array"][i]);
}
} catch (e) {
console.log(e);
}
}
rxBufferLengthGui = dataArray.length;
let Files = {
data: dataArray,
};
ipcRenderer.send("request-update-rx-buffer", Files);
//rxMsgBufferLengthGui = messageArray.length;
let Messages = {
data: messageArray,
};
//ipcRenderer.send('request-update-rx-msg-buffer', Messages);
ipcRenderer.send("request-new-msg-received", Messages);
}
}
//finally delete message buffer
socketchunk = "";
}
});
function hexToBytes(hex) {
for (var bytes = [], c = 0; c < hex.length; c += 2)
bytes.push(parseInt(hex.substr(c, 2), 16));
return bytes;
}
//Get TNC State
//exports.getTncState = function () {
function getTncState(){
command = '{"type" : "get", "command" : "tnc_state"}';
writeTncCommand(command);
};
//Get DATA State
//exports.getDataState = function () {
function getDataState(){
command = '{"type" : "get", "command" : "data_state"}';
//writeTncCommand(command)
};
// Send Ping
//exports.sendPing = function (dxcallsign) {
function sendPing(dxcallsign){
command =
'{"type" : "ping", "command" : "ping", "dxcallsign" : "' +
dxcallsign +
'"}';
writeTncCommand(command);
};
// Send Mesh Ping
//exports.sendMeshPing = function (dxcallsign) {
function sendMeshPing(dxcallsign){
command =
'{"type" : "mesh", "command" : "ping", "dxcallsign" : "' +
dxcallsign +
'"}';
writeTncCommand(command);
};
// Send CQ
//exports.sendCQ = function () {
function sendCQ(){
command = '{"type" : "broadcast", "command" : "cqcqcq"}';
writeTncCommand(command);
};
// Set AUDIO Level
//exports.setTxAudioLevel = function (value) {
function setTxAudioLevel(value){
command =
'{"type" : "set", "command" : "tx_audio_level", "value" : "' + value + '"}';
writeTncCommand(command);
};
// Send File
//exports.sendFile = function (
function sendFile(
dxcallsign,
mode,
frames,
filename,
filetype,
data,
checksum,
) {
console.log(data);
console.log(filetype);
console.log(filename);
var datatype = "f";
data =
datatype +
split_char +
filename +
split_char +
filetype +
split_char +
checksum +
split_char +
data;
console.log(data);
//console.log(btoa(data))
//Btoa / atob will not work with charsets > 8 bits (i.e. the emojis); should probably move away from using it
//TODO: Will need to update anyother occurences and throughly test
//data = btoa(data)
data = FD.btoa_FD(data);
command =
'{"type" : "arq", "command" : "send_raw", "parameter" : [{"dxcallsign" : "' +
dxcallsign +
'", "mode" : "' +
mode +
'", "n_frames" : "' +
frames +
'", "data" : "' +
data +
'"}]}';
writeTncCommand(command);
};
// Send Message
//exports.sendMessage = function (
function sendMessage(
dxcallsign,
mode,
frames,
data,
checksum,
uuid,
command,
) {
data = FD.btoa_FD(
"m" +
split_char +
command +
split_char +
checksum +
split_char +
uuid +
split_char +
data,
);
command =
'{"type" : "arq", "command" : "send_raw", "uuid" : "' +
uuid +
'", "parameter" : [{"dxcallsign" : "' +
dxcallsign +
'", "mode" : "' +
mode +
'", "n_frames" : "' +
frames +
'", "data" : "' +
data +
'", "attempts": "10"}]}';
console.log(command);
console.log("-------------------------------------");
writeTncCommand(command);
};
// Send Request message
//It would be then „m + split + request + split + request-type“
function sendRequest(dxcallsign, mode, frames, data, command) {
data = FD.btoa_FD("m" + split_char + command + split_char + data);
command =
'{"type" : "arq", "command" : "send_raw", "parameter" : [{"dxcallsign" : "' +
dxcallsign +
'", "mode" : "' +
mode +
'", "n_frames" : "' +
frames +
'", "data" : "' +
data +
'", "attempts": "10"}]}';
console.log(command);
console.log("--------------REQ--------------------");
writeTncCommand(command);
}
// Send Response message
//It would be then „m + split + request + split + request-type“
function sendResponse(dxcallsign, mode, frames, data, command) {
data = FD.btoa_FD("m" + split_char + command + split_char + data);
command =
'{"type" : "arq", "command" : "send_raw", "parameter" : [{"dxcallsign" : "' +
dxcallsign +
'", "mode" : "' +
mode +
'", "n_frames" : "' +
frames +
'", "data" : "' +
data +
'", "attempts": "10"}]}';
console.log(command);
console.log("--------------RES--------------------");
writeTncCommand(command);
}
//Send station info request
//exports.sendRequestInfo = function (dxcallsign) {
function sendRequestInfo(dxcallsign){
//Command 0 = user/station information
//Command 1 = shared folder list
//Command 2 = shared file transfer
sendRequest(dxcallsign, 255, 1, "0", "req");
};
//Send shared folder file list request
//exports.sendRequestSharedFolderList = function (dxcallsign) {
function sendRequestSharedFolderList(dxcallsign){
//Command 0 = user/station information
//Command 1 = shared folder list
//Command 2 = shared file transfer
sendRequest(dxcallsign, 255, 1, "1", "req");
};
//Send shared file request
//exports.sendRequestSharedFile = function (dxcallsign, file) {
function sendRequestSharedFile(dxcallsign, file){
//Command 0 = user/station information
//Command 1 = shared folder list
//Command 2 = shared file transfer
sendRequest(dxcallsign, 255, 1, "2" + file, "req");
};
//Send station info response
//exports.sendResponseInfo = function (dxcallsign, userinfo) {
function sendResponseInfo(dxcallsign, userinfo){
//Command 0 = user/station information
//Command 1 = shared folder list
//Command 2 = shared file transfer
sendResponse(dxcallsign, 255, 1, userinfo, "res-0");
};
//Send shared folder response
//exports.sendResponseSharedFolderList = function (dxcallsign, sharedFolderList) {
function sendResponseSharedFolderList(dxcallsign, sharedFolderList){
//Command 0 = user/station information
//Command 1 = shared folder list
//Command 2 = shared file transfer
sendResponse(dxcallsign, 255, 1, sharedFolderList, "res-1");
};
//Send shared file response
//exports.sendResponseSharedFile = function (
function sendResponseSharedFile(
dxcallsign,
sharedFile,
sharedFileData,
) {
console.log(
"In sendResponseSharedFile",
dxcallsign,
sharedFile,
sharedFileData,
);
//Command 0 = user/station information
//Command 1 = shared folder list
//Command 2 = shared file transfer
sendResponse(dxcallsign, 255, 1, sharedFile + "/" + sharedFileData, "res-2");
};
//STOP TRANSMISSION
//exports.stopTransmission = function () {
function stopTransmission(){
command = '{"type" : "arq", "command": "stop_transmission"}';
writeTncCommand(command);
};
// Get RX BUffer
//exports.getRxBuffer = function () {
function getRxBuffer(){
command = '{"type" : "get", "command" : "rx_buffer"}';
// call command only if new data arrived
if (rxBufferLengthGui != rxBufferLengthTnc) {
writeTncCommand(command);
}
};
// START BEACON
//exports.startBeacon = function (interval) {
function startBeacon(interval){
command =
'{"type" : "broadcast", "command" : "start_beacon", "parameter": "' +
interval +
'"}';
writeTncCommand(command);
};
// STOP BEACON
//exports.stopBeacon = function () {
function stopBeacon(){
command = '{"type" : "broadcast", "command" : "stop_beacon"}';
writeTncCommand(command);
};
// OPEN ARQ SESSION
//exports.connectARQ = function (dxcallsign) {
function connectARQ(dxcallsign){
command =
'{"type" : "arq", "command" : "connect", "dxcallsign": "' +
dxcallsign +
'", "attempts": "10"}';
writeTncCommand(command);
};
// CLOSE ARQ SESSION
//exports.disconnectARQ = function () {
function disconnectARQ(){
command = '{"type" : "arq", "command" : "disconnect"}';
writeTncCommand(command);
};
// SEND TEST FRAME
//exports.sendTestFrame = function () {
function sendTestFrame(){
command = '{"type" : "set", "command" : "send_test_frame"}';
writeTncCommand(command);
};
// SEND FEC
//exports.sendFEC = function (mode, payload) {
function sendFEC(mode, payload){
command =
'{"type" : "fec", "command" : "transmit", "mode" : "' +
mode +
'", "payload" : "' +
payload +
'"}';
writeTncCommand(command);
};
// SEND FEC IS WRITING
//exports.sendFecIsWriting = function (mycallsign) {
function sendFecIsWriting(mycallsign){
command =
'{"type" : "fec", "command" : "transmit_is_writing", "mycallsign" : "' +
mycallsign +
'"}';
writeTncCommand(command);
};
// SEND FEC TO BROADCASTCHANNEL
//exports.sendBroadcastChannel = function (channel, data_out, uuid) {
function sendBroadcastChannel(channel, data_out, uuid){
let checksum = "";
let command = "";
let data = FD.btoa_FD(
"m" +
split_char +
channel +
//split_char +
//checksum +
split_char +
uuid +
split_char +
data_out,
);
console.log(data.length);
let payload = data;
command =
'{"type" : "fec", "command" : "transmit", "mode": "datac4", "wakeup": "True", "payload" : "' +
payload +
'"}';
writeTncCommand(command);
};
// RECORD AUDIO
//exports.record_audio = function () {
function record_audio(){
command = '{"type" : "set", "command" : "record_audio"}';
writeTncCommand(command);
};
// SET FREQUENCY
//exports.set_frequency = function (frequency) {
function set_frequency(frequency){
command =
'{"type" : "set", "command" : "frequency", "frequency": ' + frequency + "}";
writeTncCommand(command);
};
// SET MODE
//exports.set_mode = function (mode) {
function set_mode(mode){
command = '{"type" : "set", "command" : "mode", "mode": "' + mode + '"}';
console.log(command);
writeTncCommand(command);
};
ipcRenderer.on("action-update-tnc-ip", (event, arg) => {
client.destroy();
let Data = {
busy_state: "-",
arq_state: "-",
//channel_state: "-",
frequency: "-",
mode: "-",
bandwidth: "-",
dbfs_level: 0,
};
ipcRenderer.send("request-update-tnc-state", Data);
tnc_port = arg.port;
tnc_host = arg.adress;
connectTNC();
});
// https://stackoverflow.com/a/50579690
// crc32 calculation
//console.log(crc32('abc'));
//console.log(crc32('abc').toString(16).toUpperCase()); // hex
var crc32 = function (r) {
for (var a, o = [], c = 0; c < 256; c++) {
a = c;
for (var f = 0; f < 8; f++) a = 1 & a ? 3988292384 ^ (a >>> 1) : a >>> 1;
o[c] = a;
}
for (var n = -1, t = 0; t < r.length; t++)
n = (n >>> 8) ^ o[255 & (n ^ r.charCodeAt(t))];
return (-1 ^ n) >>> 0;
};

View file

@ -1,80 +1,80 @@
import { defineStore } from 'pinia'; import { defineStore } from 'pinia'
import { ref, computed } from 'vue'; import { ref, computed } from 'vue'
export const useSettingsStore = defineStore('settingsStore', () => { export const useSettingsStore = defineStore('settingsStore', () => {
// network // network
var tnc_host = ref("127.0.0.1"); var tnc_host = ref("127.0.0.1")
var tnc_port = ref(3000); var tnc_port = ref(3000)
var daemon_host = ref("127.0.0.1"); var daemon_host = ref("127.0.0.1")
var daemon_port = ref(3001); var daemon_port = ref(3001)
var tnclocation = ref("localhost"); var tnclocation = ref("localhost")
// app // app
var screen_height = ref(430); var screen_height = ref(430)
var screen_width = ref(1050); var screen_width = ref(1050)
var theme = ref("default"); var theme = ref("default")
var wftheme = ref(2); var wftheme = ref(2)
var high_graphics = ref("False"); var high_graphics = ref("False")
var auto_start = ref(0); var auto_start = ref(0)
var enable_sys_notification = ref(1); var enable_sys_notification = ref(1)
// chat // chat
var shared_folder_path = ref("."); var shared_folder_path = ref(".")
var enable_request_profile = ref("True"); var enable_request_profile = ref("True")
var enable_request_shared_folder = ref("False"); var enable_request_shared_folder = ref("False")
var max_retry_attempts = ref(5); var max_retry_attempts = ref(5)
var enable_auto_retry = ref("False"); var enable_auto_retry = ref("False")
// station // station
var mycall = ref("AA0AA-0"); var mycall = ref("AA0AA-0")
var mygrid = ref("JN20aa"); var mygrid = ref("JN20aa")
// rigctld // rigctld
var hamlib_rigctld_port = ref(4532); var hamlib_rigctld_port = ref(4532)
var hamlib_rigctld_ip = ref("127.0.0.1"); var hamlib_rigctld_ip = ref("127.0.0.1")
var radiocontrol = ref("disabled"); var radiocontrol = ref("disabled")
var hamlib_deviceid = ref("RIG_MODEL_DUMMY_NOVFO"); var hamlib_deviceid = ref("RIG_MODEL_DUMMY_NOVFO")
var hamlib_deviceport = ref("ignore"); var hamlib_deviceport = ref("ignore")
var hamlib_stop_bits = ref("ignore"); var hamlib_stop_bits = ref("ignore")
var hamlib_data_bits = ref("ignore"); var hamlib_data_bits = ref("ignore")
var hamlib_handshake = ref("ignore"); var hamlib_handshake = ref("ignore")
var hamlib_serialspeed = ref("ignore"); var hamlib_serialspeed = ref("ignore")
var hamlib_dtrstate = ref("ignore"); var hamlib_dtrstate = ref("ignore")
var hamlib_pttprotocol = ref("ignore"); var hamlib_pttprotocol = ref("ignore")
var hamlib_ptt_port = ref("ignore"); var hamlib_ptt_port = ref("ignore")
var hamlib_dcd = ref("ignore"); var hamlib_dcd = ref("ignore")
var hamlbib_serialspeed_ptt = ref(9600); var hamlbib_serialspeed_ptt = ref(9600)
var hamlib_rigctld_port = ref(4532); var hamlib_rigctld_port = ref(4532)
var hamlib_rigctld_ip = ref("127.0.0.1"); var hamlib_rigctld_ip = ref("127.0.0.1")
var hamlib_rigctld_path = ref(""); var hamlib_rigctld_path = ref("")
var hamlib_rigctld_server_port = ref(4532); var hamlib_rigctld_server_port = ref(4532)
var hamlib_rigctld_custom_args = ref(""); var hamlib_rigctld_custom_args = ref("")
// tci // tci
var tci_ip = ref('127.0.0.1'); var tci_ip = ref('127.0.0.1')
var tci_port = ref(50001); var tci_port = ref(50001)
//tnc //tnc
var spectrum = ref("waterfall"); var spectrum = ref("waterfall")
var enable_scatter = ref("False"); var enable_scatter = ref("False")
var enable_fft = ref("False"); var enable_fft = ref("False")
var enable_fsk = ref("False"); var enable_fsk = ref("False")
var low_bandwidth_mode = ref("False"); var low_bandwidth_mode = ref("False")
var update_channel = ref("latest"); var update_channel = ref("latest")
var beacon_interval = ref(300); var beacon_interval = ref(300)
var received_files_folder = ref("None"); var received_files_folder = ref("None")
var tuning_range_fmin = ref(-50.0); var tuning_range_fmin = ref(-50.0)
var tuning_range_fmax = ref(50.0); var tuning_range_fmax = ref(50.0)
var respond_to_cq = ref("True"); var respond_to_cq = ref("True")
var rx_buffer_size = ref(16); var rx_buffer_size = ref(16)
var enable_explorer = ref("False"); var enable_explorer = ref("False")
var explorer_stats = ref("False"); var explorer_stats = ref("False")
var auto_tune = ref("False"); var auto_tune = ref("False")
var enable_is_writing = ref("True"); var enable_is_writing = ref("True")
var tx_delay = ref(0); var tx_delay = ref(0)
var enable_mesh_features = ref("False"); var enable_mesh_features = ref("False")
function getJSON(){ function getJSON(){
var config_export = { var config_export = {
@ -134,7 +134,7 @@ var config_export = {
"auto_start": auto_start.value, "auto_start": auto_start.value,
"enable_sys_notification": enable_sys_notification.value, "enable_sys_notification": enable_sys_notification.value,
"enable_mesh_features": enable_mesh_features.value "enable_mesh_features": enable_mesh_features.value
}; }
return config_export return config_export
} }
@ -202,6 +202,6 @@ var config_export = {
tx_delay, tx_delay,
enable_mesh_features, enable_mesh_features,
getJSON getJSON
}; }
}); })