SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
TestSourceGui Class Reference

#include <testsourcegui.h>

+ Inheritance diagram for TestSourceGui:
+ Collaboration diagram for TestSourceGui:

Public Member Functions

 TestSourceGui (DeviceUISet *deviceUISet, QWidget *parent=0)
 
virtual ~TestSourceGui ()
 
virtual void destroy ()
 
void setName (const QString &name)
 
QString getName () const
 
void resetToDefaults ()
 
virtual qint64 getCenterFrequency () const
 
virtual void setCenterFrequency (qint64 centerFrequency)
 
QByteArray serialize () const
 
bool deserialize (const QByteArray &data)
 
virtual MessageQueuegetInputMessageQueue ()
 
virtual bool handleMessage (const Message &message)
 
- Public Member Functions inherited from PluginInstanceGUI
 PluginInstanceGUI ()
 
virtual ~PluginInstanceGUI ()
 

Private Slots

void handleInputMessages ()
 
void on_startStop_toggled (bool checked)
 
void on_centerFrequency_changed (quint64 value)
 
void on_autoCorr_currentIndexChanged (int index)
 
void on_frequencyShift_changed (qint64 value)
 
void on_decimation_currentIndexChanged (int index)
 
void on_fcPos_currentIndexChanged (int index)
 
void on_sampleRate_changed (quint64 value)
 
void on_sampleSize_currentIndexChanged (int index)
 
void on_amplitudeCoarse_valueChanged (int value)
 
void on_amplitudeFine_valueChanged (int value)
 
void on_modulation_currentIndexChanged (int index)
 
void on_modulationFrequency_valueChanged (int value)
 
void on_amModulation_valueChanged (int value)
 
void on_fmDeviation_valueChanged (int value)
 
void on_dcBias_valueChanged (int value)
 
void on_iBias_valueChanged (int value)
 
void on_qBias_valueChanged (int value)
 
void on_phaseImbalance_valueChanged (int value)
 
void on_record_toggled (bool checked)
 
void openDeviceSettingsDialog (const QPoint &p)
 
void updateStatus ()
 
void updateHardware ()
 

Private Member Functions

void blockApplySettings (bool block)
 
void displaySettings ()
 
void sendSettings ()
 
void updateSampleRateAndFrequency ()
 
void displayAmplitude ()
 
void updateAmpCoarseLimit ()
 
void updateAmpFineLimit ()
 
void updateFrequencyShiftLimit ()
 

Private Attributes

Ui::TestSourceGui * ui
 
DeviceUISetm_deviceUISet
 
TestSourceSettings m_settings
 
QTimer m_updateTimer
 
QTimer m_statusTimer
 
bool m_doApplySettings
 
bool m_forceSettings
 
DeviceSampleSourcem_sampleSource
 
std::size_t m_tickCount
 
int m_deviceSampleRate
 
quint64 m_deviceCenterFrequency
 Center frequency in device. More...
 
int m_lastEngineState
 
MessageQueue m_inputMessageQueue
 

Detailed Description

Definition at line 36 of file testsourcegui.h.

Constructor & Destructor Documentation

◆ TestSourceGui()

TestSourceGui::TestSourceGui ( DeviceUISet deviceUISet,
QWidget *  parent = 0 
)
explicit

Definition at line 41 of file testsourcegui.cpp.

References arg(), displaySettings(), DeviceAPI::getSampleSource(), ColorMapper::GrayGold, ColorMapper::GrayGreenYellow, handleInputMessages(), DeviceUISet::m_deviceAPI, m_deviceUISet, m_inputMessageQueue, m_sampleSource, m_statusTimer, m_updateTimer, openDeviceSettingsDialog(), DeviceSampleSource::setMessageQueueToGUI(), ui, updateHardware(), and updateStatus().

41  :
42  QWidget(parent),
43  ui(new Ui::TestSourceGui),
44  m_deviceUISet(deviceUISet),
45  m_settings(),
46  m_doApplySettings(true),
47  m_forceSettings(true),
48  m_sampleSource(0),
49  m_tickCount(0),
51 {
52  qDebug("TestSourceGui::TestSourceGui");
54 
55  ui->setupUi(this);
56  ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
57  ui->centerFrequency->setValueRange(7, 0, 9999999);
58  ui->sampleRate->setColorMapper(ColorMapper(ColorMapper::GrayGreenYellow));
59  ui->sampleRate->setValueRange(7, 48000, 9999999);
60  ui->frequencyShift->setColorMapper(ColorMapper(ColorMapper::GrayGold));
61  ui->frequencyShift->setValueRange(false, 7, -9999999, 9999999);
62  ui->frequencyShiftLabel->setText(QString("%1").arg(QChar(0x94, 0x03)));
63 
65 
66  connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
67  connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
68  m_statusTimer.start(500);
69 
70  connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
72 
73  CRightClickEnabler *startStopRightClickEnabler = new CRightClickEnabler(ui->startStop);
74  connect(startStopRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openDeviceSettingsDialog(const QPoint &)));
75 }
DeviceSampleSource * getSampleSource()
Return pointer to the device sample source (single Rx) or nullptr.
Definition: deviceapi.cpp:213
void displaySettings()
MessageQueue m_inputMessageQueue
Definition: testsourcegui.h:69
void openDeviceSettingsDialog(const QPoint &p)
std::size_t m_tickCount
Definition: testsourcegui.h:65
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
engine is before initialization
Definition: deviceapi.h:53
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56
QTimer m_updateTimer
Definition: testsourcegui.h:60
DeviceAPI * m_deviceAPI
Definition: deviceuiset.h:48
DeviceSampleSource * m_sampleSource
Definition: testsourcegui.h:64
void handleInputMessages()
DeviceUISet * m_deviceUISet
Definition: testsourcegui.h:58
QTimer m_statusTimer
Definition: testsourcegui.h:61
bool m_doApplySettings
Definition: testsourcegui.h:62
bool m_forceSettings
Definition: testsourcegui.h:63
TestSourceSettings m_settings
Definition: testsourcegui.h:59
virtual void setMessageQueueToGUI(MessageQueue *queue)=0
+ Here is the call graph for this function:

