mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 17:58:43 -05:00
BladeRF Tx support: rename Rx files and classes
This commit is contained in:
parent
607e89cea6
commit
b677fe4d32
@ -1,23 +1,23 @@
|
|||||||
project(bladerf)
|
project(bladerf)
|
||||||
|
|
||||||
set(bladerf_SOURCES
|
set(bladerf_SOURCES
|
||||||
bladerfgui.cpp
|
bladerfinputgui.cpp
|
||||||
bladerfinput.cpp
|
bladerfinput.cpp
|
||||||
bladerfplugin.cpp
|
bladerfinputplugin.cpp
|
||||||
bladerfsettings.cpp
|
bladerfinputsettings.cpp
|
||||||
bladerfthread.cpp
|
bladerfinputthread.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(bladerf_HEADERS
|
set(bladerf_HEADERS
|
||||||
bladerfgui.h
|
bladerfinputgui.h
|
||||||
bladerfinput.h
|
bladerfinput.h
|
||||||
bladerfplugin.h
|
bladerfinputplugin.h
|
||||||
bladerfsettings.h
|
bladerfinputsettings.h
|
||||||
bladerfthread.h
|
bladerfinputthread.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(bladerf_FORMS
|
set(bladerf_FORMS
|
||||||
bladerfgui.ui
|
bladerfinputgui.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
if (BUILD_DEBIAN)
|
if (BUILD_DEBIAN)
|
||||||
|
@ -25,19 +25,19 @@ INCLUDEPATH += $$LIBBLADERFSRC
|
|||||||
CONFIG(Release):build_subdir = release
|
CONFIG(Release):build_subdir = release
|
||||||
CONFIG(Debug):build_subdir = debug
|
CONFIG(Debug):build_subdir = debug
|
||||||
|
|
||||||
SOURCES += bladerfgui.cpp\
|
SOURCES += bladerfinputgui.cpp\
|
||||||
bladerfinput.cpp\
|
bladerfinput.cpp\
|
||||||
bladerfplugin.cpp\
|
bladerfinputplugin.cpp\
|
||||||
bladerfsettings.cpp\
|
bladerfinputsettings.cpp\
|
||||||
bladerfthread.cpp
|
bladerfinputthread.cpp
|
||||||
|
|
||||||
HEADERS += bladerfgui.h\
|
HEADERS += bladerfinputgui.h\
|
||||||
bladerfinput.h\
|
bladerfinput.h\
|
||||||
bladerfplugin.h\
|
bladerfinputplugin.h\
|
||||||
bladerfsettings.h\
|
bladerfinputsettings.h\
|
||||||
bladerfthread.h
|
bladerfinputthread.h
|
||||||
|
|
||||||
FORMS += bladerfgui.ui
|
FORMS += bladerfinputgui.ui
|
||||||
|
|
||||||
LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase
|
LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase
|
||||||
LIBS += -L../../../libbladerf/$${build_subdir} -llibbladerf
|
LIBS += -L../../../libbladerf/$${build_subdir} -llibbladerf
|
||||||
|
@ -21,12 +21,12 @@
|
|||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
#include "dsp/dspcommands.h"
|
#include "dsp/dspcommands.h"
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
#include "bladerfgui.h"
|
|
||||||
#include "bladerfinput.h"
|
#include "bladerfinput.h"
|
||||||
|
|
||||||
#include <device/devicesourceapi.h>
|
#include <device/devicesourceapi.h>
|
||||||
|
|
||||||
#include "bladerfthread.h"
|
#include "bladerfinputgui.h"
|
||||||
|
#include "bladerfinputthread.h"
|
||||||
|
|
||||||
MESSAGE_CLASS_DEFINITION(BladerfInput::MsgConfigureBladerf, Message)
|
MESSAGE_CLASS_DEFINITION(BladerfInput::MsgConfigureBladerf, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(BladerfInput::MsgReportBladerf, Message)
|
MESSAGE_CLASS_DEFINITION(BladerfInput::MsgReportBladerf, Message)
|
||||||
@ -101,7 +101,7 @@ bool BladerfInput::start(int device)
|
|||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((m_bladerfThread = new BladerfThread(m_dev, &m_sampleFifo)) == NULL) {
|
if((m_bladerfThread = new BladerfInputThread(m_dev, &m_sampleFifo)) == NULL) {
|
||||||
qFatal("out of memory");
|
qFatal("out of memory");
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
@ -174,7 +174,7 @@ bool BladerfInput::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BladerfInput::applySettings(const BladeRFSettings& settings, bool force)
|
bool BladerfInput::applySettings(const BladeRFInputSettings& settings, bool force)
|
||||||
{
|
{
|
||||||
bool forwardChange = false;
|
bool forwardChange = false;
|
||||||
QMutexLocker mutexLocker(&m_mutex);
|
QMutexLocker mutexLocker(&m_mutex);
|
||||||
@ -382,7 +382,7 @@ bool BladerfInput::applySettings(const BladeRFSettings& settings, bool force)
|
|||||||
qint64 f_img = deviceCenterFrequency;
|
qint64 f_img = deviceCenterFrequency;
|
||||||
qint64 f_cut = deviceCenterFrequency + m_settings.m_bandwidth/2;
|
qint64 f_cut = deviceCenterFrequency + m_settings.m_bandwidth/2;
|
||||||
|
|
||||||
if ((m_settings.m_log2Decim == 0) || (m_settings.m_fcPos == BladeRFSettings::FC_POS_CENTER))
|
if ((m_settings.m_log2Decim == 0) || (m_settings.m_fcPos == BladeRFInputSettings::FC_POS_CENTER))
|
||||||
{
|
{
|
||||||
deviceCenterFrequency = m_settings.m_centerFrequency;
|
deviceCenterFrequency = m_settings.m_centerFrequency;
|
||||||
f_img = deviceCenterFrequency;
|
f_img = deviceCenterFrequency;
|
||||||
@ -390,13 +390,13 @@ bool BladerfInput::applySettings(const BladeRFSettings& settings, bool force)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_settings.m_fcPos == BladeRFSettings::FC_POS_INFRA)
|
if (m_settings.m_fcPos == BladeRFInputSettings::FC_POS_INFRA)
|
||||||
{
|
{
|
||||||
deviceCenterFrequency = m_settings.m_centerFrequency + (m_settings.m_devSampleRate / 4);
|
deviceCenterFrequency = m_settings.m_centerFrequency + (m_settings.m_devSampleRate / 4);
|
||||||
f_img = deviceCenterFrequency + m_settings.m_devSampleRate/2;
|
f_img = deviceCenterFrequency + m_settings.m_devSampleRate/2;
|
||||||
f_cut = deviceCenterFrequency + m_settings.m_bandwidth/2;
|
f_cut = deviceCenterFrequency + m_settings.m_bandwidth/2;
|
||||||
}
|
}
|
||||||
else if (m_settings.m_fcPos == BladeRFSettings::FC_POS_SUPRA)
|
else if (m_settings.m_fcPos == BladeRFInputSettings::FC_POS_SUPRA)
|
||||||
{
|
{
|
||||||
deviceCenterFrequency = m_settings.m_centerFrequency - (m_settings.m_devSampleRate / 4);
|
deviceCenterFrequency = m_settings.m_centerFrequency - (m_settings.m_devSampleRate / 4);
|
||||||
f_img = deviceCenterFrequency - m_settings.m_devSampleRate/2;
|
f_img = deviceCenterFrequency - m_settings.m_devSampleRate/2;
|
||||||
|
@ -19,12 +19,12 @@
|
|||||||
|
|
||||||
#include <dsp/devicesamplesource.h>
|
#include <dsp/devicesamplesource.h>
|
||||||
|
|
||||||
#include "bladerfsettings.h"
|
|
||||||
#include <libbladeRF.h>
|
#include <libbladeRF.h>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include "bladerfinputsettings.h"
|
||||||
|
|
||||||
class DeviceSourceAPI;
|
class DeviceSourceAPI;
|
||||||
class BladerfThread;
|
class BladerfInputThread;
|
||||||
|
|
||||||
class BladerfInput : public DeviceSampleSource {
|
class BladerfInput : public DeviceSampleSource {
|
||||||
public:
|
public:
|
||||||
@ -32,17 +32,17 @@ public:
|
|||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const BladeRFSettings& getSettings() const { return m_settings; }
|
const BladeRFInputSettings& getSettings() const { return m_settings; }
|
||||||
|
|
||||||
static MsgConfigureBladerf* create(const BladeRFSettings& settings)
|
static MsgConfigureBladerf* create(const BladeRFInputSettings& settings)
|
||||||
{
|
{
|
||||||
return new MsgConfigureBladerf(settings);
|
return new MsgConfigureBladerf(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BladeRFSettings m_settings;
|
BladeRFInputSettings m_settings;
|
||||||
|
|
||||||
MsgConfigureBladerf(const BladeRFSettings& settings) :
|
MsgConfigureBladerf(const BladeRFInputSettings& settings) :
|
||||||
Message(),
|
Message(),
|
||||||
m_settings(settings)
|
m_settings(settings)
|
||||||
{ }
|
{ }
|
||||||
@ -79,15 +79,15 @@ public:
|
|||||||
virtual bool handleMessage(const Message& message);
|
virtual bool handleMessage(const Message& message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool applySettings(const BladeRFSettings& settings, bool force);
|
bool applySettings(const BladeRFInputSettings& settings, bool force);
|
||||||
bladerf_lna_gain getLnaGain(int lnaGain);
|
bladerf_lna_gain getLnaGain(int lnaGain);
|
||||||
struct bladerf *open_bladerf_from_serial(const char *serial);
|
struct bladerf *open_bladerf_from_serial(const char *serial);
|
||||||
|
|
||||||
DeviceSourceAPI *m_deviceAPI;
|
DeviceSourceAPI *m_deviceAPI;
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
BladeRFSettings m_settings;
|
BladeRFInputSettings m_settings;
|
||||||
struct bladerf* m_dev;
|
struct bladerf* m_dev;
|
||||||
BladerfThread* m_bladerfThread;
|
BladerfInputThread* m_bladerfThread;
|
||||||
QString m_deviceDescription;
|
QString m_deviceDescription;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,19 +19,18 @@
|
|||||||
|
|
||||||
#include <libbladeRF.h>
|
#include <libbladeRF.h>
|
||||||
|
|
||||||
#include "ui_bladerfgui.h"
|
#include "ui_bladerfinputgui.h"
|
||||||
#include "gui/colormapper.h"
|
#include "gui/colormapper.h"
|
||||||
#include "gui/glspectrum.h"
|
#include "gui/glspectrum.h"
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
#include "dsp/dspcommands.h"
|
#include "dsp/dspcommands.h"
|
||||||
#include "bladerfgui.h"
|
|
||||||
|
|
||||||
#include <device/devicesourceapi.h>
|
#include <device/devicesourceapi.h>
|
||||||
#include <dsp/filerecord.h>
|
#include <dsp/filerecord.h>
|
||||||
|
#include "bladerfinputgui.h"
|
||||||
|
|
||||||
BladerfGui::BladerfGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
|
BladerfInputGui::BladerfInputGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::BladerfGui),
|
ui(new Ui::BladerfInputGui),
|
||||||
m_deviceAPI(deviceAPI),
|
m_deviceAPI(deviceAPI),
|
||||||
m_settings(),
|
m_settings(),
|
||||||
m_sampleSource(NULL),
|
m_sampleSource(NULL),
|
||||||
@ -71,7 +70,7 @@ BladerfGui::BladerfGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
|
|||||||
connect(m_deviceAPI->getDeviceOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
|
connect(m_deviceAPI->getDeviceOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
BladerfGui::~BladerfGui()
|
BladerfInputGui::~BladerfInputGui()
|
||||||
{
|
{
|
||||||
m_deviceAPI->removeSink(m_fileSink);
|
m_deviceAPI->removeSink(m_fileSink);
|
||||||
delete m_fileSink;
|
delete m_fileSink;
|
||||||
@ -79,46 +78,46 @@ BladerfGui::~BladerfGui()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::destroy()
|
void BladerfInputGui::destroy()
|
||||||
{
|
{
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::setName(const QString& name)
|
void BladerfInputGui::setName(const QString& name)
|
||||||
{
|
{
|
||||||
setObjectName(name);
|
setObjectName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BladerfGui::getName() const
|
QString BladerfInputGui::getName() const
|
||||||
{
|
{
|
||||||
return objectName();
|
return objectName();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::resetToDefaults()
|
void BladerfInputGui::resetToDefaults()
|
||||||
{
|
{
|
||||||
m_settings.resetToDefaults();
|
m_settings.resetToDefaults();
|
||||||
displaySettings();
|
displaySettings();
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 BladerfGui::getCenterFrequency() const
|
qint64 BladerfInputGui::getCenterFrequency() const
|
||||||
{
|
{
|
||||||
return m_settings.m_centerFrequency;
|
return m_settings.m_centerFrequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::setCenterFrequency(qint64 centerFrequency)
|
void BladerfInputGui::setCenterFrequency(qint64 centerFrequency)
|
||||||
{
|
{
|
||||||
m_settings.m_centerFrequency = centerFrequency;
|
m_settings.m_centerFrequency = centerFrequency;
|
||||||
displaySettings();
|
displaySettings();
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray BladerfGui::serialize() const
|
QByteArray BladerfInputGui::serialize() const
|
||||||
{
|
{
|
||||||
return m_settings.serialize();
|
return m_settings.serialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BladerfGui::deserialize(const QByteArray& data)
|
bool BladerfInputGui::deserialize(const QByteArray& data)
|
||||||
{
|
{
|
||||||
if(m_settings.deserialize(data)) {
|
if(m_settings.deserialize(data)) {
|
||||||
displaySettings();
|
displaySettings();
|
||||||
@ -130,7 +129,7 @@ bool BladerfGui::deserialize(const QByteArray& data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BladerfGui::handleMessage(const Message& message)
|
bool BladerfInputGui::handleMessage(const Message& message)
|
||||||
{
|
{
|
||||||
if (BladerfInput::MsgReportBladerf::match(message))
|
if (BladerfInput::MsgReportBladerf::match(message))
|
||||||
{
|
{
|
||||||
@ -143,7 +142,7 @@ bool BladerfGui::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::handleDSPMessages()
|
void BladerfInputGui::handleDSPMessages()
|
||||||
{
|
{
|
||||||
Message* message;
|
Message* message;
|
||||||
|
|
||||||
@ -165,14 +164,14 @@ void BladerfGui::handleDSPMessages()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::updateSampleRateAndFrequency()
|
void BladerfInputGui::updateSampleRateAndFrequency()
|
||||||
{
|
{
|
||||||
m_deviceAPI->getSpectrum()->setSampleRate(m_sampleRate);
|
m_deviceAPI->getSpectrum()->setSampleRate(m_sampleRate);
|
||||||
m_deviceAPI->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
|
m_deviceAPI->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
|
||||||
ui->deviceRateLabel->setText(tr("%1k").arg((float)m_sampleRate / 1000));
|
ui->deviceRateLabel->setText(tr("%1k").arg((float)m_sampleRate / 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::displaySettings()
|
void BladerfInputGui::displaySettings()
|
||||||
{
|
{
|
||||||
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
||||||
|
|
||||||
@ -200,45 +199,45 @@ void BladerfGui::displaySettings()
|
|||||||
ui->xb200->setCurrentIndex(getXb200Index(m_settings.m_xb200, m_settings.m_xb200Path, m_settings.m_xb200Filter));
|
ui->xb200->setCurrentIndex(getXb200Index(m_settings.m_xb200, m_settings.m_xb200Path, m_settings.m_xb200Filter));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::sendSettings()
|
void BladerfInputGui::sendSettings()
|
||||||
{
|
{
|
||||||
if(!m_updateTimer.isActive())
|
if(!m_updateTimer.isActive())
|
||||||
m_updateTimer.start(100);
|
m_updateTimer.start(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::on_centerFrequency_changed(quint64 value)
|
void BladerfInputGui::on_centerFrequency_changed(quint64 value)
|
||||||
{
|
{
|
||||||
m_settings.m_centerFrequency = value * 1000;
|
m_settings.m_centerFrequency = value * 1000;
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::on_dcOffset_toggled(bool checked)
|
void BladerfInputGui::on_dcOffset_toggled(bool checked)
|
||||||
{
|
{
|
||||||
m_settings.m_dcBlock = checked;
|
m_settings.m_dcBlock = checked;
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::on_iqImbalance_toggled(bool checked)
|
void BladerfInputGui::on_iqImbalance_toggled(bool checked)
|
||||||
{
|
{
|
||||||
m_settings.m_iqCorrection = checked;
|
m_settings.m_iqCorrection = checked;
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::on_samplerate_currentIndexChanged(int index)
|
void BladerfInputGui::on_samplerate_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
int newrate = BladerfSampleRates::getRate(index);
|
int newrate = BladerfSampleRates::getRate(index);
|
||||||
m_settings.m_devSampleRate = newrate * 1000;
|
m_settings.m_devSampleRate = newrate * 1000;
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::on_bandwidth_currentIndexChanged(int index)
|
void BladerfInputGui::on_bandwidth_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
int newbw = BladerfBandwidths::getBandwidth(index);
|
int newbw = BladerfBandwidths::getBandwidth(index);
|
||||||
m_settings.m_bandwidth = newbw * 1000;
|
m_settings.m_bandwidth = newbw * 1000;
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::on_decim_currentIndexChanged(int index)
|
void BladerfInputGui::on_decim_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
if ((index <0) || (index > 5))
|
if ((index <0) || (index > 5))
|
||||||
return;
|
return;
|
||||||
@ -246,21 +245,21 @@ void BladerfGui::on_decim_currentIndexChanged(int index)
|
|||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::on_fcPos_currentIndexChanged(int index)
|
void BladerfInputGui::on_fcPos_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
m_settings.m_fcPos = BladeRFSettings::FC_POS_INFRA;
|
m_settings.m_fcPos = BladeRFInputSettings::FC_POS_INFRA;
|
||||||
sendSettings();
|
sendSettings();
|
||||||
} else if (index == 1) {
|
} else if (index == 1) {
|
||||||
m_settings.m_fcPos = BladeRFSettings::FC_POS_SUPRA;
|
m_settings.m_fcPos = BladeRFInputSettings::FC_POS_SUPRA;
|
||||||
sendSettings();
|
sendSettings();
|
||||||
} else if (index == 2) {
|
} else if (index == 2) {
|
||||||
m_settings.m_fcPos = BladeRFSettings::FC_POS_CENTER;
|
m_settings.m_fcPos = BladeRFInputSettings::FC_POS_CENTER;
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::on_lna_currentIndexChanged(int index)
|
void BladerfInputGui::on_lna_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
qDebug() << "BladerfGui: LNA gain = " << index * 3 << " dB";
|
qDebug() << "BladerfGui: LNA gain = " << index * 3 << " dB";
|
||||||
|
|
||||||
@ -271,7 +270,7 @@ void BladerfGui::on_lna_currentIndexChanged(int index)
|
|||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::on_vga1_valueChanged(int value)
|
void BladerfInputGui::on_vga1_valueChanged(int value)
|
||||||
{
|
{
|
||||||
if ((value < BLADERF_RXVGA1_GAIN_MIN) || (value > BLADERF_RXVGA1_GAIN_MAX))
|
if ((value < BLADERF_RXVGA1_GAIN_MIN) || (value > BLADERF_RXVGA1_GAIN_MAX))
|
||||||
return;
|
return;
|
||||||
@ -281,7 +280,7 @@ void BladerfGui::on_vga1_valueChanged(int value)
|
|||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::on_vga2_valueChanged(int value)
|
void BladerfInputGui::on_vga2_valueChanged(int value)
|
||||||
{
|
{
|
||||||
if ((value < BLADERF_RXVGA2_GAIN_MIN) || (value > BLADERF_RXVGA2_GAIN_MAX))
|
if ((value < BLADERF_RXVGA2_GAIN_MIN) || (value > BLADERF_RXVGA2_GAIN_MAX))
|
||||||
return;
|
return;
|
||||||
@ -291,7 +290,7 @@ void BladerfGui::on_vga2_valueChanged(int value)
|
|||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::on_xb200_currentIndexChanged(int index)
|
void BladerfInputGui::on_xb200_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
if (index == 1) // bypass
|
if (index == 1) // bypass
|
||||||
{
|
{
|
||||||
@ -351,7 +350,7 @@ void BladerfGui::on_xb200_currentIndexChanged(int index)
|
|||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::on_startStop_toggled(bool checked)
|
void BladerfInputGui::on_startStop_toggled(bool checked)
|
||||||
{
|
{
|
||||||
if (checked)
|
if (checked)
|
||||||
{
|
{
|
||||||
@ -368,7 +367,7 @@ void BladerfGui::on_startStop_toggled(bool checked)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::on_record_toggled(bool checked)
|
void BladerfInputGui::on_record_toggled(bool checked)
|
||||||
{
|
{
|
||||||
if (checked)
|
if (checked)
|
||||||
{
|
{
|
||||||
@ -382,7 +381,7 @@ void BladerfGui::on_record_toggled(bool checked)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::updateHardware()
|
void BladerfInputGui::updateHardware()
|
||||||
{
|
{
|
||||||
qDebug() << "BladerfGui::updateHardware";
|
qDebug() << "BladerfGui::updateHardware";
|
||||||
BladerfInput::MsgConfigureBladerf* message = BladerfInput::MsgConfigureBladerf::create( m_settings);
|
BladerfInput::MsgConfigureBladerf* message = BladerfInput::MsgConfigureBladerf::create( m_settings);
|
||||||
@ -390,7 +389,7 @@ void BladerfGui::updateHardware()
|
|||||||
m_updateTimer.stop();
|
m_updateTimer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfGui::updateStatus()
|
void BladerfInputGui::updateStatus()
|
||||||
{
|
{
|
||||||
int state = m_deviceAPI->state();
|
int state = m_deviceAPI->state();
|
||||||
|
|
||||||
@ -419,7 +418,7 @@ void BladerfGui::updateStatus()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int BladerfGui::getXb200Index(bool xb_200, bladerf_xb200_path xb200Path, bladerf_xb200_filter xb200Filter)
|
unsigned int BladerfInputGui::getXb200Index(bool xb_200, bladerf_xb200_path xb200Path, bladerf_xb200_filter xb200Filter)
|
||||||
{
|
{
|
||||||
if (xb_200)
|
if (xb_200)
|
||||||
{
|
{
|
@ -14,8 +14,8 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef INCLUDE_BLADERFGUI_H
|
#ifndef INCLUDE_BLADERFINPUTGUI_H
|
||||||
#define INCLUDE_BLADERFGUI_H
|
#define INCLUDE_BLADERFINPUTGUI_H
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include "plugin/plugingui.h"
|
#include "plugin/plugingui.h"
|
||||||
@ -26,16 +26,16 @@ class DeviceSourceAPI;
|
|||||||
class FileRecord;
|
class FileRecord;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class BladerfGui;
|
class BladerfInputGui;
|
||||||
class BladerfSampleRates;
|
class BladerfSampleRates;
|
||||||
}
|
}
|
||||||
|
|
||||||
class BladerfGui : public QWidget, public PluginGUI {
|
class BladerfInputGui : public QWidget, public PluginGUI {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BladerfGui(DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
|
explicit BladerfInputGui(DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
|
||||||
virtual ~BladerfGui();
|
virtual ~BladerfInputGui();
|
||||||
void destroy();
|
void destroy();
|
||||||
|
|
||||||
void setName(const QString& name);
|
void setName(const QString& name);
|
||||||
@ -49,10 +49,10 @@ public:
|
|||||||
virtual bool handleMessage(const Message& message);
|
virtual bool handleMessage(const Message& message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::BladerfGui* ui;
|
Ui::BladerfInputGui* ui;
|
||||||
|
|
||||||
DeviceSourceAPI* m_deviceAPI;
|
DeviceSourceAPI* m_deviceAPI;
|
||||||
BladeRFSettings m_settings;
|
BladeRFInputSettings m_settings;
|
||||||
QTimer m_updateTimer;
|
QTimer m_updateTimer;
|
||||||
QTimer m_statusTimer;
|
QTimer m_statusTimer;
|
||||||
std::vector<int> m_gains;
|
std::vector<int> m_gains;
|
||||||
@ -106,4 +106,4 @@ private:
|
|||||||
static unsigned int m_nb_halfbw;
|
static unsigned int m_nb_halfbw;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_BLADERFGUI_H
|
#endif // INCLUDE_BLADERFINPUTGUI_H
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>BladerfGui</class>
|
<class>BladerfInputGui</class>
|
||||||
<widget class="QWidget" name="BladerfGui">
|
<widget class="QWidget" name="BladerfInputGui">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
@ -19,11 +19,11 @@
|
|||||||
#include <libbladeRF.h>
|
#include <libbladeRF.h>
|
||||||
#include "plugin/pluginapi.h"
|
#include "plugin/pluginapi.h"
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
#include "bladerfgui.h"
|
|
||||||
#include "bladerfplugin.h"
|
|
||||||
#include <device/devicesourceapi.h>
|
#include <device/devicesourceapi.h>
|
||||||
|
#include "bladerfinputplugin.h"
|
||||||
|
#include "bladerfinputgui.h"
|
||||||
|
|
||||||
const PluginDescriptor BlderfPlugin::m_pluginDescriptor = {
|
const PluginDescriptor BlderfInputPlugin::m_pluginDescriptor = {
|
||||||
QString("BladerRF Input"),
|
QString("BladerRF Input"),
|
||||||
QString("2.0.0"),
|
QString("2.0.0"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
@ -32,24 +32,24 @@ const PluginDescriptor BlderfPlugin::m_pluginDescriptor = {
|
|||||||
QString("https://github.com/f4exb/sdrangel")
|
QString("https://github.com/f4exb/sdrangel")
|
||||||
};
|
};
|
||||||
|
|
||||||
const QString BlderfPlugin::m_deviceTypeID = BLADERF_DEVICE_TYPE_ID;
|
const QString BlderfInputPlugin::m_deviceTypeID = BLADERF_DEVICE_TYPE_ID;
|
||||||
|
|
||||||
BlderfPlugin::BlderfPlugin(QObject* parent) :
|
BlderfInputPlugin::BlderfInputPlugin(QObject* parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const PluginDescriptor& BlderfPlugin::getPluginDescriptor() const
|
const PluginDescriptor& BlderfInputPlugin::getPluginDescriptor() const
|
||||||
{
|
{
|
||||||
return m_pluginDescriptor;
|
return m_pluginDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlderfPlugin::initPlugin(PluginAPI* pluginAPI)
|
void BlderfInputPlugin::initPlugin(PluginAPI* pluginAPI)
|
||||||
{
|
{
|
||||||
pluginAPI->registerSampleSource(m_deviceTypeID, this);
|
pluginAPI->registerSampleSource(m_deviceTypeID, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginInterface::SamplingDevices BlderfPlugin::enumSampleSources()
|
PluginInterface::SamplingDevices BlderfInputPlugin::enumSampleSources()
|
||||||
{
|
{
|
||||||
SamplingDevices result;
|
SamplingDevices result;
|
||||||
struct bladerf_devinfo *devinfo = 0;
|
struct bladerf_devinfo *devinfo = 0;
|
||||||
@ -74,11 +74,11 @@ PluginInterface::SamplingDevices BlderfPlugin::enumSampleSources()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginGUI* BlderfPlugin::createSampleSourcePluginGUI(const QString& sourceId,QWidget **widget, DeviceSourceAPI *deviceAPI)
|
PluginGUI* BlderfInputPlugin::createSampleSourcePluginGUI(const QString& sourceId,QWidget **widget, DeviceSourceAPI *deviceAPI)
|
||||||
{
|
{
|
||||||
if(sourceId == m_deviceTypeID)
|
if(sourceId == m_deviceTypeID)
|
||||||
{
|
{
|
||||||
BladerfGui* gui = new BladerfGui(deviceAPI);
|
BladerfInputGui* gui = new BladerfInputGui(deviceAPI);
|
||||||
*widget = gui;
|
*widget = gui;
|
||||||
return gui;
|
return gui;
|
||||||
}
|
}
|
@ -14,8 +14,8 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef INCLUDE_BLADERFPLUGIN_H
|
#ifndef INCLUDE_BLADERFINPUTPLUGIN_H
|
||||||
#define INCLUDE_BLADERFPLUGIN_H
|
#define INCLUDE_BLADERFINPUTPLUGIN_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include "plugin/plugininterface.h"
|
#include "plugin/plugininterface.h"
|
||||||
@ -24,13 +24,13 @@ class PluginAPI;
|
|||||||
|
|
||||||
#define BLADERF_DEVICE_TYPE_ID "sdrangel.samplesource.bladerf"
|
#define BLADERF_DEVICE_TYPE_ID "sdrangel.samplesource.bladerf"
|
||||||
|
|
||||||
class BlderfPlugin : public QObject, public PluginInterface {
|
class BlderfInputPlugin : public QObject, public PluginInterface {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(PluginInterface)
|
Q_INTERFACES(PluginInterface)
|
||||||
Q_PLUGIN_METADATA(IID BLADERF_DEVICE_TYPE_ID)
|
Q_PLUGIN_METADATA(IID BLADERF_DEVICE_TYPE_ID)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BlderfPlugin(QObject* parent = NULL);
|
explicit BlderfInputPlugin(QObject* parent = NULL);
|
||||||
|
|
||||||
const PluginDescriptor& getPluginDescriptor() const;
|
const PluginDescriptor& getPluginDescriptor() const;
|
||||||
void initPlugin(PluginAPI* pluginAPI);
|
void initPlugin(PluginAPI* pluginAPI);
|
||||||
@ -44,4 +44,4 @@ private:
|
|||||||
static const PluginDescriptor m_pluginDescriptor;
|
static const PluginDescriptor m_pluginDescriptor;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_BLADERFPLUGIN_H
|
#endif // INCLUDE_BLADERFINPUTPLUGIN_H
|
@ -16,14 +16,15 @@
|
|||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
#include "bladerfsettings.h"
|
|
||||||
|
|
||||||
BladeRFSettings::BladeRFSettings()
|
#include "bladerfinputsettings.h"
|
||||||
|
|
||||||
|
BladeRFInputSettings::BladeRFInputSettings()
|
||||||
{
|
{
|
||||||
resetToDefaults();
|
resetToDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladeRFSettings::resetToDefaults()
|
void BladeRFInputSettings::resetToDefaults()
|
||||||
{
|
{
|
||||||
m_centerFrequency = 435000*1000;
|
m_centerFrequency = 435000*1000;
|
||||||
m_devSampleRate = 3072000;
|
m_devSampleRate = 3072000;
|
||||||
@ -40,7 +41,7 @@ void BladeRFSettings::resetToDefaults()
|
|||||||
m_iqCorrection = false;
|
m_iqCorrection = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray BladeRFSettings::serialize() const
|
QByteArray BladeRFInputSettings::serialize() const
|
||||||
{
|
{
|
||||||
SimpleSerializer s(1);
|
SimpleSerializer s(1);
|
||||||
|
|
||||||
@ -60,7 +61,7 @@ QByteArray BladeRFSettings::serialize() const
|
|||||||
return s.final();
|
return s.final();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BladeRFSettings::deserialize(const QByteArray& data)
|
bool BladeRFInputSettings::deserialize(const QByteArray& data)
|
||||||
{
|
{
|
||||||
SimpleDeserializer d(data);
|
SimpleDeserializer d(data);
|
||||||
|
|
@ -14,12 +14,12 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _BLADERF_BLADERFSETTINGS_H_
|
#ifndef _BLADERF_BLADERFINPUTSETTINGS_H_
|
||||||
#define _BLADERF_BLADERFSETTINGS_H_
|
#define _BLADERF_BLADERFINPUTSETTINGS_H_
|
||||||
|
|
||||||
#include <libbladeRF.h>
|
#include <libbladeRF.h>
|
||||||
|
|
||||||
struct BladeRFSettings {
|
struct BladeRFInputSettings {
|
||||||
typedef enum {
|
typedef enum {
|
||||||
FC_POS_INFRA = 0,
|
FC_POS_INFRA = 0,
|
||||||
FC_POS_SUPRA,
|
FC_POS_SUPRA,
|
||||||
@ -40,10 +40,10 @@ struct BladeRFSettings {
|
|||||||
bool m_dcBlock;
|
bool m_dcBlock;
|
||||||
bool m_iqCorrection;
|
bool m_iqCorrection;
|
||||||
|
|
||||||
BladeRFSettings();
|
BladeRFInputSettings();
|
||||||
void resetToDefaults();
|
void resetToDefaults();
|
||||||
QByteArray serialize() const;
|
QByteArray serialize() const;
|
||||||
bool deserialize(const QByteArray& data);
|
bool deserialize(const QByteArray& data);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _BLADERF_BLADERFSETTINGS_H_ */
|
#endif /* _BLADERF_BLADERFINPUTSETTINGS_H_ */
|
@ -16,12 +16,12 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "bladerfthread.h"
|
|
||||||
#include "dsp/samplesinkfifo.h"
|
#include "dsp/samplesinkfifo.h"
|
||||||
|
#include "bladerfinputthread.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BladerfThread::BladerfThread(struct bladerf* dev, SampleSinkFifo* sampleFifo, QObject* parent) :
|
BladerfInputThread::BladerfInputThread(struct bladerf* dev, SampleSinkFifo* sampleFifo, QObject* parent) :
|
||||||
QThread(parent),
|
QThread(parent),
|
||||||
m_running(false),
|
m_running(false),
|
||||||
m_dev(dev),
|
m_dev(dev),
|
||||||
@ -32,12 +32,12 @@ BladerfThread::BladerfThread(struct bladerf* dev, SampleSinkFifo* sampleFifo, QO
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
BladerfThread::~BladerfThread()
|
BladerfInputThread::~BladerfInputThread()
|
||||||
{
|
{
|
||||||
stopWork();
|
stopWork();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfThread::startWork()
|
void BladerfInputThread::startWork()
|
||||||
{
|
{
|
||||||
m_startWaitMutex.lock();
|
m_startWaitMutex.lock();
|
||||||
start();
|
start();
|
||||||
@ -46,23 +46,23 @@ void BladerfThread::startWork()
|
|||||||
m_startWaitMutex.unlock();
|
m_startWaitMutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfThread::stopWork()
|
void BladerfInputThread::stopWork()
|
||||||
{
|
{
|
||||||
m_running = false;
|
m_running = false;
|
||||||
wait();
|
wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfThread::setLog2Decimation(unsigned int log2_decim)
|
void BladerfInputThread::setLog2Decimation(unsigned int log2_decim)
|
||||||
{
|
{
|
||||||
m_log2Decim = log2_decim;
|
m_log2Decim = log2_decim;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfThread::setFcPos(int fcPos)
|
void BladerfInputThread::setFcPos(int fcPos)
|
||||||
{
|
{
|
||||||
m_fcPos = fcPos;
|
m_fcPos = fcPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfThread::run()
|
void BladerfInputThread::run()
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ void BladerfThread::run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Decimate according to specified log2 (ex: log2=4 => decim=16)
|
// Decimate according to specified log2 (ex: log2=4 => decim=16)
|
||||||
void BladerfThread::callback(const qint16* buf, qint32 len)
|
void BladerfInputThread::callback(const qint16* buf, qint32 len)
|
||||||
{
|
{
|
||||||
SampleVector::iterator it = m_convertBuffer.begin();
|
SampleVector::iterator it = m_convertBuffer.begin();
|
||||||
|
|
@ -14,8 +14,8 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef INCLUDE_BLADERFTHREAD_H
|
#ifndef INCLUDE_BLADERFINPUTTHREAD_H
|
||||||
#define INCLUDE_BLADERFTHREAD_H
|
#define INCLUDE_BLADERFINPUTTHREAD_H
|
||||||
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
@ -26,12 +26,12 @@
|
|||||||
|
|
||||||
#define BLADERF_BLOCKSIZE (1<<14)
|
#define BLADERF_BLOCKSIZE (1<<14)
|
||||||
|
|
||||||
class BladerfThread : public QThread {
|
class BladerfInputThread : public QThread {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BladerfThread(struct bladerf* dev, SampleSinkFifo* sampleFifo, QObject* parent = NULL);
|
BladerfInputThread(struct bladerf* dev, SampleSinkFifo* sampleFifo, QObject* parent = NULL);
|
||||||
~BladerfThread();
|
~BladerfInputThread();
|
||||||
|
|
||||||
void startWork();
|
void startWork();
|
||||||
void stopWork();
|
void stopWork();
|
||||||
@ -57,4 +57,4 @@ private:
|
|||||||
void callback(const qint16* buf, qint32 len);
|
void callback(const qint16* buf, qint32 len);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_BLADERFTHREAD_H
|
#endif // INCLUDE_BLADERFINPUTTHREAD_H
|
Loading…
Reference in New Issue
Block a user