mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-23 00:18:37 -05:00
LimeSDR input: interim state (1)
This commit is contained in:
parent
a24236a300
commit
ed47cc4d2e
@ -19,6 +19,8 @@
|
||||
#include "dsp/filerecord.h"
|
||||
#include "device/devicesourceapi.h"
|
||||
#include "device/devicesinkapi.h"
|
||||
#include "plutosdr/deviceplutosdrparams.h"
|
||||
#include "plutosdr/deviceplutosdrbox.h"
|
||||
|
||||
#include "plutosdrinput.h"
|
||||
|
||||
@ -90,7 +92,53 @@ bool PlutoSDRInput::handleMessage(const Message& message)
|
||||
|
||||
bool PlutoSDRInput::openDevice()
|
||||
{
|
||||
if (!m_sampleFifo.setSize(96000 * 4))
|
||||
{
|
||||
qCritical("PlutoSDRInput::openDevice: could not allocate SampleFifo");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug("PlutoSDRInput::openDevice: allocated SampleFifo");
|
||||
}
|
||||
|
||||
// look for Tx buddy and get reference to common parameters
|
||||
if (m_deviceAPI->getSinkBuddies().size() > 0) // then sink
|
||||
{
|
||||
qDebug("PlutoSDRInput::openDevice: look at Tx buddy");
|
||||
|
||||
DeviceSinkAPI *sinkBuddy = m_deviceAPI->getSinkBuddies()[0];
|
||||
m_deviceShared = *((DevicePlutoSDRShared *) sinkBuddy->getBuddySharedPtr()); // copy parameters
|
||||
|
||||
if (m_deviceShared.m_deviceParams == 0)
|
||||
{
|
||||
qCritical("PlutoSDRInput::openDevice: cannot get device parameters from Tx buddy");
|
||||
return false; // the device params should have been created by the buddy
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug("PlutoSDRInput::openDevice: getting device parameters from Tx buddy");
|
||||
}
|
||||
}
|
||||
// There is no buddy then create the first PlutoSDR common parameters
|
||||
// open the device this will also populate common fields
|
||||
else
|
||||
{
|
||||
qDebug("PlutoSDRInput::openDevice: open device here");
|
||||
|
||||
m_deviceShared.m_deviceParams = new DevicePlutoSDRParams();
|
||||
char serial[256];
|
||||
strcpy(serial, qPrintable(m_deviceAPI->getSampleSourceSerial()));
|
||||
m_deviceShared.m_deviceParams->open(serial);
|
||||
}
|
||||
|
||||
m_deviceAPI->setBuddySharedPtr(&m_deviceShared); // propagate common parameters to API
|
||||
|
||||
// acquire the channel
|
||||
DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox();
|
||||
plutoBox->openRx();
|
||||
|
||||
// TODO: get Rx buffer
|
||||
}
|
||||
|
||||
void PlutoSDRInput::closeDevice()
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include <dsp/devicesamplesource.h>
|
||||
#include "util/message.h"
|
||||
|
||||
#include "plutosdr/deviceplutosdrshared.h"
|
||||
#include "plutosdrinputsettings.h"
|
||||
|
||||
class DeviceSourceAPI;
|
||||
@ -67,6 +67,7 @@ public:
|
||||
QString m_deviceDescription;
|
||||
PlutoSDRInputSettings m_settings;
|
||||
bool m_running;
|
||||
DevicePlutoSDRShared m_deviceShared;
|
||||
QMutex m_mutex;
|
||||
|
||||
bool openDevice();
|
||||
|
Loading…
Reference in New Issue
Block a user