From 400e6b102848d9c26dc590e7fbd802d86da63438 Mon Sep 17 00:00:00 2001 From: f4exb Date: Thu, 12 May 2016 00:35:39 +0200 Subject: [PATCH] Multi device support: cleanup after the move of DSPDeviceEngine start/stop actions --- sdrbase/dsp/dspengine.cpp | 50 +++++++++-------------------- sdrbase/dsp/dspengine.h | 9 ++---- sdrbase/gui/aboutdialog.ui | 2 +- sdrbase/mainwindow.cpp | 64 +------------------------------------- sdrbase/mainwindow.h | 6 ---- sdrbase/mainwindow.ui | 5 +-- 6 files changed, 20 insertions(+), 116 deletions(-) diff --git a/sdrbase/dsp/dspengine.cpp b/sdrbase/dsp/dspengine.cpp index bafdc61b7..186511c35 100644 --- a/sdrbase/dsp/dspengine.cpp +++ b/sdrbase/dsp/dspengine.cpp @@ -67,24 +67,26 @@ void DSPEngine::stop(uint deviceIndex) m_deviceEngines[deviceIndex]->stop(); } -bool DSPEngine::initAcquisition(uint deviceIndex) +void DSPEngine::stopAllAcquisitions() { - qDebug("DSPEngine::initAcquisition(%d)", deviceIndex); - return m_deviceEngines[deviceIndex]->initAcquisition(); + std::vector::iterator it = m_deviceEngines.begin(); + + while (it != m_deviceEngines.end()) + { + (*it)->stopAcquistion(); + ++it; + } } -bool DSPEngine::startAcquisition(uint deviceIndex) +void DSPEngine::stopAllDeviceEngines() { - qDebug("DSPEngine::startAcquisition(%d)", deviceIndex); - bool started = m_deviceEngines[deviceIndex]->startAcquisition(); + std::vector::iterator it = m_deviceEngines.begin(); - if (started) - { - m_audioOutput.start(-1, m_audioSampleRate); // FIXME: do not start here since it is global - m_audioSampleRate = m_audioOutput.getRate(); // update with actual rate - } - - return started; + while (it != m_deviceEngines.end()) + { + (*it)->stop(); + ++it; + } } void DSPEngine::startAudio() @@ -111,13 +113,6 @@ void DSPEngine::stopAudio() } } -void DSPEngine::stopAcquistion(uint deviceIndex) -{ - qDebug("DSPEngine::stopAcquistion(%d)", deviceIndex); - m_audioOutput.stop(); - m_deviceEngines[deviceIndex]->stopAcquistion(); -} - void DSPEngine::setSource(SampleSource* source, uint deviceIndex) { qDebug("DSPEngine::setSource(%d)", deviceIndex); @@ -172,16 +167,6 @@ void DSPEngine::configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCo m_deviceEngines[deviceIndex]->configureCorrections(dcOffsetCorrection, iqImbalanceCorrection); } -DSPDeviceEngine::State DSPEngine::state(uint deviceIndex) const -{ - return m_deviceEngines[deviceIndex]->state(); -} - -QString DSPEngine::errorMessage(uint deviceIndex) -{ - return m_deviceEngines[deviceIndex]->errorMessage(); -} - DSPDeviceEngine *DSPEngine::getDeviceEngineByUID(uint uid) { std::vector::iterator it = m_deviceEngines.begin(); @@ -199,11 +184,6 @@ DSPDeviceEngine *DSPEngine::getDeviceEngineByUID(uint uid) return 0; } -QString DSPEngine::sourceDeviceDescription(uint deviceIndex) -{ - return m_deviceEngines[deviceIndex]->sourceDeviceDescription(); -} - void DSPEngine::setDVSerialSupport(bool support) { #ifdef DSD_USE_SERIALDV diff --git a/sdrbase/dsp/dspengine.h b/sdrbase/dsp/dspengine.h index 763bb5f90..cb063dcf3 100644 --- a/sdrbase/dsp/dspengine.h +++ b/sdrbase/dsp/dspengine.h @@ -46,9 +46,8 @@ public: void start(uint deviceIndex = 0); //!< Device engine(s) start void stop(uint deviceIndex = 0); //!< Device engine(s) stop - bool initAcquisition(uint deviceIndex = 0); //!< Initialize acquisition sequence - bool startAcquisition(uint deviceIndex = 0); //!< Start acquisition sequence - void stopAcquistion(uint deviceIndex = 0); //!< Stop acquisition sequence + void stopAllAcquisitions(); + void stopAllDeviceEngines(); void startAudio(); void stopAudio(); @@ -64,10 +63,6 @@ public: void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection, uint deviceIndex = 0); //!< Configure DSP corrections - DSPDeviceEngine::State state(uint deviceIndex = 0) const; - QString errorMessage(uint deviceIndex = 0); //!< Return the current error message - QString sourceDeviceDescription(uint deviceIndex = 0); //!< Return the source device description - DSPDeviceEngine *getDeviceEngineByIndex(uint deviceIndex) { return m_deviceEngines[deviceIndex]; } DSPDeviceEngine *getDeviceEngineByUID(uint uid); diff --git a/sdrbase/gui/aboutdialog.ui b/sdrbase/gui/aboutdialog.ui index 762021335..ea6b7c795 100644 --- a/sdrbase/gui/aboutdialog.ui +++ b/sdrbase/gui/aboutdialog.ui @@ -84,7 +84,7 @@ - <html><head/><body><p>Version 1.2.2 - Copyright (C) 2015-2016 Edouard Griffiths, F4EXB. </p><p>Code at <a href="https://github.com/f4exb/sdrangel"><span style=" text-decoration: underline; color:#0000ff;">https://github.com/f4exb/sdrangel</span></a> This is a complete redesign from RTL-SDRangelove at <a href="https://github.com/hexameron/rtl-sdrangelove"><span style=" text-decoration: underline; color:#0000ff;">https://github.com/hexameron/rtl-sdrangelove</span></a></p><p>Many thanks to the original developers:</p><p>The osmocom developer team - especially horizon, Hoernchen &amp; tnt.</p><p>Christian Daniel from maintech GmbH.</p><p>John Greb (hexameron) for the contributions in RTL-SDRangelove</p><p>The following rules apply to the SDRangel main application and libsdrbase:<br/>This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. You should have received a copy of the GNU General Public License along with this program. If not, see <a href="http://www.gnu.org/licenses/"><span style=" text-decoration: underline; color:#0000ff;">http://www.gnu.org/licenses/</span></a>.</p><p>For the license of installed plugins, look into the plugin list.</p></body></html> + <html><head/><body><p>Version 2.0.0 - Copyright (C) 2015-2016 Edouard Griffiths, F4EXB. </p><p>Code at <a href="https://github.com/f4exb/sdrangel"><span style=" text-decoration: underline; color:#0000ff;">https://github.com/f4exb/sdrangel</span></a> This is a complete redesign from RTL-SDRangelove at <a href="https://github.com/hexameron/rtl-sdrangelove"><span style=" text-decoration: underline; color:#0000ff;">https://github.com/hexameron/rtl-sdrangelove</span></a></p><p>Many thanks to the original developers:</p><p>The osmocom developer team - especially horizon, Hoernchen &amp; tnt.</p><p>Christian Daniel from maintech GmbH.</p><p>John Greb (hexameron) for the contributions in RTL-SDRangelove</p><p>The following rules apply to the SDRangel main application and libsdrbase:<br/>This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. You should have received a copy of the GNU General Public License along with this program. If not, see <a href="http://www.gnu.org/licenses/"><span style=" text-decoration: underline; color:#0000ff;">http://www.gnu.org/licenses/</span></a>.</p><p>For the license of installed plugins, look into the plugin list.</p></body></html> true diff --git a/sdrbase/mainwindow.cpp b/sdrbase/mainwindow.cpp index 66d377fc6..5fedfd821 100644 --- a/sdrbase/mainwindow.cpp +++ b/sdrbase/mainwindow.cpp @@ -169,7 +169,7 @@ MainWindow::MainWindow(QWidget* parent) : MainWindow::~MainWindow() { - m_dspEngine->stopAcquistion(); + m_dspEngine->stopAllAcquisitions(); saveSettings(); @@ -288,18 +288,6 @@ void MainWindow::createStatusBar() m_recording = new Indicator(tr("Rec"), this); m_recording->setToolTip(tr("Recording")); statusBar()->addPermanentWidget(m_recording); - - m_engineIdle = new Indicator(tr("Idle"), this); - m_engineIdle->setToolTip(tr("DSP engine is idle")); - statusBar()->addPermanentWidget(m_engineIdle); - - m_engineRunning = new Indicator(tr("Run"), this); - m_engineRunning->setToolTip(tr("DSP engine is running")); - statusBar()->addPermanentWidget(m_engineRunning); - - m_engineError = new Indicator(tr("Err"), this); - m_engineError->setToolTip(tr("DSP engine failed")); - statusBar()->addPermanentWidget(m_engineError); } void MainWindow::closeEvent(QCloseEvent*) @@ -418,56 +406,6 @@ void MainWindow::handleMessages() } } -//void MainWindow::updateStatus() -//{ -// int state = m_dspEngine->state(); -// if(m_lastEngineState != state) { -// switch(state) { -// case DSPDeviceEngine::StNotStarted: -// m_engineIdle->setColor(Qt::gray); -// m_engineRunning->setColor(Qt::gray); -// m_engineError->setColor(Qt::gray); -// statusBar()->clearMessage(); -// break; -// -// case DSPDeviceEngine::StIdle: -// m_engineIdle->setColor(Qt::cyan); -// m_engineRunning->setColor(Qt::gray); -// m_engineError->setColor(Qt::gray); -// statusBar()->clearMessage(); -// break; -// -// case DSPDeviceEngine::StRunning: -// m_engineIdle->setColor(Qt::gray); -// m_engineRunning->setColor(Qt::green); -// m_engineError->setColor(Qt::gray); -// statusBar()->showMessage(tr("Sampling from %1").arg(m_dspEngine->sourceDeviceDescription())); -// break; -// -// case DSPDeviceEngine::StError: -// m_engineIdle->setColor(Qt::gray); -// m_engineRunning->setColor(Qt::gray); -// m_engineError->setColor(Qt::red); -// statusBar()->showMessage(tr("Error: %1").arg(m_dspEngine->errorMessage())); -// break; -// } -// m_lastEngineState = state; -// } -//} - -//void MainWindow::on_action_Start_triggered() -//{ -// if (m_dspEngine->initAcquisition()) -// { -// m_dspEngine->startAcquisition(); -// } -//} -// -//void MainWindow::on_action_Stop_triggered() -//{ -// m_dspEngine->stopAcquistion(); -//} - void MainWindow::on_action_Start_Recording_triggered() { m_recording->setColor(Qt::red); diff --git a/sdrbase/mainwindow.h b/sdrbase/mainwindow.h index a10a37319..1aa532e81 100644 --- a/sdrbase/mainwindow.h +++ b/sdrbase/mainwindow.h @@ -108,9 +108,6 @@ private: QLabel* m_sampleRateWidget; Indicator* m_recording; - Indicator* m_engineIdle; - Indicator* m_engineRunning; - Indicator* m_engineError; QWidget* m_inputGUI; @@ -138,9 +135,6 @@ private: private slots: void handleDSPMessages(); void handleMessages(); - //void updateStatus(); - //void on_action_Start_triggered(); - //void on_action_Stop_triggered(); void on_action_Start_Recording_triggered(); void on_action_Stop_Recording_triggered(); void on_action_View_Fullscreen_toggled(bool checked); diff --git a/sdrbase/mainwindow.ui b/sdrbase/mainwindow.ui index 340824f28..785c3e793 100644 --- a/sdrbase/mainwindow.ui +++ b/sdrbase/mainwindow.ui @@ -66,7 +66,7 @@ 0 0 1012 - 20 + 19 @@ -91,9 +91,6 @@ &Acquisition - - -