Multi device support: cleanup after the move of DSPDeviceEngine start/stop actions

This commit is contained in:
f4exb 2016-05-12 00:35:39 +02:00
parent ecd05096ad
commit 400e6b1028
6 changed files with 20 additions and 116 deletions

View File

@ -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<DSPDeviceEngine*>::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<DSPDeviceEngine*>::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<DSPDeviceEngine*>::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

View File

@ -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);

View File

@ -84,7 +84,7 @@
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Version 1.2.2 - Copyright (C) 2015-2016 Edouard Griffiths, F4EXB. &lt;/p&gt;&lt;p&gt;Code at &lt;a href=&quot;https://github.com/f4exb/sdrangel&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/f4exb/sdrangel&lt;/span&gt;&lt;/a&gt; This is a complete redesign from RTL-SDRangelove at &lt;a href=&quot;https://github.com/hexameron/rtl-sdrangelove&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/hexameron/rtl-sdrangelove&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Many thanks to the original developers:&lt;/p&gt;&lt;p&gt;The osmocom developer team - especially horizon, Hoernchen &amp;amp; tnt.&lt;/p&gt;&lt;p&gt;Christian Daniel from maintech GmbH.&lt;/p&gt;&lt;p&gt;John Greb (hexameron) for the contributions in RTL-SDRangelove&lt;/p&gt;&lt;p&gt;The following rules apply to the SDRangel main application and libsdrbase:&lt;br/&gt;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 &lt;a href=&quot;http://www.gnu.org/licenses/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.gnu.org/licenses/&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;For the license of installed plugins, look into the plugin list.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Version 2.0.0 - Copyright (C) 2015-2016 Edouard Griffiths, F4EXB. &lt;/p&gt;&lt;p&gt;Code at &lt;a href=&quot;https://github.com/f4exb/sdrangel&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/f4exb/sdrangel&lt;/span&gt;&lt;/a&gt; This is a complete redesign from RTL-SDRangelove at &lt;a href=&quot;https://github.com/hexameron/rtl-sdrangelove&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/hexameron/rtl-sdrangelove&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Many thanks to the original developers:&lt;/p&gt;&lt;p&gt;The osmocom developer team - especially horizon, Hoernchen &amp;amp; tnt.&lt;/p&gt;&lt;p&gt;Christian Daniel from maintech GmbH.&lt;/p&gt;&lt;p&gt;John Greb (hexameron) for the contributions in RTL-SDRangelove&lt;/p&gt;&lt;p&gt;The following rules apply to the SDRangel main application and libsdrbase:&lt;br/&gt;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 &lt;a href=&quot;http://www.gnu.org/licenses/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.gnu.org/licenses/&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;For the license of installed plugins, look into the plugin list.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>

View File

@ -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);

View File

@ -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);

View File

@ -66,7 +66,7 @@
<x>0</x>
<y>0</y>
<width>1012</width>
<height>20</height>
<height>19</height>
</rect>
</property>
<widget class="QMenu" name="menu_File">
@ -91,9 +91,6 @@
<property name="title">
<string>&amp;Acquisition</string>
</property>
<addaction name="action_Start"/>
<addaction name="action_Stop"/>
<addaction name="separator"/>
<addaction name="action_Start_Recording"/>
<addaction name="action_Stop_Recording"/>
</widget>