From 21d7e862ce666f8dc1a72b3514c0073181a2228c Mon Sep 17 00:00:00 2001 From: IonutMuthi Date: Wed, 21 Aug 2024 05:30:46 -0400 Subject: [PATCH] emu: added emu type option to json Signed-off-by: IonutMuthi --- core/include/core/emuwidget.h | 1 + core/src/emuwidget.cpp | 15 +++++++++------ resources/scopy_emu_options_config.json | 3 ++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/core/include/core/emuwidget.h b/core/include/core/emuwidget.h index ff2e92d644..b9c1d22cfb 100644 --- a/core/include/core/emuwidget.h +++ b/core/include/core/emuwidget.h @@ -64,6 +64,7 @@ private Q_SLOTS: QStringList m_availableOptions; QString m_jsonConfigVal; + QString m_emuType = "generic"; }; } // namespace scopy diff --git a/core/src/emuwidget.cpp b/core/src/emuwidget.cpp index 7e47546344..12d7939499 100644 --- a/core/src/emuwidget.cpp +++ b/core/src/emuwidget.cpp @@ -120,9 +120,7 @@ void EmuWidget::enGenericOptWidget(QWidget *xmlPathWidget, QWidget *rxTxDevWidge rxTxDevWidget->setEnabled(isNotAdalm2000); m_enDemoBtn->setFocus(); - if(isNotAdalm2000) { - configureOption(crtOpt); - } + configureOption(crtOpt); } void EmuWidget::setStatusMessage(QString msg) @@ -157,14 +155,13 @@ QStringList EmuWidget::createArgList() { QString option = m_demoOptCb->currentText(); QStringList arguments; + arguments.append(m_emuType); if(option.compare("adalm2000") != 0) { - arguments.append("generic"); arguments.append(m_xmlPathEdit->edit()->text()); arguments.append(m_rxTxDevEdit->edit()->text()); - } else { - arguments.append("adalm2000"); } + return arguments; } @@ -254,6 +251,12 @@ void EmuWidget::configureOption(QString option) m_uriEdit->edit()->setText(uri); } + if(jsonObject.contains("emu-type")) { + m_emuType = jsonObject.value(QString("emu-type")).toString(); + } else { + m_emuType = "generic"; + } + break; } } diff --git a/resources/scopy_emu_options_config.json b/resources/scopy_emu_options_config.json index 8cbe50138c..890c00c609 100644 --- a/resources/scopy_emu_options_config.json +++ b/resources/scopy_emu_options_config.json @@ -1,7 +1,8 @@ [ { "device": "adalm2000", - "uri": "ip:127.0.0.1" + "uri": "ip:127.0.0.1", + "emu-type": "adalm2000" }, { "device": "pluto",