1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-07 00:14:49 -04:00

All device plugins: make sure start and stop are effective once only. PArt of #2159

This commit is contained in:
f4exb
2024-08-21 05:27:01 +02:00
committed by Edouard Griffiths
parent 1b37a4f504
commit 585d806ef8
40 changed files with 454 additions and 243 deletions
@@ -102,35 +102,45 @@ void PlutoSDRInput::init()
bool PlutoSDRInput::start()
{
QMutexLocker mutexLocker(&m_mutex);
if (m_running) {
return true;
}
if (!m_deviceShared.m_deviceParams->getBox())
{
qCritical("PlutoSDRInput::start: device not open");
return false;
}
if (m_running) {
stop();
}
// start / stop streaming is done in the thread.
m_plutoSDRInputThread = new PlutoSDRInputThread(PLUTOSDR_BLOCKSIZE_SAMPLES, m_deviceShared.m_deviceParams->getBox(), &m_sampleFifo);
qDebug("PlutoSDRInput::start: thread created");
applySettings(m_settings, QList<QString>(), true);
m_plutoSDRInputThread->setLog2Decimation(m_settings.m_log2Decim);
m_plutoSDRInputThread->setIQOrder(m_settings.m_iqOrder);
m_plutoSDRInputThread->startWork();
m_deviceShared.m_thread = m_plutoSDRInputThread;
m_running = true;
mutexLocker.unlock();
applySettings(m_settings, QList<QString>(), true);
return true;
}
void PlutoSDRInput::stop()
{
QMutexLocker mutexLocker(&m_mutex);
if (!m_running) {
return;
}
m_running = false;
if (m_plutoSDRInputThread)
{
m_plutoSDRInputThread->stopWork();
@@ -139,7 +149,6 @@ void PlutoSDRInput::stop()
}
m_deviceShared.m_thread = nullptr;
m_running = false;
}
QByteArray PlutoSDRInput::serialize() const