1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-07-28 04:54:13 -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
@@ -47,6 +47,7 @@ MESSAGE_CLASS_DEFINITION(RemoteOutput::MsgRequestFixedData, Message)
RemoteOutput::RemoteOutput(DeviceAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_running(false),
m_settings(),
m_centerFrequency(435000000),
m_sampleRate(48000),
@@ -95,6 +96,11 @@ void RemoteOutput::destroy()
bool RemoteOutput::start()
{
QMutexLocker mutexLocker(&m_mutex);
if (m_running) {
return true;
}
qDebug() << "RemoteOutput::start";
m_remoteOutputWorker = new RemoteOutputWorker(&m_sampleSourceFifo);
@@ -105,6 +111,7 @@ bool RemoteOutput::start()
m_remoteOutputWorker->setNbBlocksFEC(m_settings.m_nbFECBlocks);
m_remoteOutputWorker->connectTimer(m_masterTimer);
startWorker();
m_running = true;
mutexLocker.unlock();
applySampleRate();
@@ -121,12 +128,18 @@ void RemoteOutput::init()
void RemoteOutput::stop()
{
qDebug() << "RemoteOutput::stop";
QMutexLocker mutexLocker(&m_mutex);
if (!m_running) {
return;
}
qDebug() << "RemoteOutput::stop";
m_running = false;
if (m_remoteOutputWorker)
{
stopWorker();
stopWorker();
delete m_remoteOutputWorker;
m_remoteOutputWorker = nullptr;
}