◆ ~TestSourceGui()

TestSourceGui::~TestSourceGui ( )
virtual

Definition at line 77 of file testsourcegui.cpp.

References ui.

78 {
79  delete ui;
80 }
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56

Member Function Documentation

◆ blockApplySettings()

void TestSourceGui::blockApplySettings ( bool  block)
inlineprivate

Definition at line 71 of file testsourcegui.h.

Referenced by displaySettings(), and handleMessage().

71 { m_doApplySettings = !block; }
bool m_doApplySettings
Definition: testsourcegui.h:62
+ Here is the caller graph for this function:

◆ deserialize()

bool TestSourceGui::deserialize ( const QByteArray &  data)
virtual

Implements PluginInstanceGUI.

Definition at line 121 of file testsourcegui.cpp.

References TestSourceSettings::deserialize(), displaySettings(), m_forceSettings, m_settings, resetToDefaults(), and sendSettings().

122 {
123  if(m_settings.deserialize(data)) {
124  displaySettings();
125  m_forceSettings = true;
126  sendSettings();
127  return true;
128  } else {
129  resetToDefaults();
130  return false;
131  }
132 }
void resetToDefaults()
bool deserialize(const QByteArray &data)
void displaySettings()
bool m_forceSettings
Definition: testsourcegui.h:63
TestSourceSettings m_settings
Definition: testsourcegui.h:59
+ Here is the call graph for this function:

◆ destroy()

void TestSourceGui::destroy ( )
virtual

Implements PluginInstanceGUI.

Definition at line 82 of file testsourcegui.cpp.

83 {
84  delete this;
85 }

◆ displayAmplitude()

void TestSourceGui::displayAmplitude ( )
private

Definition at line 295 of file testsourcegui.cpp.

References arg(), CalcDb::dbPower(), and ui.

Referenced by displaySettings(), on_amplitudeCoarse_valueChanged(), on_amplitudeFine_valueChanged(), and on_sampleSize_currentIndexChanged().

296 {
297  int amplitudeInt = ui->amplitudeCoarse->value() * 100 + ui->amplitudeFine->value();
298  double power;
299 
300  switch (ui->sampleSize->currentIndex())
301  {
302  case 0: // 8 bits: 128
303  power = (double) amplitudeInt*amplitudeInt / (double) (1<<14);
304  break;
305  case 1: // 12 bits 2048
306  power = (double) amplitudeInt*amplitudeInt / (double) (1<<22);
307  break;
308  case 2: // 16 bits 32768
309  default:
310  power = (double) amplitudeInt*amplitudeInt / (double) (1<<30);
311  break;
312  }
313 
314  ui->amplitudeBits->setText(QString(tr("%1 b").arg(amplitudeInt)));
315  double powerDb = CalcDb::dbPower(power);
316  ui->power->setText(QString(tr("%1 dB").arg(QString::number(powerDb, 'f', 1))));
317 }
static double dbPower(double magsq, double floor=1e-12)
Definition: db.cpp:22
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ displaySettings()

void TestSourceGui::displaySettings ( )
private

Definition at line 371 of file testsourcegui.cpp.

References arg(), blockApplySettings(), displayAmplitude(), TestSourceSettings::m_amModulation, TestSourceSettings::m_amplitudeBits, TestSourceSettings::m_autoCorrOptions, TestSourceSettings::m_centerFrequency, TestSourceSettings::m_dcFactor, TestSourceSettings::m_fcPos, TestSourceSettings::m_fmDeviation, TestSourceSettings::m_frequencyShift, TestSourceSettings::m_iFactor, TestSourceSettings::m_log2Decim, TestSourceSettings::m_modulation, TestSourceSettings::m_modulationTone, TestSourceSettings::m_phaseImbalance, TestSourceSettings::m_qFactor, TestSourceSettings::m_sampleRate, TestSourceSettings::m_sampleSizeIndex, m_settings, ui, updateAmpCoarseLimit(), updateAmpFineLimit(), and updateFrequencyShiftLimit().

Referenced by deserialize(), handleMessage(), resetToDefaults(), setCenterFrequency(), and TestSourceGui().

