From 6686eceac72e793d52f9b785c80cd9048d232eeb Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Mon, 16 Aug 2021 19:39:20 +0200 Subject: [PATCH] preparing for rx buffer --- gui/preload-main.js | 15 ++++++++------- gui/sock.js | 13 ++++++++++++- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/gui/preload-main.js b/gui/preload-main.js index 6b49ed35..1dc233b9 100644 --- a/gui/preload-main.js +++ b/gui/preload-main.js @@ -226,7 +226,9 @@ window.addEventListener('DOMContentLoaded', () => { var reader = new FileReader(); - reader.readAsBinaryString(fileList[0]); + //reader.readAsBinaryString(fileList[0]); + reader.readAsDataURL(fileList[0]); + reader.onload = function(e) { // binary data @@ -237,6 +239,9 @@ window.addEventListener('DOMContentLoaded', () => { console.log(fileList[0].type) console.log(fileList[0].size) console.log(fileList[0].path) + + var data = e.target.result + console.log(data) let Data = { command: "sendFile", @@ -245,7 +250,7 @@ window.addEventListener('DOMContentLoaded', () => { frames: document.getElementById("framesperburst").value, filetype: fileList[0].type, filename: fileList[0].name, - data: e.target.result, + data: data, checksum: '123123123', }; ipcRenderer.send('run-tnc-command', Data); @@ -504,11 +509,7 @@ try { var dataTypeText = document.createElement('span'); dataTypeText.innerText = arg.stations[i]['DATATYPE'] dataType.appendChild(dataTypeText); - - - - - + if(dataTypeText.innerText == 'CQ CQ CQ'){ row.classList.add("table-success"); } diff --git a/gui/sock.js b/gui/sock.js index 154b8f61..25a5273c 100644 --- a/gui/sock.js +++ b/gui/sock.js @@ -136,6 +136,17 @@ client.on('data', function(data) { console.log(Data) ipcRenderer.send('request-update-tnc-state', Data); } + + if (data['COMMAND'] == 'RX_BUFFER') { + let Data = { + data : data['DATA'], + }; + console.log(Data) + ipcRenderer.send('request-update-rx-buffer', Data); + } + + + /* if (data['COMMAND'] == 'DATA_STATE') { let Data = { @@ -242,7 +253,7 @@ exports.sendFile = function(dxcallsign, mode, frames, filename, filetype, data, // 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+' ", "timestamp" : '+Date.now()+'}' + command = '{"type" : "ARQ", "command" : "sendMessage", "dxcallsign" : " '+dxcallsign+' ", "mode" : " '+mode+' ", "n_frames" : " '+frames+' ", "data" : '+data+' , "checksum" : " '+checksum+' ", "timestamp" : '+Date.now()+'}' writeTncCommand(command) }