mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-23 00:18:37 -05:00
LimeSDR input: open, close, suspend, resume
This commit is contained in:
parent
ed47cc4d2e
commit
4322a732be
@ -30,7 +30,8 @@ PlutoSDRInput::PlutoSDRInput(DeviceSourceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_fileSink(0),
|
||||
m_deviceDescription("PlutoSDR"),
|
||||
m_running(false)
|
||||
m_running(false),
|
||||
m_plutoRxBuffer(0)
|
||||
{
|
||||
char recFileNameCStr[30];
|
||||
sprintf(recFileNameCStr, "test_%d.sdriq", m_deviceAPI->getDeviceUID());
|
||||
@ -137,21 +138,50 @@ bool PlutoSDRInput::openDevice()
|
||||
// acquire the channel
|
||||
DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox();
|
||||
plutoBox->openRx();
|
||||
|
||||
// TODO: get Rx buffer
|
||||
m_plutoRxBuffer = plutoBox->createRxBuffer(1024*1024, false);
|
||||
}
|
||||
|
||||
void PlutoSDRInput::closeDevice()
|
||||
{
|
||||
if (m_deviceShared.m_deviceParams->getBox() == 0) { // was never open
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_deviceAPI->getSinkBuddies().size() == 0)
|
||||
{
|
||||
m_deviceShared.m_deviceParams->close();
|
||||
delete m_deviceShared.m_deviceParams;
|
||||
m_deviceShared.m_deviceParams = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void PlutoSDRInput::suspendBuddies()
|
||||
{
|
||||
// suspend Tx buddy's thread
|
||||
|
||||
for (unsigned int i = 0; i < m_deviceAPI->getSinkBuddies().size(); i++)
|
||||
{
|
||||
DeviceSinkAPI *buddy = m_deviceAPI->getSinkBuddies()[i];
|
||||
DevicePlutoSDRShared *buddyShared = (DevicePlutoSDRShared *) buddy->getBuddySharedPtr();
|
||||
|
||||
if (buddyShared->m_thread) {
|
||||
buddyShared->m_thread->stopWork();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PlutoSDRInput::resumeBuddies()
|
||||
{
|
||||
// resume Tx buddy's thread
|
||||
|
||||
for (unsigned int i = 0; i < m_deviceAPI->getSinkBuddies().size(); i++)
|
||||
{
|
||||
DeviceSinkAPI *buddy = m_deviceAPI->getSinkBuddies()[i];
|
||||
DevicePlutoSDRShared *buddyShared = (DevicePlutoSDRShared *) buddy->getBuddySharedPtr();
|
||||
|
||||
if (buddyShared->m_thread) {
|
||||
buddyShared->m_thread->startWork();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "iio.h"
|
||||
#include <dsp/devicesamplesource.h>
|
||||
#include "util/message.h"
|
||||
#include "plutosdr/deviceplutosdrshared.h"
|
||||
@ -68,6 +69,7 @@ public:
|
||||
PlutoSDRInputSettings m_settings;
|
||||
bool m_running;
|
||||
DevicePlutoSDRShared m_deviceShared;
|
||||
struct iio_buffer *m_plutoRxBuffer;
|
||||
QMutex m_mutex;
|
||||
|
||||
bool openDevice();
|
||||
|
Loading…
Reference in New Issue
Block a user