From cbad491438b35c10f8584c3110c183d22bccd1ca Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 14 Dec 2022 16:54:37 -0500 Subject: [PATCH] WIP on IPC. --- widgets/activeStations.cpp | 4 ++ widgets/mainwindow.cpp | 98 +++++++++++++++++++------------------- 2 files changed, 54 insertions(+), 48 deletions(-) diff --git a/widgets/activeStations.cpp b/widgets/activeStations.cpp index 3c429b83d..cee4b8078 100644 --- a/widgets/activeStations.cpp +++ b/widgets/activeStations.cpp @@ -94,6 +94,10 @@ void ActiveStations::select() if((msec-m_msec0)<500) return; m_msec0=msec; int nline=ui->RecentStationsPlainTextEdit->textCursor().blockNumber(); + + qDebug() << "aa" << nline << ui->RecentStationsPlainTextEdit->textCursor().position(); + + if(nline!=-99) return; //TEMPORARY emit callSandP(nline); } } diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index a3a48c03d..00a9600b3 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -213,12 +213,12 @@ bool keep_frequency = false; QSharedMemory mem_q65w("mem_q65w"); //Memory segment to be shared (optionally) with Q65W struct { - int ndecodes; - int ncand; -// int nDecoderDone; -// int nDecoderBusy; -// int nTransmitting; - char result[50][60]; + int ndecodes; //Number of Q65W decodes available (so far) + int ncand; //Number of Q65W candidates considered for decoding + int nQDecoderDone; //Q65W decoder is finished (0 or 1) + int nWDecoderBusy; //WSJT-X decoder is busy (0 or 1) + int nWTransmitting; //WSJT-X is transmitting (0 or 1) + char result[50][60]; //Decodes as character*60 arrays } q65wcom; int* ipc_q65w; @@ -3687,6 +3687,7 @@ void MainWindow::callSandP2(int n) m_deGrid=""; m_txFirst=(w[i0+1]=="0"); ui->TxFreqSpinBox->setValue(1500); + qDebug() << "bb" << n << w; } else { m_deCall=w[0]; m_deGrid=w[1]; @@ -9222,58 +9223,59 @@ void MainWindow::readWidebandDecodes() m_EMECall[dxcall].t=60*nhr + nmin; m_EMECall[dxcall].worked=false; //### TEMPORARY ### if(w3.contains(grid_regexp)) m_EMECall[dxcall].grid4=w3; - qDebug() << "aa" << q65wcom.ndecodes << m_fetched << line; m_fetched++; +// qDebug() << "aa" << q65wcom.ndecodes << m_fetched << q65wcom.nQDecoderDone << line; } // Update "m_wEMECall" by reading q65w_decodes.txt - QMap::iterator i; - QString t=""; - QString t1; - QString dxcall; - QStringList list; - float f[100]; - int indx[100]; - int maxAge=m_ActiveStationsWidget->maxAge(); + QMap::iterator i; + QString t=""; + QString t1; + QString dxcall; + QStringList list; + float f[100]; + int indx[100]; + int maxAge=m_ActiveStationsWidget->maxAge(); - m_ActiveStationsWidget->setClickOK(false); - int k=0; - for(i=m_EMECall.begin(); i!=m_EMECall.end(); i++) { - int odd=1 - (i->t)%2; - int age=60*nhr + nmin - (i->t); - if(age<0) age += 1440; - if(age<=maxAge) { - dxcall=(i.key()+" ").left(8); - if(i->worked) { - t1=t1.asprintf("%5.1f %8s %3d %3d\n",i->fsked,dxcall.toLatin1().constData(),odd,age); - } else { - t1=t1.asprintf("%5.1f * %8s %3d %3d\n",i->fsked,dxcall.toLatin1().constData(),odd,age); - } - f[k]=i->fsked; - list.append(t1); - k++; + m_ActiveStationsWidget->setClickOK(false); + int k=0; + for(i=m_EMECall.begin(); i!=m_EMECall.end(); i++) { + int odd=1 - (i->t)%2; + int age=60*nhr + nmin - (i->t); + if(age<0) age += 1440; + if(age<=maxAge) { + dxcall=(i.key()+" ").left(8); + if(i->worked) { + t1=t1.asprintf("%5.1f %8s %3d %3d\n",i->fsked,dxcall.toLatin1().constData(),odd,age); + } else { + t1=t1.asprintf("%5.1f * %8s %3d %3d\n",i->fsked,dxcall.toLatin1().constData(),odd,age); } - m_ActiveStationsWidget->setClickOK(true); + f[k]=i->fsked; + list.append(t1); + k++; } + m_ActiveStationsWidget->setClickOK(true); + } - if(k>0) { - t1=""; - int kz=k; - indexx_(f,&kz,indx); - for(int k=0; kerase(); - m_ActiveStationsWidget->displayRecentStations(m_mode,t); + if(k>0) { + t1=""; + int kz=k; + indexx_(f,&kz,indx); + for(int k=0; kerase(); + m_ActiveStationsWidget->displayRecentStations(m_mode,t); + m_ActiveStationsWidget->setClickOK(true); + } + if(q65wcom.nQDecoderDone==1) m_fetched=0; } // -------------------------- Code for FT8 DXpedition Mode ---------------------------