diff --git a/gui/daemon.js b/gui/daemon.js index 9d5ac1ee..dc1060be 100644 --- a/gui/daemon.js +++ b/gui/daemon.js @@ -100,6 +100,8 @@ daemon.on('data', function(data) { 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'], diff --git a/gui/main.js b/gui/main.js index b0c4f4ec..1bf928c6 100644 --- a/gui/main.js +++ b/gui/main.js @@ -155,14 +155,20 @@ app.whenReady().then(() => { // start daemon // https://stackoverflow.com/a/5775120 - console.log("Starting Daemon") - daemonProcess = exec('./daemon', function callback(error, stdout, stderr) { - // result - console.log(stdout) - console.log(error) - console.log(stderr) + console.log("Trying to start daemon binary") + daemonProcess = exec('./daemon', function callback(err, stdout, stderr) { + if (err) { + console.error("Can't start daemon binary"); + console.error("--> this is only working with the app bundle and a precompiled binaries"); + return; + } + console.log(stdout); }); + + + + app.on('activate', () => { if (BrowserWindow.getAllWindows().length === 0) { createWindow() diff --git a/gui/package-lock.json b/gui/package-lock.json index c05c63ba..02311ebe 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -384,16 +384,6 @@ "node": ">=8" } }, - "node_modules/ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true, - "optional": true, - "engines": { - "node": ">=4" - } - }, "node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", diff --git a/gui/preload-main.js b/gui/preload-main.js index bca6e773..7c4dac95 100644 --- a/gui/preload-main.js +++ b/gui/preload-main.js @@ -11,6 +11,7 @@ const { bearingDistance, latLngToLocator } = require('qth-locator'); +const os = require('os'); // https://stackoverflow.com/a/26227660 var appDataFolder = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Application Support' : process.env.HOME + "/.config") @@ -321,10 +322,11 @@ advancedHamlibSettingsModal var collapseFirstRow = new bootstrap.Collapse(document.getElementById('collapseFirstRow'), {toggle: false}) collapseFirstRow.hide() var collapseSecondRow = new bootstrap.Collapse(document.getElementById('collapseSecondRow'), {toggle: false}) - collapseSecondRow.show() + collapseSecondRow.hide() var collapseThirdRow = new bootstrap.Collapse(document.getElementById('collapseThirdRow'), {toggle: false}) collapseThirdRow.show() - + var collapseFourthRow = new bootstrap.Collapse(document.getElementById('collapseFourthRow'), {toggle: false}) + collapseFourthRow.show() daemon.startTNC(rx_audio, tx_audio, deviceid, deviceport, pttprotocol, pttport, serialspeed, pttspeed, data_bits, stop_bits, handshake) @@ -350,10 +352,17 @@ advancedHamlibSettingsModal var collapseFirstRow = new bootstrap.Collapse(document.getElementById('collapseFirstRow'), {toggle: false}) collapseFirstRow.show() var collapseSecondRow = new bootstrap.Collapse(document.getElementById('collapseSecondRow'), {toggle: false}) - collapseSecondRow.hide() - var collapseThirdRow = new bootstrap.Collapse(document.getElementById('collapseThirdRow'), {toggle: false}) - collapseThirdRow.hide() + collapseSecondRow.show() + + var collapseThirdRow = new bootstrap.Collapse(document.getElementById('collapseThirdRow'), {toggle: false}) + collapseThirdRow.hide() + var collapseFourthRow = new bootstrap.Collapse(document.getElementById('collapseFourthRow'), {toggle: false}) + collapseFourthRow.hide() + + + + }) @@ -967,6 +976,27 @@ ipcRenderer.on('action-update-daemon-state', (event, arg) => { document.getElementById("progressbar_cpu").setAttribute("style", "width:" + arg.cpu_usage + "%;") document.getElementById("progressbar_cpu_value").innerHTML = arg.cpu_usage + "%" */ + document.getElementById("ram_load").innerHTML = "RAM " + arg.ram_usage + "%" + document.getElementById("cpu_load").innerHTML = "CPU " + arg.cpu_usage + "%" + + // OPERATING SYSTEM + + document.getElementById("operating_system").innerHTML = "OS " + os.type() + + + // PYTHON VERSION + document.getElementById("python_version").innerHTML = "Python " + arg.python_version + document.getElementById("python_version").className = "btn btn-sm btn-success"; + + // HAMLIB VERSION + document.getElementById("hamlib_version").innerHTML = "Hamlib " + arg.hamlib_version + document.getElementById("hamlib_version").className = "btn btn-sm btn-success"; + + // NODE VERSION + document.getElementById("node_version").innerHTML = "Node " + process.version + document.getElementById("node_version").className = "btn btn-sm btn-success"; + + // UPDATE AUDIO INPUT if (arg.tnc_running_state == "stopped") { if (document.getElementById("audio_input_selectbox").length != arg.input_devices.length) { @@ -1054,10 +1084,11 @@ ipcRenderer.on('action-update-daemon-state', (event, arg) => { var collapseFirstRow = new bootstrap.Collapse(document.getElementById('collapseFirstRow'), {toggle: false}) collapseFirstRow.hide() var collapseSecondRow = new bootstrap.Collapse(document.getElementById('collapseSecondRow'), {toggle: false}) - collapseSecondRow.show() + collapseSecondRow.hide() var collapseThirdRow = new bootstrap.Collapse(document.getElementById('collapseThirdRow'), {toggle: false}) collapseThirdRow.show() - + var collapseFourthRow = new bootstrap.Collapse(document.getElementById('collapseFourthRow'), {toggle: false}) + collapseFourthRow.show() } else { document.getElementById('hamlib_deviceid').disabled = false document.getElementById('hamlib_deviceport').disabled = false @@ -1081,10 +1112,11 @@ ipcRenderer.on('action-update-daemon-state', (event, arg) => { var collapseFirstRow = new bootstrap.Collapse(document.getElementById('collapseFirstRow'), {toggle: false}) collapseFirstRow.show() var collapseSecondRow = new bootstrap.Collapse(document.getElementById('collapseSecondRow'), {toggle: false}) - collapseSecondRow.hide() + collapseSecondRow.show() var collapseThirdRow = new bootstrap.Collapse(document.getElementById('collapseThirdRow'), {toggle: false}) collapseThirdRow.hide() - + var collapseFourthRow = new bootstrap.Collapse(document.getElementById('collapseFourthRow'), {toggle: false}) + collapseFourthRow.hide() } }); diff --git a/gui/src/index.html b/gui/src/index.html index 60e9ed0e..4e134b9b 100644 --- a/gui/src/index.html +++ b/gui/src/index.html @@ -622,10 +622,30 @@ --> +
+
+
+
+ + + + SYSTEM STATUS +
+
+ + + + + + +
+
+
+
-
+
MY STATION @@ -717,7 +737,7 @@
-
+
diff --git a/tnc/daemon.py b/tnc/daemon.py index 26b53040..01787030 100755 --- a/tnc/daemon.py +++ b/tnc/daemon.py @@ -214,7 +214,14 @@ class CMDTCPRequestHandler(socketserver.BaseRequestHandler): if received_json["type"] == 'GET' and received_json["command"] == 'DAEMON_STATE': - data = {'COMMAND': 'DAEMON_STATE', 'DAEMON_STATE': [], 'INPUT_DEVICES': [], 'OUTPUT_DEVICES': [], 'SERIAL_DEVICES': [ + data = { + 'COMMAND': 'DAEMON_STATE', + 'DAEMON_STATE': [], + 'PYTHON_VERSION': str(python_version), + 'HAMLIB_VERSION': str(hamlib_version), + 'INPUT_DEVICES': [], + 'OUTPUT_DEVICES': [], + 'SERIAL_DEVICES': [ ], "CPU": str(psutil.cpu_percent()), "RAM": str(psutil.virtual_memory().percent), "VERSION": "0.1-prototype"} if static.TNCSTARTED: diff --git a/tnc/modem.py b/tnc/modem.py index 2ae2badb..ec60c510 100644 --- a/tnc/modem.py +++ b/tnc/modem.py @@ -811,4 +811,3 @@ class RF(): static.FFT = [0] * 400 else: pass -