replace std::set<> for active plots with PlotUpdater emitting queued signals
This commit is contained in:
@@ -70,22 +70,18 @@ float Limits_KPI_ue[2][2] = {
|
|||||||
{0.2, 10} // Throughput in Mbs
|
{0.2, 10} // Throughput in Mbs
|
||||||
};
|
};
|
||||||
|
|
||||||
// Holds status of active plots
|
// Plot updater
|
||||||
std::set<LLRPlot *> puschLlrSet;
|
PlotUpdater puschLlrUpdater;
|
||||||
std::set<IQPlot *> puschIqSet;
|
PlotUpdater puschIqUpdater;
|
||||||
|
|
||||||
void scopeUpdaterGnb(enum PlotTypeGnbIf plotType, int numElt)
|
void scopeUpdaterGnb(enum PlotTypeGnbIf plotType, int numElt)
|
||||||
{
|
{
|
||||||
switch (plotType) {
|
switch (plotType) {
|
||||||
case puschLLRe:
|
case puschLLRe:
|
||||||
for (auto puschLlr = puschLlrSet.begin(); puschLlr != puschLlrSet.end(); puschLlr++) {
|
puschLlrUpdater.updatePlot(numElt);
|
||||||
(*puschLlr)->updatePlot(numElt);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case puschIQe:
|
case puschIQe:
|
||||||
for (auto puschIq = puschIqSet.begin(); puschIq != puschIqSet.end(); puschIq++) {
|
puschIqUpdater.updatePlot(numElt);
|
||||||
(*puschIq)->updatePlot(numElt);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -366,8 +362,7 @@ void CIRPlotUE::timerEvent(QTimerEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LLRPlot::LLRPlot(int16_t *data, int len, int interval, std::set<LLRPlot *> *notificationSet)
|
LLRPlot::LLRPlot(int16_t *data, int len, int interval, PlotUpdater *plotUpdater) : data(data), len(len), plotUpdater(plotUpdater)
|
||||||
: data(data), len(len), notificationSet(notificationSet)
|
|
||||||
{
|
{
|
||||||
this->legend()->hide();
|
this->legend()->hide();
|
||||||
|
|
||||||
@@ -393,14 +388,14 @@ LLRPlot::LLRPlot(int16_t *data, int len, int interval, std::set<LLRPlot *> *noti
|
|||||||
if (interval)
|
if (interval)
|
||||||
startTimer(interval);
|
startTimer(interval);
|
||||||
|
|
||||||
if (notificationSet)
|
if (plotUpdater)
|
||||||
notificationSet->insert(this);
|
connect(plotUpdater, &PlotUpdater::updatePlot, this, &LLRPlot::updatePlot, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
LLRPlot::~LLRPlot()
|
LLRPlot::~LLRPlot()
|
||||||
{
|
{
|
||||||
if (this->notificationSet)
|
if (this->plotUpdater)
|
||||||
this->notificationSet->erase(this);
|
disconnect(this->plotUpdater, &PlotUpdater::updatePlot, this, &LLRPlot::updatePlot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLRPlot::updatePlot(int len)
|
void LLRPlot::updatePlot(int len)
|
||||||
@@ -450,8 +445,7 @@ void LLRPlotUE::timerEvent(QTimerEvent *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IQPlot::IQPlot(complex16 *data, int len, int interval, std::set<IQPlot *> *notificationSet)
|
IQPlot::IQPlot(complex16 *data, int len, int interval, PlotUpdater *plotUpdater) : data(data), len(len), plotUpdater(plotUpdater)
|
||||||
: data(data), len(len), notificationSet(notificationSet)
|
|
||||||
{
|
{
|
||||||
this->legend()->hide();
|
this->legend()->hide();
|
||||||
|
|
||||||
@@ -476,14 +470,14 @@ IQPlot::IQPlot(complex16 *data, int len, int interval, std::set<IQPlot *> *notif
|
|||||||
if (interval)
|
if (interval)
|
||||||
startTimer(interval);
|
startTimer(interval);
|
||||||
|
|
||||||
if (notificationSet)
|
if (plotUpdater)
|
||||||
notificationSet->insert(this);
|
connect(plotUpdater, &PlotUpdater::updatePlot, this, &IQPlot::updatePlot, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
IQPlot::~IQPlot()
|
IQPlot::~IQPlot()
|
||||||
{
|
{
|
||||||
if (this->notificationSet)
|
if (this->plotUpdater)
|
||||||
this->notificationSet->erase(this);
|
disconnect(this->plotUpdater, &PlotUpdater::updatePlot, this, &IQPlot::updatePlot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IQPlot::updatePlot(int len)
|
void IQPlot::updatePlot(int len)
|
||||||
@@ -839,12 +833,12 @@ void PainterWidgetGnb::makeConnections(int type)
|
|||||||
|
|
||||||
case PlotTypeGnb::puschLLR: {
|
case PlotTypeGnb::puschLLR: {
|
||||||
int init_coded_bits_per_codeword = 100;
|
int init_coded_bits_per_codeword = 100;
|
||||||
newChart = new LLRPlot((int16_t *)p->gNB->pusch_vars[0].llr, init_coded_bits_per_codeword, 0, &puschLlrSet);
|
newChart = new LLRPlot((int16_t *)p->gNB->pusch_vars[0].llr, init_coded_bits_per_codeword, 0, &puschLlrUpdater);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PlotTypeGnb::puschIQ: {
|
case PlotTypeGnb::puschIQ: {
|
||||||
int init_num_re = 100;
|
int init_num_re = 100;
|
||||||
newChart = new IQPlot((complex16 *)p->gNB->pusch_vars[0].rxdataF_comp[0], init_num_re, 0, &puschIqSet);
|
newChart = new IQPlot((complex16 *)p->gNB->pusch_vars[0].rxdataF_comp[0], init_num_re, 0, &puschIqUpdater);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PlotTypeGnb::puschSNR: {
|
case PlotTypeGnb::puschSNR: {
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
#ifndef QT_SCOPE_MAINWINDOW_H
|
#ifndef QT_SCOPE_MAINWINDOW_H
|
||||||
#define QT_SCOPE_MAINWINDOW_H
|
#define QT_SCOPE_MAINWINDOW_H
|
||||||
|
|
||||||
#include <set>
|
|
||||||
#include <QtCharts>
|
#include <QtCharts>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -101,6 +100,14 @@ class ValueProviderUE : public ValueProvider {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Class for emitting a queued signal to update plots
|
||||||
|
class PlotUpdater : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void updatePlot(int numElt);
|
||||||
|
};
|
||||||
|
|
||||||
/// An editable GUI field for a dialog box to set certain KPI configurations
|
/// An editable GUI field for a dialog box to set certain KPI configurations
|
||||||
class ConfigBoxFloat : public QLineEdit {
|
class ConfigBoxFloat : public QLineEdit {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -249,14 +256,6 @@ class CIRPlotUE : public CIRPlot {
|
|||||||
ValueProviderUE *valueProvider;
|
ValueProviderUE *valueProvider;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// New data signal emiter
|
|
||||||
class NewDataHere : public QObject {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void updateScope();
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Chart class for plotting LLRs
|
/// Chart class for plotting LLRs
|
||||||
class LLRPlot : public QChart {
|
class LLRPlot : public QChart {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -266,8 +265,8 @@ class LLRPlot : public QChart {
|
|||||||
/// \param data Pointer to the LLR data
|
/// \param data Pointer to the LLR data
|
||||||
/// \param len Length of the LLR data
|
/// \param len Length of the LLR data
|
||||||
/// \param interval update interval in ms (0 means no timer-triggered updates)
|
/// \param interval update interval in ms (0 means no timer-triggered updates)
|
||||||
/// \param notificationSet pointer to a std::set for update notifications
|
/// \param plotUpdater pointer to a PlotUpdater for update notifications
|
||||||
LLRPlot(int16_t *data, int len, int interval = 1000, std::set<LLRPlot *> *notificationSet = nullptr);
|
LLRPlot(int16_t *data, int len, int interval = 1000, PlotUpdater *plotUpdater = nullptr);
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
~LLRPlot();
|
~LLRPlot();
|
||||||
@@ -287,8 +286,8 @@ class LLRPlot : public QChart {
|
|||||||
/// Length of the LLR data
|
/// Length of the LLR data
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
/// Pointer to a std::set for update notifications
|
/// Pointer to a PlotUpdater for update notifications
|
||||||
std::set<LLRPlot *> *notificationSet;
|
PlotUpdater *plotUpdater;
|
||||||
|
|
||||||
/// Scatter series used to plot the LLR in the chart
|
/// Scatter series used to plot the LLR in the chart
|
||||||
QScatterSeries *series;
|
QScatterSeries *series;
|
||||||
@@ -326,8 +325,8 @@ class IQPlot : public QChart {
|
|||||||
/// \param data Pointer to the complex I/Q data
|
/// \param data Pointer to the complex I/Q data
|
||||||
/// \param len Length of the I/Q data
|
/// \param len Length of the I/Q data
|
||||||
/// \param interval update interval in ms (0 means no timer-triggered updates)
|
/// \param interval update interval in ms (0 means no timer-triggered updates)
|
||||||
/// \param notificationSet pointer to a std::set for update notifications
|
/// \param plotUpdater pointer to a PlotUpdater for update notifications
|
||||||
IQPlot(complex16 *data, int len, int interval = 1000, std::set<IQPlot *> *notificationSet = nullptr);
|
IQPlot(complex16 *data, int len, int interval = 1000, PlotUpdater *plotUpdater = nullptr);
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
~IQPlot();
|
~IQPlot();
|
||||||
@@ -347,8 +346,8 @@ class IQPlot : public QChart {
|
|||||||
/// Length of the I/Q data
|
/// Length of the I/Q data
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
/// Pointer to a std::set for update notifications
|
/// Pointer to a PlotUpdater for update notifications
|
||||||
std::set<IQPlot *> *notificationSet;
|
PlotUpdater *plotUpdater;
|
||||||
|
|
||||||
/// Scatter series used to plot the I/Q constellation diagram
|
/// Scatter series used to plot the I/Q constellation diagram
|
||||||
QScatterSeries *series;
|
QScatterSeries *series;
|
||||||
|
|||||||
Reference in New Issue
Block a user