23 #include <QMessageBox> 25 #include "ui_testsourcegui.h" 44 m_deviceUISet(deviceUISet),
46 m_doApplySettings(true),
47 m_forceSettings(true),
50 m_lastEngineState(
DeviceAPI::StNotStarted)
52 qDebug(
"TestSourceGui::TestSourceGui");
57 ui->centerFrequency->setValueRange(7, 0, 9999999);
59 ui->sampleRate->setValueRange(7, 48000, 9999999);
61 ui->frequencyShift->setValueRange(
false, 7, -9999999, 9999999);
62 ui->frequencyShiftLabel->setText(QString(
"%1").
arg(QChar(0x94, 0x03)));
74 connect(startStopRightClickEnabler, SIGNAL(rightClick(
const QPoint &)),
this, SLOT(
openDeviceSettingsDialog(
const QPoint &)));
167 if ((index < 0) || (index > 6)) {
177 if ((index < 0) || (index > 2)) {
195 if ((index < 0) || (index > 2)) {
257 ui->dcBiasText->setText(QString(tr(
"%1 %").
arg(value)));
264 ui->iBiasText->setText(QString(tr(
"%1 %").
arg(value)));
271 ui->qBiasText->setText(QString(tr(
"%1 %").
arg(value)));
278 ui->phaseImbalanceText->setText(QString(tr(
"%1 %").
arg(value)));
286 ui->record->setStyleSheet(
"QToolButton { background-color : red; }");
288 ui->record->setStyleSheet(
"QToolButton { background:rgb(79,79,79); }");
297 int amplitudeInt =
ui->amplitudeCoarse->value() * 100 +
ui->amplitudeFine->value();
300 switch (
ui->sampleSize->currentIndex())
303 power = (double) amplitudeInt*amplitudeInt / (
double) (1<<14);
306 power = (double) amplitudeInt*amplitudeInt / (
double) (1<<22);
310 power = (double) amplitudeInt*amplitudeInt / (
double) (1<<30);
314 ui->amplitudeBits->setText(QString(tr(
"%1 b").
arg(amplitudeInt)));
316 ui->power->setText(QString(tr(
"%1 dB").
arg(QString::number(powerDb,
'f', 1))));
321 switch (
ui->sampleSize->currentIndex())
324 ui->amplitudeCoarse->setMaximum(1);
327 ui->amplitudeCoarse->setMaximum(20);
331 ui->amplitudeCoarse->setMaximum(327);
338 switch (
ui->sampleSize->currentIndex())
341 if (
ui->amplitudeCoarse->value() == 1) {
342 ui->amplitudeFine->setMaximum(27);
344 ui->amplitudeFine->setMaximum(99);
348 if (
ui->amplitudeCoarse->value() == 20) {
349 ui->amplitudeFine->setMaximum(47);
351 ui->amplitudeFine->setMaximum(99);
356 if (
ui->amplitudeCoarse->value() == 327) {
357 ui->amplitudeFine->setMaximum(67);
359 ui->amplitudeFine->setMaximum(99);
367 int sampleRate =
ui->sampleRate->getValueNew();
368 ui->frequencyShift->setValueRange(
false, 7, -sampleRate, sampleRate);
374 ui->sampleSize->blockSignals(
true);
385 ui->amplitudeCoarse->setValue(amplitudeBits/100);
387 ui->amplitudeFine->setValue(amplitudeBits%100);
390 ui->dcBias->setValue((
int) dcBiasPercent);
391 ui->dcBiasText->setText(QString(tr(
"%1 %").
arg(dcBiasPercent)));
393 ui->iBias->setValue((
int) iBiasPercent);
394 ui->iBiasText->setText(QString(tr(
"%1 %").
arg(iBiasPercent)));
396 ui->qBias->setValue((
int) qBiasPercent);
397 ui->qBiasText->setText(QString(tr(
"%1 %").
arg(qBiasPercent)));
399 ui->phaseImbalance->setValue((
int) phaseImbalancePercent);
400 ui->phaseImbalanceText->setText(QString(tr(
"%1 %").
arg(phaseImbalancePercent)));
402 ui->sampleSize->blockSignals(
false);
440 ui->startStop->setStyleSheet(
"QToolButton { background:rgb(79,79,79); }");
443 ui->startStop->setStyleSheet(
"QToolButton { background-color : blue; }");
446 ui->startStop->setStyleSheet(
"QToolButton { background-color : green; }");
449 ui->startStop->setStyleSheet(
"QToolButton { background-color : red; }");
464 qDebug(
"TestSourceGui::handleMessage: MsgConfigureTestSource");
472 qDebug(
"TestSourceGui::handleMessage: MsgStartStop");
497 qDebug(
"TestSourceGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu",
void on_startStop_toggled(bool checked)
void on_iBias_valueChanged(int value)
Message * pop()
Pop message from queue.
const QString & getReverseAPIAddress() const
void push(Message *message, bool emitSignal=true)
Push message onto queue.
void setSampleRate(qint32 sampleRate)
quint32 m_sampleSizeIndex
void on_amModulation_valueChanged(int value)
static double dbPower(double magsq, double floor=1e-12)
virtual bool handleMessage(const Message &message)
QString m_reverseAPIAddress
DeviceSampleSource * getSampleSource()
Return pointer to the device sample source (single Rx) or nullptr.
void setUseReverseAPI(bool useReverseAPI)
bool deserialize(const QByteArray &data)
MessageQueue * getInputMessageQueue()
float m_qFactor
-1.0 < x < 1.0
void updateSampleRateAndFrequency()
MessageQueue m_inputMessageQueue
void on_amplitudeCoarse_valueChanged(int value)
void updateAmpCoarseLimit()
float m_phaseImbalance
-1.0 < x < 1.0
QByteArray serialize() const
uint16_t getReverseAPIDeviceIndex() const
virtual void setCenterFrequency(qint64 centerFrequency)
void updateAmpFineLimit()
void blockApplySettings(bool block)
QString errorMessage()
Last error message from the device engine.
AutoCorrOptions m_autoCorrOptions
void openDeviceSettingsDialog(const QPoint &p)
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
GLSpectrum * getSpectrum()
Direct spectrum getter.
engine is before initialization
qint64 getCenterFrequency() const
virtual qint64 getCenterFrequency() const
EngineState state() const
Return the state of the device engine corresponding to the stream type.
void on_fmDeviation_valueChanged(int value)
void updateFrequencyShiftLimit()
float m_iFactor
-1.0 < x < 1.0
void on_dcBias_valueChanged(int value)
uint16_t m_reverseAPIPort
DeviceSampleSource * m_sampleSource
uint16_t getReverseAPIPort() const
TestSourceGui(DeviceUISet *deviceUISet, QWidget *parent=0)
void on_modulation_currentIndexChanged(int index)
void on_frequencyShift_changed(qint64 value)
void on_centerFrequency_changed(quint64 value)
uint16_t m_reverseAPIDeviceIndex
bool deserialize(const QByteArray &data)
void on_sampleSize_currentIndexChanged(int index)
static bool match(const Message *message)
void handleInputMessages()
void on_amplitudeFine_valueChanged(int value)
void on_phaseImbalance_valueChanged(int value)
void on_record_toggled(bool checked)
DeviceUISet * m_deviceUISet
void on_sampleRate_changed(quint64 value)
int m_modulationTone
10'Hz
int getSampleRate() const
void on_qBias_valueChanged(int value)
void on_fcPos_currentIndexChanged(int index)
quint64 m_centerFrequency
void setCenterFrequency(qint64 frequency)
void setReverseAPIAddress(const QString &address)
void setReverseAPIDeviceIndex(uint16_t deviceIndex)
void on_decimation_currentIndexChanged(int index)
TestSourceSettings m_settings
void on_autoCorr_currentIndexChanged(int index)
void setReverseAPIPort(uint16_t port)
virtual void setMessageQueueToGUI(MessageQueue *queue)=0
quint64 m_deviceCenterFrequency
Center frequency in device.
bool useReverseAPI() const
int m_fmDeviation
100'Hz
QByteArray serialize() const
void on_modulationFrequency_valueChanged(int value)
void setName(const QString &name)
int m_amModulation
percent
float m_dcFactor
-1.0 < x < 1.0