time of execution

This commit is contained in:
DJ2LS 2021-08-08 11:43:50 +02:00 committed by GitHub
parent 5a9f603c46
commit d2e484f183
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 13 deletions

View file

@ -62,10 +62,12 @@ function createWindow() {
// https://stackoverflow.com/questions/44258831/only-hide-the-window-when-closing-it-electron
/*
data.on('close', function(evt) {
evt.preventDefault();
data.hide()
});
*/
}

View file

@ -10,10 +10,10 @@ const fs = require('fs');
// START INTERVALL COMMAND EXECUTION FOR STATES
setInterval(daemon.getDaemonState, 1000)
setInterval(sock.getTncState, 350)
setInterval(sock.getTncState, 250)
//setInterval(sock.getDataState, 500)
//setInterval(sock.getHeardStations, 1000)
console.log("jojojo der preloader hier")
// UPDATE FFT DEMO
@ -220,6 +220,16 @@ window.addEventListener('DOMContentLoaded', () => {
ipcRenderer.on('action-update-tnc-state', (event, arg) => {
// TOE TIME OF EXECUTION --> How many time needs a command to be executed until data arrives
if (typeof(arg.toe) == 'undefined'){
var toe = 0
} else {
var toe = arg.toe
}
document.getElementById("toe").innerHTML = toe + ' ms'
// SCATTER DIAGRAM PLOTTING
//global.myChart.destroy();
@ -312,6 +322,7 @@ ipcRenderer.on('action-update-tnc-state', (event, arg) => {
document.getElementById("rms_level").setAttribute("aria-valuenow", arg.rms_level)
document.getElementById("rms_level").setAttribute("style", "width:" + arg.rms_level + "%;")
// CHANNEL STATE
if (arg.channel_state == 'RECEIVING_SIGNALLING') {
document.getElementById("signalling_state").className = "btn btn-success";
@ -460,8 +471,6 @@ 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 + "%"
// VERSION
document.getElementById("tncversion").innerHTML = arg.version
// UPDATE AUDIO INPUT

View file

@ -107,7 +107,9 @@ client.on('data', function(data) {
if (data['COMMAND'] == 'TNC_STATE') {
let Data = {
toe: Date.now() - data['TIMESTAMP'], // time of execution
ptt_state: data['PTT_STATE'],
busy_state: data['TNC_STATE'],
arq_state: data['ARQ_STATE'],
@ -188,55 +190,55 @@ function hexToBytes(hex) {
//Save myCall
exports.saveMyCall = function(callsign) {
command = '{"type" : "SET", "command": "MYCALLSIGN" , "parameter": "' + callsign + '" }'
command = '{"type" : "SET", "command": "MYCALLSIGN" , "parameter": "' + callsign + '", "timestamp" : '+Date.now()+'}'
writeTncCommand(command)
}
// Save myGrid
exports.saveMyGrid = function(grid) {
command = '{"type" : "SET", "command": "MYGRID" , "parameter": "' + grid + '" }'
command = '{"type" : "SET", "command": "MYGRID" , "parameter": "' + grid + '", "timestamp" : '+Date.now()+'}'
writeTncCommand(command)
}
//Get TNC State
exports.getTncState = function() {
command = '{"type" : "GET", "command" : "TNC_STATE"}';
command = '{"type" : "GET", "command" : "TNC_STATE", "timestamp" : '+Date.now()+'}';
writeTncCommand(command)
}
//Get DATA State
exports.getDataState = function() {
command = '{"type" : "GET", "command" : "DATA_STATE"}';
command = '{"type" : "GET", "command" : "DATA_STATE", "timestamp" : '+Date.now()+'}';
//writeTncCommand(command)
}
//Get Heard Stations
exports.getHeardStations = function() {
command = '{"type" : "GET", "command" : "HEARD_STATIONS"}';
command = '{"type" : "GET", "command" : "HEARD_STATIONS", "timestamp" : '+Date.now()+'}';
writeTncCommand(command)
}
// Send Ping
exports.sendPing = function(dxcallsign) {
command = '{"type" : "PING", "command" : "PING", "dxcallsign" : "' + dxcallsign + '"}'
command = '{"type" : "PING", "command" : "PING", "dxcallsign" : "' + dxcallsign + '", "timestamp" : '+Date.now()+'}'
writeTncCommand(command)
}
// Send CQ
exports.sendCQ = function() {
command = '{"type" : "CQ", "command" : "CQCQCQ"}'
command = '{"type" : "CQ", "command" : "CQCQCQ", "timestamp" : '+Date.now()+'}'
writeTncCommand(command)
}
// Send File
exports.sendFile = function(dxcallsign, mode, frames, filename, filetype, data, checksum) {
command = '{"type" : "ARQ", "command" : "sendFile", "dxcallsign" : "'+dxcallsign+'", "mode" : "'+mode+'", "n_frames" : "'+frames+'", "filename" : "'+filename+'", "filetype" : "'+filetype+'", "data" : "'+data+'", "checksum" : "'+checksum+'"}'
command = '{"type" : "ARQ", "command" : "sendFile", "dxcallsign" : "'+dxcallsign+'", "mode" : "'+mode+'", "n_frames" : "'+frames+'", "filename" : "'+filename+'", "filetype" : "'+filetype+'", "data" : "'+data+'", "checksum" : "'+checksum+'", "timestamp" : '+Date.now()+'}'
writeTncCommand(command)
}
// Send Message
exports.sendMessage = function(dxcallsign, mode, frames, data, checksum) {
command = '{"type" : "ARQ", "command" : "sendMessage", "dxcallsign" : " '+dxcallsign+' ", "mode" : " '+mode+' ", "n_frames" : " '+frames+' ", "data" : " '+data+' ", "checksum" : " '+checksum+' "}'
command = '{"type" : "ARQ", "command" : "sendMessage", "dxcallsign" : " '+dxcallsign+' ", "mode" : " '+mode+' ", "n_frames" : " '+frames+' ", "data" : " '+data+' ", "checksum" : " '+checksum+' ", "timestamp" : '+Date.now()+'}'
writeTncCommand(command)
}