mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 01:18:38 -05:00
RTLSDR: make sure start and stop are effective once only. PArt of #2159
This commit is contained in:
parent
f6b3b22e4f
commit
beaf2932ba
@ -78,6 +78,7 @@ RTLSDRInput::RTLSDRInput(DeviceAPI *deviceAPI) :
|
||||
|
||||
RTLSDRInput::~RTLSDRInput()
|
||||
{
|
||||
qDebug("RTLSDRInput::~RTLSDRInput");
|
||||
QObject::disconnect(
|
||||
m_networkManager,
|
||||
&QNetworkAccessManager::finished,
|
||||
@ -91,6 +92,7 @@ RTLSDRInput::~RTLSDRInput()
|
||||
}
|
||||
|
||||
closeDevice();
|
||||
qDebug("RTLSDRInput::~RTLSDRInput: end");
|
||||
}
|
||||
|
||||
void RTLSDRInput::destroy()
|
||||
@ -231,11 +233,15 @@ bool RTLSDRInput::start()
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
if (m_running) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!m_dev) {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_running) stop();
|
||||
qDebug("RTLSDRInput::start");
|
||||
|
||||
m_rtlSDRThread = new RTLSDRThread(m_dev, &m_sampleFifo, &m_replayBuffer);
|
||||
m_rtlSDRThread->setSamplerate(m_settings.m_devSampleRate);
|
||||
@ -243,11 +249,11 @@ bool RTLSDRInput::start()
|
||||
m_rtlSDRThread->setFcPos((int) m_settings.m_fcPos);
|
||||
m_rtlSDRThread->setIQOrder(m_settings.m_iqOrder);
|
||||
m_rtlSDRThread->startWork();
|
||||
m_running = true;
|
||||
|
||||
mutexLocker.unlock();
|
||||
|
||||
applySettings(m_settings, QList<QString>(), true);
|
||||
m_running = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -267,6 +273,12 @@ void RTLSDRInput::stop()
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
if (!m_running) {
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug("RTLSDRInput::stop");
|
||||
|
||||
if (m_rtlSDRThread)
|
||||
{
|
||||
m_rtlSDRThread->stopWork();
|
||||
|
Loading…
Reference in New Issue
Block a user