372 {
373  blockApplySettings(true);
374  ui->sampleSize->blockSignals(true);
375 
376  ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
377  ui->decimation->setCurrentIndex(m_settings.m_log2Decim);
378  ui->fcPos->setCurrentIndex((int) m_settings.m_fcPos);
379  ui->sampleRate->setValue(m_settings.m_sampleRate);
381  ui->frequencyShift->setValue(m_settings.m_frequencyShift);
382  ui->sampleSize->setCurrentIndex(m_settings.m_sampleSizeIndex);
384  int amplitudeBits = m_settings.m_amplitudeBits;
385  ui->amplitudeCoarse->setValue(amplitudeBits/100);
387  ui->amplitudeFine->setValue(amplitudeBits%100);
389  int dcBiasPercent = roundf(m_settings.m_dcFactor * 100.0f);
390  ui->dcBias->setValue((int) dcBiasPercent);
391  ui->dcBiasText->setText(QString(tr("%1 %").arg(dcBiasPercent)));
392  int iBiasPercent = roundf(m_settings.m_iFactor * 100.0f);
393  ui->iBias->setValue((int) iBiasPercent);
394  ui->iBiasText->setText(QString(tr("%1 %").arg(iBiasPercent)));
395  int qBiasPercent = roundf(m_settings.m_qFactor * 100.0f);
396  ui->qBias->setValue((int) qBiasPercent);
397  ui->qBiasText->setText(QString(tr("%1 %").arg(qBiasPercent)));
398  int phaseImbalancePercent = roundf(m_settings.m_phaseImbalance * 100.0f);
399  ui->phaseImbalance->setValue((int) phaseImbalancePercent);
400  ui->phaseImbalanceText->setText(QString(tr("%1 %").arg(phaseImbalancePercent)));
401  ui->autoCorr->setCurrentIndex(m_settings.m_autoCorrOptions);
402  ui->sampleSize->blockSignals(false);
403  ui->modulation->setCurrentIndex((int) m_settings.m_modulation);
404  ui->modulationFrequency->setValue(m_settings.m_modulationTone);
405  ui->modulationFrequencyText->setText(QString("%1").arg(m_settings.m_modulationTone / 100.0, 0, 'f', 2));
406  ui->amModulation->setValue(m_settings.m_amModulation);
407  ui->amModulationText->setText(QString("%1").arg(m_settings.m_amModulation));
408  ui->fmDeviation->setValue(m_settings.m_fmDeviation);
409  ui->fmDeviationText->setText(QString("%1").arg(m_settings.m_fmDeviation / 10.0, 0, 'f', 1));
410  blockApplySettings(false);
411 }
float m_qFactor
-1.0 < x < 1.0
void updateAmpCoarseLimit()
float m_phaseImbalance
-1.0 < x < 1.0
void updateAmpFineLimit()
void blockApplySettings(bool block)
Definition: testsourcegui.h:71
AutoCorrOptions m_autoCorrOptions
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56
void updateFrequencyShiftLimit()
float m_iFactor
-1.0 < x < 1.0
void displayAmplitude()
int m_modulationTone
10&#39;Hz
TestSourceSettings m_settings
Definition: testsourcegui.h:59
int m_fmDeviation
100&#39;Hz
int m_amModulation
percent
float m_dcFactor
-1.0 < x < 1.0
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCenterFrequency()

qint64 TestSourceGui::getCenterFrequency ( ) const
virtual

Implements PluginInstanceGUI.

Definition at line 104 of file testsourcegui.cpp.

References TestSourceSettings::m_centerFrequency, and m_settings.

105 {
107 }
TestSourceSettings m_settings
Definition: testsourcegui.h:59

◆ getInputMessageQueue()

virtual MessageQueue* TestSourceGui::getInputMessageQueue ( )
inlinevirtual

Implements PluginInstanceGUI.

Definition at line 52 of file testsourcegui.h.

52 { return &m_inputMessageQueue; }
MessageQueue m_inputMessageQueue
Definition: testsourcegui.h:69

◆ getName()

QString TestSourceGui::getName ( ) const
virtual

Implements PluginInstanceGUI.

Definition at line 92 of file testsourcegui.cpp.

93 {
94  return objectName();
95 }

◆ handleInputMessages

void TestSourceGui::handleInputMessages ( )
privateslot

Definition at line 486 of file testsourcegui.cpp.

References DSPSignalNotification::getCenterFrequency(), DSPSignalNotification::getSampleRate(), handleMessage(), m_deviceCenterFrequency, m_deviceSampleRate, m_inputMessageQueue, Message::match(), MessageQueue::pop(), and updateSampleRateAndFrequency().

Referenced by TestSourceGui().

