arq waiting modal if channel busy

This commit is contained in:
DJ2LS 2022-11-17 22:17:50 +01:00
parent d71fb3c640
commit 503fa52696
6 changed files with 67 additions and 3 deletions

View file

@ -622,6 +622,12 @@ ipcMain.on('request-show-arq-toast-datachannel-opening',(event,data)=>{
win.webContents.send('action-show-arq-toast-datachannel-opening', data);
});
// ARQ DATA CHANNEL WAITING
ipcMain.on('request-show-arq-toast-datachannel-waiting',(event,data)=>{
win.webContents.send('action-show-arq-toast-datachannel-waiting', 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);
@ -813,12 +819,24 @@ ipcMain.on('request-start-rigctld',(event, data)=>{
try{
spawn(data.path, data.parameters);
let rigctld_proc = spawn(data.path, data.parameters);
} catch (e) {
console.log(e);
}
rigctld_proc.on('exit', function (code) {
console.log('rigctld process exited with code ' + code);
// if rigctld crashes, error code is -2
// then we are going to restart rigctld
// this "fixes" a problem with latest rigctld on raspberry pi
//if (code == -2){
// setTimeout(ipcRenderer.send('request-start-rigctld', data), 500);
//}
//let rigctld_proc = spawn(data.path, data.parameters);
});
/*
const rigctld = exec(data.path, data.parameters);

View file

@ -62,6 +62,25 @@ try{
PouchDB.plugin(require('pouchdb-find'));
var db = new PouchDB(chatDB);
var remoteDB = new PouchDB('http://192.168.178.79:5984/chatDB')
db.sync(remoteDB, {
live: true,
retry: true
}).on('change', function (change) {
// yo, something changed!
console.log(change)
}).on('paused', function (info) {
// replication was paused, usually because of a lost connection
console.log(info)
}).on('active', function (info) {
// replication was resumed
console.log(info)
}).on('error', function (err) {
// totally unhandled error (shouldn't happen)
console.log(error)
});
var dxcallsigns = new Set();
db.createIndex({
index: {
@ -73,6 +92,7 @@ db.createIndex({
}).catch(function(err) {
console.log(err);
});
db.find({
selector: {
timestamp: {

View file

@ -12,7 +12,7 @@ const {
} = require('qth-locator');
const os = require('os');
// split character used for appending addiotional data to files
// split character used for appending additional data to files
const split_char = '\0;';
@ -2172,6 +2172,14 @@ ipcRenderer.on('action-show-arq-toast-datachannel-opening', (event, data) => {
toast.show();
});
// DATA CHANNEL WAITING TOAST
ipcRenderer.on('action-show-arq-toast-datachannel-waiting', (event, data) => {
var toastDATACHANNELwaiting = document.getElementById('toastDATACHANNELwaiting');
var toast = bootstrap.Toast.getOrCreateInstance(toastDATACHANNELwaiting); // 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');
@ -2351,6 +2359,5 @@ function checkRigctld(){
}
ipcRenderer.on('action-check-rigctld', (event, data) => {
console.log(data)
document.getElementById("hamlib_rigctld_status").value = data["state"];
});

View file

@ -326,6 +326,10 @@ client.on('data', function(socketdata) {
} else if (data['status'] == 'opening') {
ipcRenderer.send('request-show-arq-toast-datachannel-opening', {data: [data]});
// ARQ WAITING
} else if (data['status'] == 'waiting') {
ipcRenderer.send('request-show-arq-toast-datachannel-waiting', {data: [data]});
// ARQ TRANSMISSION FAILED
} else if (data['status'] == 'failed') {

View file

@ -136,6 +136,15 @@
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
<!-- DATACHANNEL WAITING -->
<div class="toast align-items-center text-white bg-warning border-0" id="toastDATACHANNELwaiting" role="alert" aria-live="assertive" aria-atomic="true">
<div class="d-flex">
<div class="toast-body">DATACHANNEL BUSY! Waiting...</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
<!-- STOPPING TRANSMISSION -->
<div class="toast align-items-center text-white bg-danger border-0" id="toastTRANSMISSIONstopped" role="alert" aria-live="assertive" aria-atomic="true">
<div class="d-flex">

View file

@ -1599,6 +1599,12 @@ class DATA:
# Let's check if we have a busy channel and we are not in a running arq session.
if static.CHANNEL_BUSY and not static.ARQ_SESSION:
self.log.warning("[TNC] Channel busy, waiting until free...")
self.send_data_to_socket_queue(
freedata="tnc-message",
arq="transmission",
status="waiting",
)
# wait while timeout not reached and our busy state is busy
while static.CHANNEL_BUSY and not self.datachannel_timeout:
time.sleep(0.01)