1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-02 06:04:39 -04:00

Single DeviceAPI interface (1)

This commit is contained in:
f4exb
2019-05-08 22:11:53 +02:00
parent 69313daeae
commit 89e53cf179
255 changed files with 1632 additions and 1717 deletions
@@ -29,8 +29,7 @@
#include "dsp/dspcommands.h"
#include "dsp/dspengine.h"
#include "dsp/filerecord.h"
#include "device/devicesourceapi.h"
#include "device/devicesinkapi.h"
#include "device/deviceapi.h"
#include "hackrf/devicehackrfvalues.h"
#include "hackrf/devicehackrfshared.h"
@@ -42,7 +41,7 @@ MESSAGE_CLASS_DEFINITION(HackRFInput::MsgReportHackRF, Message)
MESSAGE_CLASS_DEFINITION(HackRFInput::MsgFileRecord, Message)
MESSAGE_CLASS_DEFINITION(HackRFInput::MsgStartStop, Message)
HackRFInput::HackRFInput(DeviceSourceAPI *deviceAPI) :
HackRFInput::HackRFInput(DeviceAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_settings(),
m_dev(0),
@@ -53,7 +52,7 @@ HackRFInput::HackRFInput(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);
@@ -70,7 +69,7 @@ HackRFInput::~HackRFInput()
stop();
}
m_deviceAPI->removeSink(m_fileSink);
m_deviceAPI->removeAncillarySink(m_fileSink);
delete m_fileSink;
closeDevice();
m_deviceAPI->setBuddySharedPtr(0);
@@ -96,7 +95,7 @@ bool HackRFInput::openDevice()
if (m_deviceAPI->getSinkBuddies().size() > 0)
{
DeviceSinkAPI *buddy = m_deviceAPI->getSinkBuddies()[0];
DeviceAPI *buddy = m_deviceAPI->getSinkBuddies()[0];
DeviceHackRFParams *buddySharedParams = (DeviceHackRFParams *) buddy->getBuddySharedPtr();
if (buddySharedParams == 0)
@@ -116,9 +115,9 @@ bool HackRFInput::openDevice()
}
else
{
if ((m_dev = DeviceHackRF::open_hackrf(qPrintable(m_deviceAPI->getSampleSourceSerial()))) == 0)
if ((m_dev = DeviceHackRF::open_hackrf(qPrintable(m_deviceAPI->getSamplingDeviceSerial()))) == 0)
{
qCritical("HackRFInput::openDevice: could not open HackRF %s", qPrintable(m_deviceAPI->getSampleSourceSerial()));
qCritical("HackRFInput::openDevice: could not open HackRF %s", qPrintable(m_deviceAPI->getSamplingDeviceSerial()));
return false;
}
@@ -296,14 +295,14 @@ bool HackRFInput::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) {
@@ -450,9 +449,9 @@ bool HackRFInput::applySettings(const HackRFInputSettings& settings, bool force)
if (m_deviceAPI->getSinkBuddies().size() > 0) // forward to buddy if necessary
{
DeviceSinkAPI *buddy = m_deviceAPI->getSinkBuddies()[0];
DeviceAPI *buddy = m_deviceAPI->getSinkBuddies()[0];
DeviceHackRFShared::MsgSynchronizeFrequency *freqMsg = DeviceHackRFShared::MsgSynchronizeFrequency::create(deviceCenterFrequency);
buddy->getSampleSinkInputMessageQueue()->push(freqMsg);
buddy->getSamplingDeviceInputMessageQueue()->push(freqMsg);
}
forwardChange = true;
@@ -30,7 +30,7 @@
class QNetworkAccessManager;
class QNetworkReply;
class DeviceSourceAPI;
class DeviceAPI;
class HackRFInputThread;
class FileRecord;
@@ -116,7 +116,7 @@ public:
{ }
};
HackRFInput(DeviceSourceAPI *deviceAPI);
HackRFInput(DeviceAPI *deviceAPI);
virtual ~HackRFInput();
virtual void destroy();
@@ -157,7 +157,7 @@ public:
private:
DeviceSourceAPI *m_deviceAPI;
DeviceAPI *m_deviceAPI;
QMutex m_mutex;
HackRFInputSettings m_settings;
struct hackrf_device* m_dev;
@@ -28,8 +28,7 @@
#include "gui/basicdevicesettingsdialog.h"
#include "dsp/dspengine.h"
#include "dsp/dspcommands.h"
#include "device/devicesourceapi.h"
#include "device/devicesinkapi.h"
#include "device/deviceapi.h"
#include "device/deviceuiset.h"
#include "hackrf/devicehackrfvalues.h"
@@ -44,9 +43,9 @@ HackRFInputGui::HackRFInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
m_forceSettings(true),
m_doApplySettings(true),
m_sampleSource(NULL),
m_lastEngineState(DSPDeviceSourceEngine::StNotStarted)
m_lastEngineState(DeviceAPI::StNotStarted)
{
m_sampleSource = (HackRFInput*) m_deviceUISet->m_deviceSourceAPI->getSampleSource();
m_sampleSource = (HackRFInput*) m_deviceUISet->m_deviceAPI->getSampleSource();
ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
@@ -447,25 +446,25 @@ void HackRFInputGui::blockApplySettings(bool block)
void HackRFInputGui::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; }");
ui->startStop->setChecked(false);
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;
@@ -152,7 +152,7 @@ PluginInstanceGUI* HackRFInputPlugin::createSampleSourcePluginInstanceGUI(
}
#endif
DeviceSampleSource *HackRFInputPlugin::createSampleSourcePluginInstanceInput(const QString& sourceId, DeviceSourceAPI *deviceAPI)
DeviceSampleSource *HackRFInputPlugin::createSampleSourcePluginInstanceInput(const QString& sourceId, DeviceAPI *deviceAPI)
{
if (sourceId == m_deviceTypeID)
{
@@ -41,7 +41,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;