BladerRF2 input support (8). Streams but thread issue

pull/228/head
f4exb 2018-09-25 08:45:57 +02:00
rodzic b20feec1fd
commit 47a4da4142
5 zmienionych plików z 21 dodań i 8 usunięć

Wyświetl plik

@ -32,7 +32,7 @@ public:
class InputThreadInterface
{
public:
virtual ~InputThreadInterface() = 0;
virtual ~InputThreadInterface() {}
virtual void startWork() = 0;
virtual void stopWork() = 0;
virtual bool isRunning() const = 0;
@ -48,7 +48,7 @@ public:
class OutputThreadInterface
{
public:
virtual ~OutputThreadInterface() = 0;
virtual ~OutputThreadInterface() {}
virtual void startWork() = 0;
virtual void stopWork() = 0;
virtual bool isRunning() = 0;

Wyświetl plik

@ -42,7 +42,8 @@ BladeRF2Input::BladeRF2Input(DeviceSourceAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_settings(),
m_deviceDescription("BladeRF2Input"),
m_running(false)
m_running(false),
m_thread(0)
{
openDevice();
@ -313,11 +314,13 @@ void BladeRF2Input::stop()
}
int nbOriginalChannels = m_deviceShared.m_inputThread->getNbChannels();
Bladerf2InputThread *bladerf2InputThread = 0;
if (nbOriginalChannels == 1) // SI mode
{
m_deviceShared.m_inputThread->stopWork();
delete m_deviceShared.m_inputThread;
bladerf2InputThread = (Bladerf2InputThread*) m_deviceShared.m_inputThread;
delete bladerf2InputThread;
m_deviceShared.m_inputThread = 0;
m_running = false;
}
@ -334,8 +337,10 @@ void BladeRF2Input::stop()
fcPoss[i] = m_deviceShared.m_inputThread->getFcPos(i);
}
delete m_deviceShared.m_inputThread;
m_deviceShared.m_inputThread = new Bladerf2InputThread(m_deviceShared.m_dev->getDev(), nbOriginalChannels-1);
bladerf2InputThread = (Bladerf2InputThread*) m_deviceShared.m_inputThread;
delete bladerf2InputThread;
bladerf2InputThread = new Bladerf2InputThread(m_deviceShared.m_dev->getDev(), nbOriginalChannels-1);
m_deviceShared.m_inputThread = bladerf2InputThread;
for (int i = 0; i < nbOriginalChannels-1; i++) { // restore original FIFO references
m_deviceShared.m_inputThread->setFifo(i, fifos[i]);

Wyświetl plik

@ -26,7 +26,7 @@
#include "bladerf2inputsettings.h"
class DeviceSourceAPI;
class LimeSDRInputThread;
class BladeRF2InputThread;
class FileRecord;
class BladeRF2Input : public DeviceSampleSource
@ -147,6 +147,7 @@ private:
QString m_deviceDescription;
bool m_running;
DeviceBladeRF2Shared m_deviceShared;
BladeRF2InputThread *m_thread;
FileRecord *m_fileSink; //!< File sink to record device I/Q output
bool openDevice();

Wyświetl plik

@ -23,11 +23,18 @@ Bladerf2InputThread::Bladerf2InputThread(struct bladerf* dev, unsigned int nbRxC
m_nbChannels(nbRxChannels)
{
m_channels = new Channel[nbRxChannels];
for (unsigned int i = 0; i < nbRxChannels; i++) {
m_channels[i].m_convertBuffer.resize(DeviceBladeRF2::blockSize, Sample{0,0});
}
m_buf = new qint16[2*DeviceBladeRF2::blockSize*nbRxChannels];
}
Bladerf2InputThread::~Bladerf2InputThread()
{
qDebug("Bladerf2InputThread::~Bladerf2InputThread");
if (m_running) {
stopWork();
}

Wyświetl plik

@ -37,7 +37,7 @@ class Bladerf2InputThread : public QThread, public DeviceBladeRF2Shared::InputTh
public:
Bladerf2InputThread(struct bladerf* dev, unsigned int nbRxChannels, QObject* parent = NULL);
virtual ~Bladerf2InputThread();
~Bladerf2InputThread();
virtual void startWork();
virtual void stopWork();