mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 10:05:46 -05:00
FT8 demod: implemented messages in GUI
This commit is contained in:
parent
b1cf15213c
commit
d4363929f4
@ -104,6 +104,15 @@ void FT8Demod::setDeviceAPI(DeviceAPI *deviceAPI)
|
||||
}
|
||||
}
|
||||
|
||||
void FT8Demod::setMessageQueueToGUI(MessageQueue *queue)
|
||||
{
|
||||
ChannelAPI::setMessageQueueToGUI(queue);
|
||||
|
||||
if (m_basebandSink) {
|
||||
m_basebandSink->setMessageQueueToGUI(queue);
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t FT8Demod::getNumberOfDeviceStreams() const
|
||||
{
|
||||
return m_deviceAPI->getNbSourceStreams();
|
||||
@ -136,6 +145,7 @@ void FT8Demod::start()
|
||||
);
|
||||
m_basebandSink->setSpectrumSink(&m_spectrumVis);
|
||||
m_basebandSink->setChannel(this);
|
||||
qDebug("FT8Demod::start: setMessageQueueToGUI: %p", getMessageQueueToGUI());
|
||||
m_basebandSink->setMessageQueueToGUI(getMessageQueueToGUI());
|
||||
m_basebandSink->moveToThread(m_thread);
|
||||
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
return m_settings.m_inputFrequencyOffset;
|
||||
}
|
||||
|
||||
void setMessageQueueToGUI(MessageQueue* queue) override { ChannelAPI::setMessageQueueToGUI(queue); }
|
||||
void setMessageQueueToGUI(MessageQueue* queue) override;
|
||||
uint32_t getChannelSampleRate() const { return m_running ? m_basebandSink->getChannelSampleRate() : 0; }
|
||||
double getMagSq() const { return m_running ? m_basebandSink->getMagSq() : 0.0; }
|
||||
|
||||
|
@ -31,7 +31,8 @@ MESSAGE_CLASS_DEFINITION(FT8DemodBaseband::MsgConfigureFT8DemodBaseband, Message
|
||||
FT8DemodBaseband::FT8DemodBaseband() :
|
||||
m_channelizer(&m_sink),
|
||||
m_messageQueueToGUI(nullptr),
|
||||
m_spectrumVis(nullptr)
|
||||
m_spectrumVis(nullptr),
|
||||
m_deviceCenterFrequency(0)
|
||||
{
|
||||
qDebug("FT8DemodBaseband::FT8DemodBaseband");
|
||||
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(48000));
|
||||
@ -39,7 +40,6 @@ FT8DemodBaseband::FT8DemodBaseband() :
|
||||
|
||||
m_workerThread = new QThread();
|
||||
m_ft8DemodWorker = new FT8DemodWorker();
|
||||
|
||||
m_ft8DemodWorker->moveToThread(m_workerThread);
|
||||
|
||||
QObject::connect(
|
||||
@ -93,6 +93,12 @@ void FT8DemodBaseband::reset()
|
||||
m_channelSampleRate = 0;
|
||||
}
|
||||
|
||||
void FT8DemodBaseband::setMessageQueueToGUI(MessageQueue *messageQueue)
|
||||
{
|
||||
m_messageQueueToGUI = messageQueue;
|
||||
m_ft8DemodWorker->setReportingMessageQueue(m_messageQueueToGUI);
|
||||
}
|
||||
|
||||
void FT8DemodBaseband::setChannel(ChannelAPI *channel)
|
||||
{
|
||||
m_sink.setChannel(channel);
|
||||
@ -174,6 +180,12 @@ bool FT8DemodBaseband::handleMessage(const Message& cmd)
|
||||
m_channelSampleRate = m_channelizer.getChannelSampleRate();
|
||||
}
|
||||
|
||||
if (notif.getCenterFrequency() != m_deviceCenterFrequency)
|
||||
{
|
||||
m_ft8DemodWorker->invalidateSequence();
|
||||
m_deviceCenterFrequency = notif.getCenterFrequency();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@ -186,6 +198,7 @@ void FT8DemodBaseband::applySettings(const FT8DemodSettings& settings, bool forc
|
||||
{
|
||||
if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || force)
|
||||
{
|
||||
m_ft8DemodWorker->invalidateSequence();
|
||||
m_channelizer.setChannelization(FT8DemodSettings::m_ft8SampleRate, settings.m_inputFrequencyOffset);
|
||||
m_sink.applyChannelSettings(m_channelizer.getChannelSampleRate(), m_channelizer.getChannelFrequencyOffset());
|
||||
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
void getMagSqLevels(double& avg, double& peak, int& nbSamples) { m_sink.getMagSqLevels(avg, peak, nbSamples); }
|
||||
bool getAudioActive() const { return m_sink.getAudioActive(); }
|
||||
void setBasebandSampleRate(int sampleRate);
|
||||
void setMessageQueueToGUI(MessageQueue *messageQueue) { m_messageQueueToGUI = messageQueue; }
|
||||
void setMessageQueueToGUI(MessageQueue *messageQueue);
|
||||
void setChannel(ChannelAPI *channel);
|
||||
void setFifoLabel(const QString& label) { m_sampleFifo.setLabel(label); }
|
||||
|
||||
@ -102,6 +102,7 @@ private:
|
||||
QThread *m_workerThread;
|
||||
FT8DemodWorker *m_ft8DemodWorker;
|
||||
int16_t *m_ft8WorkerBuffer;
|
||||
qint64 m_deviceCenterFrequency;
|
||||
QRecursiveMutex m_mutex;
|
||||
|
||||
bool handleMessage(const Message& cmd);
|
||||
|
@ -15,6 +15,7 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
#include <QPixmap>
|
||||
#include <QScrollBar>
|
||||
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "device/deviceuiset.h"
|
||||
@ -106,6 +107,12 @@ bool FT8DemodGUI::handleMessage(const Message& message)
|
||||
updateAbsoluteCenterFrequency();
|
||||
return true;
|
||||
}
|
||||
else if (MsgReportFT8Messages::match(message))
|
||||
{
|
||||
MsgReportFT8Messages& notif = (MsgReportFT8Messages&) message;
|
||||
messagesReceived(notif.getFT8Messages());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
@ -204,6 +211,11 @@ void FT8DemodGUI::on_filterIndex_valueChanged(int value)
|
||||
applyBandwidths(m_settings.m_filterBank[m_settings.m_filterIndex].m_spanLog2, true); // does applySettings(true)
|
||||
}
|
||||
|
||||
void FT8DemodGUI::on_clearMessages_clicked()
|
||||
{
|
||||
ui->messages->setRowCount(0);
|
||||
}
|
||||
|
||||
void FT8DemodGUI::on_recordWav_toggled(bool checked)
|
||||
{
|
||||
m_settings.m_recordWav = checked;
|
||||
@ -585,6 +597,7 @@ void FT8DemodGUI::makeUIConnections()
|
||||
QObject::connect(ui->spanLog2, &QSlider::valueChanged, this, &FT8DemodGUI::on_spanLog2_valueChanged);
|
||||
QObject::connect(ui->fftWindow, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &FT8DemodGUI::on_fftWindow_currentIndexChanged);
|
||||
QObject::connect(ui->filterIndex, &QDial::valueChanged, this, &FT8DemodGUI::on_filterIndex_valueChanged);
|
||||
QObject::connect(ui->clearMessages, &QPushButton::clicked, this, &FT8DemodGUI::on_clearMessages_clicked);
|
||||
QObject::connect(ui->recordWav, &ButtonSwitch::toggled, this, &FT8DemodGUI::on_recordWav_toggled);
|
||||
QObject::connect(ui->logMessages, &ButtonSwitch::toggled, this, &FT8DemodGUI::on_logMessages_toggled);
|
||||
QObject::connect(ui->nbThreads, &QDial::valueChanged, this, &FT8DemodGUI::on_nbThreads_valueChanged);
|
||||
@ -606,12 +619,68 @@ void FT8DemodGUI::resizeMessageTable()
|
||||
ui->messages->setItem(row, MESSAGE_COL_N, new QTableWidgetItem("0"));
|
||||
ui->messages->setItem(row, MESSAGE_COL_SNR, new QTableWidgetItem("-24"));
|
||||
ui->messages->setItem(row, MESSAGE_COL_DEC, new QTableWidgetItem("174"));
|
||||
ui->messages->setItem(row, MESSAGE_COL_DT, new QTableWidgetItem("0.0"));
|
||||
ui->messages->setItem(row, MESSAGE_COL_DT, new QTableWidgetItem("-0.0"));
|
||||
ui->messages->setItem(row, MESSAGE_COL_DF, new QTableWidgetItem("0000"));
|
||||
ui->messages->setItem(row, MESSAGE_COL_CALL1, new QTableWidgetItem("123456789ABCD"));
|
||||
ui->messages->setItem(row, MESSAGE_COL_CALL2, new QTableWidgetItem("HF7SIEMA"));
|
||||
ui->messages->setItem(row, MESSAGE_COL_LOC, new QTableWidgetItem("JN00"));
|
||||
ui->messages->setItem(row, MESSAGE_COL_INFO, new QTableWidgetItem("hint1"));
|
||||
ui->messages->setItem(row, MESSAGE_COL_LOC, new QTableWidgetItem("JN000"));
|
||||
ui->messages->setItem(row, MESSAGE_COL_INFO, new QTableWidgetItem("OSD-0-73"));
|
||||
ui->messages->resizeColumnsToContents();
|
||||
ui->messages->removeRow(row);
|
||||
}
|
||||
|
||||
void FT8DemodGUI::messagesReceived(const QList<FT8Message>& messages)
|
||||
{
|
||||
ui->nbDecodesText->setText(tr("%1").arg(messages.size()));
|
||||
|
||||
// Is scroll bar at bottom
|
||||
QScrollBar *sb = ui->messages->verticalScrollBar();
|
||||
bool scrollToBottom = sb->value() == sb->maximum();
|
||||
|
||||
// Add to messages table
|
||||
int row = ui->messages->rowCount();
|
||||
|
||||
for (const auto& message : messages)
|
||||
{
|
||||
ui->messages->setRowCount(row + 1);
|
||||
|
||||
QTableWidgetItem *utcItem = new QTableWidgetItem();
|
||||
QTableWidgetItem *passItem = new QTableWidgetItem();
|
||||
QTableWidgetItem *snrItem = new QTableWidgetItem();
|
||||
QTableWidgetItem *correctItem = new QTableWidgetItem();
|
||||
QTableWidgetItem *dtItem = new QTableWidgetItem();
|
||||
QTableWidgetItem *dfItem = new QTableWidgetItem();
|
||||
QTableWidgetItem *call1Item = new QTableWidgetItem();
|
||||
QTableWidgetItem *call2Item = new QTableWidgetItem();
|
||||
QTableWidgetItem *locItem = new QTableWidgetItem();
|
||||
QTableWidgetItem *infoItem = new QTableWidgetItem();
|
||||
|
||||
ui->messages->setItem(row, MESSAGE_COL_UTC, utcItem);
|
||||
ui->messages->setItem(row, MESSAGE_COL_N, passItem);
|
||||
ui->messages->setItem(row, MESSAGE_COL_SNR, snrItem);
|
||||
ui->messages->setItem(row, MESSAGE_COL_DEC, correctItem);
|
||||
ui->messages->setItem(row, MESSAGE_COL_DT, dtItem);
|
||||
ui->messages->setItem(row, MESSAGE_COL_DF, dfItem);
|
||||
ui->messages->setItem(row, MESSAGE_COL_CALL1, call1Item);
|
||||
ui->messages->setItem(row, MESSAGE_COL_CALL2, call2Item);
|
||||
ui->messages->setItem(row, MESSAGE_COL_LOC, locItem);
|
||||
ui->messages->setItem(row, MESSAGE_COL_INFO, infoItem);
|
||||
|
||||
utcItem->setText(message.ts.toString("HHmmss"));
|
||||
passItem->setText(tr("%1").arg(message.pass));
|
||||
snrItem->setText(tr("%1").arg(message.snr));
|
||||
correctItem->setText(tr("%1").arg(message.nbCorrectBits));
|
||||
dtItem->setText(tr("%1").arg(message.dt, 0, 'f', 1));
|
||||
dfItem->setText(tr("%1").arg((int) message.df));
|
||||
call1Item->setText(message.call1);
|
||||
call2Item->setText(message.call2);
|
||||
locItem->setText(message.loc);
|
||||
infoItem->setText(message.decoderInfo);
|
||||
|
||||
row++;
|
||||
}
|
||||
|
||||
if (scrollToBottom) {
|
||||
ui->messages->scrollToBottom();
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "dsp/channelmarker.h"
|
||||
#include "dsp/movingaverage.h"
|
||||
#include "util/messagequeue.h"
|
||||
#include "util/ft8message.h"
|
||||
#include "settings/rollupstate.h"
|
||||
#include "ft8demodsettings.h"
|
||||
|
||||
@ -101,6 +102,7 @@ private:
|
||||
void enterEvent(EnterEventType*);
|
||||
|
||||
void resizeMessageTable();
|
||||
void messagesReceived(const QList<FT8Message>& messages);
|
||||
|
||||
enum MessageCol {
|
||||
MESSAGE_COL_UTC,
|
||||
@ -124,6 +126,7 @@ private slots:
|
||||
void on_spanLog2_valueChanged(int value);
|
||||
void on_fftWindow_currentIndexChanged(int index);
|
||||
void on_filterIndex_valueChanged(int value);
|
||||
void on_clearMessages_clicked();
|
||||
void on_recordWav_toggled(bool checked);
|
||||
void on_logMessages_toggled(bool checked);
|
||||
void on_nbThreads_valueChanged(int value);
|
||||
|
@ -6,19 +6,19 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>414</width>
|
||||
<width>500</width>
|
||||
<height>731</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>414</width>
|
||||
<width>500</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -36,7 +36,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>412</width>
|
||||
<width>481</width>
|
||||
<height>181</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -742,7 +742,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>460</y>
|
||||
<width>412</width>
|
||||
<width>481</width>
|
||||
<height>251</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -907,6 +907,32 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearMessages">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Clear messages from table</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrgui/resources/res.qrc">
|
||||
<normaloff>:/bin.png</normaloff>:/bin.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="logMessages">
|
||||
<property name="toolTip">
|
||||
|
@ -58,7 +58,6 @@ int FT8DemodWorker::FT8Callback::hcb(
|
||||
}
|
||||
|
||||
cycle_already[msg] = true;
|
||||
cycle_mu.unlock();
|
||||
|
||||
QList<FT8Message>& ft8Messages = m_msgReportFT8Messages->getFT8Messages();
|
||||
ft8Messages.push_back(FT8Message());
|
||||
@ -74,6 +73,7 @@ int FT8DemodWorker::FT8Callback::hcb(
|
||||
ft8Message.call2 = QString(call2.c_str());
|
||||
ft8Message.loc = QString(loc.c_str());
|
||||
ft8Message.decoderInfo = QString(comment);
|
||||
cycle_mu.unlock();
|
||||
|
||||
qDebug("FT8DemodWorker::FT8Callback::hcb: %d %3d %3d %5.2f %6.1f %s [%s:%s:%s] (%s)",
|
||||
pass,
|
||||
@ -114,6 +114,13 @@ void FT8DemodWorker::processBuffer(int16_t *buffer, QDateTime periodTS)
|
||||
qDebug("FT8DemodWorker::processBuffer: %s %d:%f [%d:%d]", qPrintable(periodTS.toString("yyyy-MM-dd HH:mm:ss")),
|
||||
m_nbDecoderThreads, m_decoderTimeBudget, m_lowFreq, m_highFreq);
|
||||
|
||||
if (m_invalidSequence)
|
||||
{
|
||||
qDebug("FT8DemodWorker::processBuffer: invalid sequence");
|
||||
m_invalidSequence = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_recordSamples)
|
||||
{
|
||||
WavFileRecord *wavFileRecord = new WavFileRecord(FT8DemodSettings::m_ft8SampleRate);
|
||||
|
@ -42,6 +42,7 @@ public:
|
||||
void setLowFrequency(int lowFreq) { m_lowFreq = lowFreq; }
|
||||
void setHighFrequency(int highFreq) { m_highFreq = highFreq; }
|
||||
void setReportingMessageQueue(MessageQueue *messageQueue) { m_reportingMessageQueue = messageQueue; }
|
||||
void invalidateSequence() { m_invalidSequence = true; }
|
||||
|
||||
private:
|
||||
class FT8Callback : public FT8::CallbackInterface
|
||||
@ -78,6 +79,7 @@ private:
|
||||
float m_decoderTimeBudget;
|
||||
int m_lowFreq;
|
||||
int m_highFreq;
|
||||
bool m_invalidSequence;
|
||||
FT8::FT8Decoder m_ft8Decoder;
|
||||
FT8::Packing m_packing;
|
||||
MessageQueue *m_reportingMessageQueue;
|
||||
|
Loading…
Reference in New Issue
Block a user