487 {
488  Message* message;
489 
490  while ((message = m_inputMessageQueue.pop()) != 0)
491  {
492  if (DSPSignalNotification::match(*message))
493  {
494  DSPSignalNotification* notif = (DSPSignalNotification*) message;
497  qDebug("TestSourceGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu",
498  notif->getSampleRate(),
499  notif->getCenterFrequency());
501 
502  delete message;
503  }
504  else
505  {
506  if (handleMessage(*message))
507  {
508  delete message;
509  }
510  }
511  }
512 }
Message * pop()
Pop message from queue.
virtual bool handleMessage(const Message &message)
void updateSampleRateAndFrequency()
MessageQueue m_inputMessageQueue
Definition: testsourcegui.h:69
qint64 getCenterFrequency() const
Definition: dspcommands.h:329
static bool match(const Message *message)
Definition: message.cpp:45
int m_deviceSampleRate
Definition: testsourcegui.h:66
int getSampleRate() const
Definition: dspcommands.h:328
quint64 m_deviceCenterFrequency
Center frequency in device.
Definition: testsourcegui.h:67
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleMessage()

bool TestSourceGui::handleMessage ( const Message message)
virtual

Implements PluginInstanceGUI.

Definition at line 460 of file testsourcegui.cpp.

References blockApplySettings(), displaySettings(), TestSourceInput::MsgConfigureTestSource::getSettings(), TestSourceInput::MsgStartStop::getStartStop(), m_settings, Message::match(), and ui.

Referenced by handleInputMessages().

461 {
463  {
464  qDebug("TestSourceGui::handleMessage: MsgConfigureTestSource");
466  m_settings = cfg.getSettings();
467  displaySettings();
468  return true;
469  }
470  else if (TestSourceInput::MsgStartStop::match(message))
471  {
472  qDebug("TestSourceGui::handleMessage: MsgStartStop");
474  blockApplySettings(true);
475  ui->startStop->setChecked(notif.getStartStop());
476  blockApplySettings(false);
477 
478  return true;
479  }
480  else
481  {
482  return false;
483  }
484 }
void displaySettings()
void blockApplySettings(bool block)
Definition: testsourcegui.h:71
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56
static bool match(const Message *message)
Definition: message.cpp:45
TestSourceSettings m_settings
Definition: testsourcegui.h:59
const TestSourceSettings & getSettings() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ on_amModulation_valueChanged

void TestSourceGui::on_amModulation_valueChanged ( int  value)
privateslot

Definition at line 241 of file testsourcegui.cpp.

References arg(), TestSourceSettings::m_amModulation, m_settings, sendSettings(), and ui.

242 {
243  m_settings.m_amModulation = value;
244  ui->amModulationText->setText(QString("%1").arg(m_settings.m_amModulation));
245  sendSettings();
246 }
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56
TestSourceSettings m_settings
Definition: testsourcegui.h:59
int m_amModulation
percent
+ Here is the call graph for this function:

◆ on_amplitudeCoarse_valueChanged

void TestSourceGui::on_amplitudeCoarse_valueChanged ( int  value)
privateslot

Definition at line 207 of file testsourcegui.cpp.

References displayAmplitude(), TestSourceSettings::m_amplitudeBits, m_settings, sendSettings(), ui, and updateAmpFineLimit().

208 {
209  (void) value;
212  m_settings.m_amplitudeBits = ui->amplitudeCoarse->value() * 100 + ui->amplitudeFine->value();
213  sendSettings();
214 }
void updateAmpFineLimit()
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56
void displayAmplitude()
TestSourceSettings m_settings
Definition: testsourcegui.h:59
+ Here is the call graph for this function:

◆ on_amplitudeFine_valueChanged

void TestSourceGui::on_amplitudeFine_valueChanged ( int  value)
privateslot

Definition at line 216 of file testsourcegui.cpp.

References displayAmplitude(), TestSourceSettings::m_amplitudeBits, m_settings, sendSettings(), and ui.

217 {
218  (void) value;
220  m_settings.m_amplitudeBits = ui->amplitudeCoarse->value() * 100 + ui->amplitudeFine->value();
221  sendSettings();
222 }
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56
void displayAmplitude()
TestSourceSettings m_settings
Definition: testsourcegui.h:59
+ Here is the call graph for this function:

◆ on_autoCorr_currentIndexChanged

void TestSourceGui::on_autoCorr_currentIndexChanged ( int  index)
privateslot

Definition at line 149 of file testsourcegui.cpp.

References TestSourceSettings::AutoCorrLast, TestSourceSettings::m_autoCorrOptions, m_settings, and sendSettings().

150 {
151  if ((index < 0) || (index > TestSourceSettings::AutoCorrLast)) {
152  return;
153  }
154 
156  sendSettings();
157 }
AutoCorrOptions m_autoCorrOptions
TestSourceSettings m_settings
Definition: testsourcegui.h:59
+ Here is the call graph for this function:

◆ on_centerFrequency_changed

void TestSourceGui::on_centerFrequency_changed ( quint64  value)
privateslot

Definition at line 143 of file testsourcegui.cpp.

References TestSourceSettings::m_centerFrequency, m_settings, and sendSettings().

144 {
145  m_settings.m_centerFrequency = value * 1000;
146  sendSettings();
147 }
TestSourceSettings m_settings
Definition: testsourcegui.h:59
+ Here is the call graph for this function:

◆ on_dcBias_valueChanged

void TestSourceGui::on_dcBias_valueChanged ( int  value)
privateslot

Definition at line 255 of file testsourcegui.cpp.

