mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-07-25 11:34:09 -04:00
Single DeviceAPI interface (1)
This commit is contained in:
@@ -28,8 +28,7 @@
|
||||
#include "util/simpleserializer.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "device/devicesourceapi.h"
|
||||
#include "device/devicesinkapi.h"
|
||||
#include "device/deviceapi.h"
|
||||
#include "hackrf/devicehackrfshared.h"
|
||||
#include "hackrfoutputthread.h"
|
||||
#include "hackrfoutput.h"
|
||||
@@ -38,7 +37,7 @@ MESSAGE_CLASS_DEFINITION(HackRFOutput::MsgConfigureHackRF, Message)
|
||||
MESSAGE_CLASS_DEFINITION(HackRFOutput::MsgStartStop, Message)
|
||||
MESSAGE_CLASS_DEFINITION(HackRFOutput::MsgReportHackRF, Message)
|
||||
|
||||
HackRFOutput::HackRFOutput(DeviceSinkAPI *deviceAPI) :
|
||||
HackRFOutput::HackRFOutput(DeviceAPI *deviceAPI) :
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_settings(),
|
||||
m_dev(0),
|
||||
@@ -81,7 +80,7 @@ bool HackRFOutput::openDevice()
|
||||
|
||||
if (m_deviceAPI->getSourceBuddies().size() > 0)
|
||||
{
|
||||
DeviceSourceAPI *buddy = m_deviceAPI->getSourceBuddies()[0];
|
||||
DeviceAPI *buddy = m_deviceAPI->getSourceBuddies()[0];
|
||||
DeviceHackRFParams *buddySharedParams = (DeviceHackRFParams *) buddy->getBuddySharedPtr();
|
||||
|
||||
if (buddySharedParams == 0)
|
||||
@@ -101,9 +100,9 @@ bool HackRFOutput::openDevice()
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((m_dev = DeviceHackRF::open_hackrf(qPrintable(m_deviceAPI->getSampleSinkSerial()))) == 0)
|
||||
if ((m_dev = DeviceHackRF::open_hackrf(qPrintable(m_deviceAPI->getSamplingDeviceSerial()))) == 0)
|
||||
{
|
||||
qCritical("HackRFOutput::openDevice: could not open HackRF %s", qPrintable(m_deviceAPI->getSampleSinkSerial()));
|
||||
qCritical("HackRFOutput::openDevice: could not open HackRF %s", qPrintable(m_deviceAPI->getSamplingDeviceSerial()));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -258,14 +257,14 @@ bool HackRFOutput::handleMessage(const Message& message)
|
||||
|
||||
if (cmd.getStartStop())
|
||||
{
|
||||
if (m_deviceAPI->initGeneration())
|
||||
if (m_deviceAPI->initDeviceEngine())
|
||||
{
|
||||
m_deviceAPI->startGeneration();
|
||||
m_deviceAPI->startDeviceEngine();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_deviceAPI->stopGeneration();
|
||||
m_deviceAPI->stopDeviceEngine();
|
||||
}
|
||||
|
||||
if (m_settings.m_useReverseAPI) {
|
||||
@@ -436,9 +435,9 @@ bool HackRFOutput::applySettings(const HackRFOutputSettings& settings, bool forc
|
||||
|
||||
if (m_deviceAPI->getSourceBuddies().size() > 0)
|
||||
{
|
||||
DeviceSourceAPI *buddy = m_deviceAPI->getSourceBuddies()[0];
|
||||
DeviceAPI *buddy = m_deviceAPI->getSourceBuddies()[0];
|
||||
DeviceHackRFShared::MsgSynchronizeFrequency *freqMsg = DeviceHackRFShared::MsgSynchronizeFrequency::create(deviceCenterFrequency);
|
||||
buddy->getSampleSourceInputMessageQueue()->push(freqMsg);
|
||||
buddy->getSamplingDeviceInputMessageQueue()->push(freqMsg);
|
||||
}
|
||||
|
||||
forwardChange = true;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
class QNetworkAccessManager;
|
||||
class QNetworkReply;
|
||||
class DeviceSinkAPI;
|
||||
class DeviceAPI;
|
||||
class HackRFOutputThread;
|
||||
|
||||
class HackRFOutput : public DeviceSampleSink {
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
{ }
|
||||
};
|
||||
|
||||
HackRFOutput(DeviceSinkAPI *deviceAPI);
|
||||
HackRFOutput(DeviceAPI *deviceAPI);
|
||||
virtual ~HackRFOutput();
|
||||
virtual void destroy();
|
||||
|
||||
@@ -134,7 +134,7 @@ public:
|
||||
QString& errorMessage);
|
||||
|
||||
private:
|
||||
DeviceSinkAPI *m_deviceAPI;
|
||||
DeviceAPI *m_deviceAPI;
|
||||
QMutex m_mutex;
|
||||
HackRFOutputSettings m_settings;
|
||||
struct hackrf_device* m_dev;
|
||||
|
||||
@@ -26,8 +26,7 @@
|
||||
#include "gui/basicdevicesettingsdialog.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "device/devicesinkapi.h"
|
||||
#include "device/devicesourceapi.h"
|
||||
#include "device/deviceapi.h"
|
||||
#include "device/deviceuiset.h"
|
||||
#include "hackrf/devicehackrfvalues.h"
|
||||
#include "hackrf/devicehackrfshared.h"
|
||||
@@ -43,10 +42,10 @@ HackRFOutputGui::HackRFOutputGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||
m_settings(),
|
||||
m_sampleRateMode(true),
|
||||
m_deviceSampleSink(0),
|
||||
m_lastEngineState(DSPDeviceSinkEngine::StNotStarted),
|
||||
m_lastEngineState(DeviceAPI::StNotStarted),
|
||||
m_doApplySettings(true)
|
||||
{
|
||||
m_deviceSampleSink = (HackRFOutput*) m_deviceUISet->m_deviceSinkAPI->getSampleSink();
|
||||
m_deviceSampleSink = (HackRFOutput*) m_deviceUISet->m_deviceAPI->getSampleSink();
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||
@@ -402,25 +401,25 @@ void HackRFOutputGui::updateHardware()
|
||||
|
||||
void HackRFOutputGui::updateStatus()
|
||||
{
|
||||
int state = m_deviceUISet->m_deviceSinkAPI->state();
|
||||
int state = m_deviceUISet->m_deviceAPI->state();
|
||||
|
||||
if(m_lastEngineState != state)
|
||||
{
|
||||
switch(state)
|
||||
{
|
||||
case DSPDeviceSinkEngine::StNotStarted:
|
||||
case DeviceAPI::StNotStarted:
|
||||
ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||
break;
|
||||
case DSPDeviceSinkEngine::StIdle:
|
||||
case DeviceAPI::StIdle:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : blue; }");
|
||||
ui->startStop->setChecked(false);
|
||||
break;
|
||||
case DSPDeviceSinkEngine::StRunning:
|
||||
case DeviceAPI::StRunning:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
|
||||
break;
|
||||
case DSPDeviceSinkEngine::StError:
|
||||
case DeviceAPI::StError:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : red; }");
|
||||
QMessageBox::information(this, tr("Message"), m_deviceUISet->m_deviceSinkAPI->errorMessage());
|
||||
QMessageBox::information(this, tr("Message"), m_deviceUISet->m_deviceAPI->errorMessage());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -149,7 +149,7 @@ PluginInstanceGUI* HackRFOutputPlugin::createSampleSinkPluginInstanceGUI(
|
||||
}
|
||||
#endif
|
||||
|
||||
DeviceSampleSink* HackRFOutputPlugin::createSampleSinkPluginInstanceOutput(const QString& sinkId, DeviceSinkAPI *deviceAPI)
|
||||
DeviceSampleSink* HackRFOutputPlugin::createSampleSinkPluginInstanceOutput(const QString& sinkId, DeviceAPI *deviceAPI)
|
||||
{
|
||||
if(sinkId == m_deviceTypeID)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
const QString& sinkId,
|
||||
QWidget **widget,
|
||||
DeviceUISet *deviceUISet);
|
||||
virtual DeviceSampleSink* createSampleSinkPluginInstanceOutput(const QString& sinkId, DeviceSinkAPI *deviceAPI);
|
||||
virtual DeviceSampleSink* createSampleSinkPluginInstanceOutput(const QString& sinkId, DeviceAPI *deviceAPI);
|
||||
|
||||
static const QString m_hardwareID;
|
||||
static const QString m_deviceTypeID;
|
||||
|
||||
Reference in New Issue
Block a user