diff --git a/plugins/samplesource/sdrdaemon/CMakeLists.txt b/plugins/samplesource/sdrdaemon/CMakeLists.txt index 082f1bd64..a191fe0f7 100644 --- a/plugins/samplesource/sdrdaemon/CMakeLists.txt +++ b/plugins/samplesource/sdrdaemon/CMakeLists.txt @@ -27,7 +27,6 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/include-gpl - ${LIBRTLSDR_INCLUDE_DIR} ) #include(${QT_USE_FILE}) @@ -50,7 +49,6 @@ target_include_directories(inputsdrdaemon PUBLIC target_link_libraries(inputsdrdaemon ${QT_LIBRARIES} - ${LIBUSB_LIBRARIES} ${LZ4_LIBRARIES} sdrbase ) diff --git a/plugins/samplesource/sdrdaemon/sdrdaemongui.cpp b/plugins/samplesource/sdrdaemon/sdrdaemongui.cpp index 6cccf59ea..a9bebf701 100644 --- a/plugins/samplesource/sdrdaemon/sdrdaemongui.cpp +++ b/plugins/samplesource/sdrdaemon/sdrdaemongui.cpp @@ -39,7 +39,9 @@ SDRdaemonGui::SDRdaemonGui(PluginAPI* pluginAPI, QWidget* parent) : m_sampleRate(0), m_centerFrequency(0), m_samplesCount(0), - m_tickCount(0) + m_tickCount(0), + m_dcBlock(false), + m_iqCorrection(false) { m_startingTimeStamp.tv_sec = 0; m_startingTimeStamp.tv_usec = 0; @@ -173,7 +175,7 @@ void SDRdaemonGui::handleSourceMessages() while ((message = m_sampleSource->getOutputMessageQueueToGUI()->pop()) != 0) { - qDebug("SDRdaemonGui::handleSourceMessages: message: %s", message->getIdentifier()); + //qDebug("SDRdaemonGui::handleSourceMessages: message: %s", message->getIdentifier()); if (handleMessage(*message)) { @@ -184,6 +186,8 @@ void SDRdaemonGui::handleSourceMessages() void SDRdaemonGui::displaySettings() { + ui->dcOffset->setChecked(m_dcBlock); + ui->iqImbalance->setChecked(m_iqCorrection); } /* @@ -198,6 +202,26 @@ void SDRdaemonGui::on_applyButton_clicked(bool checked) configureUDPLink(); } +void SDRdaemonGui::on_dcOffset_toggled(bool checked) +{ + if (m_dcBlock != checked) + { + m_dcBlock = checked; + SDRdaemonInput::MsgConfigureSDRdaemonAutoCorr* message = SDRdaemonInput::MsgConfigureSDRdaemonAutoCorr::create(m_dcBlock, m_iqCorrection); + m_sampleSource->getInputMessageQueue()->push(message); + } +} + +void SDRdaemonGui::on_iqImbalance_toggled(bool checked) +{ + if (m_iqCorrection != checked) + { + m_iqCorrection = checked; + SDRdaemonInput::MsgConfigureSDRdaemonAutoCorr* message = SDRdaemonInput::MsgConfigureSDRdaemonAutoCorr::create(m_dcBlock, m_iqCorrection); + m_sampleSource->getInputMessageQueue()->push(message); + } +} + void SDRdaemonGui::configureUDPLink() { bool ok; @@ -232,28 +256,8 @@ void SDRdaemonGui::updateWithStreamTime() { quint64 startingTimeStampMsec = (m_startingTimeStamp.tv_sec * 1000) + (m_startingTimeStamp.tv_usec / 1000); QDateTime dt = QDateTime::fromMSecsSinceEpoch(startingTimeStampMsec); - QString s_date = dt.toString("yyyyMMdd hh.mm.ss.zzz"); + QString s_date = dt.toString("yyyy-MM-dd hh:mm:ss.zzz"); ui->absTimeText->setText(s_date); - /* - int t_sec = 0; - int t_msec = 0; - - if (m_sampleRate > 0){ - t_msec = ((m_samplesCount * 1000) / m_sampleRate) % 1000; - t_sec = m_samplesCount / m_sampleRate; - } - - QTime t(0, 0, 0, 0); - t = t.addSecs(t_sec); - t = t.addMSecs(t_msec); - QString s_time = t.toString("hh:mm:ss.zzz"); - - quint64 startingTimeStampMsec = m_startingTimeStamp * 1000; - QDateTime dt = QDateTime::fromMSecsSinceEpoch(startingTimeStampMsec); - dt = dt.addSecs(t_sec); - dt = dt.addMSecs(t_msec); - QString s_date = dt.toString("yyyyMMdd hh.mm.ss.zzz"); - ui->absTimeText->setText(s_date);*/ } void SDRdaemonGui::tick() diff --git a/plugins/samplesource/sdrdaemon/sdrdaemongui.h b/plugins/samplesource/sdrdaemon/sdrdaemongui.h index 8ed697b8d..baa640374 100644 --- a/plugins/samplesource/sdrdaemon/sdrdaemongui.h +++ b/plugins/samplesource/sdrdaemon/sdrdaemongui.h @@ -60,6 +60,9 @@ private: int m_samplesCount; std::size_t m_tickCount; + bool m_dcBlock; + bool m_iqCorrection; + void displaySettings(); void displayTime(); void configureUDPLink(); @@ -70,6 +73,8 @@ private: private slots: void handleSourceMessages(); void on_applyButton_clicked(bool checked); + void on_dcOffset_toggled(bool checked); + void on_iqImbalance_toggled(bool checked); void tick(); }; diff --git a/plugins/samplesource/sdrdaemon/sdrdaemongui.ui b/plugins/samplesource/sdrdaemon/sdrdaemongui.ui index 77943b0a6..f19d28026 100644 --- a/plugins/samplesource/sdrdaemon/sdrdaemongui.ui +++ b/plugins/samplesource/sdrdaemon/sdrdaemongui.ui @@ -103,6 +103,119 @@ + + + + Qt::Horizontal + + + + + + + + + Rate: + + + + + + + + 50 + 0 + + + + + 8 + + + + Record sample rate + + + 0k + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Vertical + + + + + + + false + + + Record absolute time + + + 20150101 00:00:00.000 + + + + + + + + + Qt::Horizontal + + + + + + + + + Auto corr + + + + + + + DC Offset auto correction + + + DC Offset + + + + + + + IQ Imbalance auto correction + + + IQ Imbalance + + + + + @@ -175,75 +288,7 @@ - - - - - Rate: - - - - - - - - 50 - 0 - - - - - 8 - - - - Record sample rate - - - 0k - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Qt::Vertical - - - - - - - false - - - Record absolute time - - - 20150101 00:00:00.000 - - - - - - - + Qt::Horizontal @@ -261,6 +306,11 @@
gui/valuedial.h
1 + + ButtonSwitch + QToolButton +
gui/buttonswitch.h
+
diff --git a/plugins/samplesource/sdrdaemon/sdrdaemoninput.cpp b/plugins/samplesource/sdrdaemon/sdrdaemoninput.cpp index e0693390b..4ce93a06f 100644 --- a/plugins/samplesource/sdrdaemon/sdrdaemoninput.cpp +++ b/plugins/samplesource/sdrdaemon/sdrdaemoninput.cpp @@ -28,6 +28,7 @@ #include "sdrdaemonudphandler.h" MESSAGE_CLASS_DEFINITION(SDRdaemonInput::MsgConfigureSDRdaemonUDPLink, Message) +MESSAGE_CLASS_DEFINITION(SDRdaemonInput::MsgConfigureSDRdaemonAutoCorr, Message) MESSAGE_CLASS_DEFINITION(SDRdaemonInput::MsgConfigureSDRdaemonWork, Message) MESSAGE_CLASS_DEFINITION(SDRdaemonInput::MsgConfigureSDRdaemonStreamTiming, Message) MESSAGE_CLASS_DEFINITION(SDRdaemonInput::MsgReportSDRdaemonAcquisition, Message) @@ -100,6 +101,15 @@ bool SDRdaemonInput::handleMessage(const Message& message) { if (MsgConfigureSDRdaemonUDPLink::match(message)) { + // TODO: change UDP settings + return true; + } + else if (MsgConfigureSDRdaemonAutoCorr::match(message)) + { + MsgConfigureSDRdaemonAutoCorr& conf = (MsgConfigureSDRdaemonAutoCorr&) message; + bool dcBlock = conf.getDCBlock(); + bool iqImbalance = conf.getIQImbalance(); + DSPEngine::instance()->configureCorrections(dcBlock, iqImbalance); return true; } else if (MsgConfigureSDRdaemonWork::match(message)) diff --git a/plugins/samplesource/sdrdaemon/sdrdaemoninput.h b/plugins/samplesource/sdrdaemon/sdrdaemoninput.h index e17c8676c..f89be1e81 100644 --- a/plugins/samplesource/sdrdaemon/sdrdaemoninput.h +++ b/plugins/samplesource/sdrdaemon/sdrdaemoninput.h @@ -51,6 +51,28 @@ public: { } }; + class MsgConfigureSDRdaemonAutoCorr : public Message { + MESSAGE_CLASS_DECLARATION + public: + bool getDCBlock() const { return m_dcBlock; } + bool getIQImbalance() const { return m_iqCorrection; } + + static MsgConfigureSDRdaemonAutoCorr* create(bool dcBlock, bool iqImbalance) + { + return new MsgConfigureSDRdaemonAutoCorr(dcBlock, iqImbalance); + } + + private: + bool m_dcBlock; + bool m_iqCorrection; + + MsgConfigureSDRdaemonAutoCorr(bool dcBlock, bool iqImbalance) : + Message(), + m_dcBlock(dcBlock), + m_iqCorrection(iqImbalance) + { } + }; + class MsgConfigureSDRdaemonWork : public Message { MESSAGE_CLASS_DECLARATION