mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-08 08:54:49 -04:00
Single DeviceAPI interface (1)
This commit is contained in:
@@ -27,10 +27,11 @@
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspdevicesourceengine.h"
|
||||
#include "dsp/dspdevicesinkengine.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/filerecord.h"
|
||||
#include "device/devicesourceapi.h"
|
||||
#include "device/devicesinkapi.h"
|
||||
#include "device/deviceapi.h"
|
||||
|
||||
#include "bladerf1input.h"
|
||||
#include "bladerf1inputthread.h"
|
||||
@@ -39,7 +40,7 @@ MESSAGE_CLASS_DEFINITION(Bladerf1Input::MsgConfigureBladerf1, Message)
|
||||
MESSAGE_CLASS_DEFINITION(Bladerf1Input::MsgStartStop, Message)
|
||||
MESSAGE_CLASS_DEFINITION(Bladerf1Input::MsgFileRecord, Message)
|
||||
|
||||
Bladerf1Input::Bladerf1Input(DeviceSourceAPI *deviceAPI) :
|
||||
Bladerf1Input::Bladerf1Input(DeviceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_settings(),
|
||||
m_dev(0),
|
||||
@@ -49,7 +50,7 @@ Bladerf1Input::Bladerf1Input(DeviceSourceAPI *deviceAPI) :
|
||||
{
|
||||
openDevice();
|
||||
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
|
||||
m_deviceAPI->addSink(m_fileSink);
|
||||
m_deviceAPI->addAncillarySink(m_fileSink);
|
||||
|
||||
m_deviceAPI->setBuddySharedPtr(&m_sharedParams);
|
||||
|
||||
@@ -66,7 +67,7 @@ Bladerf1Input::~Bladerf1Input()
|
||||
stop();
|
||||
}
|
||||
|
||||
m_deviceAPI->removeSink(m_fileSink);
|
||||
m_deviceAPI->removeAncillarySink(m_fileSink);
|
||||
delete m_fileSink;
|
||||
closeDevice();
|
||||
m_deviceAPI->setBuddySharedPtr(0);
|
||||
@@ -94,7 +95,7 @@ bool Bladerf1Input::openDevice()
|
||||
|
||||
if (m_deviceAPI->getSinkBuddies().size() > 0)
|
||||
{
|
||||
DeviceSinkAPI *sinkBuddy = m_deviceAPI->getSinkBuddies()[0];
|
||||
DeviceAPI *sinkBuddy = m_deviceAPI->getSinkBuddies()[0];
|
||||
DeviceBladeRF1Params *buddySharedParams = (DeviceBladeRF1Params *) sinkBuddy->getBuddySharedPtr();
|
||||
|
||||
if (buddySharedParams == 0)
|
||||
@@ -114,9 +115,9 @@ bool Bladerf1Input::openDevice()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!DeviceBladeRF1::open_bladerf(&m_dev, qPrintable(m_deviceAPI->getSampleSourceSerial())))
|
||||
if (!DeviceBladeRF1::open_bladerf(&m_dev, qPrintable(m_deviceAPI->getSamplingDeviceSerial())))
|
||||
{
|
||||
qCritical("BladerfInput::start: could not open BladeRF %s", qPrintable(m_deviceAPI->getSampleSourceSerial()));
|
||||
qCritical("BladerfInput::start: could not open BladeRF %s", qPrintable(m_deviceAPI->getSamplingDeviceSerial()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -313,14 +314,14 @@ bool Bladerf1Input::handleMessage(const Message& message)
|
||||
|
||||
if (cmd.getStartStop())
|
||||
{
|
||||
if (m_deviceAPI->initAcquisition())
|
||||
if (m_deviceAPI->initDeviceEngine())
|
||||
{
|
||||
m_deviceAPI->startAcquisition();
|
||||
m_deviceAPI->startDeviceEngine();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopAcquisition();
|
||||
m_deviceAPI->stopDeviceEngine();
|
||||
}
|
||||
|
||||
if (m_settings.m_useReverseAPI) {
|
||||
@@ -408,7 +409,7 @@ bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, bool fo
|
||||
|
||||
if (m_deviceAPI->getSinkBuddies().size() > 0)
|
||||
{
|
||||
DeviceSinkAPI *buddy = m_deviceAPI->getSinkBuddies()[0];
|
||||
DeviceAPI *buddy = m_deviceAPI->getSinkBuddies()[0];
|
||||
|
||||
if (buddy->getDeviceSinkEngine()->state() == DSPDeviceSinkEngine::StRunning) { // Tx side running
|
||||
changeSettings = false;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
class QNetworkAccessManager;
|
||||
class QNetworkReply;
|
||||
class DeviceSourceAPI;
|
||||
class DeviceAPI;
|
||||
class Bladerf1InputThread;
|
||||
class FileRecord;
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
{ }
|
||||
};
|
||||
|
||||
Bladerf1Input(DeviceSourceAPI *deviceAPI);
|
||||
Bladerf1Input(DeviceAPI *deviceAPI);
|
||||
virtual ~Bladerf1Input();
|
||||
virtual void destroy();
|
||||
|
||||
@@ -139,7 +139,7 @@ public:
|
||||
QString& errorMessage);
|
||||
|
||||
private:
|
||||
DeviceSourceAPI *m_deviceAPI;
|
||||
DeviceAPI *m_deviceAPI;
|
||||
QMutex m_mutex;
|
||||
BladeRF1InputSettings m_settings;
|
||||
struct bladerf* m_dev;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "gui/basicdevicesettingsdialog.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "device/devicesourceapi.h"
|
||||
#include "device/deviceapi.h"
|
||||
#include "device/deviceuiset.h"
|
||||
|
||||
#include "bladerf1inputgui.h"
|
||||
@@ -42,9 +42,9 @@ Bladerf1InputGui::Bladerf1InputGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||
m_sampleRateMode(true),
|
||||
m_sampleSource(NULL),
|
||||
m_sampleRate(0),
|
||||
m_lastEngineState(DSPDeviceSourceEngine::StNotStarted)
|
||||
m_lastEngineState(DeviceAPI::StNotStarted)
|
||||
{
|
||||
m_sampleSource = (Bladerf1Input*) m_deviceUISet->m_deviceSourceAPI->getSampleSource();
|
||||
m_sampleSource = (Bladerf1Input*) m_deviceUISet->m_deviceAPI->getSampleSource();
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||
@@ -471,24 +471,24 @@ void Bladerf1InputGui::blockApplySettings(bool block)
|
||||
|
||||
void Bladerf1InputGui::updateStatus()
|
||||
{
|
||||
int state = m_deviceUISet->m_deviceSourceAPI->state();
|
||||
int state = m_deviceUISet->m_deviceAPI->state();
|
||||
|
||||
if(m_lastEngineState != state)
|
||||
{
|
||||
switch(state)
|
||||
{
|
||||
case DSPDeviceSourceEngine::StNotStarted:
|
||||
case DeviceAPI::StNotStarted:
|
||||
ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||
break;
|
||||
case DSPDeviceSourceEngine::StIdle:
|
||||
case DeviceAPI::StIdle:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
|
||||
break;
|
||||
case DSPDeviceSourceEngine::StRunning:
|
||||
case DeviceAPI::StRunning:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
|
||||
break;
|
||||
case DSPDeviceSourceEngine::StError:
|
||||
case DeviceAPI::StError:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : red; }");
|
||||
QMessageBox::information(this, tr("Message"), m_deviceUISet->m_deviceSourceAPI->errorMessage());
|
||||
QMessageBox::information(this, tr("Message"), m_deviceUISet->m_deviceAPI->errorMessage());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -135,7 +135,7 @@ PluginInstanceGUI* Blderf1InputPlugin::createSampleSourcePluginInstanceGUI(
|
||||
}
|
||||
#endif
|
||||
|
||||
DeviceSampleSource *Blderf1InputPlugin::createSampleSourcePluginInstanceInput(const QString& sourceId, DeviceSourceAPI *deviceAPI)
|
||||
DeviceSampleSource *Blderf1InputPlugin::createSampleSourcePluginInstanceInput(const QString& sourceId, DeviceAPI *deviceAPI)
|
||||
{
|
||||
if (sourceId == m_deviceTypeID)
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "plugin/plugininterface.h"
|
||||
|
||||
class PluginAPI;
|
||||
class DeviceSourceAPI;
|
||||
class DeviceAPI;
|
||||
class DeviceUISet;
|
||||
|
||||
#define BLADERF1INPUT_DEVICE_TYPE_ID "sdrangel.samplesource.bladerf1input"
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
const QString& sourceId,
|
||||
QWidget **widget,
|
||||
DeviceUISet *deviceUISet);
|
||||
virtual DeviceSampleSource* createSampleSourcePluginInstanceInput(const QString& sourceId, DeviceSourceAPI *deviceAPI);
|
||||
virtual DeviceSampleSource* createSampleSourcePluginInstanceInput(const QString& sourceId, DeviceAPI *deviceAPI);
|
||||
|
||||
static const QString m_hardwareID;
|
||||
static const QString m_deviceTypeID;
|
||||
|
||||
Reference in New Issue
Block a user