mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-04 06:54:39 -04:00
Single DeviceAPI interface (1)
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
#include "util/simpleserializer.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "device/devicesourceapi.h"
|
||||
#include "device/deviceapi.h"
|
||||
#include "dsp/filerecord.h"
|
||||
|
||||
#include "remoteinput.h"
|
||||
@@ -44,7 +44,7 @@ MESSAGE_CLASS_DEFINITION(RemoteInput::MsgReportRemoteInputStreamTiming, Message)
|
||||
MESSAGE_CLASS_DEFINITION(RemoteInput::MsgFileRecord, Message)
|
||||
MESSAGE_CLASS_DEFINITION(RemoteInput::MsgStartStop, Message)
|
||||
|
||||
RemoteInput::RemoteInput(DeviceSourceAPI *deviceAPI) :
|
||||
RemoteInput::RemoteInput(DeviceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_settings(),
|
||||
m_remoteInputUDPHandler(0),
|
||||
@@ -55,7 +55,7 @@ RemoteInput::RemoteInput(DeviceSourceAPI *deviceAPI) :
|
||||
m_remoteInputUDPHandler = new RemoteInputUDPHandler(&m_sampleFifo, m_deviceAPI);
|
||||
|
||||
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
|
||||
m_deviceAPI->addSink(m_fileSink);
|
||||
m_deviceAPI->addAncillarySink(m_fileSink);
|
||||
|
||||
m_networkManager = new QNetworkAccessManager();
|
||||
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
|
||||
@@ -66,7 +66,7 @@ RemoteInput::~RemoteInput()
|
||||
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
|
||||
delete m_networkManager;
|
||||
stop();
|
||||
m_deviceAPI->removeSink(m_fileSink);
|
||||
m_deviceAPI->removeAncillarySink(m_fileSink);
|
||||
delete m_fileSink;
|
||||
delete m_remoteInputUDPHandler;
|
||||
}
|
||||
@@ -193,14 +193,14 @@ bool RemoteInput::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) {
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
class QNetworkAccessManager;
|
||||
class QNetworkReply;
|
||||
class DeviceSourceAPI;
|
||||
class DeviceAPI;
|
||||
class RemoteInputUDPHandler;
|
||||
class FileRecord;
|
||||
|
||||
@@ -268,7 +268,7 @@ public:
|
||||
{ }
|
||||
};
|
||||
|
||||
RemoteInput(DeviceSourceAPI *deviceAPI);
|
||||
RemoteInput(DeviceAPI *deviceAPI);
|
||||
virtual ~RemoteInput();
|
||||
virtual void destroy();
|
||||
|
||||
@@ -314,7 +314,7 @@ public:
|
||||
QString& errorMessage);
|
||||
|
||||
private:
|
||||
DeviceSourceAPI *m_deviceAPI;
|
||||
DeviceAPI *m_deviceAPI;
|
||||
QMutex m_mutex;
|
||||
RemoteInputSettings m_settings;
|
||||
RemoteInputUDPHandler* m_remoteInputUDPHandler;
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "mainwindow.h"
|
||||
#include "util/simpleserializer.h"
|
||||
#include "device/devicesourceapi.h"
|
||||
#include "device/deviceapi.h"
|
||||
#include "device/deviceuiset.h"
|
||||
#include "remoteinputgui.h"
|
||||
|
||||
@@ -53,7 +53,7 @@ RemoteInputGui::RemoteInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||
m_acquisition(false),
|
||||
m_streamSampleRate(0),
|
||||
m_streamCenterFrequency(0),
|
||||
m_lastEngineState(DSPDeviceSourceEngine::StNotStarted),
|
||||
m_lastEngineState(DeviceAPI::StNotStarted),
|
||||
m_framesDecodingStatus(0),
|
||||
m_bufferLengthInSecs(0.0),
|
||||
m_bufferGauge(-50),
|
||||
@@ -92,7 +92,7 @@ RemoteInputGui::RemoteInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||
m_statusTimer.start(500);
|
||||
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
|
||||
|
||||
m_sampleSource = (RemoteInput*) m_deviceUISet->m_deviceSourceAPI->getSampleSource();
|
||||
m_sampleSource = (RemoteInput*) m_deviceUISet->m_deviceAPI->getSampleSource();
|
||||
|
||||
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
|
||||
m_sampleSource->setMessageQueueToGUI(&m_inputMessageQueue);
|
||||
@@ -538,24 +538,24 @@ void RemoteInputGui::updateStatus()
|
||||
{
|
||||
if (m_sampleSource->isStreaming())
|
||||
{
|
||||
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;
|
||||
|
||||
@@ -100,7 +100,7 @@ PluginInstanceGUI* RemoteInputPlugin::createSampleSourcePluginInstanceGUI(
|
||||
}
|
||||
#endif
|
||||
|
||||
DeviceSampleSource *RemoteInputPlugin::createSampleSourcePluginInstanceInput(const QString& sourceId, DeviceSourceAPI *deviceAPI)
|
||||
DeviceSampleSource *RemoteInputPlugin::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;
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include <device/devicesourceapi.h>
|
||||
#include "device/deviceapi.h"
|
||||
|
||||
#include "remoteinputudphandler.h"
|
||||
#include "remoteinput.h"
|
||||
|
||||
RemoteInputUDPHandler::RemoteInputUDPHandler(SampleSinkFifo *sampleFifo, DeviceSourceAPI *deviceAPI) :
|
||||
RemoteInputUDPHandler::RemoteInputUDPHandler(SampleSinkFifo *sampleFifo, DeviceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_masterTimer(deviceAPI->getMasterTimer()),
|
||||
m_masterTimerConnected(false),
|
||||
|
||||
@@ -31,13 +31,13 @@
|
||||
class SampleSinkFifo;
|
||||
class MessageQueue;
|
||||
class QTimer;
|
||||
class DeviceSourceAPI;
|
||||
class DeviceAPI;
|
||||
|
||||
class RemoteInputUDPHandler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RemoteInputUDPHandler(SampleSinkFifo* sampleFifo, DeviceSourceAPI *deviceAPI);
|
||||
RemoteInputUDPHandler(SampleSinkFifo* sampleFifo, DeviceAPI *deviceAPI);
|
||||
~RemoteInputUDPHandler();
|
||||
void setMessageQueueToGUI(MessageQueue *queue) { m_outputMessageQueueToGUI = queue; }
|
||||
void start();
|
||||
@@ -56,7 +56,7 @@ public slots:
|
||||
void dataReadyRead();
|
||||
|
||||
private:
|
||||
DeviceSourceAPI *m_deviceAPI;
|
||||
DeviceAPI *m_deviceAPI;
|
||||
const QTimer& m_masterTimer;
|
||||
bool m_masterTimerConnected;
|
||||
bool m_running;
|
||||
|
||||
Reference in New Issue
Block a user