mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
changed name to FreeDATA
This commit is contained in:
parent
ce5b25bd67
commit
7875f6a5e5
|
@ -6,7 +6,7 @@ const {
|
||||||
|
|
||||||
// https://stackoverflow.com/a/26227660
|
// https://stackoverflow.com/a/26227660
|
||||||
var appDataFolder = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Application Support' : process.env.HOME + "/.config")
|
var appDataFolder = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Application Support' : process.env.HOME + "/.config")
|
||||||
var configFolder = path.join(appDataFolder, "codec2-FreeDATA");
|
var configFolder = path.join(appDataFolder, "FreeDATA");
|
||||||
var configPath = path.join(configFolder, 'config.json')
|
var configPath = path.join(configFolder, 'config.json')
|
||||||
const config = require(configPath);
|
const config = require(configPath);
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ daemon.on('error', function(data) {
|
||||||
/*
|
/*
|
||||||
client.on('close', function(data) {
|
client.on('close', function(data) {
|
||||||
console.log(' TNC connection closed');
|
console.log(' TNC connection closed');
|
||||||
setTimeout(connectTNC, 2000)
|
setTimeout(connectTNC, 2000)
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -53,13 +53,13 @@ daemon.on('end', function(data) {
|
||||||
setTimeout(connectDAEMON, 2000)
|
setTimeout(connectDAEMON, 2000)
|
||||||
});
|
});
|
||||||
|
|
||||||
//exports.writeCommand = function(command){
|
//exports.writeCommand = function(command){
|
||||||
writeDaemonCommand = function(command) {
|
writeDaemonCommand = function(command) {
|
||||||
|
|
||||||
// we use the writingCommand function to update our TCPIP state because we are calling this function a lot
|
// we use the writingCommand function to update our TCPIP state because we are calling this function a lot
|
||||||
// if socket openend, we are able to run commands
|
// if socket openend, we are able to run commands
|
||||||
if (daemon.readyState == 'open') {
|
if (daemon.readyState == 'open') {
|
||||||
//uiMain.setDAEMONconnection('open')
|
//uiMain.setDAEMONconnection('open')
|
||||||
daemon.write(command + '\n');
|
daemon.write(command + '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,10 @@ const {
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
|
|
||||||
app.setName("codec2-FreeDATA");
|
app.setName("FreeDATA");
|
||||||
|
|
||||||
var appDataFolder = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Application Support' : process.env.HOME + "/.config")
|
var appDataFolder = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Application Support' : process.env.HOME + "/.config")
|
||||||
var configFolder = path.join(appDataFolder, "codec2-FreeDATA");
|
var configFolder = path.join(appDataFolder, "FreeDATA");
|
||||||
var configPath = path.join(configFolder, 'config.json')
|
var configPath = path.join(configFolder, 'config.json')
|
||||||
|
|
||||||
// create folder if not exists
|
// create folder if not exists
|
||||||
|
@ -44,7 +44,7 @@ if (!fs.existsSync(configPath)) {
|
||||||
// Creates receivedFiles folder if not exists
|
// Creates receivedFiles folder if not exists
|
||||||
// https://stackoverflow.com/a/26227660
|
// https://stackoverflow.com/a/26227660
|
||||||
var appDataFolder = process.env.HOME
|
var appDataFolder = process.env.HOME
|
||||||
var applicationFolder = path.join(appDataFolder, "codec2-FreeDATA");
|
var applicationFolder = path.join(appDataFolder, "FreeDATA");
|
||||||
var receivedFilesFolder = path.join(applicationFolder, "receivedFiles");
|
var receivedFilesFolder = path.join(applicationFolder, "receivedFiles");
|
||||||
|
|
||||||
// https://stackoverflow.com/a/13544465
|
// https://stackoverflow.com/a/13544465
|
||||||
|
|
|
@ -14,7 +14,7 @@ const {
|
||||||
|
|
||||||
// https://stackoverflow.com/a/26227660
|
// https://stackoverflow.com/a/26227660
|
||||||
var appDataFolder = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Application Support' : process.env.HOME + "/.config")
|
var appDataFolder = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Application Support' : process.env.HOME + "/.config")
|
||||||
var configFolder = path.join(appDataFolder, "codec2-FreeDATA");
|
var configFolder = path.join(appDataFolder, "FreeDATA");
|
||||||
var configPath = path.join(configFolder, 'config.json')
|
var configPath = path.join(configFolder, 'config.json')
|
||||||
const config = require(configPath);
|
const config = require(configPath);
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ setInterval(daemon.getDaemonState, 1000)
|
||||||
setInterval(sock.getTncState, 150)
|
setInterval(sock.getTncState, 150)
|
||||||
setInterval(sock.getRxBuffer, 1000)
|
setInterval(sock.getRxBuffer, 1000)
|
||||||
|
|
||||||
// UPDATE FFT DEMO
|
// UPDATE FFT DEMO
|
||||||
/*
|
/*
|
||||||
updateFFT = function(fft) {
|
updateFFT = function(fft) {
|
||||||
var fft = Array.from({
|
var fft = Array.from({
|
||||||
|
@ -64,7 +64,7 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||||
document.getElementById("waterfall").style.height = '0px';
|
document.getElementById("waterfall").style.height = '0px';
|
||||||
}
|
}
|
||||||
|
|
||||||
// remote tnc
|
// remote tnc
|
||||||
if (config.tnclocation == 'remote') {
|
if (config.tnclocation == 'remote') {
|
||||||
document.getElementById("local-remote-switch1").checked = false
|
document.getElementById("local-remote-switch1").checked = false
|
||||||
document.getElementById("local-remote-switch2").checked = true
|
document.getElementById("local-remote-switch2").checked = true
|
||||||
|
@ -172,7 +172,7 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// saveMyCall button clicked
|
// saveMyCall button clicked
|
||||||
document.getElementById("saveMyCall").addEventListener("click", () => {
|
document.getElementById("saveMyCall").addEventListener("click", () => {
|
||||||
callsign = document.getElementById("myCall").value
|
callsign = document.getElementById("myCall").value
|
||||||
config.mycall = callsign
|
config.mycall = callsign
|
||||||
|
@ -180,7 +180,7 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||||
sock.saveMyCall(callsign)
|
sock.saveMyCall(callsign)
|
||||||
});
|
});
|
||||||
|
|
||||||
// saveMyGrid button clicked
|
// saveMyGrid button clicked
|
||||||
document.getElementById("saveMyGrid").addEventListener("click", () => {
|
document.getElementById("saveMyGrid").addEventListener("click", () => {
|
||||||
grid = document.getElementById("myGrid").value
|
grid = document.getElementById("myGrid").value
|
||||||
config.mygrid = grid
|
config.mygrid = grid
|
||||||
|
@ -189,24 +189,24 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// startPing button clicked
|
// startPing button clicked
|
||||||
document.getElementById("sendPing").addEventListener("click", () => {
|
document.getElementById("sendPing").addEventListener("click", () => {
|
||||||
var dxcallsign = document.getElementById("dxCall").value
|
var dxcallsign = document.getElementById("dxCall").value
|
||||||
sock.sendPing(dxcallsign)
|
sock.sendPing(dxcallsign)
|
||||||
});
|
});
|
||||||
|
|
||||||
// dataModalstartPing button clicked
|
// dataModalstartPing button clicked
|
||||||
document.getElementById("dataModalSendPing").addEventListener("click", () => {
|
document.getElementById("dataModalSendPing").addEventListener("click", () => {
|
||||||
var dxcallsign = document.getElementById("dataModalDxCall").value
|
var dxcallsign = document.getElementById("dataModalDxCall").value
|
||||||
sock.sendPing(dxcallsign)
|
sock.sendPing(dxcallsign)
|
||||||
});
|
});
|
||||||
|
|
||||||
// sendCQ button clicked
|
// sendCQ button clicked
|
||||||
document.getElementById("sendCQ").addEventListener("click", () => {
|
document.getElementById("sendCQ").addEventListener("click", () => {
|
||||||
sock.sendCQ()
|
sock.sendCQ()
|
||||||
});
|
});
|
||||||
|
|
||||||
// startTNC button clicked
|
// startTNC button clicked
|
||||||
document.getElementById("startTNC").addEventListener("click", () => {
|
document.getElementById("startTNC").addEventListener("click", () => {
|
||||||
var rx_audio = document.getElementById("audio_input_selectbox").value
|
var rx_audio = document.getElementById("audio_input_selectbox").value
|
||||||
var tx_audio = document.getElementById("audio_output_selectbox").value
|
var tx_audio = document.getElementById("audio_output_selectbox").value
|
||||||
|
@ -230,12 +230,12 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||||
}, 4000);
|
}, 4000);
|
||||||
})
|
})
|
||||||
|
|
||||||
// stopTNC button clicked
|
// stopTNC button clicked
|
||||||
document.getElementById("stopTNC").addEventListener("click", () => {
|
document.getElementById("stopTNC").addEventListener("click", () => {
|
||||||
daemon.stopTNC()
|
daemon.stopTNC()
|
||||||
})
|
})
|
||||||
|
|
||||||
// openDataModule button clicked
|
// openDataModule button clicked
|
||||||
document.getElementById("openDataModule").addEventListener("click", () => {
|
document.getElementById("openDataModule").addEventListener("click", () => {
|
||||||
if (document.getElementById("mySidebar").style.width == "40%") {
|
if (document.getElementById("mySidebar").style.width == "40%") {
|
||||||
document.getElementById("mySidebar").style.width = "0px";
|
document.getElementById("mySidebar").style.width = "0px";
|
||||||
|
@ -244,7 +244,7 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// START TRANSMISSION
|
// START TRANSMISSION
|
||||||
document.getElementById("startTransmission").addEventListener("click", () => {
|
document.getElementById("startTransmission").addEventListener("click", () => {
|
||||||
|
|
||||||
var fileList = document.getElementById("dataModalFile").files;
|
var fileList = document.getElementById("dataModalFile").files;
|
||||||
|
@ -288,7 +288,7 @@ ipcRenderer.on('action-update-tnc-state', (event, arg) => {
|
||||||
length: 2048
|
length: 2048
|
||||||
}, () => Math.floor(Math.random() * 10));
|
}, () => Math.floor(Math.random() * 10));
|
||||||
spectrum.addData(fft);
|
spectrum.addData(fft);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// update FFT
|
// update FFT
|
||||||
|
@ -300,7 +300,7 @@ ipcRenderer.on('action-update-tnc-state', (event, arg) => {
|
||||||
//console.log(array[0])
|
//console.log(array[0])
|
||||||
spectrum.addData(array[0]);
|
spectrum.addData(array[0]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TOE TIME OF EXECUTION --> How many time needs a command to be executed until data arrives
|
// TOE TIME OF EXECUTION --> How many time needs a command to be executed until data arrives
|
||||||
|
@ -322,8 +322,8 @@ ipcRenderer.on('action-update-tnc-state', (event, arg) => {
|
||||||
const config = {
|
const config = {
|
||||||
plugins: {
|
plugins: {
|
||||||
legend: {
|
legend: {
|
||||||
display: false,
|
display: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
animations: false,
|
animations: false,
|
||||||
tooltips: {
|
tooltips: {
|
||||||
|
@ -464,7 +464,7 @@ ipcRenderer.on('action-update-tnc-state', (event, arg) => {
|
||||||
document.getElementById("transmission_progress").setAttribute("aria-valuenow", arg.arq_transmission_percent)
|
document.getElementById("transmission_progress").setAttribute("aria-valuenow", arg.arq_transmission_percent)
|
||||||
document.getElementById("transmission_progress").setAttribute("style", "width:" + arg.arq_transmission_percent + "%;")
|
document.getElementById("transmission_progress").setAttribute("style", "width:" + arg.arq_transmission_percent + "%;")
|
||||||
|
|
||||||
// UPDATE HEARD STATIONS
|
// UPDATE HEARD STATIONS
|
||||||
var tbl = document.getElementById("heardstations");
|
var tbl = document.getElementById("heardstations");
|
||||||
document.getElementById("heardstations").innerHTML = ''
|
document.getElementById("heardstations").innerHTML = ''
|
||||||
|
|
||||||
|
@ -495,9 +495,9 @@ ipcRenderer.on('action-update-tnc-state', (event, arg) => {
|
||||||
|
|
||||||
// now we update the heard stations list
|
// now we update the heard stations list
|
||||||
var row = document.createElement("tr");
|
var row = document.createElement("tr");
|
||||||
//https://stackoverflow.com/q/51421470
|
//https://stackoverflow.com/q/51421470
|
||||||
|
|
||||||
//https://stackoverflow.com/a/847196
|
//https://stackoverflow.com/a/847196
|
||||||
timestampRaw = arg.stations[i]['TIMESTAMP']
|
timestampRaw = arg.stations[i]['TIMESTAMP']
|
||||||
var date = new Date(timestampRaw * 1000);
|
var date = new Date(timestampRaw * 1000);
|
||||||
var hours = date.getHours();
|
var hours = date.getHours();
|
||||||
|
@ -696,9 +696,9 @@ ipcRenderer.on('action-update-rx-buffer', (event, arg) => {
|
||||||
// now we update the heard stations list
|
// now we update the heard stations list
|
||||||
|
|
||||||
var row = document.createElement("tr");
|
var row = document.createElement("tr");
|
||||||
//https://stackoverflow.com/q/51421470
|
//https://stackoverflow.com/q/51421470
|
||||||
|
|
||||||
//https://stackoverflow.com/a/847196
|
//https://stackoverflow.com/a/847196
|
||||||
timestampRaw = arg.data[i]['TIMESTAMP']
|
timestampRaw = arg.data[i]['TIMESTAMP']
|
||||||
var date = new Date(timestampRaw * 1000);
|
var date = new Date(timestampRaw * 1000);
|
||||||
var hours = date.getHours();
|
var hours = date.getHours();
|
||||||
|
@ -739,7 +739,7 @@ ipcRenderer.on('action-update-rx-buffer', (event, arg) => {
|
||||||
// https://stackoverflow.com/a/26227660
|
// https://stackoverflow.com/a/26227660
|
||||||
var appDataFolder = process.env.HOME
|
var appDataFolder = process.env.HOME
|
||||||
console.log("appDataFolder:" + appDataFolder)
|
console.log("appDataFolder:" + appDataFolder)
|
||||||
var applicationFolder = path.join(appDataFolder, "codec2-FreeDATA");
|
var applicationFolder = path.join(appDataFolder, "FreeDATA");
|
||||||
console.log(applicationFolder)
|
console.log(applicationFolder)
|
||||||
var receivedFilesFolder = path.join(applicationFolder, "receivedFiles");
|
var receivedFilesFolder = path.join(applicationFolder, "receivedFiles");
|
||||||
console.log("receivedFilesFolder: " + receivedFilesFolder)
|
console.log("receivedFilesFolder: " + receivedFilesFolder)
|
||||||
|
|
12
gui/sock.js
12
gui/sock.js
|
@ -6,7 +6,7 @@ const {
|
||||||
|
|
||||||
// https://stackoverflow.com/a/26227660
|
// https://stackoverflow.com/a/26227660
|
||||||
var appDataFolder = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Application Support' : process.env.HOME + "/.config")
|
var appDataFolder = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Application Support' : process.env.HOME + "/.config")
|
||||||
var configFolder = path.join(appDataFolder, "codec2-FreeDATA");
|
var configFolder = path.join(appDataFolder, "FreeDATA");
|
||||||
var configPath = path.join(configFolder, 'config.json')
|
var configPath = path.join(configFolder, 'config.json')
|
||||||
const config = require(configPath);
|
const config = require(configPath);
|
||||||
|
|
||||||
|
@ -61,20 +61,20 @@ client.on('error', function(data) {
|
||||||
/*
|
/*
|
||||||
client.on('close', function(data) {
|
client.on('close', function(data) {
|
||||||
console.log(' TNC connection closed');
|
console.log(' TNC connection closed');
|
||||||
setTimeout(connectTNC, 2000)
|
setTimeout(connectTNC, 2000)
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
client.on('end', function(data) {
|
client.on('end', function(data) {
|
||||||
console.log('TNC connection ended');
|
console.log('TNC connection ended');
|
||||||
//setTimeout(connectTNC, 2000)
|
//setTimeout(connectTNC, 2000)
|
||||||
setTimeout(connectTNC, 0)
|
setTimeout(connectTNC, 0)
|
||||||
|
|
||||||
// setTimeout( function() { exports.connectTNC(tnc_host, tnc_port); }, 2000 );
|
// setTimeout( function() { exports.connectTNC(tnc_host, tnc_port); }, 2000 );
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//exports.writeTncCommand = function(command){
|
//exports.writeTncCommand = function(command){
|
||||||
writeTncCommand = function(command) {
|
writeTncCommand = function(command) {
|
||||||
|
|
||||||
//console.log(command)
|
//console.log(command)
|
||||||
|
@ -99,7 +99,7 @@ writeTncCommand = function(command) {
|
||||||
|
|
||||||
client.on('data', function(data) {
|
client.on('data', function(data) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
stackoverflow.com questions 9070700 nodejs-net-createserver-large-amount-of-data-coming-in
|
stackoverflow.com questions 9070700 nodejs-net-createserver-large-amount-of-data-coming-in
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ function hexToBytes(hex) {
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save myCall
|
//Save myCall
|
||||||
exports.saveMyCall = function(callsign) {
|
exports.saveMyCall = function(callsign) {
|
||||||
command = '{"type" : "SET", "command": "MYCALLSIGN" , "parameter": "' + callsign + '", "timestamp" : ' + Date.now() + '}'
|
command = '{"type" : "SET", "command": "MYCALLSIGN" , "parameter": "' + callsign + '", "timestamp" : ' + Date.now() + '}'
|
||||||
writeTncCommand(command)
|
writeTncCommand(command)
|
||||||
|
|
Loading…
Reference in a new issue