References arg(), TestSourceSettings::m_dcFactor, m_settings, sendSettings(), and ui.

256 {
257  ui->dcBiasText->setText(QString(tr("%1 %").arg(value)));
258  m_settings.m_dcFactor = value / 100.0f;
259  sendSettings();
260 }
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56
TestSourceSettings m_settings
Definition: testsourcegui.h:59
float m_dcFactor
-1.0 < x < 1.0
+ Here is the call graph for this function:

◆ on_decimation_currentIndexChanged

void TestSourceGui::on_decimation_currentIndexChanged ( int  index)
privateslot

Definition at line 165 of file testsourcegui.cpp.

References TestSourceSettings::m_log2Decim, m_settings, and sendSettings().

166 {
167  if ((index < 0) || (index > 6)) {
168  return;
169  }
170 
171  m_settings.m_log2Decim = index;
172  sendSettings();
173 }
TestSourceSettings m_settings
Definition: testsourcegui.h:59
+ Here is the call graph for this function:

◆ on_fcPos_currentIndexChanged

void TestSourceGui::on_fcPos_currentIndexChanged ( int  index)
privateslot

Definition at line 175 of file testsourcegui.cpp.

References TestSourceSettings::m_fcPos, m_settings, and sendSettings().

176 {
177  if ((index < 0) || (index > 2)) {
178  return;
179  }
180 
182  sendSettings();
183 }
TestSourceSettings m_settings
Definition: testsourcegui.h:59
+ Here is the call graph for this function:

◆ on_fmDeviation_valueChanged

void TestSourceGui::on_fmDeviation_valueChanged ( int  value)
privateslot

Definition at line 248 of file testsourcegui.cpp.

References arg(), TestSourceSettings::m_fmDeviation, m_settings, sendSettings(), and ui.

249 {
250  m_settings.m_fmDeviation = value;
251  ui->fmDeviationText->setText(QString("%1").arg(m_settings.m_fmDeviation / 10.0, 0, 'f', 1));
252  sendSettings();
253 }
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56
TestSourceSettings m_settings
Definition: testsourcegui.h:59
int m_fmDeviation
100&#39;Hz
+ Here is the call graph for this function:

◆ on_frequencyShift_changed

void TestSourceGui::on_frequencyShift_changed ( qint64  value)
privateslot

Definition at line 159 of file testsourcegui.cpp.

References TestSourceSettings::m_frequencyShift, m_settings, and sendSettings().

160 {
162  sendSettings();
163 }
TestSourceSettings m_settings
Definition: testsourcegui.h:59
+ Here is the call graph for this function:

◆ on_iBias_valueChanged

void TestSourceGui::on_iBias_valueChanged ( int  value)
privateslot

Definition at line 262 of file testsourcegui.cpp.

References arg(), TestSourceSettings::m_iFactor, m_settings, sendSettings(), and ui.

263 {
264  ui->iBiasText->setText(QString(tr("%1 %").arg(value)));
265  m_settings.m_iFactor = value / 100.0f;
266  sendSettings();
267 }
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56
float m_iFactor
-1.0 < x < 1.0
TestSourceSettings m_settings
Definition: testsourcegui.h:59
+ Here is the call graph for this function:

◆ on_modulation_currentIndexChanged

void TestSourceGui::on_modulation_currentIndexChanged ( int  index)
privateslot

Definition at line 224 of file testsourcegui.cpp.

References TestSourceSettings::m_modulation, m_settings, TestSourceSettings::ModulationLast, and sendSettings().

225 {
226  if ((index < 0) || (index > TestSourceSettings::ModulationLast)) {
227  return;
228  }
229 
231  sendSettings();
232 }
TestSourceSettings m_settings
Definition: testsourcegui.h:59
+ Here is the call graph for this function:

◆ on_modulationFrequency_valueChanged

void TestSourceGui::on_modulationFrequency_valueChanged ( int  value)
privateslot

Definition at line 234 of file testsourcegui.cpp.

References arg(), TestSourceSettings::m_modulationTone, m_settings, sendSettings(), and ui.

235 {
237  ui->modulationFrequencyText->setText(QString("%1").arg(m_settings.m_modulationTone / 100.0, 0, 'f', 2));
238  sendSettings();
239 }
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56
int m_modulationTone
10&#39;Hz
TestSourceSettings m_settings
Definition: testsourcegui.h:59
+ Here is the call graph for this function:

◆ on_phaseImbalance_valueChanged

void TestSourceGui::on_phaseImbalance_valueChanged ( int  value)
privateslot

Definition at line 276 of file testsourcegui.cpp.

References arg(), TestSourceSettings::m_phaseImbalance, m_settings, sendSettings(), and ui.

277 {
278  ui->phaseImbalanceText->setText(QString(tr("%1 %").arg(value)));
279  m_settings.m_phaseImbalance = value / 100.0f;
280  sendSettings();
281 }
float m_phaseImbalance
-1.0 < x < 1.0
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56
TestSourceSettings m_settings
Definition: testsourcegui.h:59
+ Here is the call graph for this function:

◆ on_qBias_valueChanged

void TestSourceGui::on_qBias_valueChanged ( int  value)
privateslot

