From b288b20289f5e9ed794ca04c5f2c9715e0be2b8a Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 13 Dec 2022 20:42:01 -0500 Subject: [PATCH] WIP toward communication between Q65W and WSJT-X by means of shared memory. --- q65w/mainwindow.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/q65w/mainwindow.cpp b/q65w/mainwindow.cpp index d85911c6d..a08ae3a1a 100644 --- a/q65w/mainwindow.cpp +++ b/q65w/mainwindow.cpp @@ -21,7 +21,7 @@ qint16 id[2*60*96000]; -//QSharedMemory mem_m65("mem_m65"); +QSharedMemory mem_q65w("mem_q65w"); //Memory segment to be shared (optionally) with WSJT-X extern const int RxDataFrequency = 96000; @@ -101,6 +101,24 @@ MainWindow::MainWindow(QWidget *parent) : xSignalMeter = new SignalMeter(ui->xMeterFrame); xSignalMeter->resize(50, 160); +//### +//Attach or create a memory segment to be shared with WSJT-X. + int memSize=4096; + if(!mem_q65w.attach()) { + if(!mem_q65w.create(memSize)) { + msgBox("Unable to create shared memory segment."); + } + } + qDebug() << "aa" << memSize << mem_q65w.size(); + char *to = (char*)mem_q65w.data(); + int *to4 = (int*)mem_q65w.data(); + mem_q65w.lock(); +// memset(to,0,memSize); //Zero all of shared memory + memset(to,1,memSize); //Zero all of shared memory + qDebug() << "bb" << int(to[0]) << int(to[10]) << to4[0] << to4[1]; + mem_q65w.unlock(); +//### + fftwf_import_wisdom_from_filename (QDir {m_appDir}.absoluteFilePath ("q65w_wisdom.dat").toLocal8Bit ()); readSettings(); //Restore user's setup params