mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Merge pull request #206 from DJ2LS/improve_TNCs_info_fields
update info fields
This commit is contained in:
commit
6e08daa603
115
gui/main.js
115
gui/main.js
|
@ -471,6 +471,10 @@ console.log(filepath.filePaths[0])
|
||||||
|
|
||||||
var filename = path.basename(filepath.filePaths[0])
|
var filename = path.basename(filepath.filePaths[0])
|
||||||
var mimeType = mime.getType(filename)
|
var mimeType = mime.getType(filename)
|
||||||
|
console.log(mimeType)
|
||||||
|
if (mimeType == '' || mimeType == null){
|
||||||
|
mimeType = 'plain/text'
|
||||||
|
}
|
||||||
chat.webContents.send('return-selected-files', {data : data, mime: mimeType, filename: filename})
|
chat.webContents.send('return-selected-files', {data : data, mime: mimeType, filename: filename})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -514,6 +518,117 @@ ipcMain.on('save-file-to-folder',(event,data)=>{
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//tnc messages START --------------------------------------
|
||||||
|
|
||||||
|
// CQ TRANSMITTING
|
||||||
|
ipcMain.on('request-show-cq-toast-transmitting',(event,data)=>{
|
||||||
|
win.webContents.send('action-show-cq-toast-transmitting', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
// CQ RECEIVED
|
||||||
|
ipcMain.on('request-show-cq-toast-received',(event,data)=>{
|
||||||
|
win.webContents.send('action-show-cq-toast-received', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
// QRV TRANSMITTING
|
||||||
|
ipcMain.on('request-show-qrv-toast-transmitting',(event,data)=>{
|
||||||
|
win.webContents.send('action-show-qrv-toast-transmitting', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
// QRV RECEIVED
|
||||||
|
ipcMain.on('request-show-qrv-toast-received',(event,data)=>{
|
||||||
|
win.webContents.send('action-show-qrv-toast-received', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
// BEACON TRANSMITTING
|
||||||
|
ipcMain.on('request-show-beacon-toast-transmitting',(event,data)=>{
|
||||||
|
win.webContents.send('action-show-beacon-toast-transmitting', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
// BEACON RECEIVED
|
||||||
|
ipcMain.on('request-show-beacon-toast-received',(event,data)=>{
|
||||||
|
win.webContents.send('action-show-beacon-toast-received', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
// PING TRANSMITTING
|
||||||
|
ipcMain.on('request-show-ping-toast-transmitting',(event,data)=>{
|
||||||
|
win.webContents.send('action-show-ping-toast-transmitting', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
// PING RECEIVED
|
||||||
|
ipcMain.on('request-show-ping-toast-received',(event,data)=>{
|
||||||
|
win.webContents.send('action-show-ping-toast-received', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
// PING RECEIVED ACK
|
||||||
|
ipcMain.on('request-show-ping-toast-received-ack',(event,data)=>{
|
||||||
|
win.webContents.send('action-show-ping-toast-received-ack', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ DATA CHANNEL OPENING
|
||||||
|
ipcMain.on('request-show-arq-toast-datachannel-opening',(event,data)=>{
|
||||||
|
win.webContents.send('action-show-arq-toast-datachannel-opening', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ DATA CHANNEL OPEN
|
||||||
|
ipcMain.on('request-show-arq-toast-datachannel-opened',(event,data)=>{
|
||||||
|
win.webContents.send('action-show-arq-toast-datachannel-opened', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ DATA RECEIVED OPENER
|
||||||
|
ipcMain.on('request-show-arq-toast-datachannel-received-opener',(event,data)=>{
|
||||||
|
win.webContents.send('action-show-arq-toast-datachannel-received-opener', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ TRANSMISSION FAILED
|
||||||
|
ipcMain.on('request-show-arq-toast-transmission-failed',(event,data)=>{
|
||||||
|
win.webContents.send('action-show-arq-toast-transmission-failed', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ TRANSMISSION RECEIVING
|
||||||
|
ipcMain.on('request-show-arq-toast-transmission-receiving',(event,data)=>{
|
||||||
|
win.webContents.send('action-show-arq-toast-transmission-receiving', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ TRANSMISSION RECEIVED
|
||||||
|
ipcMain.on('request-show-arq-toast-transmission-received',(event,data)=>{
|
||||||
|
win.webContents.send('action-show-arq-toast-transmission-received', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ TRANSMISSION TRANSMITTING
|
||||||
|
ipcMain.on('request-show-arq-toast-transmission-transmitting',(event,data)=>{
|
||||||
|
win.webContents.send('action-show-arq-toast-transmission-transmitting', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ TRANSMISSION TRANSMITTED
|
||||||
|
ipcMain.on('request-show-arq-toast-transmission-transmitted',(event,data)=>{
|
||||||
|
win.webContents.send('action-show-arq-toast-transmission-transmitted', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ SESSION CONNECTING
|
||||||
|
ipcMain.on('request-show-arq-toast-session-connecting',(event,data)=>{
|
||||||
|
win.webContents.send('action-show-arq-toast-session-connecting', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ SESSION CONNECTED
|
||||||
|
ipcMain.on('request-show-arq-toast-session-connected',(event,data)=>{
|
||||||
|
win.webContents.send('action-show-arq-toast-session-connected', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ SESSION CLOSE
|
||||||
|
ipcMain.on('request-show-arq-toast-session-close',(event,data)=>{
|
||||||
|
win.webContents.send('action-show-arq-toast-session-close', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ SESSION FAILED
|
||||||
|
ipcMain.on('request-show-arq-toast-session-failed',(event,data)=>{
|
||||||
|
win.webContents.send('action-show-arq-toast-session-failed', data);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//tnc messages END --------------------------------------
|
||||||
|
|
||||||
//restart and install udpate
|
//restart and install udpate
|
||||||
ipcMain.on('request-restart-and-install',(event,data)=>{
|
ipcMain.on('request-restart-and-install',(event,data)=>{
|
||||||
close_sub_processes()
|
close_sub_processes()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "FreeDATA",
|
"name": "FreeDATA",
|
||||||
"version": "0.4.0-alpha.9",
|
"version": "0.4.1-alpha",
|
||||||
"description": "FreeDATA ",
|
"description": "FreeDATA ",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -30,11 +30,11 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"blob-util": "^2.0.2",
|
"blob-util": "^2.0.2",
|
||||||
"bootstrap": "^5.1.3",
|
"bootstrap": "^5.1.3",
|
||||||
"bootstrap-icons": "^1.8.1",
|
"bootstrap-icons": "^1.8.3",
|
||||||
"bootswatch": "^5.1.3",
|
"bootswatch": "^5.1.3",
|
||||||
"chart.js": "^3.7.1",
|
"chart.js": "^3.8.0",
|
||||||
"chartjs-plugin-annotation": "^1.4.0",
|
"chartjs-plugin-annotation": "^1.4.0",
|
||||||
"electron-log": "^4.4.6",
|
"electron-log": "^4.4.7",
|
||||||
"electron-updater": "^5.0.1",
|
"electron-updater": "^5.0.1",
|
||||||
"emoji-picker-element": "^1.11.3",
|
"emoji-picker-element": "^1.11.3",
|
||||||
"emoji-picker-element-data": "^1.3.0",
|
"emoji-picker-element-data": "^1.3.0",
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
"uuid": "^8.3.2"
|
"uuid": "^8.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron": "^18.1.0",
|
"electron": "^19.0.4",
|
||||||
"electron-builder": "^23.0.3"
|
"electron-builder": "^23.0.3"
|
||||||
},
|
},
|
||||||
"build": {
|
"build": {
|
||||||
|
|
|
@ -73,7 +73,7 @@ db.find({
|
||||||
// handle result
|
// handle result
|
||||||
if (typeof(result) !== 'undefined') {
|
if (typeof(result) !== 'undefined') {
|
||||||
result.docs.forEach(function(item) {
|
result.docs.forEach(function(item) {
|
||||||
console.log(item)
|
//console.log(item)
|
||||||
update_chat(item);
|
update_chat(item);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -118,9 +118,14 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||||
result.docs.forEach(function(item) {
|
result.docs.forEach(function(item) {
|
||||||
console.log(item)
|
console.log(item)
|
||||||
db.get(item._id).then(function(doc) {
|
db.get(item._id).then(function(doc) {
|
||||||
return db.remove(doc);
|
db.remove(doc).then(function(doc) {
|
||||||
|
return location.reload();
|
||||||
|
}).catch(function(err) {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
}).catch(function(err) {
|
||||||
|
console.log(err);
|
||||||
});
|
});
|
||||||
location.reload();
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -152,8 +157,22 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ADJUST TEXTAREA SIZE
|
||||||
|
document.getElementById("chatModuleMessage").addEventListener("input", () => {
|
||||||
|
var textarea = document.getElementById("chatModuleMessage");
|
||||||
|
var text = textarea.value;
|
||||||
|
var lines = text.split("\n").length
|
||||||
|
if (lines >= 10){
|
||||||
|
lines = 10;
|
||||||
|
}
|
||||||
|
var message_container_height_offset = 90 + (23*lines);
|
||||||
|
var message_container_height = `calc(100% - ${message_container_height_offset}px)`;
|
||||||
|
document.getElementById("message-container").style.height = message_container_height;
|
||||||
|
textarea.rows = lines;
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
// NEW CHAT
|
// NEW CHAT
|
||||||
|
|
||||||
|
|
||||||
|
@ -179,14 +198,8 @@ db.post({
|
||||||
}).catch(function(err) {
|
}).catch(function(err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
});
|
});
|
||||||
db.get(uuid, [{
|
update_chat_obj_by_uuid(uuid);
|
||||||
attachments: true
|
|
||||||
}]).then(function(doc) {
|
|
||||||
// handle doc
|
|
||||||
update_chat(doc)
|
|
||||||
}).catch(function(err) {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// SEND MSG
|
// SEND MSG
|
||||||
|
@ -194,10 +207,21 @@ db.post({
|
||||||
document.getElementById('emojipickercontainer').style.display = "none";
|
document.getElementById('emojipickercontainer').style.display = "none";
|
||||||
|
|
||||||
var dxcallsign = selected_callsign.toUpperCase();
|
var dxcallsign = selected_callsign.toUpperCase();
|
||||||
var chatmessage = document.getElementById('chatModuleMessage').value;
|
var textarea = document.getElementById('chatModuleMessage')
|
||||||
|
var chatmessage = textarea.value;
|
||||||
|
|
||||||
|
// reset textarea size
|
||||||
|
var message_container_height_offset = 110;
|
||||||
|
var message_container_height = `calc(100% - ${message_container_height_offset}px)`;
|
||||||
|
document.getElementById("message-container").style.height = message_container_height;
|
||||||
|
textarea.rows = 1
|
||||||
|
|
||||||
console.log(file);
|
console.log(file);
|
||||||
console.log(filename);
|
console.log(filename);
|
||||||
console.log(filetype);
|
console.log(filetype);
|
||||||
|
if (filetype == ''){
|
||||||
|
filetype = 'plain/text'
|
||||||
|
}
|
||||||
var data_with_attachment = chatmessage + split_char + filename + split_char + filetype + split_char + file;
|
var data_with_attachment = chatmessage + split_char + filename + split_char + filetype + split_char + file;
|
||||||
|
|
||||||
|
|
||||||
|
@ -237,21 +261,16 @@ db.post({
|
||||||
}).catch(function(err) {
|
}).catch(function(err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
});
|
});
|
||||||
db.get(uuid, [{
|
|
||||||
attachments: true
|
update_chat_obj_by_uuid(uuid);
|
||||||
}]).then(function(doc) {
|
|
||||||
// handle doc
|
|
||||||
update_chat(doc)
|
|
||||||
}).catch(function(err) {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
// scroll to bottom
|
// scroll to bottom
|
||||||
var element = document.getElementById("message-container");
|
var element = document.getElementById("message-container");
|
||||||
element.scrollTo(0, element.scrollHeight);
|
element.scrollTo(0, element.scrollHeight);
|
||||||
// clear input
|
// clear input
|
||||||
document.getElementById('chatModuleMessage').value = ''
|
document.getElementById('chatModuleMessage').value = ''
|
||||||
|
|
||||||
// after adding file data to our attachment varible, delete it from global
|
// after adding file data to our attachment variable, delete it from global
|
||||||
filetype = '';
|
filetype = '';
|
||||||
file = '';
|
file = '';
|
||||||
filename = '';
|
filename = '';
|
||||||
|
@ -265,6 +284,8 @@ db.post({
|
||||||
});
|
});
|
||||||
ipcRenderer.on('return-selected-files', (event, arg) => {
|
ipcRenderer.on('return-selected-files', (event, arg) => {
|
||||||
filetype = arg.mime;
|
filetype = arg.mime;
|
||||||
|
console.log(filetype)
|
||||||
|
|
||||||
file = arg.data;
|
file = arg.data;
|
||||||
filename = arg.filename;
|
filename = arg.filename;
|
||||||
document.getElementById('selectFilesButton').innerHTML = `
|
document.getElementById('selectFilesButton').innerHTML = `
|
||||||
|
@ -274,13 +295,13 @@ ipcRenderer.on('return-selected-files', (event, arg) => {
|
||||||
`;
|
`;
|
||||||
});
|
});
|
||||||
ipcRenderer.on('action-update-transmission-status', (event, arg) => {
|
ipcRenderer.on('action-update-transmission-status', (event, arg) => {
|
||||||
console.log(arg.status);
|
var data = arg["data"][0]
|
||||||
console.log(arg.uuid);
|
console.log(data.status);
|
||||||
db.get(arg.uuid, {
|
db.get(data.uuid, {
|
||||||
attachments: true
|
attachments: true
|
||||||
}).then(function(doc) {
|
}).then(function(doc) {
|
||||||
return db.put({
|
return db.put({
|
||||||
_id: arg.uuid,
|
_id: data.uuid,
|
||||||
_rev: doc._rev,
|
_rev: doc._rev,
|
||||||
timestamp: doc.timestamp,
|
timestamp: doc.timestamp,
|
||||||
dxcallsign: doc.dxcallsign,
|
dxcallsign: doc.dxcallsign,
|
||||||
|
@ -288,33 +309,30 @@ ipcRenderer.on('action-update-transmission-status', (event, arg) => {
|
||||||
msg: doc.msg,
|
msg: doc.msg,
|
||||||
checksum: doc.checksum,
|
checksum: doc.checksum,
|
||||||
type: "transmit",
|
type: "transmit",
|
||||||
status: arg.status,
|
status: data.status,
|
||||||
percent: arg.percent,
|
percent: data.percent,
|
||||||
bytesperminute: arg.bytesperminute,
|
bytesperminute: data.bytesperminute,
|
||||||
uuid: doc.uuid,
|
uuid: doc.uuid,
|
||||||
_attachments: doc._attachments
|
_attachments: doc._attachments
|
||||||
});
|
});
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
// handle response
|
update_chat_obj_by_uuid(data.uuid);
|
||||||
db.get(arg.uuid, [{
|
|
||||||
attachments: true
|
|
||||||
}]).then(function(doc) {
|
|
||||||
// handle doc
|
|
||||||
update_chat(doc);
|
|
||||||
}).catch(function(err) {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
}).catch(function(err) {
|
}).catch(function(err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
console.log(data)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
ipcRenderer.on('action-new-msg-received', (event, arg) => {
|
ipcRenderer.on('action-new-msg-received', (event, arg) => {
|
||||||
console.log(arg.data)
|
console.log(arg.data)
|
||||||
|
|
||||||
var new_msg = arg.data;
|
var new_msg = arg.data;
|
||||||
new_msg.forEach(function(item) {
|
new_msg.forEach(function(item) {
|
||||||
console.log(item)
|
console.log(item.status)
|
||||||
let obj = new Object();
|
let obj = new Object();
|
||||||
if (item.type == 'ping') {
|
|
||||||
|
//handle ping
|
||||||
|
if (item.ping == 'received') {
|
||||||
obj.timestamp = item.timestamp;
|
obj.timestamp = item.timestamp;
|
||||||
obj.dxcallsign = item.dxcallsign;
|
obj.dxcallsign = item.dxcallsign;
|
||||||
obj.dxgrid = item.dxgrid;
|
obj.dxgrid = item.dxgrid;
|
||||||
|
@ -324,37 +342,19 @@ ipcRenderer.on('action-new-msg-received', (event, arg) => {
|
||||||
obj.msg = 'null';
|
obj.msg = 'null';
|
||||||
obj.status = item.status;
|
obj.status = item.status;
|
||||||
obj.snr = item.snr;
|
obj.snr = item.snr;
|
||||||
obj.type = item.type;
|
obj.type = 'ping';
|
||||||
|
obj.filename = 'null';
|
||||||
|
obj.filetype = 'null';
|
||||||
|
obj.file = 'null';
|
||||||
|
|
||||||
db.put({
|
add_obj_to_database(obj)
|
||||||
_id: obj.uuid,
|
update_chat_obj_by_uuid(obj.uuid);
|
||||||
timestamp: obj.timestamp,
|
|
||||||
uuid: obj.uuid,
|
|
||||||
dxcallsign: obj.dxcallsign,
|
|
||||||
dxgrid: obj.dxgrid,
|
|
||||||
msg: obj.msg,
|
|
||||||
checksum: obj.checksum,
|
|
||||||
type: obj.type,
|
|
||||||
command: obj.command,
|
|
||||||
status: obj.status,
|
|
||||||
snr: obj.snr,
|
|
||||||
}).then(function(response) {
|
|
||||||
console.log("new database entry");
|
|
||||||
console.log(response);
|
|
||||||
}).catch(function(err) {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
|
|
||||||
db.get(item.uuid, {
|
|
||||||
attachments: true
|
|
||||||
}).then(function(doc) {
|
|
||||||
console.log(doc)
|
|
||||||
update_chat(doc);
|
|
||||||
|
|
||||||
}).catch(function(err) {
|
|
||||||
console.log(err);
|
|
||||||
});
|
// handle beacon
|
||||||
} else if (item.type == 'beacon') {
|
} else if (item.beacon == 'received') {
|
||||||
obj.timestamp = item.timestamp;
|
obj.timestamp = item.timestamp;
|
||||||
obj.dxcallsign = item.dxcallsign;
|
obj.dxcallsign = item.dxcallsign;
|
||||||
obj.dxgrid = item.dxgrid;
|
obj.dxgrid = item.dxgrid;
|
||||||
|
@ -364,36 +364,17 @@ ipcRenderer.on('action-new-msg-received', (event, arg) => {
|
||||||
obj.msg = 'null';
|
obj.msg = 'null';
|
||||||
obj.status = item.status;
|
obj.status = item.status;
|
||||||
obj.snr = item.snr;
|
obj.snr = item.snr;
|
||||||
obj.type = item.type;
|
obj.type = 'beacon';
|
||||||
|
obj.filename = 'null';
|
||||||
|
obj.filetype = 'null';
|
||||||
|
obj.file = 'null';
|
||||||
|
|
||||||
db.put({
|
add_obj_to_database(obj);
|
||||||
_id: obj.uuid,
|
update_chat_obj_by_uuid(obj.uuid);
|
||||||
timestamp: obj.timestamp,
|
|
||||||
uuid: obj.uuid,
|
|
||||||
dxcallsign: obj.dxcallsign,
|
|
||||||
dxgrid: obj.dxgrid,
|
|
||||||
msg: obj.msg,
|
|
||||||
checksum: obj.checksum,
|
|
||||||
type: obj.type,
|
|
||||||
command: obj.command,
|
|
||||||
status: obj.status,
|
|
||||||
snr: obj.snr,
|
|
||||||
}).then(function(response) {
|
|
||||||
console.log("new database entry");
|
|
||||||
console.log(response);
|
|
||||||
}).catch(function(err) {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
|
|
||||||
db.get(item.uuid, {
|
|
||||||
attachments: true
|
// handle ARQ transmission
|
||||||
}).then(function(doc) {
|
} else if (item.arq == 'transmission' && item.status == 'received') {
|
||||||
console.log(doc);
|
|
||||||
update_chat(doc);
|
|
||||||
}).catch(function(err) {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
} else if (item.arq == 'received') {
|
|
||||||
var encoded_data = atob(item.data);
|
var encoded_data = atob(item.data);
|
||||||
var splitted_data = encoded_data.split(split_char);
|
var splitted_data = encoded_data.split(split_char);
|
||||||
obj.timestamp = item.timestamp;
|
obj.timestamp = item.timestamp;
|
||||||
|
@ -410,46 +391,20 @@ ipcRenderer.on('action-new-msg-received', (event, arg) => {
|
||||||
obj.filename = utf8.decode(splitted_data[5]);
|
obj.filename = utf8.decode(splitted_data[5]);
|
||||||
obj.filetype = utf8.decode(splitted_data[6]);
|
obj.filetype = utf8.decode(splitted_data[6]);
|
||||||
obj.file = btoa(utf8.decode(splitted_data[7]));
|
obj.file = btoa(utf8.decode(splitted_data[7]));
|
||||||
db.put({
|
|
||||||
_id: obj.uuid,
|
|
||||||
timestamp: obj.timestamp,
|
|
||||||
uuid: obj.uuid,
|
|
||||||
dxcallsign: obj.dxcallsign,
|
|
||||||
dxgrid: obj.dxgrid,
|
|
||||||
msg: obj.msg,
|
|
||||||
checksum: obj.checksum,
|
|
||||||
type: obj.type,
|
|
||||||
command: obj.command,
|
|
||||||
status: obj.status,
|
|
||||||
snr: obj.snr,
|
|
||||||
_attachments: {
|
|
||||||
[obj.filename]: {
|
|
||||||
content_type: obj.filetype,
|
|
||||||
data: obj.file
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).then(function(response) {
|
|
||||||
console.log("new database entry");
|
|
||||||
console.log(response);
|
|
||||||
}).catch(function(err) {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
|
|
||||||
db.get(obj.uuid, {
|
add_obj_to_database(obj);
|
||||||
attachments: true
|
update_chat_obj_by_uuid(obj.uuid);
|
||||||
}).then(function(doc) {
|
|
||||||
console.log(doc);
|
|
||||||
update_chat(doc);
|
|
||||||
}).catch(function(err) {
|
|
||||||
console.log(err);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//window.location = window.location;
|
//window.location = window.location;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Update chat list
|
// Update chat list
|
||||||
update_chat = function(obj) {
|
update_chat = function(obj) {
|
||||||
//console.log(obj);
|
|
||||||
var dxcallsign = obj.dxcallsign;
|
var dxcallsign = obj.dxcallsign;
|
||||||
var timestamp = dateFormat.format(obj.timestamp * 1000);
|
var timestamp = dateFormat.format(obj.timestamp * 1000);
|
||||||
var timestampShort = dateFormatShort.format(obj.timestamp * 1000);
|
var timestampShort = dateFormatShort.format(obj.timestamp * 1000);
|
||||||
|
@ -462,12 +417,12 @@ update_chat = function(obj) {
|
||||||
var shortmsg = obj.type;
|
var shortmsg = obj.type;
|
||||||
} else {
|
} else {
|
||||||
var shortmsg = obj.msg;
|
var shortmsg = obj.msg;
|
||||||
var maxlength = 40;
|
var maxlength = 30;
|
||||||
var shortmsg = shortmsg.length > maxlength ? shortmsg.substring(0, maxlength - 3) + "..." : shortmsg;
|
var shortmsg = shortmsg.length > maxlength ? shortmsg.substring(0, maxlength - 3) + "..." : shortmsg;
|
||||||
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
console.log(Object.keys(obj._attachments)[0].length)
|
//console.log(Object.keys(obj._attachments)[0].length)
|
||||||
if (typeof(obj._attachments) !== 'undefined' && Object.keys(obj._attachments)[0].length > 0) {
|
if (typeof(obj._attachments) !== 'undefined' && Object.keys(obj._attachments)[0].length > 0) {
|
||||||
//var filename = obj._attachments;
|
//var filename = obj._attachments;
|
||||||
var filename = Object.keys(obj._attachments)[0]
|
var filename = Object.keys(obj._attachments)[0]
|
||||||
|
@ -504,6 +459,7 @@ update_chat = function(obj) {
|
||||||
} else {
|
} else {
|
||||||
var filename = '';
|
var filename = '';
|
||||||
var fileheader = '';
|
var fileheader = '';
|
||||||
|
var filetype = 'text/plain';
|
||||||
var controlarea_transmit = `
|
var controlarea_transmit = `
|
||||||
<div class="ms-auto" id="msg-${obj._id}-control-area">
|
<div class="ms-auto" id="msg-${obj._id}-control-area">
|
||||||
<button class="btn bg-transparent p-1 m-1"><i class="bi bi-arrow-repeat" id="retransmit-msg-${obj._id}" style="font-size: 1.2rem; color: grey;"></i></button>
|
<button class="btn bg-transparent p-1 m-1"><i class="bi bi-arrow-repeat" id="retransmit-msg-${obj._id}" style="font-size: 1.2rem; color: grey;"></i></button>
|
||||||
|
@ -554,7 +510,7 @@ update_chat = function(obj) {
|
||||||
|
|
||||||
// scroll to bottom
|
// scroll to bottom
|
||||||
var element = document.getElementById("message-container");
|
var element = document.getElementById("message-container");
|
||||||
console.log(element.scrollHeight)
|
//console.log(element.scrollHeight)
|
||||||
element.scrollTo(0, element.scrollHeight);
|
element.scrollTo(0, element.scrollHeight);
|
||||||
|
|
||||||
|
|
||||||
|
@ -634,19 +590,15 @@ update_chat = function(obj) {
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (obj.type == 'transmit') {
|
if (obj.type == 'transmit') {
|
||||||
|
|
||||||
console.log('msg-' + obj._id + '-status')
|
//console.log('msg-' + obj._id + '-status')
|
||||||
|
|
||||||
|
|
||||||
if (obj.status == 'failed'){
|
|
||||||
var progressbar_bg = 'bg-danger';
|
|
||||||
} else {
|
|
||||||
var progressbar_bg = 'bg-primary';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (obj.status == 'failed'){
|
||||||
|
var progressbar_bg = 'bg-danger';
|
||||||
|
} else {
|
||||||
|
var progressbar_bg = 'bg-primary';
|
||||||
|
}
|
||||||
|
|
||||||
var new_message = `
|
var new_message = `
|
||||||
|
|
||||||
|
@ -698,17 +650,15 @@ update_chat = function(obj) {
|
||||||
var id = "chat-" + obj.dxcallsign
|
var id = "chat-" + obj.dxcallsign
|
||||||
document.getElementById(id).insertAdjacentHTML("beforeend", new_message);
|
document.getElementById(id).insertAdjacentHTML("beforeend", new_message);
|
||||||
|
|
||||||
var element = document.getElementById("message-container");
|
//var element = document.getElementById("message-container");
|
||||||
console.log(element.scrollHeight)
|
//console.log(element.scrollHeight)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* UPDATE EXISTING ELEMENTS */
|
||||||
} else if (document.getElementById('msg-' + obj._id)) {
|
} else if (document.getElementById('msg-' + obj._id)) {
|
||||||
console.log("element already exists......")
|
console.log("element already exists......")
|
||||||
console.log(obj)
|
console.log(obj)
|
||||||
console.log(document.getElementById('msg-' + obj._id + '-progress').getAttribute("aria-valuenow"))
|
|
||||||
|
|
||||||
|
console.log(document.getElementById('msg-' + obj._id + '-progress').getAttribute("aria-valuenow"))
|
||||||
|
|
||||||
document.getElementById('msg-' + obj._id + '-status').innerHTML = get_icon_for_state(obj.status);
|
document.getElementById('msg-' + obj._id + '-status').innerHTML = get_icon_for_state(obj.status);
|
||||||
|
|
||||||
|
@ -716,10 +666,8 @@ update_chat = function(obj) {
|
||||||
document.getElementById('msg-' + obj._id + '-progress').setAttribute("style", "width:" + obj.percent + "%;");
|
document.getElementById('msg-' + obj._id + '-progress').setAttribute("style", "width:" + obj.percent + "%;");
|
||||||
document.getElementById('msg-' + obj._id + '-progress-information').innerHTML = obj.percent + "% - " + obj.bytesperminute + " Bpm";
|
document.getElementById('msg-' + obj._id + '-progress-information').innerHTML = obj.percent + "% - " + obj.bytesperminute + " Bpm";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (obj.percent >= 100){
|
if (obj.percent >= 100){
|
||||||
document.getElementById('msg-' + obj._id + '-progress').classList.remove("progress-bar-striped");
|
//document.getElementById('msg-' + obj._id + '-progress').classList.remove("progress-bar-striped");
|
||||||
document.getElementById('msg-' + obj._id + '-progress').classList.remove("progress-bar-animated");
|
document.getElementById('msg-' + obj._id + '-progress').classList.remove("progress-bar-animated");
|
||||||
document.getElementById('msg-' + obj._id + '-progress').innerHTML = '';
|
document.getElementById('msg-' + obj._id + '-progress').innerHTML = '';
|
||||||
} else {
|
} else {
|
||||||
|
@ -727,9 +675,8 @@ update_chat = function(obj) {
|
||||||
document.getElementById('msg-' + obj._id + '-progress').classList.add("progress-bar-animated");
|
document.getElementById('msg-' + obj._id + '-progress').classList.add("progress-bar-animated");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (obj.status == 'failed'){
|
if (obj.status == 'failed'){
|
||||||
document.getElementById('msg-' + obj._id + '-progress').classList.remove("progress-bar-striped");
|
//document.getElementById('msg-' + obj._id + '-progress').classList.remove("progress-bar-striped");
|
||||||
document.getElementById('msg-' + obj._id + '-progress').classList.remove("progress-bar-animated");
|
document.getElementById('msg-' + obj._id + '-progress').classList.remove("progress-bar-animated");
|
||||||
document.getElementById('msg-' + obj._id + '-progress').classList.remove("bg-primary");
|
document.getElementById('msg-' + obj._id + '-progress').classList.remove("bg-primary");
|
||||||
document.getElementById('msg-' + obj._id + '-progress').classList.add("bg-danger");
|
document.getElementById('msg-' + obj._id + '-progress').classList.add("bg-danger");
|
||||||
|
@ -762,11 +709,8 @@ update_chat = function(obj) {
|
||||||
|
|
||||||
// set Attribute to determine if we already created an EventListener for this element
|
// set Attribute to determine if we already created an EventListener for this element
|
||||||
document.getElementById('retransmit-msg-' + obj._id).setAttribute('listenerOnClick', 'true');
|
document.getElementById('retransmit-msg-' + obj._id).setAttribute('listenerOnClick', 'true');
|
||||||
|
|
||||||
document.getElementById('retransmit-msg-' + obj._id).addEventListener("click", () => {
|
document.getElementById('retransmit-msg-' + obj._id).addEventListener("click", () => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
db.get(obj._id, {
|
db.get(obj._id, {
|
||||||
attachments: true
|
attachments: true
|
||||||
}).then(function(doc) {
|
}).then(function(doc) {
|
||||||
|
@ -819,39 +763,7 @@ update_chat = function(obj) {
|
||||||
//window.location = window.location
|
//window.location = window.location
|
||||||
}
|
}
|
||||||
|
|
||||||
function getObjByID(id) {
|
|
||||||
/*
|
|
||||||
{
|
|
||||||
"timestamp": 1648139683,
|
|
||||||
"dxcallsign": "DN2LS-0",
|
|
||||||
"dxgrid": "null",
|
|
||||||
"msg": "",
|
|
||||||
"checksum": "null",
|
|
||||||
"type": "transmit",
|
|
||||||
"status": "transmit",
|
|
||||||
"uuid": "5b72a46c-49cf-40d6-8936-a64c95bc3da7",
|
|
||||||
"_attachments": {
|
|
||||||
"CMakeLists.txt": {
|
|
||||||
"content_type": "text/plain",
|
|
||||||
"digest": "md5-Cdk6Ol6uuJ7Gj5lin9o4SQ==",
|
|
||||||
"length": 7802,
|
|
||||||
"revpos": 1,
|
|
||||||
"stub": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"_id": "5b72a46c-49cf-40d6-8936-a64c95bc3da7",
|
|
||||||
"_rev": "1-6df2d7227c4f89f8a3a2b4978661dd79"
|
|
||||||
}
|
|
||||||
**/
|
|
||||||
db.get(id, {
|
|
||||||
attachments: true
|
|
||||||
}).then(function(doc) {
|
|
||||||
return obj
|
|
||||||
}).catch(function(err) {
|
|
||||||
console.log(err);
|
|
||||||
return false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function saveFileToFolder(id) {
|
function saveFileToFolder(id) {
|
||||||
db.get(id, {
|
db.get(id, {
|
||||||
|
@ -891,13 +803,57 @@ function get_icon_for_state(state) {
|
||||||
if (state == 'transmit') {
|
if (state == 'transmit') {
|
||||||
var status_icon = '<i class="bi bi-check" style="font-size:1rem;"></i>';
|
var status_icon = '<i class="bi bi-check" style="font-size:1rem;"></i>';
|
||||||
} else if (state == 'transmitting') {
|
} else if (state == 'transmitting') {
|
||||||
var status_icon = '<i class="bi bi-arrow-left-right" style="font-size:0.8rem;"></i>';
|
//var status_icon = '<i class="bi bi-arrow-left-right" style="font-size:0.8rem;"></i>';
|
||||||
|
var status_icon = `
|
||||||
|
<i class="spinner-border ms-auto" style="width: 0.8rem; height: 0.8rem;" role="status" aria-hidden="true"></i>
|
||||||
|
`;
|
||||||
} else if (state == 'failed') {
|
} else if (state == 'failed') {
|
||||||
var status_icon = '<i class="bi bi-exclamation-circle" style="font-size:1rem;"></i>';
|
var status_icon = '<i class="bi bi-exclamation-circle" style="font-size:1rem;"></i>';
|
||||||
} else if (state == 'success') {
|
} else if (state == 'transmitted') {
|
||||||
var status_icon = '<i class="bi bi-check-all" style="font-size:1rem;"></i>';
|
var status_icon = '<i class="bi bi-check-all" style="font-size:1rem;"></i>';
|
||||||
} else {
|
} else {
|
||||||
var status_icon = '<i class="bi bi-question" style="font-size:1rem;"></i>';
|
var status_icon = '<i class="bi bi-question" style="font-size:1rem;"></i>';
|
||||||
}
|
}
|
||||||
return status_icon;
|
return status_icon;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
update_chat_obj_by_uuid = function(uuid) {
|
||||||
|
db.get(uuid, {
|
||||||
|
attachments: true
|
||||||
|
}).then(function(doc) {
|
||||||
|
update_chat(doc)
|
||||||
|
//return doc
|
||||||
|
}).catch(function(err) {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
add_obj_to_database = function(obj){
|
||||||
|
db.put({
|
||||||
|
_id: obj.uuid,
|
||||||
|
timestamp: obj.timestamp,
|
||||||
|
uuid: obj.uuid,
|
||||||
|
dxcallsign: obj.dxcallsign,
|
||||||
|
dxgrid: obj.dxgrid,
|
||||||
|
msg: obj.msg,
|
||||||
|
checksum: obj.checksum,
|
||||||
|
type: obj.type,
|
||||||
|
command: obj.command,
|
||||||
|
status: obj.status,
|
||||||
|
snr: obj.snr,
|
||||||
|
_attachments: {
|
||||||
|
[obj.filename]: {
|
||||||
|
content_type: obj.filetype,
|
||||||
|
data: obj.file
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).then(function(response) {
|
||||||
|
console.log("new database entry");
|
||||||
|
console.log(response);
|
||||||
|
}).catch(function(err) {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
}
|
|
@ -1333,143 +1333,6 @@ ipcRenderer.on('action-update-tnc-state', (event, arg) => {
|
||||||
tbl.appendChild(row);
|
tbl.appendChild(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// DISPLAY INFO TOASTS
|
|
||||||
if (typeof(arg.info) == 'undefined') {
|
|
||||||
var infoLength = 0;
|
|
||||||
} else {
|
|
||||||
var infoLength = arg.info.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < infoLength; i++) {
|
|
||||||
|
|
||||||
// SENDING CQ TOAST
|
|
||||||
if (arg.info[i] == "CQ;SENDING"){
|
|
||||||
var toastCQsending = document.getElementById('toastCQsending');
|
|
||||||
var toast = bootstrap.Toast.getOrCreateInstance(toastCQsending); // Returns a Bootstrap toast instance
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
// RECEIVING CQ TOAST
|
|
||||||
if (arg.info[i] == "CQ;RECEIVING"){
|
|
||||||
var toastCQreceiving = document.getElementById('toastCQreceiving');
|
|
||||||
var toast = bootstrap.Toast.getOrCreateInstance(toastCQreceiving); // Returns a Bootstrap toast instance
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
// RECEIVING BEACON TOAST
|
|
||||||
if (arg.info[i] == "BEACON;RECEIVING"){
|
|
||||||
var toastBEACONreceiving = document.getElementById('toastBEACONreceiving');
|
|
||||||
var toast = bootstrap.Toast.getOrCreateInstance(toastBEACONreceiving); // Returns a Bootstrap toast instance
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// SENDING PING TOAST
|
|
||||||
if (arg.info[i] == "PING;SENDING"){
|
|
||||||
var toastPINGsending = document.getElementById('toastPINGsending');
|
|
||||||
var toast = bootstrap.Toast.getOrCreateInstance(toastPINGsending); // Returns a Bootstrap toast instance
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
// RECEIVING PING TOAST
|
|
||||||
if (arg.info[i] == "PING;RECEIVING"){
|
|
||||||
var toastPINGreceiving = document.getElementById('toastPINGreceiving');
|
|
||||||
var toast = bootstrap.Toast.getOrCreateInstance(toastPINGreceiving); // Returns a Bootstrap toast instance
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
// RECEIVING PING ACK TOAST
|
|
||||||
if (arg.info[i] == "PING;RECEIVEDACK"){
|
|
||||||
var toastPINGreceivedACK = document.getElementById('toastPINGreceivedACK');
|
|
||||||
var toast = bootstrap.Toast.getOrCreateInstance(toastPINGreceivedACK); // Returns a Bootstrap toast instance
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
// DATACHANNEL OPENING TOAST
|
|
||||||
if (arg.info[i] == "DATACHANNEL;OPENING"){
|
|
||||||
var toastDATACHANNELopening = document.getElementById('toastDATACHANNELopening');
|
|
||||||
var toast = bootstrap.Toast.getOrCreateInstance(toastDATACHANNELopening); // Returns a Bootstrap toast instance
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
// DATACHANNEL OPEN TOAST
|
|
||||||
if (arg.info[i] == "DATACHANNEL;OPEN"){
|
|
||||||
var toastDATACHANNELopen = document.getElementById('toastDATACHANNELopen');
|
|
||||||
var toast = bootstrap.Toast.getOrCreateInstance(toastDATACHANNELopen); // Returns a Bootstrap toast instance
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
// DATACHANNEL RECEIVEDOPENER TOAST
|
|
||||||
if (arg.info[i] == "DATACHANNEL;RECEIVEDOPENER"){
|
|
||||||
var toastDATACHANNELreceivedopener = document.getElementById('toastDATACHANNELreceivedopener');
|
|
||||||
var toast = bootstrap.Toast.getOrCreateInstance(toastDATACHANNELreceivedopener); // Returns a Bootstrap toast instance
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
// TRANSMISSION STOPPED
|
|
||||||
if (arg.info[i] == "TRANSMISSION;STOPPED"){
|
|
||||||
var toastDATACHANNELreceivedopener = document.getElementById('toastTRANSMISSIONstopped');
|
|
||||||
var toast = bootstrap.Toast.getOrCreateInstance(toastDATACHANNELreceivedopener); // Returns a Bootstrap toast instance
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
// DATACHANNEL FAILED TOAST
|
|
||||||
if (arg.info[i] == "DATACHANNEL;FAILED"){
|
|
||||||
var toastDATACHANNELfailed = document.getElementById('toastDATACHANNELfailed');
|
|
||||||
var toast = bootstrap.Toast.getOrCreateInstance(toastDATACHANNELfailed); // Returns a Bootstrap toast instance
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
// ARQ RECEIVING TOAST
|
|
||||||
if (arg.info[i] == "ARQ;RECEIVING"){
|
|
||||||
|
|
||||||
document.getElementById("transmission_progress").className = "progress-bar progress-bar-striped progress-bar-animated bg-primary";
|
|
||||||
|
|
||||||
var toastARQreceiving = document.getElementById('toastARQreceiving');
|
|
||||||
var toast = bootstrap.Toast.getOrCreateInstance(toastARQreceiving); // Returns a Bootstrap toast instance
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
// ARQ RECEIVING SUCCESS TOAST
|
|
||||||
console.log(arg.info[i])
|
|
||||||
if (arg.info[i] == "ARQ;RECEIVING;SUCCESS"){
|
|
||||||
|
|
||||||
document.getElementById("transmission_progress").className = "progress-bar progress-bar-striped bg-success";
|
|
||||||
|
|
||||||
var toastARQreceivingsuccess = document.getElementById('toastARQreceivingsuccess');
|
|
||||||
var toast = bootstrap.Toast.getOrCreateInstance(toastARQreceivingsuccess); // Returns a Bootstrap toast instance
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
// ARQ RECEIVING FAILED TOAST
|
|
||||||
if (arg.info[i] == "ARQ;RECEIVING;FAILED"){
|
|
||||||
|
|
||||||
document.getElementById("transmission_progress").className = "progress-bar progress-bar-striped bg-danger";
|
|
||||||
|
|
||||||
var toastARQreceivingfailed = document.getElementById('toastARQreceivingfailed');
|
|
||||||
var toast = bootstrap.Toast.getOrCreateInstance(toastARQreceivingfailed); // Returns a Bootstrap toast instance
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
// ARQ TRANSMITTING TOAST
|
|
||||||
if (arg.info[i] == "ARQ;TRANSMITTING"){
|
|
||||||
|
|
||||||
document.getElementById("transmission_progress").className = "progress-bar progress-bar-striped progress-bar-animated bg-primary";
|
|
||||||
|
|
||||||
var toastARQtransmitting = document.getElementById('toastARQtransmitting');
|
|
||||||
var toast = bootstrap.Toast.getOrCreateInstance(toastARQtransmitting); // Returns a Bootstrap toast instance
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
// ARQ TRANSMITTING SUCCESS TOAST
|
|
||||||
if (arg.info[i] == "ARQ;TRANSMITTING;SUCCESS"){
|
|
||||||
|
|
||||||
document.getElementById("transmission_progress").className = "progress-bar progress-bar-striped bg-success";
|
|
||||||
|
|
||||||
var toastARQtransmittingsuccess = document.getElementById('toastARQtransmittingsuccess');
|
|
||||||
var toast = bootstrap.Toast.getOrCreateInstance(toastARQtransmittingsuccess); // Returns a Bootstrap toast instance
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
// ARQ TRANSMITTING FAILED TOAST
|
|
||||||
if (arg.info[i] == "ARQ;TRANSMITTING;FAILED"){
|
|
||||||
|
|
||||||
document.getElementById("transmission_progress").className = "progress-bar progress-bar-striped bg-danger";
|
|
||||||
|
|
||||||
var toast = bootstrap.Toast.getOrCreateInstance(toastARQtransmittingfailed); // Returns a Bootstrap toast instance
|
|
||||||
toast.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcRenderer.on('action-update-daemon-state', (event, arg) => {
|
ipcRenderer.on('action-update-daemon-state', (event, arg) => {
|
||||||
|
@ -1929,3 +1792,225 @@ ipcRenderer.on('action-updater', (event, arg) => {
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ----------- INFO MODAL ACTIONS -------------------------------
|
||||||
|
|
||||||
|
// CQ TRANSMITTING
|
||||||
|
ipcRenderer.on('action-show-cq-toast-transmitting', (event, data) => {
|
||||||
|
var toastCQsending = document.getElementById('toastCQsending');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastCQsending); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// CQ RECEIVED
|
||||||
|
ipcRenderer.on('action-show-cq-toast-received', (event, data) => {
|
||||||
|
var toastCQreceiving = document.getElementById('toastCQreceiving');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastCQreceiving); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// QRV TRANSMITTING
|
||||||
|
ipcRenderer.on('action-show-qrv-toast-transmitting', (event, data) => {
|
||||||
|
var toastQRVtransmitting = document.getElementById('toastQRVtransmitting');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastQRVtransmitting); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// QRV RECEIVED
|
||||||
|
ipcRenderer.on('action-show-qrv-toast-received', (event, data) => {
|
||||||
|
var toastQRVreceiving = document.getElementById('toastQRVreceiving');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastQRVreceiving); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// BEACON TRANSMITTING
|
||||||
|
ipcRenderer.on('action-show-beacon-toast-transmitting', (event, data) => {
|
||||||
|
});
|
||||||
|
|
||||||
|
// BEACON RECEIVED
|
||||||
|
ipcRenderer.on('action-show-beacon-toast-received', (event, data) => {
|
||||||
|
var toastBEACONreceiving = document.getElementById('toastBEACONreceiving');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastBEACONreceiving); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// PING TRANSMITTING
|
||||||
|
ipcRenderer.on('action-show-ping-toast-transmitting', (event, data) => {
|
||||||
|
var toastPINGsending = document.getElementById('toastPINGsending');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastPINGsending); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// PING RECEIVED
|
||||||
|
ipcRenderer.on('action-show-ping-toast-received', (event, data) => {
|
||||||
|
var toastPINGreceiving = document.getElementById('toastPINGreceiving');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastPINGreceiving); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// PING RECEIVED ACK
|
||||||
|
ipcRenderer.on('action-show-ping-toast-received-ack', (event, data) => {
|
||||||
|
var toastPINGreceivedACK = document.getElementById('toastPINGreceivedACK');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastPINGreceivedACK); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// DATA CHANNEL OPENING TOAST
|
||||||
|
ipcRenderer.on('action-show-arq-toast-datachannel-opening', (event, data) => {
|
||||||
|
var toastDATACHANNELopening = document.getElementById('toastDATACHANNELopening');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastDATACHANNELopening); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// DATA CHANNEL OPEN TOAST
|
||||||
|
ipcRenderer.on('action-show-arq-toast-datachannel-open', (event, data) => {
|
||||||
|
var toastDATACHANNELopen = document.getElementById('toastDATACHANNELopen');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastDATACHANNELopen); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// DATA CHANNEL RECEIVED OPENER TOAST
|
||||||
|
ipcRenderer.on('action-show-arq-toast-datachannel-received-opener', (event, data) => {
|
||||||
|
var toastDATACHANNELreceivedopener = document.getElementById('toastDATACHANNELreceivedopener');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastDATACHANNELreceivedopener); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ TRANSMISSION FAILED
|
||||||
|
// TODO: use for both - transmitting and receiving --> we need to change the IDs
|
||||||
|
ipcRenderer.on('action-show-arq-toast-transmission-failed', (event, data) => {
|
||||||
|
document.getElementById("transmission_progress").className = "progress-bar progress-bar-striped bg-danger";
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastARQtransmittingfailed); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ TRANSMISSION STOPPED
|
||||||
|
// TODO: RENAME ID -- WRONG
|
||||||
|
ipcRenderer.on('action-show-arq-toast-transmission-stopped', (event, data) => {
|
||||||
|
var toastDATACHANNELreceivedopener = document.getElementById('toastTRANSMISSIONstopped');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastDATACHANNELreceivedopener); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ TRANSMISSION FAILED
|
||||||
|
// TODO: USE FOR TX AND RX
|
||||||
|
ipcRenderer.on('action-show-arq-toast-transmission-failed', (event, data) => {
|
||||||
|
document.getElementById("transmission_progress").className = "progress-bar progress-bar-striped bg-danger";
|
||||||
|
|
||||||
|
var toastARQreceivingfailed = document.getElementById('toastARQreceivingfailed');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastARQreceivingfailed); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ TRANSMISSION TRANSMITTED
|
||||||
|
ipcRenderer.on('action-show-arq-toast-transmission-transmitted', (event, data) => {
|
||||||
|
|
||||||
|
document.getElementById("transmission_progress").className = "progress-bar progress-bar-striped bg-success";
|
||||||
|
var toastARQtransmittingsuccess = document.getElementById('toastARQtransmittingsuccess');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastARQtransmittingsuccess); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ TRANSMISSION TRANSMITTING
|
||||||
|
ipcRenderer.on('action-show-arq-toast-transmission-transmitting', (event, data) => {
|
||||||
|
|
||||||
|
document.getElementById("transmission_progress").className = "progress-bar progress-bar-striped progress-bar-animated bg-primary";
|
||||||
|
var toastARQtransmitting = document.getElementById('toastARQtransmitting');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastARQtransmitting); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ TRANSMISSION RECEIVED
|
||||||
|
ipcRenderer.on('action-show-arq-toast-transmission-received', (event, data) => {
|
||||||
|
|
||||||
|
document.getElementById("transmission_progress").className = "progress-bar progress-bar-striped bg-success";
|
||||||
|
var toastARQreceivingsuccess = document.getElementById('toastARQreceivingsuccess');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastARQreceivingsuccess); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ TRANSMISSION RECEIVING
|
||||||
|
ipcRenderer.on('action-show-arq-toast-transmission-receiving', (event, data) => {
|
||||||
|
|
||||||
|
document.getElementById("transmission_progress").className = "progress-bar progress-bar-striped progress-bar-animated bg-primary";
|
||||||
|
var toastARQreceiving = document.getElementById('toastARQreceiving');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastARQreceiving); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ SESSION CONNECTING
|
||||||
|
ipcRenderer.on('action-show-arq-toast-session-connecting', (event, data) => {
|
||||||
|
|
||||||
|
var toastARQreceiving = document.getElementById('toastARQsessionconnecting');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastARQsessionconnecting); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ SESSION CONNECTED
|
||||||
|
ipcRenderer.on('action-show-arq-toast-session-connected', (event, data) => {
|
||||||
|
|
||||||
|
var toastARQreceiving = document.getElementById('toastARQsessionconnected');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastARQsessionconnected); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ SESSION CLOSE
|
||||||
|
ipcRenderer.on('action-show-arq-toast-session-close', (event, data) => {
|
||||||
|
|
||||||
|
var toastARQreceiving = document.getElementById('toastARQsessionclose');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastARQsessionclose); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
// ARQ SESSION FAILED
|
||||||
|
ipcRenderer.on('action-show-arq-toast-session-failed', (event, data) => {
|
||||||
|
|
||||||
|
var toastARQreceiving = document.getElementById('toastARQsessionfailed');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastARQsessionfailed); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
// TRANSMISSION STOPPED
|
||||||
|
if (arg.info[i] == "TRANSMISSION;STOPPED"){
|
||||||
|
var toastDATACHANNELreceivedopener = document.getElementById('toastTRANSMISSIONstopped');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastDATACHANNELreceivedopener); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// DATACHANNEL FAILED TOAST
|
||||||
|
//if (arg.info[i] == "DATACHANNEL;FAILED"){
|
||||||
|
// var toastDATACHANNELfailed = document.getElementById('toastDATACHANNELfailed');
|
||||||
|
// var toast = bootstrap.Toast.getOrCreateInstance(toastDATACHANNELfailed); // Returns a Bootstrap toast instance
|
||||||
|
// toast.show();
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
// ARQ RECEIVING FAILED TOAST
|
||||||
|
if (arg.info[i] == "ARQ;RECEIVING;FAILED"){
|
||||||
|
|
||||||
|
document.getElementById("transmission_progress").className = "progress-bar progress-bar-striped bg-danger";
|
||||||
|
|
||||||
|
var toastARQreceivingfailed = document.getElementById('toastARQreceivingfailed');
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastARQreceivingfailed); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
// ARQ TRANSMITTING FAILED TOAST
|
||||||
|
if (arg.info[i] == "ARQ;TRANSMITTING;FAILED"){
|
||||||
|
|
||||||
|
document.getElementById("transmission_progress").className = "progress-bar progress-bar-striped bg-danger";
|
||||||
|
|
||||||
|
var toast = bootstrap.Toast.getOrCreateInstance(toastARQtransmittingfailed); // Returns a Bootstrap toast instance
|
||||||
|
toast.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
199
gui/sock.js
199
gui/sock.js
|
@ -226,67 +226,166 @@ client.on('data', function(socketdata) {
|
||||||
ipcRenderer.send('request-update-tnc-state', Data);
|
ipcRenderer.send('request-update-tnc-state', Data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update transmission status
|
|
||||||
|
|
||||||
if (data['arq'] == 'transmission'){
|
|
||||||
socketLog.info(data)
|
|
||||||
|
|
||||||
let state = {
|
|
||||||
status: data['status'],
|
|
||||||
uuid: data['uuid'],
|
|
||||||
percent: data['percent'],
|
|
||||||
bytesperminute: data['bytesperminute'],
|
|
||||||
};
|
|
||||||
ipcRenderer.send('request-update-transmission-status', state);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for Ping
|
|
||||||
if (data['type'] == 'ping') {
|
|
||||||
ipcRenderer.send('request-new-msg-received', {data: [data]});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for Beacon
|
|
||||||
if (data['type'] == 'beacon') {
|
|
||||||
ipcRenderer.send('request-new-msg-received', {data: [data]});
|
|
||||||
}
|
|
||||||
|
|
||||||
/* A TEST WITH STREAMING DATA .... */
|
|
||||||
// if we received data through network stream, we get a single data item
|
|
||||||
if (data['arq'] == 'received') {
|
|
||||||
dataArray = []
|
|
||||||
messageArray = []
|
|
||||||
|
|
||||||
|
// ----------- catch tnc messages START -----------
|
||||||
|
if (data['freedata'] == 'tnc-message'){
|
||||||
socketLog.info(data)
|
socketLog.info(data)
|
||||||
// we need to encode here to do a deep check for checking if file or message
|
|
||||||
var encoded_data = atob(data['data'])
|
|
||||||
var splitted_data = encoded_data.split(split_char)
|
|
||||||
|
|
||||||
|
// update transmission status
|
||||||
|
/*
|
||||||
|
if (data['arq'] == 'transmission' && data['status'] == 'transmitting'){
|
||||||
|
|
||||||
if(splitted_data[0] == 'f'){
|
let state = {
|
||||||
dataArray.push(data)
|
status: data['status'],
|
||||||
|
uuid: data['uuid'],
|
||||||
|
percent: data['percent'],
|
||||||
|
bytesperminute: data['bytesperminute'],
|
||||||
|
};
|
||||||
|
|
||||||
|
ipcRenderer.send('request-update-transmission-status', state);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// CQ TRANSMITTING
|
||||||
|
if (data['cq'] == 'transmitting') {
|
||||||
|
ipcRenderer.send('request-show-cq-toast-transmitting', {data: [data]});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(splitted_data[0] == 'm'){
|
// CQ RECEIVED
|
||||||
messageArray.push(data)
|
if (data['cq'] == 'received') {
|
||||||
console.log(data)
|
ipcRenderer.send('request-show-cq-toast-received', {data: [data]});
|
||||||
}
|
}
|
||||||
|
|
||||||
rxBufferLengthGui = dataArray.length
|
// QRV TRANSMITTING
|
||||||
let Files = {
|
if (data['qrv'] == 'transmitting') {
|
||||||
data: dataArray,
|
ipcRenderer.send('request-show-qrv-toast-transmitting', {data: [data]});
|
||||||
};
|
}
|
||||||
ipcRenderer.send('request-update-rx-buffer', Files);
|
|
||||||
ipcRenderer.send('request-new-msg-received', Files);
|
|
||||||
|
|
||||||
rxMsgBufferLengthGui = messageArray.length
|
// QRV RECEIVED
|
||||||
let Messages = {
|
if (data['qrv'] == 'received') {
|
||||||
data: messageArray,
|
ipcRenderer.send('request-show-qrv-toast-received', {data: [data]});
|
||||||
};
|
}
|
||||||
ipcRenderer.send('request-new-msg-received', Messages);
|
|
||||||
|
// BEACON TRANSMITTING
|
||||||
|
if (data['beacon'] == 'transmitting') {
|
||||||
|
ipcRenderer.send('request-show-beacon-toast-transmitting', {data: [data]});
|
||||||
|
}
|
||||||
|
|
||||||
|
// BEACON RECEIVED
|
||||||
|
if (data['beacon'] == 'received') {
|
||||||
|
ipcRenderer.send('request-show-beacon-toast-received', {data: [data]});
|
||||||
|
ipcRenderer.send('request-new-msg-received', {data: [data]});
|
||||||
|
}
|
||||||
|
|
||||||
|
// PING TRANSMITTING
|
||||||
|
if (data['ping'] == 'transmitting') {
|
||||||
|
ipcRenderer.send('request-show-ping-toast-transmitting', {data: [data]});
|
||||||
|
}
|
||||||
|
|
||||||
|
// PING RECEIVED
|
||||||
|
if (data['ping'] == 'received') {
|
||||||
|
ipcRenderer.send('request-show-ping-toast-received', {data: [data]});
|
||||||
|
ipcRenderer.send('request-new-msg-received', {data: [data]});
|
||||||
|
}
|
||||||
|
|
||||||
|
// PING ACKNOWLEDGE
|
||||||
|
if (data['ping'] == 'acknowledge') {
|
||||||
|
ipcRenderer.send('request-show-ping-toast-received-ack', {data: [data]});
|
||||||
|
ipcRenderer.send('request-new-msg-received', {data: [data]});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ARQ SESSION
|
||||||
|
if (data['arq'] == 'session') {
|
||||||
|
|
||||||
|
// ARQ OPEN
|
||||||
|
if (data['status'] == 'connecting') {
|
||||||
|
ipcRenderer.send('request-show-arq-toast-session-connecting', {data: [data]});
|
||||||
|
|
||||||
|
// ARQ OPENING
|
||||||
|
} else if (data['status'] == 'connected') {
|
||||||
|
ipcRenderer.send('request-show-arq-toast-session-connected', {data: [data]});
|
||||||
|
|
||||||
|
// ARQ OPENING
|
||||||
|
} else if (data['status'] == 'close') {
|
||||||
|
ipcRenderer.send('request-show-arq-toast-session-close', {data: [data]});
|
||||||
|
|
||||||
|
// ARQ OPENING
|
||||||
|
} else if (data['status'] == 'failed') {
|
||||||
|
ipcRenderer.send('request-show-arq-toast-session-failed', {data: [data]});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// ARQ TRANSMISSION
|
||||||
|
if (data['arq'] == 'transmission') {
|
||||||
|
|
||||||
|
// ARQ OPEN
|
||||||
|
if (data['status'] == 'opened') {
|
||||||
|
ipcRenderer.send('request-show-arq-toast-datachannel-opened', {data: [data]});
|
||||||
|
|
||||||
|
// ARQ OPENING
|
||||||
|
} else if (data['status'] == 'opening') {
|
||||||
|
ipcRenderer.send('request-show-arq-toast-datachannel-opening', {data: [data]});
|
||||||
|
|
||||||
|
|
||||||
|
// ARQ TRANSMISSION FAILED
|
||||||
|
} else if (data['status'] == 'failed') {
|
||||||
|
ipcRenderer.send('request-show-arq-toast-transmission-failed', {data: [data]});
|
||||||
|
ipcRenderer.send('request-update-transmission-status', {data: [data]});
|
||||||
|
|
||||||
|
|
||||||
|
// ARQ TRANSMISSION RECEIVED
|
||||||
|
} else if (data['status'] == 'received') {
|
||||||
|
ipcRenderer.send('request-show-arq-toast-transmission-received', {data: [data]});
|
||||||
|
ipcRenderer.send('request-update-transmission-status', {data: [data]});
|
||||||
|
|
||||||
|
dataArray = []
|
||||||
|
messageArray = []
|
||||||
|
|
||||||
|
socketLog.info(data)
|
||||||
|
// we need to encode here to do a deep check for checking if file or message
|
||||||
|
var encoded_data = atob(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);
|
||||||
|
|
||||||
|
// ARQ TRANSMISSION TRANSMITTING
|
||||||
|
} else if (data['status'] == 'transmitting') {
|
||||||
|
ipcRenderer.send('request-show-arq-toast-transmission-transmitting', {data: [data]});
|
||||||
|
ipcRenderer.send('request-update-transmission-status', {data: [data]});
|
||||||
|
|
||||||
|
|
||||||
|
// ARQ TRANSMISSION TRANSMITTED
|
||||||
|
} else if (data['status'] == 'transmitted') {
|
||||||
|
ipcRenderer.send('request-show-arq-toast-transmission-transmitted', {data: [data]});
|
||||||
|
ipcRenderer.send('request-update-transmission-status', {data: [data]});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------- catch tnc info messages END -----------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// if we manually checking for the rx buffer we are getting an array of multiple data
|
// if we manually checking for the rx buffer we are getting an array of multiple data
|
||||||
if (data['command'] == 'rx_buffer') {
|
if (data['command'] == 'rx_buffer') {
|
||||||
socketLog.info(data)
|
socketLog.info(data)
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
<!--<button class="btn btn-sm btn-primary me-2" id="emojipickerbutton" type="button">--><i id="emojipickerbutton" class="bi bi-emoji-smile m-1" style="font-size: 1.5rem; color: grey;"></i><!--</button>-->
|
<!--<button class="btn btn-sm btn-primary me-2" id="emojipickerbutton" type="button">--><i id="emojipickerbutton" class="bi bi-emoji-smile m-1" style="font-size: 1.5rem; color: grey;"></i><!--</button>-->
|
||||||
<!--<input class="form-control rounded-pill m-1 p-1" id="chatModuleMessage" placeholder="Message - Send with [Enter]"></input>-->
|
<!--<input class="form-control rounded-pill m-1 p-1" id="chatModuleMessage" placeholder="Message - Send with [Enter]"></input>-->
|
||||||
|
|
||||||
<textarea class="form-control rounded-pill m-1 p-1" rows="1" id="chatModuleMessage" placeholder="Message - Send with [Enter]"></textarea>
|
<textarea class="form-control m-1 p-1" rows="1" id="chatModuleMessage" placeholder="Message - Send with [Enter]"></textarea>
|
||||||
|
|
||||||
|
|
||||||
<!--<button class="btn btn-sm btn-primary me-2" style="width: 3rem" id="selectFilesButton" type="button"><i class="bi bi-paperclip" style="font-size: 1.2rem; color: white;"></i></button>--><i class="bi bi-paperclip m-1" style="font-size: 1.5rem; color: grey;" id="selectFilesButton"></i>
|
<!--<button class="btn btn-sm btn-primary me-2" style="width: 3rem" id="selectFilesButton" type="button"><i class="bi bi-paperclip" style="font-size: 1.2rem; color: white;"></i></button>--><i class="bi bi-paperclip m-1" style="font-size: 1.5rem; color: grey;" id="selectFilesButton"></i>
|
||||||
|
|
|
@ -102,6 +102,20 @@
|
||||||
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
|
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- RECEIVING QRV -->
|
||||||
|
<div class="toast align-items-center text-white bg-primary border-0" id="toastQRVreceiving" role="alert" aria-live="assertive" aria-atomic="true">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="toast-body">Receiving a QRV signal!</div>
|
||||||
|
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- TRANSMITTING QRV -->
|
||||||
|
<div class="toast align-items-center text-white bg-primary border-0" id="toastQRVtransmitting" role="alert" aria-live="assertive" aria-atomic="true">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="toast-body">Transmitting a QRV signal!</div>
|
||||||
|
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<!-- RECEIVING BEACON -->
|
<!-- RECEIVING BEACON -->
|
||||||
<div class="toast align-items-center text-white bg-primary border-0" id="toastBEACONreceiving" role="alert" aria-live="assertive" aria-atomic="true">
|
<div class="toast align-items-center text-white bg-primary border-0" id="toastBEACONreceiving" role="alert" aria-live="assertive" aria-atomic="true">
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
|
@ -207,6 +221,41 @@
|
||||||
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
|
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- ARQ SESSION CONNECTING-->
|
||||||
|
<div class="toast align-items-center text-white bg-warning border-0" id="toastARQsessionconnecting" role="alert" aria-live="assertive" aria-atomic="true">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="toast-body">CONNECTING / OPENING ARQ SESSION</div>
|
||||||
|
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ARQ SESSION CONNECTED-->
|
||||||
|
<div class="toast align-items-center text-white bg-success border-0" id="toastARQsessionconnected" role="alert" aria-live="assertive" aria-atomic="true">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="toast-body">CONNECTED / ARQ SESSION</div>
|
||||||
|
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ARQ SESSION CLOSE-->
|
||||||
|
<div class="toast align-items-center text-white bg-success border-0" id="toastARQsessionclose" role="alert" aria-live="assertive" aria-atomic="true">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="toast-body">CLOSE / ARQ SESSION</div>
|
||||||
|
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ARQ SESSION FAILED-->
|
||||||
|
<div class="toast align-items-center text-white bg-danger border-0" id="toastARQsessionfailed" role="alert" aria-live="assertive" aria-atomic="true">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="toast-body">FAILED / ARQ SESSION</div>
|
||||||
|
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!------------------------------------------------------------------------------------------>
|
<!------------------------------------------------------------------------------------------>
|
||||||
|
|
|
@ -394,10 +394,12 @@ class DATA:
|
||||||
Dictionary containing the data to be sent, in the format:
|
Dictionary containing the data to be sent, in the format:
|
||||||
key=value, for each item. E.g.:
|
key=value, for each item. E.g.:
|
||||||
self.send_data_to_socket_queue(
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
arq="received",
|
arq="received",
|
||||||
uuid=uniqueid,
|
status="success",
|
||||||
|
uuid=self.transmission_uuid,
|
||||||
timestamp=timestamp,
|
timestamp=timestamp,
|
||||||
mycallsign=str(mycallsign, "UTF-8"),
|
mycallsign=str(self.mycallsign, "UTF-8"),
|
||||||
dxcallsign=str(static.DXCALLSIGN, "UTF-8"),
|
dxcallsign=str(static.DXCALLSIGN, "UTF-8"),
|
||||||
dxgrid=str(static.DXGRID, "UTF-8"),
|
dxgrid=str(static.DXGRID, "UTF-8"),
|
||||||
data=base64_data,
|
data=base64_data,
|
||||||
|
@ -526,7 +528,6 @@ class DATA:
|
||||||
|
|
||||||
static.TNC_STATE = "BUSY"
|
static.TNC_STATE = "BUSY"
|
||||||
static.ARQ_STATE = True
|
static.ARQ_STATE = True
|
||||||
static.INFO.append("ARQ;RECEIVING")
|
|
||||||
|
|
||||||
# Update data_channel timestamp
|
# Update data_channel timestamp
|
||||||
self.data_channel_last_received = int(time.time())
|
self.data_channel_last_received = int(time.time())
|
||||||
|
@ -674,7 +675,7 @@ class DATA:
|
||||||
|
|
||||||
if bof_position >= 0:
|
if bof_position >= 0:
|
||||||
payload = static.RX_FRAME_BUFFER[
|
payload = static.RX_FRAME_BUFFER[
|
||||||
bof_position + len(self.data_frame_bof) : eof_position
|
bof_position + len(self.data_frame_bof): eof_position
|
||||||
]
|
]
|
||||||
frame_length = int.from_bytes(payload[4:8], "big") # 4:8 4bytes
|
frame_length = int.from_bytes(payload[4:8], "big") # 4:8 4bytes
|
||||||
static.TOTAL_BYTES = frame_length
|
static.TOTAL_BYTES = frame_length
|
||||||
|
@ -701,7 +702,7 @@ class DATA:
|
||||||
|
|
||||||
# Extract raw data from buffer
|
# Extract raw data from buffer
|
||||||
payload = static.RX_FRAME_BUFFER[
|
payload = static.RX_FRAME_BUFFER[
|
||||||
bof_position + len(self.data_frame_bof) : eof_position
|
bof_position + len(self.data_frame_bof): eof_position
|
||||||
]
|
]
|
||||||
# Get the data frame crc
|
# Get the data frame crc
|
||||||
data_frame_crc = payload[:4] # 0:4 = 4 bytes
|
data_frame_crc = payload[:4] # 0:4 = 4 bytes
|
||||||
|
@ -724,7 +725,7 @@ class DATA:
|
||||||
)
|
)
|
||||||
data_frame = data_frame_decompressed
|
data_frame = data_frame_decompressed
|
||||||
|
|
||||||
uniqueid = str(uuid.uuid4())
|
self.transmission_uuid = str(uuid.uuid4())
|
||||||
timestamp = int(time.time())
|
timestamp = int(time.time())
|
||||||
|
|
||||||
# check if callsign ssid override
|
# check if callsign ssid override
|
||||||
|
@ -739,18 +740,19 @@ class DATA:
|
||||||
# Re-code data_frame in base64, UTF-8 for JSON UI communication.
|
# Re-code data_frame in base64, UTF-8 for JSON UI communication.
|
||||||
base64_data = base64.b64encode(data_frame).decode("UTF-8")
|
base64_data = base64.b64encode(data_frame).decode("UTF-8")
|
||||||
static.RX_BUFFER.append(
|
static.RX_BUFFER.append(
|
||||||
[uniqueid, timestamp, static.DXCALLSIGN, static.DXGRID, base64_data]
|
[self.transmission_uuid, timestamp, static.DXCALLSIGN, static.DXGRID, base64_data]
|
||||||
)
|
)
|
||||||
self.send_data_to_socket_queue(
|
self.send_data_to_socket_queue(
|
||||||
arq="received",
|
freedata="tnc-message",
|
||||||
uuid=uniqueid,
|
arq="transmission",
|
||||||
|
status="received",
|
||||||
|
uuid=self.transmission_uuid,
|
||||||
timestamp=timestamp,
|
timestamp=timestamp,
|
||||||
mycallsign=str(mycallsign, "UTF-8"),
|
mycallsign=str(mycallsign, "UTF-8"),
|
||||||
dxcallsign=str(static.DXCALLSIGN, "UTF-8"),
|
dxcallsign=str(static.DXCALLSIGN, "UTF-8"),
|
||||||
dxgrid=str(static.DXGRID, "UTF-8"),
|
dxgrid=str(static.DXGRID, "UTF-8"),
|
||||||
data=base64_data,
|
data=base64_data,
|
||||||
)
|
)
|
||||||
static.INFO.append("ARQ;RECEIVING;SUCCESS")
|
|
||||||
|
|
||||||
self.log.info(
|
self.log.info(
|
||||||
"[TNC] ARQ | RX | SENDING DATA FRAME ACK",
|
"[TNC] ARQ | RX | SENDING DATA FRAME ACK",
|
||||||
|
@ -773,9 +775,16 @@ class DATA:
|
||||||
)
|
)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
static.INFO.append("ARQ;RECEIVING;FAILED")
|
|
||||||
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
|
arq="transmission",
|
||||||
|
status="failed",
|
||||||
|
uuid=self.transmission_uuid,
|
||||||
|
)
|
||||||
|
|
||||||
self.log.warning(
|
self.log.warning(
|
||||||
"[TNC] ARQ | RX | DATA FRAME NOT SUCESSFULLY RECEIVED!",
|
"[TNC] ARQ | RX | DATA FRAME NOT SUCCESSFULLY RECEIVED!",
|
||||||
e="wrong crc",
|
e="wrong crc",
|
||||||
expected=data_frame_crc,
|
expected=data_frame_crc,
|
||||||
received=data_frame_crc_received,
|
received=data_frame_crc_received,
|
||||||
|
@ -807,12 +816,10 @@ class DATA:
|
||||||
self.speed_level = len(self.mode_list) - 1
|
self.speed_level = len(self.mode_list) - 1
|
||||||
static.ARQ_SPEED_LEVEL = self.speed_level
|
static.ARQ_SPEED_LEVEL = self.speed_level
|
||||||
|
|
||||||
TX_N_SENT_BYTES = 0 # already sent bytes per data frame
|
|
||||||
self.tx_n_retry_of_burst = 0 # retries we already sent data
|
self.tx_n_retry_of_burst = 0 # retries we already sent data
|
||||||
# Maximum number of retries to send before declaring a frame is lost
|
# Maximum number of retries to send before declaring a frame is lost
|
||||||
TX_N_MAX_RETRIES_PER_BURST = 50
|
TX_N_MAX_RETRIES_PER_BURST = 50
|
||||||
TX_N_FRAMES_PER_BURST = n_frames_per_burst # amount of n frames per burst
|
TX_N_FRAMES_PER_BURST = n_frames_per_burst # amount of n frames per burst
|
||||||
TX_BUFFER = [] # our buffer for appending new data
|
|
||||||
|
|
||||||
# TIMEOUTS
|
# TIMEOUTS
|
||||||
BURST_ACK_TIMEOUT_SECONDS = 3.0 # timeout for burst acknowledges
|
BURST_ACK_TIMEOUT_SECONDS = 3.0 # timeout for burst acknowledges
|
||||||
|
@ -823,9 +830,9 @@ class DATA:
|
||||||
# static.TOTAL_BYTES = round(len(data_out) / 1024, 2)
|
# static.TOTAL_BYTES = round(len(data_out) / 1024, 2)
|
||||||
static.TOTAL_BYTES = len(data_out)
|
static.TOTAL_BYTES = len(data_out)
|
||||||
frame_total_size = len(data_out).to_bytes(4, byteorder="big")
|
frame_total_size = len(data_out).to_bytes(4, byteorder="big")
|
||||||
static.INFO.append("ARQ;TRANSMITTING")
|
|
||||||
|
|
||||||
self.send_data_to_socket_queue(
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
arq="transmission",
|
arq="transmission",
|
||||||
status="transmitting",
|
status="transmitting",
|
||||||
uuid=self.transmission_uuid,
|
uuid=self.transmission_uuid,
|
||||||
|
@ -1014,6 +1021,7 @@ class DATA:
|
||||||
)
|
)
|
||||||
|
|
||||||
self.send_data_to_socket_queue(
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
arq="transmission",
|
arq="transmission",
|
||||||
status="transmitting",
|
status="transmitting",
|
||||||
uuid=self.transmission_uuid,
|
uuid=self.transmission_uuid,
|
||||||
|
@ -1021,17 +1029,22 @@ class DATA:
|
||||||
bytesperminute=static.ARQ_BYTES_PER_MINUTE,
|
bytesperminute=static.ARQ_BYTES_PER_MINUTE,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# GOING TO NEXT ITERATION
|
# GOING TO NEXT ITERATION
|
||||||
|
|
||||||
if self.data_frame_ack_received:
|
if self.data_frame_ack_received:
|
||||||
|
# we need to wait until sending "transmitted" state
|
||||||
|
# gui database is too slow for handling this within 0.001 seconds
|
||||||
|
# so let's sleep a little
|
||||||
|
time.sleep(0.2)
|
||||||
self.send_data_to_socket_queue(
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
arq="transmission",
|
arq="transmission",
|
||||||
status="success",
|
status="transmitted",
|
||||||
uuid=self.transmission_uuid,
|
uuid=self.transmission_uuid,
|
||||||
percent=static.ARQ_TRANSMISSION_PERCENT,
|
percent=static.ARQ_TRANSMISSION_PERCENT,
|
||||||
bytesperminute=static.ARQ_BYTES_PER_MINUTE,
|
bytesperminute=static.ARQ_BYTES_PER_MINUTE,
|
||||||
)
|
)
|
||||||
static.INFO.append("ARQ;TRANSMITTING;SUCCESS")
|
|
||||||
|
|
||||||
self.log.info(
|
self.log.info(
|
||||||
"[TNC] ARQ | TX | DATA TRANSMITTED!",
|
"[TNC] ARQ | TX | DATA TRANSMITTED!",
|
||||||
|
@ -1042,13 +1055,13 @@ class DATA:
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.send_data_to_socket_queue(
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
arq="transmission",
|
arq="transmission",
|
||||||
status="failed",
|
status="failed",
|
||||||
uuid=self.transmission_uuid,
|
uuid=self.transmission_uuid,
|
||||||
percent=static.ARQ_TRANSMISSION_PERCENT,
|
percent=static.ARQ_TRANSMISSION_PERCENT,
|
||||||
bytesperminute=static.ARQ_BYTES_PER_MINUTE,
|
bytesperminute=static.ARQ_BYTES_PER_MINUTE,
|
||||||
)
|
)
|
||||||
static.INFO.append("ARQ;TRANSMITTING;FAILED")
|
|
||||||
|
|
||||||
self.log.info(
|
self.log.info(
|
||||||
"[TNC] ARQ | TX | TRANSMISSION FAILED OR TIME OUT!",
|
"[TNC] ARQ | TX | TRANSMISSION FAILED OR TIME OUT!",
|
||||||
|
@ -1169,13 +1182,13 @@ class DATA:
|
||||||
static.HAMLIB_FREQUENCY,
|
static.HAMLIB_FREQUENCY,
|
||||||
)
|
)
|
||||||
self.send_data_to_socket_queue(
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
arq="transmission",
|
arq="transmission",
|
||||||
status="failed",
|
status="failed",
|
||||||
uuid=self.transmission_uuid,
|
uuid=self.transmission_uuid,
|
||||||
percent=static.ARQ_TRANSMISSION_PERCENT,
|
percent=static.ARQ_TRANSMISSION_PERCENT,
|
||||||
bytesperminute=static.ARQ_BYTES_PER_MINUTE,
|
bytesperminute=static.ARQ_BYTES_PER_MINUTE,
|
||||||
)
|
)
|
||||||
static.INFO.append("ARQ;TRANSMITTING;FAILED")
|
|
||||||
# Update data_channel timestamp
|
# Update data_channel timestamp
|
||||||
self.arq_session_last_received = int(time.time())
|
self.arq_session_last_received = int(time.time())
|
||||||
|
|
||||||
|
@ -1240,12 +1253,27 @@ class DATA:
|
||||||
while not static.ARQ_SESSION and not self.arq_session_timeout:
|
while not static.ARQ_SESSION and not self.arq_session_timeout:
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
static.ARQ_SESSION_STATE = "connecting"
|
static.ARQ_SESSION_STATE = "connecting"
|
||||||
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
|
arq="session",
|
||||||
|
status="connecting",
|
||||||
|
)
|
||||||
if static.ARQ_SESSION and static.ARQ_SESSION_STATE == "connected":
|
if static.ARQ_SESSION and static.ARQ_SESSION_STATE == "connected":
|
||||||
# static.ARQ_SESSION_STATE = "connected"
|
# static.ARQ_SESSION_STATE = "connected"
|
||||||
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
|
arq="session",
|
||||||
|
status="connected",
|
||||||
|
)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
static.ARQ_SESSION_STATE = "failed"
|
static.ARQ_SESSION_STATE = "failed"
|
||||||
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
|
arq="session",
|
||||||
|
status="failed",
|
||||||
|
reason="timeout",
|
||||||
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def open_session(self) -> bool:
|
def open_session(self) -> bool:
|
||||||
|
@ -1355,7 +1383,13 @@ class DATA:
|
||||||
+ "]",
|
+ "]",
|
||||||
state=static.ARQ_SESSION_STATE,
|
state=static.ARQ_SESSION_STATE,
|
||||||
)
|
)
|
||||||
static.INFO.append("ARQ;SESSION;CLOSE")
|
|
||||||
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
|
arq="session",
|
||||||
|
status="close",
|
||||||
|
)
|
||||||
|
|
||||||
self.IS_ARQ_SESSION_MASTER = False
|
self.IS_ARQ_SESSION_MASTER = False
|
||||||
static.ARQ_SESSION = False
|
static.ARQ_SESSION = False
|
||||||
self.arq_cleanup()
|
self.arq_cleanup()
|
||||||
|
@ -1391,7 +1425,12 @@ class DATA:
|
||||||
+ "]",
|
+ "]",
|
||||||
state=static.ARQ_SESSION_STATE,
|
state=static.ARQ_SESSION_STATE,
|
||||||
)
|
)
|
||||||
static.INFO.append("ARQ;SESSION;CLOSE")
|
|
||||||
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
|
arq="session",
|
||||||
|
status="close",
|
||||||
|
)
|
||||||
|
|
||||||
self.IS_ARQ_SESSION_MASTER = False
|
self.IS_ARQ_SESSION_MASTER = False
|
||||||
static.ARQ_SESSION = False
|
static.ARQ_SESSION = False
|
||||||
|
@ -1536,7 +1575,13 @@ class DATA:
|
||||||
while not static.ARQ_STATE:
|
while not static.ARQ_STATE:
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
for attempt in range(self.data_channel_max_retries):
|
for attempt in range(self.data_channel_max_retries):
|
||||||
static.INFO.append("DATACHANNEL;OPENING")
|
|
||||||
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
|
arq="transmission",
|
||||||
|
status="opening",
|
||||||
|
)
|
||||||
|
|
||||||
self.log.info(
|
self.log.info(
|
||||||
"[TNC] ARQ | DATA | TX | ["
|
"[TNC] ARQ | DATA | TX | ["
|
||||||
+ str(mycallsign, "UTF-8")
|
+ str(mycallsign, "UTF-8")
|
||||||
|
@ -1556,14 +1601,16 @@ class DATA:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# `data_channel_max_retries` attempts have been sent. Aborting attempt & cleaning up
|
# `data_channel_max_retries` attempts have been sent. Aborting attempt & cleaning up
|
||||||
static.INFO.append("DATACHANNEL;FAILED")
|
|
||||||
self.log.debug(
|
self.log.debug(
|
||||||
"[TNC] arq_open_data_channel:", transmission_uuid=self.transmission_uuid
|
"[TNC] arq_open_data_channel:", transmission_uuid=self.transmission_uuid
|
||||||
)
|
)
|
||||||
|
|
||||||
self.send_data_to_socket_queue(
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
arq="transmission",
|
arq="transmission",
|
||||||
status="failed",
|
status="failed",
|
||||||
|
reason="unknown",
|
||||||
uuid=self.transmission_uuid,
|
uuid=self.transmission_uuid,
|
||||||
percent=static.ARQ_TRANSMISSION_PERCENT,
|
percent=static.ARQ_TRANSMISSION_PERCENT,
|
||||||
bytesperminute=static.ARQ_BYTES_PER_MINUTE,
|
bytesperminute=static.ARQ_BYTES_PER_MINUTE,
|
||||||
|
@ -1597,7 +1644,11 @@ class DATA:
|
||||||
"""
|
"""
|
||||||
self.arq_file_transfer = True
|
self.arq_file_transfer = True
|
||||||
self.is_IRS = True
|
self.is_IRS = True
|
||||||
static.INFO.append("DATACHANNEL;RECEIVEDOPENER")
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
|
arq="transmission",
|
||||||
|
status="opening",
|
||||||
|
)
|
||||||
static.DXCALLSIGN_CRC = bytes(data_in[4:7])
|
static.DXCALLSIGN_CRC = bytes(data_in[4:7])
|
||||||
static.DXCALLSIGN = helpers.bytes_to_callsign(bytes(data_in[7:13]))
|
static.DXCALLSIGN = helpers.bytes_to_callsign(bytes(data_in[7:13]))
|
||||||
|
|
||||||
|
@ -1697,7 +1748,11 @@ class DATA:
|
||||||
"""
|
"""
|
||||||
protocol_version = int.from_bytes(bytes(data_in[13:14]), "big")
|
protocol_version = int.from_bytes(bytes(data_in[13:14]), "big")
|
||||||
if protocol_version == static.ARQ_PROTOCOL_VERSION:
|
if protocol_version == static.ARQ_PROTOCOL_VERSION:
|
||||||
static.INFO.append("DATACHANNEL;OPEN")
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
|
arq="transmission",
|
||||||
|
status="opened",
|
||||||
|
)
|
||||||
frametype = int.from_bytes(bytes(data_in[:1]), "big")
|
frametype = int.from_bytes(bytes(data_in[:1]), "big")
|
||||||
|
|
||||||
if frametype == 228:
|
if frametype == 228:
|
||||||
|
@ -1737,7 +1792,12 @@ class DATA:
|
||||||
else:
|
else:
|
||||||
static.TNC_STATE = "IDLE"
|
static.TNC_STATE = "IDLE"
|
||||||
static.ARQ_STATE = False
|
static.ARQ_STATE = False
|
||||||
static.INFO.append("PROTOCOL;VERSION_MISMATCH")
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
|
arq="transmission",
|
||||||
|
status="failed",
|
||||||
|
reason="protocol version missmatch",
|
||||||
|
)
|
||||||
# TODO: We should display a message to this effect on the UI.
|
# TODO: We should display a message to this effect on the UI.
|
||||||
self.log.warning(
|
self.log.warning(
|
||||||
"[TNC] protocol version mismatch:",
|
"[TNC] protocol version mismatch:",
|
||||||
|
@ -1757,7 +1817,10 @@ class DATA:
|
||||||
static.DXCALLSIGN = dxcallsign
|
static.DXCALLSIGN = dxcallsign
|
||||||
static.DXCALLSIGN_CRC = helpers.get_crc_24(static.DXCALLSIGN)
|
static.DXCALLSIGN_CRC = helpers.get_crc_24(static.DXCALLSIGN)
|
||||||
|
|
||||||
static.INFO.append("PING;SENDING")
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
|
ping="transmitting",
|
||||||
|
)
|
||||||
self.log.info(
|
self.log.info(
|
||||||
"[TNC] PING REQ ["
|
"[TNC] PING REQ ["
|
||||||
+ str(self.mycallsign, "UTF-8")
|
+ str(self.mycallsign, "UTF-8")
|
||||||
|
@ -1801,8 +1864,16 @@ class DATA:
|
||||||
static.HAMLIB_FREQUENCY,
|
static.HAMLIB_FREQUENCY,
|
||||||
)
|
)
|
||||||
|
|
||||||
static.INFO.append("PING;RECEIVING")
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
|
ping="received",
|
||||||
|
uuid=str(uuid.uuid4()),
|
||||||
|
timestamp=int(time.time()),
|
||||||
|
mycallsign=str(self.mycallsign, "UTF-8"),
|
||||||
|
dxcallsign=str(static.DXCALLSIGN, "UTF-8"),
|
||||||
|
dxgrid=str(static.DXGRID, "UTF-8"),
|
||||||
|
snr=str(static.SNR)
|
||||||
|
)
|
||||||
# check if callsign ssid override
|
# check if callsign ssid override
|
||||||
valid, mycallsign = helpers.check_callsign(self.mycallsign, data_in[1:4])
|
valid, mycallsign = helpers.check_callsign(self.mycallsign, data_in[1:4])
|
||||||
if not valid:
|
if not valid:
|
||||||
|
@ -1846,8 +1917,8 @@ class DATA:
|
||||||
static.DXGRID = bytes(data_in[7:13]).rstrip(b"\x00")
|
static.DXGRID = bytes(data_in[7:13]).rstrip(b"\x00")
|
||||||
|
|
||||||
self.send_data_to_socket_queue(
|
self.send_data_to_socket_queue(
|
||||||
type="ping",
|
freedata="tnc-message",
|
||||||
status="ack",
|
ping="acknowledge",
|
||||||
uuid=str(uuid.uuid4()),
|
uuid=str(uuid.uuid4()),
|
||||||
timestamp=int(time.time()),
|
timestamp=int(time.time()),
|
||||||
mycallsign=str(self.mycallsign, "UTF-8"),
|
mycallsign=str(self.mycallsign, "UTF-8"),
|
||||||
|
@ -1865,8 +1936,6 @@ class DATA:
|
||||||
static.HAMLIB_FREQUENCY,
|
static.HAMLIB_FREQUENCY,
|
||||||
)
|
)
|
||||||
|
|
||||||
static.INFO.append("PING;RECEIVEDACK")
|
|
||||||
|
|
||||||
self.log.info(
|
self.log.info(
|
||||||
"[TNC] PING ACK ["
|
"[TNC] PING ACK ["
|
||||||
+ str(self.mycallsign, "UTF-8")
|
+ str(self.mycallsign, "UTF-8")
|
||||||
|
@ -1892,7 +1961,11 @@ class DATA:
|
||||||
|
|
||||||
static.TNC_STATE = "IDLE"
|
static.TNC_STATE = "IDLE"
|
||||||
static.ARQ_STATE = False
|
static.ARQ_STATE = False
|
||||||
static.INFO.append("TRANSMISSION;STOPPED")
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
|
arq="transmission",
|
||||||
|
status="stopped",
|
||||||
|
)
|
||||||
self.arq_cleanup()
|
self.arq_cleanup()
|
||||||
|
|
||||||
def received_stop_transmission(self) -> None:
|
def received_stop_transmission(self) -> None:
|
||||||
|
@ -1902,7 +1975,14 @@ class DATA:
|
||||||
self.log.warning("[TNC] Stopping transmission!")
|
self.log.warning("[TNC] Stopping transmission!")
|
||||||
static.TNC_STATE = "IDLE"
|
static.TNC_STATE = "IDLE"
|
||||||
static.ARQ_STATE = False
|
static.ARQ_STATE = False
|
||||||
static.INFO.append("TRANSMISSION;STOPPED")
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
|
arq="transmission",
|
||||||
|
status="stopped",
|
||||||
|
uuid=self.transmission_uuid,
|
||||||
|
mycallsign=str(self.mycallsign, "UTF-8"),
|
||||||
|
dxcallsign=str(static.DXCALLSIGN, "UTF-8"),
|
||||||
|
)
|
||||||
self.arq_cleanup()
|
self.arq_cleanup()
|
||||||
|
|
||||||
# ----------- BROADCASTS
|
# ----------- BROADCASTS
|
||||||
|
@ -1925,7 +2005,11 @@ class DATA:
|
||||||
and not self.arq_file_transfer
|
and not self.arq_file_transfer
|
||||||
and not static.BEACON_PAUSE
|
and not static.BEACON_PAUSE
|
||||||
):
|
):
|
||||||
static.INFO.append("BEACON;SENDING")
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
|
beacon="transmitting",
|
||||||
|
interval=self.beacon_interval,
|
||||||
|
)
|
||||||
self.log.info(
|
self.log.info(
|
||||||
"[TNC] Sending beacon!", interval=self.beacon_interval
|
"[TNC] Sending beacon!", interval=self.beacon_interval
|
||||||
)
|
)
|
||||||
|
@ -1967,8 +2051,8 @@ class DATA:
|
||||||
dxgrid = bytes(data_in[9:13]).rstrip(b"\x00")
|
dxgrid = bytes(data_in[9:13]).rstrip(b"\x00")
|
||||||
|
|
||||||
self.send_data_to_socket_queue(
|
self.send_data_to_socket_queue(
|
||||||
type="beacon",
|
freedata="tnc-message",
|
||||||
status="received",
|
beacon="received",
|
||||||
uuid=str(uuid.uuid4()),
|
uuid=str(uuid.uuid4()),
|
||||||
timestamp=int(time.time()),
|
timestamp=int(time.time()),
|
||||||
mycallsign=str(self.mycallsign, "UTF-8"),
|
mycallsign=str(self.mycallsign, "UTF-8"),
|
||||||
|
@ -1976,7 +2060,6 @@ class DATA:
|
||||||
dxgrid=str(dxgrid, "UTF-8"),
|
dxgrid=str(dxgrid, "UTF-8"),
|
||||||
snr=str(static.SNR),
|
snr=str(static.SNR),
|
||||||
)
|
)
|
||||||
static.INFO.append("BEACON;RECEIVING")
|
|
||||||
|
|
||||||
self.log.info(
|
self.log.info(
|
||||||
"[TNC] BEACON RCVD ["
|
"[TNC] BEACON RCVD ["
|
||||||
|
@ -2000,8 +2083,10 @@ class DATA:
|
||||||
Transmit a CQ
|
Transmit a CQ
|
||||||
"""
|
"""
|
||||||
self.log.info("[TNC] CQ CQ CQ")
|
self.log.info("[TNC] CQ CQ CQ")
|
||||||
static.INFO.append("CQ;SENDING")
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
|
cq="transmitting",
|
||||||
|
)
|
||||||
cq_frame = bytearray(14)
|
cq_frame = bytearray(14)
|
||||||
cq_frame[:1] = bytes([200])
|
cq_frame[:1] = bytes([200])
|
||||||
cq_frame[1:7] = helpers.callsign_to_bytes(self.mycallsign)
|
cq_frame[1:7] = helpers.callsign_to_bytes(self.mycallsign)
|
||||||
|
@ -2031,7 +2116,13 @@ class DATA:
|
||||||
self.log.debug("[TNC] received_cq:", dxcallsign=dxcallsign)
|
self.log.debug("[TNC] received_cq:", dxcallsign=dxcallsign)
|
||||||
|
|
||||||
dxgrid = bytes(helpers.decode_grid(data_in[7:11]), "UTF-8")
|
dxgrid = bytes(helpers.decode_grid(data_in[7:11]), "UTF-8")
|
||||||
static.INFO.append("CQ;RECEIVING")
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
|
cq="received",
|
||||||
|
mycallsign=str(self.mycallsign, "UTF-8"),
|
||||||
|
dxcallsign=str(static.DXCALLSIGN, "UTF-8"),
|
||||||
|
dxgrid=str(static.DXGRID, "UTF-8"),
|
||||||
|
)
|
||||||
self.log.info(
|
self.log.info(
|
||||||
"[TNC] CQ RCVD ["
|
"[TNC] CQ RCVD ["
|
||||||
+ str(dxcallsign, "UTF-8")
|
+ str(dxcallsign, "UTF-8")
|
||||||
|
@ -2064,7 +2155,10 @@ class DATA:
|
||||||
# duration, plus overhead. Set the wait interval to be random between 0 and 2s
|
# duration, plus overhead. Set the wait interval to be random between 0 and 2s
|
||||||
# in 0.5s increments.
|
# in 0.5s increments.
|
||||||
helpers.wait(randrange(0, 20, 5) / 10.0)
|
helpers.wait(randrange(0, 20, 5) / 10.0)
|
||||||
static.INFO.append("QRV;SENDING")
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
|
qrv="transmitting",
|
||||||
|
)
|
||||||
self.log.info("[TNC] Sending QRV!")
|
self.log.info("[TNC] Sending QRV!")
|
||||||
|
|
||||||
qrv_frame = bytearray(14)
|
qrv_frame = bytearray(14)
|
||||||
|
@ -2093,16 +2187,9 @@ class DATA:
|
||||||
dxgrid = bytes(helpers.decode_grid(data_in[7:11]), "UTF-8")
|
dxgrid = bytes(helpers.decode_grid(data_in[7:11]), "UTF-8")
|
||||||
|
|
||||||
self.send_data_to_socket_queue(
|
self.send_data_to_socket_queue(
|
||||||
type="qrv",
|
freedata="tnc-message",
|
||||||
status="received",
|
qrv="received",
|
||||||
uuid=str(uuid.uuid4()),
|
|
||||||
timestamp=int(time.time()),
|
|
||||||
mycallsign=str(self.mycallsign, "UTF-8"),
|
|
||||||
dxcallsign=str(dxcallsign, "UTF-8"),
|
|
||||||
dxgrid=str(dxgrid, "UTF-8"),
|
|
||||||
snr=str(static.SNR),
|
|
||||||
)
|
)
|
||||||
static.INFO.append("QRV;RECEIVING")
|
|
||||||
|
|
||||||
self.log.info(
|
self.log.info(
|
||||||
"[TNC] QRV RCVD ["
|
"[TNC] QRV RCVD ["
|
||||||
|
@ -2404,7 +2491,12 @@ class DATA:
|
||||||
+ str(static.DXCALLSIGN, "UTF-8")
|
+ str(static.DXCALLSIGN, "UTF-8")
|
||||||
+ "]"
|
+ "]"
|
||||||
)
|
)
|
||||||
static.INFO.append("ARQ;RECEIVING;FAILED")
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
|
arq="transmission",
|
||||||
|
status="failed",
|
||||||
|
uuid=self.transmission_uuid,
|
||||||
|
)
|
||||||
self.arq_cleanup()
|
self.arq_cleanup()
|
||||||
|
|
||||||
def arq_session_keep_alive_watchdog(self) -> None:
|
def arq_session_keep_alive_watchdog(self) -> None:
|
||||||
|
@ -2427,7 +2519,12 @@ class DATA:
|
||||||
+ str(static.DXCALLSIGN, "UTF-8")
|
+ str(static.DXCALLSIGN, "UTF-8")
|
||||||
+ "]"
|
+ "]"
|
||||||
)
|
)
|
||||||
static.INFO.append("ARQ;SESSION;TIMEOUT")
|
self.send_data_to_socket_queue(
|
||||||
|
freedata="tnc-message",
|
||||||
|
arq="session",
|
||||||
|
status="failed",
|
||||||
|
reason="timeout",
|
||||||
|
)
|
||||||
self.close_session()
|
self.close_session()
|
||||||
|
|
||||||
def heartbeat(self) -> None:
|
def heartbeat(self) -> None:
|
||||||
|
|
|
@ -467,7 +467,6 @@ def send_tnc_state():
|
||||||
"arq_compression_factor": str(static.ARQ_COMPRESSION_FACTOR),
|
"arq_compression_factor": str(static.ARQ_COMPRESSION_FACTOR),
|
||||||
"arq_transmission_percent": str(static.ARQ_TRANSMISSION_PERCENT),
|
"arq_transmission_percent": str(static.ARQ_TRANSMISSION_PERCENT),
|
||||||
"total_bytes": str(static.TOTAL_BYTES),
|
"total_bytes": str(static.TOTAL_BYTES),
|
||||||
"info": static.INFO,
|
|
||||||
"beacon_state": str(static.BEACON_STATE),
|
"beacon_state": str(static.BEACON_STATE),
|
||||||
"stations": [],
|
"stations": [],
|
||||||
"mycallsign": str(static.MYCALLSIGN, encoding),
|
"mycallsign": str(static.MYCALLSIGN, encoding),
|
||||||
|
|
|
@ -10,7 +10,7 @@ Not nice, suggestions are appreciated :-)
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
VERSION = "0.4.0-alpha"
|
VERSION = "0.4.1-alpha"
|
||||||
|
|
||||||
# DAEMON
|
# DAEMON
|
||||||
DAEMONPORT: int = 3001
|
DAEMONPORT: int = 3001
|
||||||
|
|
Loading…
Reference in a new issue