mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-04 23:14:47 -04:00
Single DeviceAPI interface (1)
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include "testsourcegui.h"
|
||||
#include <device/devicesourceapi.h>
|
||||
#include "device/deviceapi.h"
|
||||
#include "device/deviceuiset.h"
|
||||
|
||||
TestSourceGui::TestSourceGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||
@@ -47,10 +47,10 @@ TestSourceGui::TestSourceGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||
m_forceSettings(true),
|
||||
m_sampleSource(0),
|
||||
m_tickCount(0),
|
||||
m_lastEngineState(DSPDeviceSourceEngine::StNotStarted)
|
||||
m_lastEngineState(DeviceAPI::StNotStarted)
|
||||
{
|
||||
qDebug("TestSourceGui::TestSourceGui");
|
||||
m_sampleSource = m_deviceUISet->m_deviceSourceAPI->getSampleSource();
|
||||
m_sampleSource = m_deviceUISet->m_deviceAPI->getSampleSource();
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||
@@ -430,24 +430,24 @@ void TestSourceGui::updateHardware()
|
||||
|
||||
void TestSourceGui::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;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "SWGDeviceState.h"
|
||||
|
||||
#include "testsourceinput.h"
|
||||
#include "device/devicesourceapi.h"
|
||||
#include "device/deviceapi.h"
|
||||
#include "testsourcethread.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspengine.h"
|
||||
@@ -38,7 +38,7 @@ MESSAGE_CLASS_DEFINITION(TestSourceInput::MsgFileRecord, Message)
|
||||
MESSAGE_CLASS_DEFINITION(TestSourceInput::MsgStartStop, Message)
|
||||
|
||||
|
||||
TestSourceInput::TestSourceInput(DeviceSourceAPI *deviceAPI) :
|
||||
TestSourceInput::TestSourceInput(DeviceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_settings(),
|
||||
m_testSourceThread(0),
|
||||
@@ -47,7 +47,7 @@ TestSourceInput::TestSourceInput(DeviceSourceAPI *deviceAPI) :
|
||||
m_masterTimer(deviceAPI->getMasterTimer())
|
||||
{
|
||||
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
|
||||
m_deviceAPI->addSink(m_fileSink);
|
||||
m_deviceAPI->addAncillarySink(m_fileSink);
|
||||
|
||||
if (!m_sampleFifo.setSize(96000 * 4)) {
|
||||
qCritical("TestSourceInput::TestSourceInput: Could not allocate SampleFifo");
|
||||
@@ -66,7 +66,7 @@ TestSourceInput::~TestSourceInput()
|
||||
stop();
|
||||
}
|
||||
|
||||
m_deviceAPI->removeSink(m_fileSink);
|
||||
m_deviceAPI->removeAncillarySink(m_fileSink);
|
||||
delete m_fileSink;
|
||||
}
|
||||
|
||||
@@ -214,14 +214,14 @@ bool TestSourceInput::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) {
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <dsp/devicesamplesource.h>
|
||||
#include "testsourcesettings.h"
|
||||
|
||||
class DeviceSourceAPI;
|
||||
class DeviceAPI;
|
||||
class TestSourceThread;
|
||||
class FileRecord;
|
||||
class QNetworkAccessManager;
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
{ }
|
||||
};
|
||||
|
||||
TestSourceInput(DeviceSourceAPI *deviceAPI);
|
||||
TestSourceInput(DeviceAPI *deviceAPI);
|
||||
virtual ~TestSourceInput();
|
||||
virtual void destroy();
|
||||
|
||||
@@ -136,7 +136,7 @@ public:
|
||||
QString& errorMessage);
|
||||
|
||||
private:
|
||||
DeviceSourceAPI *m_deviceAPI;
|
||||
DeviceAPI *m_deviceAPI;
|
||||
FileRecord *m_fileSink; //!< File sink to record device I/Q output
|
||||
QMutex m_mutex;
|
||||
TestSourceSettings m_settings;
|
||||
|
||||
@@ -97,7 +97,7 @@ PluginInstanceGUI* TestSourcePlugin::createSampleSourcePluginInstanceGUI(
|
||||
}
|
||||
#endif
|
||||
|
||||
DeviceSampleSource *TestSourcePlugin::createSampleSourcePluginInstanceInput(const QString& sourceId, DeviceSourceAPI *deviceAPI)
|
||||
DeviceSampleSource *TestSourcePlugin::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;
|
||||
|
||||
Reference in New Issue
Block a user