mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-09-02 13:17:48 -04:00
LimeSDR: put the code to suspend buddies in one place
This commit is contained in:
parent
463abb637f
commit
d524378d8e
@ -45,17 +45,21 @@ LimeSDROutput::LimeSDROutput(DeviceSinkAPI *deviceAPI) :
|
|||||||
m_channelAcquired(false)
|
m_channelAcquired(false)
|
||||||
{
|
{
|
||||||
m_streamId.handle = 0;
|
m_streamId.handle = 0;
|
||||||
suspendBuddies();
|
suspendRxBuddies();
|
||||||
|
suspendTxBuddies();
|
||||||
openDevice();
|
openDevice();
|
||||||
resumeBuddies();
|
resumeTxBuddies();
|
||||||
|
resumeRxBuddies();
|
||||||
}
|
}
|
||||||
|
|
||||||
LimeSDROutput::~LimeSDROutput()
|
LimeSDROutput::~LimeSDROutput()
|
||||||
{
|
{
|
||||||
if (m_running) stop();
|
if (m_running) stop();
|
||||||
suspendBuddies();
|
suspendRxBuddies();
|
||||||
|
suspendTxBuddies();
|
||||||
closeDevice();
|
closeDevice();
|
||||||
resumeBuddies();
|
resumeTxBuddies();
|
||||||
|
resumeRxBuddies();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LimeSDROutput::destroy()
|
void LimeSDROutput::destroy()
|
||||||
@ -161,56 +165,74 @@ bool LimeSDROutput::openDevice()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LimeSDROutput::suspendBuddies()
|
void LimeSDROutput::suspendRxBuddies()
|
||||||
{
|
{
|
||||||
// suspend Tx buddy's threads
|
const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
|
||||||
|
std::vector<DeviceSourceAPI*>::const_iterator itSource = sourceBuddies.begin();
|
||||||
|
|
||||||
for (unsigned int i = 0; i < m_deviceAPI->getSinkBuddies().size(); i++)
|
for (; itSource != sourceBuddies.end(); ++itSource)
|
||||||
{
|
{
|
||||||
DeviceSinkAPI *buddy = m_deviceAPI->getSinkBuddies()[i];
|
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSource)->getBuddySharedPtr();
|
||||||
DeviceLimeSDRShared *buddyShared = (DeviceLimeSDRShared *) buddy->getBuddySharedPtr();
|
|
||||||
|
|
||||||
if (buddyShared->m_thread) {
|
if (buddySharedPtr->m_thread && buddySharedPtr->m_thread->isRunning())
|
||||||
buddyShared->m_thread->stopWork();
|
{
|
||||||
|
buddySharedPtr->m_thread->stopWork();
|
||||||
|
buddySharedPtr->m_threadWasRunning = true;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
// suspend Rx buddy's threads
|
buddySharedPtr->m_threadWasRunning = false;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < m_deviceAPI->getSourceBuddies().size(); i++)
|
|
||||||
{
|
|
||||||
DeviceSourceAPI *buddy = m_deviceAPI->getSourceBuddies()[i];
|
|
||||||
DeviceLimeSDRShared *buddyShared = (DeviceLimeSDRShared *) buddy->getBuddySharedPtr();
|
|
||||||
|
|
||||||
if (buddyShared->m_thread) {
|
|
||||||
buddyShared->m_thread->stopWork();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LimeSDROutput::resumeBuddies()
|
void LimeSDROutput::suspendTxBuddies()
|
||||||
{
|
{
|
||||||
// resume Tx buddy's threads
|
const std::vector<DeviceSinkAPI*>& sinkBuddies = m_deviceAPI->getSinkBuddies();
|
||||||
|
std::vector<DeviceSinkAPI*>::const_iterator itSink = sinkBuddies.begin();
|
||||||
|
|
||||||
for (unsigned int i = 0; i < m_deviceAPI->getSinkBuddies().size(); i++)
|
for (; itSink != sinkBuddies.end(); ++itSink)
|
||||||
{
|
{
|
||||||
DeviceSinkAPI *buddy = m_deviceAPI->getSinkBuddies()[i];
|
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSink)->getBuddySharedPtr();
|
||||||
DeviceLimeSDRShared *buddyShared = (DeviceLimeSDRShared *) buddy->getBuddySharedPtr();
|
|
||||||
|
|
||||||
if (buddyShared->m_thread) {
|
if (buddySharedPtr->m_thread && buddySharedPtr->m_thread->isRunning())
|
||||||
buddyShared->m_thread->startWork();
|
{
|
||||||
|
buddySharedPtr->m_thread->stopWork();
|
||||||
|
buddySharedPtr->m_threadWasRunning = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buddySharedPtr->m_threadWasRunning = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// resume Rx buddy's threads
|
void LimeSDROutput::resumeRxBuddies()
|
||||||
|
{
|
||||||
|
const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
|
||||||
|
std::vector<DeviceSourceAPI*>::const_iterator itSource = sourceBuddies.begin();
|
||||||
|
|
||||||
for (unsigned int i = 0; i < m_deviceAPI->getSourceBuddies().size(); i++)
|
for (; itSource != sourceBuddies.end(); ++itSource)
|
||||||
{
|
{
|
||||||
DeviceSourceAPI *buddy = m_deviceAPI->getSourceBuddies()[i];
|
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSource)->getBuddySharedPtr();
|
||||||
DeviceLimeSDRShared *buddyShared = (DeviceLimeSDRShared *) buddy->getBuddySharedPtr();
|
|
||||||
|
|
||||||
if (buddyShared->m_thread) {
|
if (buddySharedPtr->m_threadWasRunning) {
|
||||||
buddyShared->m_thread->startWork();
|
buddySharedPtr->m_thread->startWork();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LimeSDROutput::resumeTxBuddies()
|
||||||
|
{
|
||||||
|
const std::vector<DeviceSinkAPI*>& sinkBuddies = m_deviceAPI->getSinkBuddies();
|
||||||
|
std::vector<DeviceSinkAPI*>::const_iterator itSink = sinkBuddies.begin();
|
||||||
|
|
||||||
|
for (; itSink != sinkBuddies.end(); ++itSink)
|
||||||
|
{
|
||||||
|
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSink)->getBuddySharedPtr();
|
||||||
|
|
||||||
|
if (buddySharedPtr->m_threadWasRunning) {
|
||||||
|
buddySharedPtr->m_thread->startWork();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -293,7 +315,7 @@ bool LimeSDROutput::start()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_running) stop();
|
if (m_running) { stop(); }
|
||||||
|
|
||||||
if (!acquireChannel())
|
if (!acquireChannel())
|
||||||
{
|
{
|
||||||
@ -573,41 +595,8 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
|
|||||||
|
|
||||||
if (suspendAllThread)
|
if (suspendAllThread)
|
||||||
{
|
{
|
||||||
const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
|
suspendRxBuddies();
|
||||||
std::vector<DeviceSourceAPI*>::const_iterator itSource = sourceBuddies.begin();
|
suspendTxBuddies();
|
||||||
|
|
||||||
for (; itSource != sourceBuddies.end(); ++itSource)
|
|
||||||
{
|
|
||||||
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSource)->getBuddySharedPtr();
|
|
||||||
|
|
||||||
if (buddySharedPtr->m_thread && buddySharedPtr->m_thread->isRunning())
|
|
||||||
{
|
|
||||||
buddySharedPtr->m_thread->stopWork();
|
|
||||||
buddySharedPtr->m_threadWasRunning = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buddySharedPtr->m_threadWasRunning = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::vector<DeviceSinkAPI*>& sinkBuddies = m_deviceAPI->getSinkBuddies();
|
|
||||||
std::vector<DeviceSinkAPI*>::const_iterator itSink = sinkBuddies.begin();
|
|
||||||
|
|
||||||
for (; itSink != sinkBuddies.end(); ++itSink)
|
|
||||||
{
|
|
||||||
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSink)->getBuddySharedPtr();
|
|
||||||
|
|
||||||
if (buddySharedPtr->m_thread && buddySharedPtr->m_thread->isRunning())
|
|
||||||
{
|
|
||||||
buddySharedPtr->m_thread->stopWork();
|
|
||||||
buddySharedPtr->m_threadWasRunning = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buddySharedPtr->m_threadWasRunning = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_limeSDROutputThread && m_limeSDROutputThread->isRunning())
|
if (m_limeSDROutputThread && m_limeSDROutputThread->isRunning())
|
||||||
{
|
{
|
||||||
@ -617,17 +606,7 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
|
|||||||
}
|
}
|
||||||
else if (suspendTxThread)
|
else if (suspendTxThread)
|
||||||
{
|
{
|
||||||
const std::vector<DeviceSinkAPI*>& sinkBuddies = m_deviceAPI->getSinkBuddies();
|
suspendTxBuddies();
|
||||||
std::vector<DeviceSinkAPI*>::const_iterator itSink = sinkBuddies.begin();
|
|
||||||
|
|
||||||
for (; itSink != sinkBuddies.end(); ++itSink)
|
|
||||||
{
|
|
||||||
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSink)->getBuddySharedPtr();
|
|
||||||
|
|
||||||
if (buddySharedPtr->m_thread) {
|
|
||||||
buddySharedPtr->m_thread->stopWork();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_limeSDROutputThread && m_limeSDROutputThread->isRunning())
|
if (m_limeSDROutputThread && m_limeSDROutputThread->isRunning())
|
||||||
{
|
{
|
||||||
@ -851,29 +830,8 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
|
|||||||
|
|
||||||
if (suspendAllThread)
|
if (suspendAllThread)
|
||||||
{
|
{
|
||||||
const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
|
resumeTxBuddies();
|
||||||
std::vector<DeviceSourceAPI*>::const_iterator itSource = sourceBuddies.begin();
|
resumeRxBuddies();
|
||||||
|
|
||||||
for (; itSource != sourceBuddies.end(); ++itSource)
|
|
||||||
{
|
|
||||||
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSource)->getBuddySharedPtr();
|
|
||||||
|
|
||||||
if (buddySharedPtr->m_threadWasRunning) {
|
|
||||||
buddySharedPtr->m_thread->startWork();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::vector<DeviceSinkAPI*>& sinkBuddies = m_deviceAPI->getSinkBuddies();
|
|
||||||
std::vector<DeviceSinkAPI*>::const_iterator itSink = sinkBuddies.begin();
|
|
||||||
|
|
||||||
for (; itSink != sinkBuddies.end(); ++itSink)
|
|
||||||
{
|
|
||||||
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSink)->getBuddySharedPtr();
|
|
||||||
|
|
||||||
if (buddySharedPtr->m_threadWasRunning) {
|
|
||||||
buddySharedPtr->m_thread->startWork();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ownThreadWasRunning) {
|
if (ownThreadWasRunning) {
|
||||||
m_limeSDROutputThread->startWork();
|
m_limeSDROutputThread->startWork();
|
||||||
@ -881,17 +839,7 @@ bool LimeSDROutput::applySettings(const LimeSDROutputSettings& settings, bool fo
|
|||||||
}
|
}
|
||||||
else if (suspendTxThread)
|
else if (suspendTxThread)
|
||||||
{
|
{
|
||||||
const std::vector<DeviceSinkAPI*>& sinkBuddies = m_deviceAPI->getSinkBuddies();
|
resumeTxBuddies();
|
||||||
std::vector<DeviceSinkAPI*>::const_iterator itSink = sinkBuddies.begin();
|
|
||||||
|
|
||||||
for (; itSink != sinkBuddies.end(); ++itSink)
|
|
||||||
{
|
|
||||||
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSink)->getBuddySharedPtr();
|
|
||||||
|
|
||||||
if (buddySharedPtr->m_threadWasRunning) {
|
|
||||||
buddySharedPtr->m_thread->startWork();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ownThreadWasRunning) {
|
if (ownThreadWasRunning) {
|
||||||
m_limeSDROutputThread->startWork();
|
m_limeSDROutputThread->startWork();
|
||||||
|
@ -224,8 +224,10 @@ private:
|
|||||||
void closeDevice();
|
void closeDevice();
|
||||||
bool acquireChannel();
|
bool acquireChannel();
|
||||||
void releaseChannel();
|
void releaseChannel();
|
||||||
void suspendBuddies();
|
void suspendRxBuddies();
|
||||||
void resumeBuddies();
|
void resumeRxBuddies();
|
||||||
|
void suspendTxBuddies();
|
||||||
|
void resumeTxBuddies();
|
||||||
bool applySettings(const LimeSDROutputSettings& settings, bool force = false);
|
bool applySettings(const LimeSDROutputSettings& settings, bool force = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -46,9 +46,11 @@ LimeSDRInput::LimeSDRInput(DeviceSourceAPI *deviceAPI) :
|
|||||||
m_firstConfig(true)
|
m_firstConfig(true)
|
||||||
{
|
{
|
||||||
m_streamId.handle = 0;
|
m_streamId.handle = 0;
|
||||||
suspendBuddies();
|
suspendRxBuddies();
|
||||||
|
suspendTxBuddies();
|
||||||
openDevice();
|
openDevice();
|
||||||
resumeBuddies();
|
resumeTxBuddies();
|
||||||
|
resumeRxBuddies();
|
||||||
|
|
||||||
char recFileNameCStr[30];
|
char recFileNameCStr[30];
|
||||||
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
|
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
|
||||||
@ -61,9 +63,11 @@ LimeSDRInput::~LimeSDRInput()
|
|||||||
if (m_running) stop();
|
if (m_running) stop();
|
||||||
m_deviceAPI->removeSink(m_fileSink);
|
m_deviceAPI->removeSink(m_fileSink);
|
||||||
delete m_fileSink;
|
delete m_fileSink;
|
||||||
suspendBuddies();
|
suspendRxBuddies();
|
||||||
|
suspendTxBuddies();
|
||||||
closeDevice();
|
closeDevice();
|
||||||
resumeBuddies();
|
resumeTxBuddies();
|
||||||
|
resumeRxBuddies();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LimeSDRInput::destroy()
|
void LimeSDRInput::destroy()
|
||||||
@ -209,56 +213,73 @@ bool LimeSDRInput::openDevice()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LimeSDRInput::suspendBuddies()
|
void LimeSDRInput::suspendRxBuddies()
|
||||||
{
|
{
|
||||||
// suspend Rx buddy's threads
|
const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
|
||||||
|
std::vector<DeviceSourceAPI*>::const_iterator itSource = sourceBuddies.begin();
|
||||||
|
|
||||||
for (unsigned int i = 0; i < m_deviceAPI->getSourceBuddies().size(); i++)
|
for (; itSource != sourceBuddies.end(); ++itSource)
|
||||||
{
|
{
|
||||||
DeviceSourceAPI *buddy = m_deviceAPI->getSourceBuddies()[i];
|
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSource)->getBuddySharedPtr();
|
||||||
DeviceLimeSDRShared *buddyShared = (DeviceLimeSDRShared *) buddy->getBuddySharedPtr();
|
|
||||||
|
|
||||||
if (buddyShared->m_thread) {
|
if (buddySharedPtr->m_thread && buddySharedPtr->m_thread->isRunning())
|
||||||
buddyShared->m_thread->stopWork();
|
{
|
||||||
|
buddySharedPtr->m_thread->stopWork();
|
||||||
|
buddySharedPtr->m_threadWasRunning = true;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
// suspend Tx buddy's threads
|
buddySharedPtr->m_threadWasRunning = false;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < m_deviceAPI->getSinkBuddies().size(); i++)
|
|
||||||
{
|
|
||||||
DeviceSinkAPI *buddy = m_deviceAPI->getSinkBuddies()[i];
|
|
||||||
DeviceLimeSDRShared *buddyShared = (DeviceLimeSDRShared *) buddy->getBuddySharedPtr();
|
|
||||||
|
|
||||||
if (buddyShared->m_thread) {
|
|
||||||
buddyShared->m_thread->stopWork();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LimeSDRInput::resumeBuddies()
|
void LimeSDRInput::suspendTxBuddies()
|
||||||
{
|
{
|
||||||
// resume Rx buddy's threads
|
const std::vector<DeviceSinkAPI*>& sinkBuddies = m_deviceAPI->getSinkBuddies();
|
||||||
|
std::vector<DeviceSinkAPI*>::const_iterator itSink = sinkBuddies.begin();
|
||||||
|
|
||||||
for (unsigned int i = 0; i < m_deviceAPI->getSourceBuddies().size(); i++)
|
for (; itSink != sinkBuddies.end(); ++itSink)
|
||||||
{
|
{
|
||||||
DeviceSourceAPI *buddy = m_deviceAPI->getSourceBuddies()[i];
|
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSink)->getBuddySharedPtr();
|
||||||
DeviceLimeSDRShared *buddyShared = (DeviceLimeSDRShared *) buddy->getBuddySharedPtr();
|
|
||||||
|
|
||||||
if (buddyShared->m_thread) {
|
if (buddySharedPtr->m_thread) {
|
||||||
buddyShared->m_thread->startWork();
|
buddySharedPtr->m_thread->stopWork();
|
||||||
|
buddySharedPtr->m_threadWasRunning = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buddySharedPtr->m_threadWasRunning = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// resume Tx buddy's threads
|
void LimeSDRInput::resumeRxBuddies()
|
||||||
|
{
|
||||||
|
const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
|
||||||
|
std::vector<DeviceSourceAPI*>::const_iterator itSource = sourceBuddies.begin();
|
||||||
|
|
||||||
for (unsigned int i = 0; i < m_deviceAPI->getSinkBuddies().size(); i++)
|
for (; itSource != sourceBuddies.end(); ++itSource)
|
||||||
{
|
{
|
||||||
DeviceSinkAPI *buddy = m_deviceAPI->getSinkBuddies()[i];
|
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSource)->getBuddySharedPtr();
|
||||||
DeviceLimeSDRShared *buddyShared = (DeviceLimeSDRShared *) buddy->getBuddySharedPtr();
|
|
||||||
|
|
||||||
if (buddyShared->m_thread) {
|
if (buddySharedPtr->m_threadWasRunning) {
|
||||||
buddyShared->m_thread->startWork();
|
buddySharedPtr->m_thread->startWork();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LimeSDRInput::resumeTxBuddies()
|
||||||
|
{
|
||||||
|
const std::vector<DeviceSinkAPI*>& sinkBuddies = m_deviceAPI->getSinkBuddies();
|
||||||
|
std::vector<DeviceSinkAPI*>::const_iterator itSink = sinkBuddies.begin();
|
||||||
|
|
||||||
|
for (; itSink != sinkBuddies.end(); ++itSink)
|
||||||
|
{
|
||||||
|
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSink)->getBuddySharedPtr();
|
||||||
|
|
||||||
|
if (buddySharedPtr->m_threadWasRunning) {
|
||||||
|
buddySharedPtr->m_thread->startWork();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -593,40 +614,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
|||||||
|
|
||||||
if (suspendAllThread)
|
if (suspendAllThread)
|
||||||
{
|
{
|
||||||
const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
|
suspendRxBuddies();
|
||||||
std::vector<DeviceSourceAPI*>::const_iterator itSource = sourceBuddies.begin();
|
suspendTxBuddies();
|
||||||
|
|
||||||
for (; itSource != sourceBuddies.end(); ++itSource)
|
|
||||||
{
|
|
||||||
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSource)->getBuddySharedPtr();
|
|
||||||
|
|
||||||
if (buddySharedPtr->m_thread && buddySharedPtr->m_thread->isRunning())
|
|
||||||
{
|
|
||||||
buddySharedPtr->m_thread->stopWork();
|
|
||||||
buddySharedPtr->m_threadWasRunning = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buddySharedPtr->m_threadWasRunning = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::vector<DeviceSinkAPI*>& sinkBuddies = m_deviceAPI->getSinkBuddies();
|
|
||||||
std::vector<DeviceSinkAPI*>::const_iterator itSink = sinkBuddies.begin();
|
|
||||||
|
|
||||||
for (; itSink != sinkBuddies.end(); ++itSink)
|
|
||||||
{
|
|
||||||
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSink)->getBuddySharedPtr();
|
|
||||||
|
|
||||||
if (buddySharedPtr->m_thread) {
|
|
||||||
buddySharedPtr->m_thread->stopWork();
|
|
||||||
buddySharedPtr->m_threadWasRunning = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buddySharedPtr->m_threadWasRunning = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_limeSDRInputThread && m_limeSDRInputThread->isRunning())
|
if (m_limeSDRInputThread && m_limeSDRInputThread->isRunning())
|
||||||
{
|
{
|
||||||
@ -636,17 +625,7 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
|||||||
}
|
}
|
||||||
else if (suspendRxThread)
|
else if (suspendRxThread)
|
||||||
{
|
{
|
||||||
const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
|
suspendRxBuddies();
|
||||||
std::vector<DeviceSourceAPI*>::const_iterator itSource = sourceBuddies.begin();
|
|
||||||
|
|
||||||
for (; itSource != sourceBuddies.end(); ++itSource)
|
|
||||||
{
|
|
||||||
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSource)->getBuddySharedPtr();
|
|
||||||
|
|
||||||
if (buddySharedPtr->m_thread) {
|
|
||||||
buddySharedPtr->m_thread->stopWork();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_limeSDRInputThread && m_limeSDRInputThread->isRunning())
|
if (m_limeSDRInputThread && m_limeSDRInputThread->isRunning())
|
||||||
{
|
{
|
||||||
@ -1015,29 +994,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|
|||||||
|
|
||||||
if (suspendAllThread)
|
if (suspendAllThread)
|
||||||
{
|
{
|
||||||
const std::vector<DeviceSourceAPI*>& sourceBuddies = m_deviceAPI->getSourceBuddies();
|
resumeTxBuddies();
|
||||||
std::vector<DeviceSourceAPI*>::const_iterator itSource = sourceBuddies.begin();
|
resumeRxBuddies();
|
||||||
|
|
||||||
for (; itSource != sourceBuddies.end(); ++itSource)
|
|
||||||
{
|
|
||||||
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSource)->getBuddySharedPtr();
|
|
||||||
|
|
||||||
if (buddySharedPtr->m_threadWasRunning) {
|
|
||||||
buddySharedPtr->m_thread->startWork();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::vector<DeviceSinkAPI*>& sinkBuddies = m_deviceAPI->getSinkBuddies();
|
|
||||||
std::vector<DeviceSinkAPI*>::const_iterator itSink = sinkBuddies.begin();
|
|
||||||
|
|
||||||
for (; itSink != sinkBuddies.end(); ++itSink)
|
|
||||||
{
|
|
||||||
DeviceLimeSDRShared *buddySharedPtr = (DeviceLimeSDRShared *) (*itSink)->getBuddySharedPtr();
|
|
||||||
|
|
||||||
if (buddySharedPtr->m_threadWasRunning) {
|
|
||||||
buddySharedPtr->m_thread->startWork();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ownThreadWasRunning) {
|
if (ownThreadWasRunning) {
|
||||||
m_limeSDRInputThread->startWork();
|
m_limeSDRInputThread->startWork();
|
||||||
|
@ -241,8 +241,10 @@ private:
|
|||||||
|
|
||||||
bool openDevice();
|
bool openDevice();
|
||||||
void closeDevice();
|
void closeDevice();
|
||||||
void suspendBuddies();
|
void suspendRxBuddies();
|
||||||
void resumeBuddies();
|
void resumeRxBuddies();
|
||||||
|
void suspendTxBuddies();
|
||||||
|
void resumeTxBuddies();
|
||||||
bool applySettings(const LimeSDRInputSettings& settings, bool force = false);
|
bool applySettings(const LimeSDRInputSettings& settings, bool force = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user