Definition at line 269 of file testsourcegui.cpp.

References arg(), TestSourceSettings::m_qFactor, m_settings, sendSettings(), and ui.

270 {
271  ui->qBiasText->setText(QString(tr("%1 %").arg(value)));
272  m_settings.m_qFactor = value / 100.0f;
273  sendSettings();
274 }
float m_qFactor
-1.0 < x < 1.0
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56
TestSourceSettings m_settings
Definition: testsourcegui.h:59
+ Here is the call graph for this function:

◆ on_record_toggled

void TestSourceGui::on_record_toggled ( bool  checked)
privateslot

Definition at line 283 of file testsourcegui.cpp.

References TestSourceInput::MsgFileRecord::create(), DeviceSampleSource::getInputMessageQueue(), m_sampleSource, MessageQueue::push(), and ui.

284 {
285  if (checked) {
286  ui->record->setStyleSheet("QToolButton { background-color : red; }");
287  } else {
288  ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
289  }
290 
293 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
static MsgFileRecord * create(bool startStop)
MessageQueue * getInputMessageQueue()
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56
DeviceSampleSource * m_sampleSource
Definition: testsourcegui.h:64
+ Here is the call graph for this function:

◆ on_sampleRate_changed

void TestSourceGui::on_sampleRate_changed ( quint64  value)
privateslot

Definition at line 185 of file testsourcegui.cpp.

References TestSourceSettings::m_frequencyShift, TestSourceSettings::m_sampleRate, m_settings, sendSettings(), ui, and updateFrequencyShiftLimit().

186 {
188  m_settings.m_frequencyShift = ui->frequencyShift->getValueNew();
189  m_settings.m_sampleRate = value;
190  sendSettings();
191 }
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56
void updateFrequencyShiftLimit()
TestSourceSettings m_settings
Definition: testsourcegui.h:59
+ Here is the call graph for this function:

◆ on_sampleSize_currentIndexChanged

void TestSourceGui::on_sampleSize_currentIndexChanged ( int  index)
privateslot

Definition at line 193 of file testsourcegui.cpp.

References displayAmplitude(), TestSourceSettings::m_amplitudeBits, TestSourceSettings::m_sampleSizeIndex, m_settings, sendSettings(), ui, updateAmpCoarseLimit(), and updateAmpFineLimit().

194 {
195  if ((index < 0) || (index > 2)) {
196  return;
197  }
198 
202  m_settings.m_amplitudeBits = ui->amplitudeCoarse->value() * 100 + ui->amplitudeFine->value();
204  sendSettings();
205 }
void updateAmpCoarseLimit()
void updateAmpFineLimit()
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56
void displayAmplitude()
TestSourceSettings m_settings
Definition: testsourcegui.h:59
+ Here is the call graph for this function:

◆ on_startStop_toggled

void TestSourceGui::on_startStop_toggled ( bool  checked)
privateslot

Definition at line 134 of file testsourcegui.cpp.

References TestSourceInput::MsgStartStop::create(), DeviceSampleSource::getInputMessageQueue(), m_doApplySettings, m_sampleSource, and MessageQueue::push().

135 {
136  if (m_doApplySettings)
137  {
140  }
141 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
DeviceSampleSource * m_sampleSource
Definition: testsourcegui.h:64
static MsgStartStop * create(bool startStop)
bool m_doApplySettings
Definition: testsourcegui.h:62
+ Here is the call graph for this function:

◆ openDeviceSettingsDialog

void TestSourceGui::openDeviceSettingsDialog ( const QPoint &  p)
privateslot

Definition at line 521 of file testsourcegui.cpp.

References BasicDeviceSettingsDialog::getReverseAPIAddress(), BasicDeviceSettingsDialog::getReverseAPIDeviceIndex(), BasicDeviceSettingsDialog::getReverseAPIPort(), TestSourceSettings::m_reverseAPIAddress, TestSourceSettings::m_reverseAPIDeviceIndex, TestSourceSettings::m_reverseAPIPort, m_settings, TestSourceSettings::m_useReverseAPI, sendSettings(), BasicDeviceSettingsDialog::setReverseAPIAddress(), BasicDeviceSettingsDialog::setReverseAPIDeviceIndex(), BasicDeviceSettingsDialog::setReverseAPIPort(), BasicDeviceSettingsDialog::setUseReverseAPI(), and BasicDeviceSettingsDialog::useReverseAPI().

Referenced by TestSourceGui().

522 {
523  BasicDeviceSettingsDialog dialog(this);
524  dialog.setUseReverseAPI(m_settings.m_useReverseAPI);
525  dialog.setReverseAPIAddress(m_settings.m_reverseAPIAddress);
526  dialog.setReverseAPIPort(m_settings.m_reverseAPIPort);
527  dialog.setReverseAPIDeviceIndex(m_settings.m_reverseAPIDeviceIndex);
528 
529  dialog.move(p);
530  dialog.exec();
531 
532  m_settings.m_useReverseAPI = dialog.useReverseAPI();
533  m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
534  m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
535  m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
536 
537  sendSettings();
538 }
uint16_t m_reverseAPIDeviceIndex
TestSourceSettings m_settings
Definition: testsourcegui.h:59
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetToDefaults()

void TestSourceGui::resetToDefaults ( )
virtual

Implements PluginInstanceGUI.

Definition at line 97 of file testsourcegui.cpp.

References displaySettings(), m_settings, TestSourceSettings::resetToDefaults(), and sendSettings().

Referenced by deserialize().

98 {
100  displaySettings();
101  sendSettings();
102 }
void displaySettings()
TestSourceSettings m_settings
Definition: testsourcegui.h:59
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendSettings()

void TestSourceGui::sendSettings ( )
private

◆ serialize()

QByteArray TestSourceGui::serialize ( ) const
virtual

Implements PluginInstanceGUI.

Definition at line 116 of file testsourcegui.cpp.

References m_settings, and TestSourceSettings::serialize().

117 {
118  return m_settings.serialize();
119 }
QByteArray serialize() const
TestSourceSettings m_settings
Definition: testsourcegui.h:59
+ Here is the call graph for this function:

◆ setCenterFrequency()

void TestSourceGui::setCenterFrequency ( qint64  centerFrequency)
virtual

Implements PluginInstanceGUI.

Definition at line 109 of file testsourcegui.cpp.

References displaySettings(), TestSourceSettings::m_centerFrequency, m_settings, and sendSettings().

110 {
111  m_settings.m_centerFrequency = centerFrequency;
112  displaySettings();
113  sendSettings();
114 }
void displaySettings()
TestSourceSettings m_settings
Definition: testsourcegui.h:59
+ Here is the call graph for this function:

◆ setName()

void TestSourceGui::setName ( const QString &  name)
virtual

Implements PluginInstanceGUI.

Definition at line 87 of file testsourcegui.cpp.

88 {
89  setObjectName(name);
90 }

◆ updateAmpCoarseLimit()

void TestSourceGui::updateAmpCoarseLimit ( )
private

Definition at line 319 of file testsourcegui.cpp.

References ui.

Referenced by displaySettings(), and on_sampleSize_currentIndexChanged().

320 {
321  switch (ui->sampleSize->currentIndex())
322  {
323  case 0: // 8 bits: 128
324  ui->amplitudeCoarse->setMaximum(1);
325  break;
326  case 1: // 12 bits 2048
327  ui->amplitudeCoarse->setMaximum(20);
328  break;
329  case 2: // 16 bits 32768
330  default:
331  ui->amplitudeCoarse->setMaximum(327);
332  break;
333  }
334 }
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56
+ Here is the caller graph for this function:

◆ updateAmpFineLimit()

void TestSourceGui::updateAmpFineLimit ( )
private

Definition at line 336 of file testsourcegui.cpp.

References ui.

Referenced by displaySettings(), on_amplitudeCoarse_valueChanged(), and on_sampleSize_currentIndexChanged().

337 {
338  switch (ui->sampleSize->currentIndex())
339  {
340  case 0: // 8 bits: 128
341  if (ui->amplitudeCoarse->value() == 1) {
342  ui->amplitudeFine->setMaximum(27);
343  } else {
344  ui->amplitudeFine->setMaximum(99);
345  }
346  break;
347  case 1: // 12 bits 2048
348  if (ui->amplitudeCoarse->value() == 20) {
349  ui->amplitudeFine->setMaximum(47);
350  } else {
351  ui->amplitudeFine->setMaximum(99);
352  }
353  break;
354  case 2: // 16 bits 32768
355  default:
356  if (ui->amplitudeCoarse->value() == 327) {
357  ui->amplitudeFine->setMaximum(67);
358  } else {
359  ui->amplitudeFine->setMaximum(99);
360  }
361  break;
362  }
363 }
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56
+ Here is the caller graph for this function:

◆ updateFrequencyShiftLimit()

void TestSourceGui::updateFrequencyShiftLimit ( )
private

Definition at line 365 of file testsourcegui.cpp.

References ui.

Referenced by displaySettings(), and on_sampleRate_changed().

366 {
367  int sampleRate = ui->sampleRate->getValueNew();
368  ui->frequencyShift->setValueRange(false, 7, -sampleRate, sampleRate);
369 }
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56
+ Here is the caller graph for this function:

◆ updateHardware

void TestSourceGui::updateHardware ( )
privateslot

Definition at line 420 of file testsourcegui.cpp.

References TestSourceInput::MsgConfigureTestSource::create(), DeviceSampleSource::getInputMessageQueue(), m_doApplySettings, m_forceSettings, m_sampleSource, m_settings, m_updateTimer, and MessageQueue::push().

Referenced by TestSourceGui().

421 {
422  if (m_doApplySettings)
423  {
426  m_forceSettings = false;
427  m_updateTimer.stop();
428  }
429 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue * getInputMessageQueue()
QTimer m_updateTimer
Definition: testsourcegui.h:60
static MsgConfigureTestSource * create(const TestSourceSettings &settings, bool force)
DeviceSampleSource * m_sampleSource
Definition: testsourcegui.h:64
bool m_doApplySettings
Definition: testsourcegui.h:62
bool m_forceSettings
Definition: testsourcegui.h:63
TestSourceSettings m_settings
Definition: testsourcegui.h:59
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateSampleRateAndFrequency()

void TestSourceGui::updateSampleRateAndFrequency ( )
private

Definition at line 514 of file testsourcegui.cpp.

References arg(), DeviceUISet::getSpectrum(), m_deviceCenterFrequency, m_deviceSampleRate, m_deviceUISet, GLSpectrum::setCenterFrequency(), GLSpectrum::setSampleRate(), and ui.

Referenced by handleInputMessages().

515 {
518  ui->deviceRateText->setText(tr("%1k").arg((float)m_deviceSampleRate / 1000));
519 }
void setSampleRate(qint32 sampleRate)
Definition: glspectrum.cpp:211
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
GLSpectrum * getSpectrum()
Direct spectrum getter.
Definition: deviceuiset.h:57
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56
int m_deviceSampleRate
Definition: testsourcegui.h:66
DeviceUISet * m_deviceUISet
Definition: testsourcegui.h:58
void setCenterFrequency(qint64 frequency)
Definition: glspectrum.cpp:175
quint64 m_deviceCenterFrequency
Center frequency in device.
Definition: testsourcegui.h:67
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateStatus

void TestSourceGui::updateStatus ( )
privateslot

Definition at line 431 of file testsourcegui.cpp.

References DeviceAPI::errorMessage(), DeviceUISet::m_deviceAPI, m_deviceUISet, m_lastEngineState, DeviceAPI::state(), DeviceAPI::StError, DeviceAPI::StIdle, DeviceAPI::StNotStarted, DeviceAPI::StRunning, and ui.

Referenced by TestSourceGui().

432 {
433  int state = m_deviceUISet->m_deviceAPI->state();
434 
435  if(m_lastEngineState != state)
436  {
437  switch(state)
438  {
440  ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
441  break;
442  case DeviceAPI::StIdle:
443  ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
444  break;
446  ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
447  break;
448  case DeviceAPI::StError:
449  ui->startStop->setStyleSheet("QToolButton { background-color : red; }");
450  QMessageBox::information(this, tr("Message"), m_deviceUISet->m_deviceAPI->errorMessage());
451  break;
452  default:
453  break;
454  }
455 
456  m_lastEngineState = state;
457  }
458 }
QString errorMessage()
Last error message from the device engine.
Definition: deviceapi.cpp:290
engine is before initialization
Definition: deviceapi.h:53
EngineState state() const
Return the state of the device engine corresponding to the stream type.
Definition: deviceapi.cpp:277
Ui::TestSourceGui * ui
Definition: testsourcegui.h:56
DeviceAPI * m_deviceAPI
Definition: deviceuiset.h:48
engine is idle
Definition: deviceapi.h:54
DeviceUISet * m_deviceUISet
Definition: testsourcegui.h:58
engine is running
Definition: deviceapi.h:56
engine is in error
Definition: deviceapi.h:57
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_deviceCenterFrequency

quint64 TestSourceGui::m_deviceCenterFrequency
private

Center frequency in device.

Definition at line 67 of file testsourcegui.h.

Referenced by handleInputMessages(), and updateSampleRateAndFrequency().

◆ m_deviceSampleRate

int TestSourceGui::m_deviceSampleRate
private

Definition at line 66 of file testsourcegui.h.

Referenced by handleInputMessages(), and updateSampleRateAndFrequency().

◆ m_deviceUISet

DeviceUISet* TestSourceGui::m_deviceUISet
private

Definition at line 58 of file testsourcegui.h.

Referenced by TestSourceGui(), updateSampleRateAndFrequency(), and updateStatus().

◆ m_doApplySettings

bool TestSourceGui::m_doApplySettings
private

Definition at line 62 of file testsourcegui.h.

Referenced by on_startStop_toggled(), and updateHardware().

◆ m_forceSettings

bool TestSourceGui::m_forceSettings
private

Definition at line 63 of file testsourcegui.h.

Referenced by deserialize(), and updateHardware().

◆ m_inputMessageQueue

MessageQueue TestSourceGui::m_inputMessageQueue
private

Definition at line 69 of file testsourcegui.h.

Referenced by handleInputMessages(), and TestSourceGui().

◆ m_lastEngineState

int TestSourceGui::m_lastEngineState
private

Definition at line 68 of file testsourcegui.h.

Referenced by updateStatus().

◆ m_sampleSource

DeviceSampleSource* TestSourceGui::m_sampleSource
private

◆ m_settings

TestSourceSettings TestSourceGui::m_settings
private

◆ m_statusTimer

QTimer TestSourceGui::m_statusTimer
private

Definition at line 61 of file testsourcegui.h.

Referenced by TestSourceGui().

◆ m_tickCount

std::size_t TestSourceGui::m_tickCount
private

Definition at line 65 of file testsourcegui.h.

◆ m_updateTimer

QTimer TestSourceGui::m_updateTimer
private

Definition at line 60 of file testsourcegui.h.

Referenced by sendSettings(), TestSourceGui(), and updateHardware().

◆ ui

Ui::TestSourceGui* TestSourceGui::ui
private

The documentation for this class was generated from the following files: