1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-12 19:36:10 -05:00

LibbladeRF2: migrate bladerfoutput to bladerf1output

This commit is contained in:
f4exb 2018-09-19 08:42:59 +02:00
parent e130c2213f
commit 0e79f4eccf
19 changed files with 194 additions and 193 deletions

View File

@ -4,7 +4,7 @@ find_package(LibUSB)
find_package(LibBLADERF)
if(LIBUSB_FOUND AND LIBBLADERF_FOUND)
add_subdirectory(bladerfoutput)
add_subdirectory(bladerf1output)
endif(LIBUSB_FOUND AND LIBBLADERF_FOUND)
find_package(LibHACKRF)
@ -28,7 +28,7 @@ if(CM256CC_FOUND)
endif(CM256CC_FOUND)
if (BUILD_DEBIAN)
add_subdirectory(bladerfoutput)
add_subdirectory(bladerf1output)
add_subdirectory(hackrfoutput)
add_subdirectory(limesdroutput)
add_subdirectory(plutosdroutput)

View File

@ -1,24 +1,24 @@
project(bladerfoutput)
project(bladerf1output)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(bladerfoutput_SOURCES
bladerfoutputgui.cpp
bladerfoutput.cpp
bladerfoutputplugin.cpp
bladerfoutputsettings.cpp
bladerfoutputthread.cpp
set(bladerf1output_SOURCES
bladerf1outputgui.cpp
bladerf1output.cpp
bladerf1outputplugin.cpp
bladerf1outputsettings.cpp
bladerf1outputthread.cpp
)
set(bladerfoutput_HEADERS
bladerfoutputgui.h
bladerfoutput.h
bladerfoutputplugin.h
bladerfoutputsettings.h
bladerfoutputthread.h
set(bladerf1output_HEADERS
bladerf1outputgui.h
bladerf1output.h
bladerf1soutputplugin.h
bladerf1outputsettings.h
bladerf1outputthread.h
)
set(bladerfoutput_FORMS
set(bladerf1output_FORMS
bladerf1outputgui.ui
)
@ -46,17 +46,17 @@ add_definitions(${QT_DEFINITIONS})
add_definitions(-DQT_PLUGIN)
add_definitions(-DQT_SHARED)
#qt4_wrap_cpp(bladerfoutput_HEADERS_MOC ${bladerfoutput_HEADERS})
qt5_wrap_ui(bladerfoutput_FORMS_HEADERS ${bladerfoutput_FORMS})
#qt4_wrap_cpp(bladerf1output_HEADERS_MOC ${bladerf1output_HEADERS})
qt5_wrap_ui(bladerf1output_FORMS_HEADERS ${bladerf1output_FORMS})
add_library(outputbladerf SHARED
${bladerfoutput_SOURCES}
${bladerfoutput_HEADERS_MOC}
${bladerfoutput_FORMS_HEADERS}
add_library(outputbladerf1 SHARED
${bladerf1output_SOURCES}
${bladerf1output_HEADERS_MOC}
${bladerf1output_FORMS_HEADERS}
)
if (BUILD_DEBIAN)
target_link_libraries(outputbladerf
target_link_libraries(outputbladerf1
${QT_LIBRARIES}
bladerf
sdrbase
@ -65,7 +65,7 @@ target_link_libraries(outputbladerf
bladerf1device
)
else (BUILD_DEBIAN)
target_link_libraries(outputbladerf
target_link_libraries(outputbladerf1
${QT_LIBRARIES}
${LIBBLADERF_LIBRARIES}
sdrbase
@ -75,6 +75,6 @@ target_link_libraries(outputbladerf
)
endif (BUILD_DEBIAN)
target_link_libraries(outputbladerf Qt5::Core Qt5::Widgets)
target_link_libraries(outputbladerf1 Qt5::Core Qt5::Widgets)
install(TARGETS outputbladerf DESTINATION lib/plugins/samplesink)
install(TARGETS outputbladerf1 DESTINATION lib/plugins/samplesink)

View File

@ -14,6 +14,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "bladerf1output.h"
#include <string.h>
#include <errno.h>
#include <QDebug>
@ -26,16 +28,14 @@
#include "dsp/dspengine.h"
#include "device/devicesinkapi.h"
#include "device/devicesourceapi.h"
#include "bladerfoutput.h"
#include "../../../devices/bladerf1/devicebladerf1shared.h"
#include "bladerfoutputthread.h"
#include "bladerf1outputthread.h"
MESSAGE_CLASS_DEFINITION(BladerfOutput::MsgConfigureBladerf, Message)
MESSAGE_CLASS_DEFINITION(BladerfOutput::MsgStartStop, Message)
MESSAGE_CLASS_DEFINITION(BladerfOutput::MsgReportBladerf, Message)
MESSAGE_CLASS_DEFINITION(Bladerf1Output::MsgConfigureBladerf1, Message)
MESSAGE_CLASS_DEFINITION(Bladerf1Output::MsgStartStop, Message)
MESSAGE_CLASS_DEFINITION(Bladerf1Output::MsgReportBladerf1, Message)
BladerfOutput::BladerfOutput(DeviceSinkAPI *deviceAPI) :
Bladerf1Output::Bladerf1Output(DeviceSinkAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_settings(),
m_dev(0),
@ -48,19 +48,19 @@ BladerfOutput::BladerfOutput(DeviceSinkAPI *deviceAPI) :
m_deviceAPI->setBuddySharedPtr(&m_sharedParams);
}
BladerfOutput::~BladerfOutput()
Bladerf1Output::~Bladerf1Output()
{
if (m_running) stop();
closeDevice();
m_deviceAPI->setBuddySharedPtr(0);
}
void BladerfOutput::destroy()
void Bladerf1Output::destroy()
{
delete this;
}
bool BladerfOutput::openDevice()
bool Bladerf1Output::openDevice()
{
if (m_dev != 0)
{
@ -118,12 +118,12 @@ bool BladerfOutput::openDevice()
return true;
}
void BladerfOutput::init()
void Bladerf1Output::init()
{
applySettings(m_settings, true);
}
bool BladerfOutput::start()
bool Bladerf1Output::start()
{
// QMutexLocker mutexLocker(&m_mutex);
@ -133,7 +133,7 @@ bool BladerfOutput::start()
if (m_running) stop();
m_bladerfThread = new BladerfOutputThread(m_dev, &m_sampleSourceFifo);
m_bladerfThread = new Bladerf1OutputThread(m_dev, &m_sampleSourceFifo);
// mutexLocker.unlock();
applySettings(m_settings, true);
@ -148,7 +148,7 @@ bool BladerfOutput::start()
return true;
}
void BladerfOutput::closeDevice()
void Bladerf1Output::closeDevice()
{
int res;
@ -175,7 +175,7 @@ void BladerfOutput::closeDevice()
m_dev = 0;
}
void BladerfOutput::stop()
void Bladerf1Output::stop()
{
// QMutexLocker mutexLocker(&m_mutex);
if (m_bladerfThread != 0)
@ -188,12 +188,12 @@ void BladerfOutput::stop()
m_running = false;
}
QByteArray BladerfOutput::serialize() const
QByteArray Bladerf1Output::serialize() const
{
return m_settings.serialize();
}
bool BladerfOutput::deserialize(const QByteArray& data)
bool Bladerf1Output::deserialize(const QByteArray& data)
{
bool success = true;
@ -203,54 +203,54 @@ bool BladerfOutput::deserialize(const QByteArray& data)
success = false;
}
MsgConfigureBladerf* message = MsgConfigureBladerf::create(m_settings, true);
MsgConfigureBladerf1* message = MsgConfigureBladerf1::create(m_settings, true);
m_inputMessageQueue.push(message);
if (m_guiMessageQueue)
{
MsgConfigureBladerf* messageToGUI = MsgConfigureBladerf::create(m_settings, true);
MsgConfigureBladerf1* messageToGUI = MsgConfigureBladerf1::create(m_settings, true);
m_guiMessageQueue->push(messageToGUI);
}
return success;
}
const QString& BladerfOutput::getDeviceDescription() const
const QString& Bladerf1Output::getDeviceDescription() const
{
return m_deviceDescription;
}
int BladerfOutput::getSampleRate() const
int Bladerf1Output::getSampleRate() const
{
int rate = m_settings.m_devSampleRate;
return (rate / (1<<m_settings.m_log2Interp));
}
quint64 BladerfOutput::getCenterFrequency() const
quint64 Bladerf1Output::getCenterFrequency() const
{
return m_settings.m_centerFrequency;
}
void BladerfOutput::setCenterFrequency(qint64 centerFrequency)
void Bladerf1Output::setCenterFrequency(qint64 centerFrequency)
{
BladeRFOutputSettings settings = m_settings;
BladeRF1OutputSettings settings = m_settings;
settings.m_centerFrequency = centerFrequency;
MsgConfigureBladerf* message = MsgConfigureBladerf::create(settings, false);
MsgConfigureBladerf1* message = MsgConfigureBladerf1::create(settings, false);
m_inputMessageQueue.push(message);
if (m_guiMessageQueue)
{
MsgConfigureBladerf* messageToGUI = MsgConfigureBladerf::create(settings, false);
MsgConfigureBladerf1* messageToGUI = MsgConfigureBladerf1::create(settings, false);
m_guiMessageQueue->push(messageToGUI);
}
}
bool BladerfOutput::handleMessage(const Message& message)
bool Bladerf1Output::handleMessage(const Message& message)
{
if (MsgConfigureBladerf::match(message))
if (MsgConfigureBladerf1::match(message))
{
MsgConfigureBladerf& conf = (MsgConfigureBladerf&) message;
MsgConfigureBladerf1& conf = (MsgConfigureBladerf1&) message;
qDebug() << "BladerfOutput::handleMessage: MsgConfigureBladerf";
if (!applySettings(conf.getSettings(), conf.getForce()))
@ -285,7 +285,7 @@ bool BladerfOutput::handleMessage(const Message& message)
}
}
bool BladerfOutput::applySettings(const BladeRFOutputSettings& settings, bool force)
bool Bladerf1Output::applySettings(const BladeRF1OutputSettings& settings, bool force)
{
bool forwardChange = false;
bool suspendOwnThread = false;
@ -534,7 +534,7 @@ bool BladerfOutput::applySettings(const BladeRFOutputSettings& settings, bool fo
return true;
}
int BladerfOutput::webapiSettingsGet(
int Bladerf1Output::webapiSettingsGet(
SWGSDRangel::SWGDeviceSettings& response,
QString& errorMessage __attribute__((unused)))
{
@ -544,7 +544,7 @@ int BladerfOutput::webapiSettingsGet(
return 200;
}
void BladerfOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const BladeRFOutputSettings& settings)
void Bladerf1Output::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const BladeRF1OutputSettings& settings)
{
response.getBladeRf1OutputSettings()->setCenterFrequency(settings.m_centerFrequency);
response.getBladeRf1OutputSettings()->setDevSampleRate(settings.m_devSampleRate);
@ -557,13 +557,13 @@ void BladerfOutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& r
response.getBladeRf1OutputSettings()->setXb200Filter((int) settings.m_xb200Filter);
}
int BladerfOutput::webapiSettingsPutPatch(
int Bladerf1Output::webapiSettingsPutPatch(
bool force,
const QStringList& deviceSettingsKeys,
SWGSDRangel::SWGDeviceSettings& response, // query + response
QString& errorMessage __attribute__((unused)))
{
BladeRFOutputSettings settings = m_settings;
BladeRF1OutputSettings settings = m_settings;
if (deviceSettingsKeys.contains("centerFrequency")) {
settings.m_centerFrequency = response.getBladeRf1OutputSettings()->getCenterFrequency();
@ -593,12 +593,12 @@ int BladerfOutput::webapiSettingsPutPatch(
settings.m_xb200Filter = static_cast<bladerf_xb200_filter>(response.getBladeRf1OutputSettings()->getXb200Filter());
}
MsgConfigureBladerf *msg = MsgConfigureBladerf::create(settings, force);
MsgConfigureBladerf1 *msg = MsgConfigureBladerf1::create(settings, force);
m_inputMessageQueue.push(msg);
if (m_guiMessageQueue) // forward to GUI if any
{
MsgConfigureBladerf *msgToGUI = MsgConfigureBladerf::create(settings, force);
MsgConfigureBladerf1 *msgToGUI = MsgConfigureBladerf1::create(settings, force);
m_guiMessageQueue->push(msgToGUI);
}
@ -606,7 +606,7 @@ int BladerfOutput::webapiSettingsPutPatch(
return 200;
}
int BladerfOutput::webapiRunGet(
int Bladerf1Output::webapiRunGet(
SWGSDRangel::SWGDeviceState& response,
QString& errorMessage __attribute__((unused)))
{
@ -614,7 +614,7 @@ int BladerfOutput::webapiRunGet(
return 200;
}
int BladerfOutput::webapiRun(
int Bladerf1Output::webapiRun(
bool run,
SWGSDRangel::SWGDeviceState& response,
QString& errorMessage __attribute__((unused)))

View File

@ -23,30 +23,30 @@
#include "../../../devices/bladerf1/devicebladerf1.h"
#include "../../../devices/bladerf1/devicebladerf1param.h"
#include "bladerfoutputsettings.h"
#include "bladerf1outputsettings.h"
class DeviceSinkAPI;
class BladerfOutputThread;
class Bladerf1OutputThread;
class BladerfOutput : public DeviceSampleSink {
class Bladerf1Output : public DeviceSampleSink {
public:
class MsgConfigureBladerf : public Message {
class MsgConfigureBladerf1 : public Message {
MESSAGE_CLASS_DECLARATION
public:
const BladeRFOutputSettings& getSettings() const { return m_settings; }
const BladeRF1OutputSettings& getSettings() const { return m_settings; }
bool getForce() const { return m_force; }
static MsgConfigureBladerf* create(const BladeRFOutputSettings& settings, bool force)
static MsgConfigureBladerf1* create(const BladeRF1OutputSettings& settings, bool force)
{
return new MsgConfigureBladerf(settings, force);
return new MsgConfigureBladerf1(settings, force);
}
private:
BladeRFOutputSettings m_settings;
BladeRF1OutputSettings m_settings;
bool m_force;
MsgConfigureBladerf(const BladeRFOutputSettings& settings, bool force) :
MsgConfigureBladerf1(const BladeRF1OutputSettings& settings, bool force) :
Message(),
m_settings(settings),
m_force(force)
@ -72,25 +72,25 @@ public:
{ }
};
class MsgReportBladerf : public Message {
class MsgReportBladerf1 : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgReportBladerf* create()
static MsgReportBladerf1* create()
{
return new MsgReportBladerf();
return new MsgReportBladerf1();
}
protected:
MsgReportBladerf() :
MsgReportBladerf1() :
Message()
{ }
};
BladerfOutput(DeviceSinkAPI *deviceAPI);
virtual ~BladerfOutput();
Bladerf1Output(DeviceSinkAPI *deviceAPI);
virtual ~Bladerf1Output();
virtual void destroy();
virtual void init();
@ -130,14 +130,14 @@ public:
private:
bool openDevice();
void closeDevice();
bool applySettings(const BladeRFOutputSettings& settings, bool force);
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const BladeRFOutputSettings& settings);
bool applySettings(const BladeRF1OutputSettings& settings, bool force);
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const BladeRF1OutputSettings& settings);
DeviceSinkAPI *m_deviceAPI;
QMutex m_mutex;
BladeRFOutputSettings m_settings;
BladeRF1OutputSettings m_settings;
struct bladerf* m_dev;
BladerfOutputThread* m_bladerfThread;
Bladerf1OutputThread* m_bladerfThread;
QString m_deviceDescription;
DeviceBladeRF1Params m_sharedParams;
bool m_running;

View File

@ -26,9 +26,9 @@
#include "dsp/dspcommands.h"
#include "device/devicesinkapi.h"
#include "device/deviceuiset.h"
#include "bladerfoutputgui.h"
#include "bladerf1outputgui.h"
BladerfOutputGui::BladerfOutputGui(DeviceUISet *deviceUISet, QWidget* parent) :
Bladerf1OutputGui::Bladerf1OutputGui(DeviceUISet *deviceUISet, QWidget* parent) :
QWidget(parent),
ui(new Ui::Bladerf1OutputGui),
m_deviceUISet(deviceUISet),
@ -39,7 +39,7 @@ BladerfOutputGui::BladerfOutputGui(DeviceUISet *deviceUISet, QWidget* parent) :
m_sampleRate(0),
m_lastEngineState(DSPDeviceSinkEngine::StNotStarted)
{
m_deviceSampleSink = (BladerfOutput*) m_deviceUISet->m_deviceSinkAPI->getSampleSink();
m_deviceSampleSink = (Bladerf1Output*) m_deviceUISet->m_deviceSinkAPI->getSampleSink();
ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
@ -67,51 +67,51 @@ BladerfOutputGui::BladerfOutputGui(DeviceUISet *deviceUISet, QWidget* parent) :
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
}
BladerfOutputGui::~BladerfOutputGui()
Bladerf1OutputGui::~Bladerf1OutputGui()
{
delete ui;
}
void BladerfOutputGui::destroy()
void Bladerf1OutputGui::destroy()
{
delete this;
}
void BladerfOutputGui::setName(const QString& name)
void Bladerf1OutputGui::setName(const QString& name)
{
setObjectName(name);
}
QString BladerfOutputGui::getName() const
QString Bladerf1OutputGui::getName() const
{
return objectName();
}
void BladerfOutputGui::resetToDefaults()
void Bladerf1OutputGui::resetToDefaults()
{
m_settings.resetToDefaults();
displaySettings();
sendSettings();
}
qint64 BladerfOutputGui::getCenterFrequency() const
qint64 Bladerf1OutputGui::getCenterFrequency() const
{
return m_settings.m_centerFrequency;
}
void BladerfOutputGui::setCenterFrequency(qint64 centerFrequency)
void Bladerf1OutputGui::setCenterFrequency(qint64 centerFrequency)
{
m_settings.m_centerFrequency = centerFrequency;
displaySettings();
sendSettings();
}
QByteArray BladerfOutputGui::serialize() const
QByteArray Bladerf1OutputGui::serialize() const
{
return m_settings.serialize();
}
bool BladerfOutputGui::deserialize(const QByteArray& data)
bool Bladerf1OutputGui::deserialize(const QByteArray& data)
{
if(m_settings.deserialize(data)) {
displaySettings();
@ -124,25 +124,25 @@ bool BladerfOutputGui::deserialize(const QByteArray& data)
}
}
bool BladerfOutputGui::handleMessage(const Message& message)
bool Bladerf1OutputGui::handleMessage(const Message& message)
{
if (BladerfOutput::MsgConfigureBladerf::match(message))
if (Bladerf1Output::MsgConfigureBladerf1::match(message))
{
const BladerfOutput::MsgConfigureBladerf& cfg = (BladerfOutput::MsgConfigureBladerf&) message;
const Bladerf1Output::MsgConfigureBladerf1& cfg = (Bladerf1Output::MsgConfigureBladerf1&) message;
m_settings = cfg.getSettings();
blockApplySettings(true);
displaySettings();
blockApplySettings(false);
return true;
}
else if (BladerfOutput::MsgReportBladerf::match(message))
else if (Bladerf1Output::MsgReportBladerf1::match(message))
{
displaySettings();
return true;
}
else if (BladerfOutput::MsgStartStop::match(message))
else if (Bladerf1Output::MsgStartStop::match(message))
{
BladerfOutput::MsgStartStop& notif = (BladerfOutput::MsgStartStop&) message;
Bladerf1Output::MsgStartStop& notif = (Bladerf1Output::MsgStartStop&) message;
blockApplySettings(true);
ui->startStop->setChecked(notif.getStartStop());
blockApplySettings(false);
@ -154,7 +154,7 @@ bool BladerfOutputGui::handleMessage(const Message& message)
}
}
void BladerfOutputGui::handleInputMessages()
void Bladerf1OutputGui::handleInputMessages()
{
Message* message;
@ -182,14 +182,14 @@ void BladerfOutputGui::handleInputMessages()
}
}
void BladerfOutputGui::updateSampleRateAndFrequency()
void Bladerf1OutputGui::updateSampleRateAndFrequency()
{
m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate);
m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
ui->deviceRateLabel->setText(QString("%1k").arg(QString::number(m_sampleRate/1000.0, 'g', 5)));
}
void BladerfOutputGui::displaySettings()
void Bladerf1OutputGui::displaySettings()
{
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
ui->sampleRate->setValue(m_settings.m_devSampleRate);
@ -208,32 +208,32 @@ void BladerfOutputGui::displaySettings()
ui->xb200->setCurrentIndex(getXb200Index(m_settings.m_xb200, m_settings.m_xb200Path, m_settings.m_xb200Filter));
}
void BladerfOutputGui::sendSettings()
void Bladerf1OutputGui::sendSettings()
{
if(!m_updateTimer.isActive())
m_updateTimer.start(100);
}
void BladerfOutputGui::on_centerFrequency_changed(quint64 value)
void Bladerf1OutputGui::on_centerFrequency_changed(quint64 value)
{
m_settings.m_centerFrequency = value * 1000;
sendSettings();
}
void BladerfOutputGui::on_sampleRate_changed(quint64 value)
void Bladerf1OutputGui::on_sampleRate_changed(quint64 value)
{
m_settings.m_devSampleRate = value;
sendSettings();
}
void BladerfOutputGui::on_bandwidth_currentIndexChanged(int index)
void Bladerf1OutputGui::on_bandwidth_currentIndexChanged(int index)
{
int newbw = BladerfBandwidths::getBandwidth(index);
m_settings.m_bandwidth = newbw * 1000;
sendSettings();
}
void BladerfOutputGui::on_interp_currentIndexChanged(int index)
void Bladerf1OutputGui::on_interp_currentIndexChanged(int index)
{
if ((index <0) || (index > 6))
return;
@ -241,7 +241,7 @@ void BladerfOutputGui::on_interp_currentIndexChanged(int index)
sendSettings();
}
void BladerfOutputGui::on_vga1_valueChanged(int value)
void Bladerf1OutputGui::on_vga1_valueChanged(int value)
{
if ((value < BLADERF_TXVGA1_GAIN_MIN) || (value > BLADERF_TXVGA1_GAIN_MAX))
return;
@ -251,7 +251,7 @@ void BladerfOutputGui::on_vga1_valueChanged(int value)
sendSettings();
}
void BladerfOutputGui::on_vga2_valueChanged(int value)
void Bladerf1OutputGui::on_vga2_valueChanged(int value)
{
if ((value < BLADERF_TXVGA2_GAIN_MIN) || (value > BLADERF_TXVGA2_GAIN_MAX))
return;
@ -261,7 +261,7 @@ void BladerfOutputGui::on_vga2_valueChanged(int value)
sendSettings();
}
void BladerfOutputGui::on_xb200_currentIndexChanged(int index)
void Bladerf1OutputGui::on_xb200_currentIndexChanged(int index)
{
if (index == 1) // bypass
{
@ -321,25 +321,25 @@ void BladerfOutputGui::on_xb200_currentIndexChanged(int index)
sendSettings();
}
void BladerfOutputGui::on_startStop_toggled(bool checked)
void Bladerf1OutputGui::on_startStop_toggled(bool checked)
{
if (m_doApplySettings)
{
BladerfOutput::MsgStartStop *message = BladerfOutput::MsgStartStop::create(checked);
Bladerf1Output::MsgStartStop *message = Bladerf1Output::MsgStartStop::create(checked);
m_deviceSampleSink->getInputMessageQueue()->push(message);
}
}
void BladerfOutputGui::updateHardware()
void Bladerf1OutputGui::updateHardware()
{
qDebug() << "BladerfGui::updateHardware";
BladerfOutput::MsgConfigureBladerf* message = BladerfOutput::MsgConfigureBladerf::create( m_settings, m_forceSettings);
Bladerf1Output::MsgConfigureBladerf1* message = Bladerf1Output::MsgConfigureBladerf1::create( m_settings, m_forceSettings);
m_deviceSampleSink->getInputMessageQueue()->push(message);
m_forceSettings = false;
m_updateTimer.stop();
}
void BladerfOutputGui::updateStatus()
void Bladerf1OutputGui::updateStatus()
{
int state = m_deviceUISet->m_deviceSinkAPI->state();
@ -368,7 +368,7 @@ void BladerfOutputGui::updateStatus()
}
}
unsigned int BladerfOutputGui::getXb200Index(bool xb_200, bladerf_xb200_path xb200Path, bladerf_xb200_filter xb200Filter)
unsigned int Bladerf1OutputGui::getXb200Index(bool xb_200, bladerf_xb200_path xb200Path, bladerf_xb200_filter xb200Filter)
{
if (xb_200)
{

View File

@ -23,7 +23,7 @@
#include "util/messagequeue.h"
#include "bladerfoutput.h"
#include "bladerf1output.h"
class DeviceSampleSink;
class DeviceUISet;
@ -32,12 +32,12 @@ namespace Ui {
class Bladerf1OutputGui;
}
class BladerfOutputGui : public QWidget, public PluginInstanceGUI {
class Bladerf1OutputGui : public QWidget, public PluginInstanceGUI {
Q_OBJECT
public:
explicit BladerfOutputGui(DeviceUISet *deviceUISet, QWidget* parent = 0);
virtual ~BladerfOutputGui();
explicit Bladerf1OutputGui(DeviceUISet *deviceUISet, QWidget* parent = 0);
virtual ~Bladerf1OutputGui();
virtual void destroy();
void setName(const QString& name);
@ -57,7 +57,7 @@ private:
DeviceUISet* m_deviceUISet;
bool m_doApplySettings;
bool m_forceSettings;
BladeRFOutputSettings m_settings;
BladeRF1OutputSettings m_settings;
QTimer m_updateTimer;
QTimer m_statusTimer;
DeviceSampleSink* m_deviceSampleSink;

View File

@ -20,15 +20,15 @@
#include "util/simpleserializer.h"
#include <device/devicesourceapi.h>
#include "bladerfoutputplugin.h"
#include "bladerf1outputplugin.h"
#ifdef SERVER_MODE
#include "bladerfoutput.h"
#include "bladerf1output.h"
#else
#include "bladerfoutputgui.h"
#include "bladerf1outputgui.h"
#endif
const PluginDescriptor BladerfOutputPlugin::m_pluginDescriptor = {
const PluginDescriptor Bladerf1OutputPlugin::m_pluginDescriptor = {
QString("BladeRF1 Output"),
QString("4.2.0"),
QString("(c) Edouard Griffiths, F4EXB"),
@ -37,25 +37,25 @@ const PluginDescriptor BladerfOutputPlugin::m_pluginDescriptor = {
QString("https://github.com/f4exb/sdrangel")
};
const QString BladerfOutputPlugin::m_hardwareID = "BladeRF1";
const QString BladerfOutputPlugin::m_deviceTypeID = BLADERF1OUTPUT_DEVICE_TYPE_ID;
const QString Bladerf1OutputPlugin::m_hardwareID = "BladeRF1";
const QString Bladerf1OutputPlugin::m_deviceTypeID = BLADERF1OUTPUT_DEVICE_TYPE_ID;
BladerfOutputPlugin::BladerfOutputPlugin(QObject* parent) :
Bladerf1OutputPlugin::Bladerf1OutputPlugin(QObject* parent) :
QObject(parent)
{
}
const PluginDescriptor& BladerfOutputPlugin::getPluginDescriptor() const
const PluginDescriptor& Bladerf1OutputPlugin::getPluginDescriptor() const
{
return m_pluginDescriptor;
}
void BladerfOutputPlugin::initPlugin(PluginAPI* pluginAPI)
void Bladerf1OutputPlugin::initPlugin(PluginAPI* pluginAPI)
{
pluginAPI->registerSampleSink(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices BladerfOutputPlugin::enumSampleSinks()
PluginInterface::SamplingDevices Bladerf1OutputPlugin::enumSampleSinks()
{
SamplingDevices result;
struct bladerf_devinfo *devinfo = 0;
@ -109,7 +109,7 @@ PluginInterface::SamplingDevices BladerfOutputPlugin::enumSampleSinks()
}
#ifdef SERVER_MODE
PluginInstanceGUI* BladerfOutputPlugin::createSampleSinkPluginInstanceGUI(
PluginInstanceGUI* Bladerf1OutputPlugin::createSampleSinkPluginInstanceGUI(
const QString& sinkId __attribute__((unused)),
QWidget **widget __attribute__((unused)),
DeviceUISet *deviceUISet __attribute__((unused)))
@ -117,14 +117,14 @@ PluginInstanceGUI* BladerfOutputPlugin::createSampleSinkPluginInstanceGUI(
return 0;
}
#else
PluginInstanceGUI* BladerfOutputPlugin::createSampleSinkPluginInstanceGUI(
PluginInstanceGUI* Bladerf1OutputPlugin::createSampleSinkPluginInstanceGUI(
const QString& sinkId,
QWidget **widget,
DeviceUISet *deviceUISet)
{
if(sinkId == m_deviceTypeID)
{
BladerfOutputGui* gui = new BladerfOutputGui(deviceUISet);
Bladerf1OutputGui* gui = new Bladerf1OutputGui(deviceUISet);
*widget = gui;
return gui;
}
@ -135,16 +135,15 @@ PluginInstanceGUI* BladerfOutputPlugin::createSampleSinkPluginInstanceGUI(
}
#endif
DeviceSampleSink* BladerfOutputPlugin::createSampleSinkPluginInstanceOutput(const QString& sinkId, DeviceSinkAPI *deviceAPI)
DeviceSampleSink* Bladerf1OutputPlugin::createSampleSinkPluginInstanceOutput(const QString& sinkId, DeviceSinkAPI *deviceAPI)
{
if(sinkId == m_deviceTypeID)
{
BladerfOutput* output = new BladerfOutput(deviceAPI);
Bladerf1Output* output = new Bladerf1Output(deviceAPI);
return output;
}
else
{
return 0;
}
}

View File

@ -24,13 +24,13 @@ class PluginAPI;
#define BLADERF1OUTPUT_DEVICE_TYPE_ID "sdrangel.samplesource.bladerf1output"
class BladerfOutputPlugin : public QObject, public PluginInterface {
class Bladerf1OutputPlugin : public QObject, public PluginInterface {
Q_OBJECT
Q_INTERFACES(PluginInterface)
Q_PLUGIN_METADATA(IID BLADERF1OUTPUT_DEVICE_TYPE_ID)
public:
explicit BladerfOutputPlugin(QObject* parent = NULL);
explicit Bladerf1OutputPlugin(QObject* parent = NULL);
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);

View File

@ -14,17 +14,18 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "bladerf1outputsettings.h"
#include <QtGlobal>
#include "util/simpleserializer.h"
#include "bladerfoutputsettings.h"
BladeRFOutputSettings::BladeRFOutputSettings()
BladeRF1OutputSettings::BladeRF1OutputSettings()
{
resetToDefaults();
}
void BladeRFOutputSettings::resetToDefaults()
void BladeRF1OutputSettings::resetToDefaults()
{
m_centerFrequency = 435000*1000;
m_devSampleRate = 3072000;
@ -37,7 +38,7 @@ void BladeRFOutputSettings::resetToDefaults()
m_xb200Filter = BLADERF_XB200_AUTO_1DB;
}
QByteArray BladeRFOutputSettings::serialize() const
QByteArray BladeRF1OutputSettings::serialize() const
{
SimpleSerializer s(1);
@ -53,7 +54,7 @@ QByteArray BladeRFOutputSettings::serialize() const
return s.final();
}
bool BladeRFOutputSettings::deserialize(const QByteArray& data)
bool BladeRF1OutputSettings::deserialize(const QByteArray& data)
{
SimpleDeserializer d(data);

View File

@ -20,7 +20,7 @@
#include <QtGlobal>
#include <libbladeRF.h>
struct BladeRFOutputSettings {
struct BladeRF1OutputSettings {
quint64 m_centerFrequency;
qint32 m_devSampleRate;
qint32 m_vga1;
@ -31,7 +31,7 @@ struct BladeRFOutputSettings {
bladerf_xb200_path m_xb200Path;
bladerf_xb200_filter m_xb200Filter;
BladeRFOutputSettings();
BladeRF1OutputSettings();
void resetToDefaults();
QByteArray serialize() const;
bool deserialize(const QByteArray& data);

View File

@ -14,14 +14,15 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "bladerf1outputthread.h"
#include <stdio.h>
#include <errno.h>
#include <algorithm>
#include "bladerfoutputthread.h"
BladerfOutputThread::BladerfOutputThread(struct bladerf* dev, SampleSourceFifo* sampleFifo, QObject* parent) :
Bladerf1OutputThread::Bladerf1OutputThread(struct bladerf* dev, SampleSourceFifo* sampleFifo, QObject* parent) :
QThread(parent),
m_running(false),
m_dev(dev),
@ -31,12 +32,12 @@ BladerfOutputThread::BladerfOutputThread(struct bladerf* dev, SampleSourceFifo*
std::fill(m_buf, m_buf + 2*BLADERFOUTPUT_BLOCKSIZE, 0);
}
BladerfOutputThread::~BladerfOutputThread()
Bladerf1OutputThread::~Bladerf1OutputThread()
{
stopWork();
}
void BladerfOutputThread::startWork()
void Bladerf1OutputThread::startWork()
{
m_startWaitMutex.lock();
start();
@ -45,18 +46,18 @@ void BladerfOutputThread::startWork()
m_startWaitMutex.unlock();
}
void BladerfOutputThread::stopWork()
void Bladerf1OutputThread::stopWork()
{
m_running = false;
wait();
}
void BladerfOutputThread::setLog2Interpolation(unsigned int log2_interp)
void Bladerf1OutputThread::setLog2Interpolation(unsigned int log2_interp)
{
m_log2Interp = log2_interp;
}
void BladerfOutputThread::run()
void Bladerf1OutputThread::run()
{
int res;
@ -78,7 +79,7 @@ void BladerfOutputThread::run()
}
// Interpolate according to specified log2 (ex: log2=4 => decim=16)
void BladerfOutputThread::callback(qint16* buf, qint32 len)
void Bladerf1OutputThread::callback(qint16* buf, qint32 len)
{
SampleVector::iterator beginRead;
m_sampleFifo->readAdvance(beginRead, len/(1<<m_log2Interp));

View File

@ -26,12 +26,12 @@
#define BLADERFOUTPUT_BLOCKSIZE (1<<16)
class BladerfOutputThread : public QThread {
class Bladerf1OutputThread : public QThread {
Q_OBJECT
public:
BladerfOutputThread(struct bladerf* dev, SampleSourceFifo* sampleFifo, QObject* parent = NULL);
~BladerfOutputThread();
Bladerf1OutputThread(struct bladerf* dev, SampleSourceFifo* sampleFifo, QObject* parent = NULL);
~Bladerf1OutputThread();
void startWork();
void stopWork();

View File

@ -9,7 +9,7 @@ CONFIG += plugin
QT += core gui widgets multimedia opengl
TARGET = outputbladerf
TARGET = outputbladerf1
DEFINES += USE_SSE2=1
QMAKE_CXXFLAGS += -msse2
@ -30,19 +30,19 @@ INCLUDEPATH += $$LIBBLADERFSRC
CONFIG(Release):build_subdir = release
CONFIG(Debug):build_subdir = debug
SOURCES += bladerfoutputgui.cpp\
bladerfoutput.cpp\
bladerfoutputplugin.cpp\
bladerfoutputsettings.cpp\
bladerfoutputthread.cpp
SOURCES += bladerf1outputgui.cpp\
bladerf1output.cpp\
bladerf1outputplugin.cpp\
bladerf1outputsettings.cpp\
bladerf1outputthread.cpp
HEADERS += bladerfoutputgui.h\
bladerfoutput.h\
bladerfoutputplugin.h\
bladerfoutputsettings.h\
bladerfoutputthread.h
HEADERS += bladerf1outputgui.h\
bladerf1output.h\
bladerf1outputplugin.h\
bladerf1outputsettings.h\
bladerf1outputthread.h
FORMS += bladerfoutputgui.ui
FORMS += bladerf1outputgui.ui
LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase
LIBS += -L../../../sdrgui/$${build_subdir} -lsdrgui

View File

@ -1,20 +1,20 @@
project(bladerfoutput)
project(bladerf1output)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(PLUGIN_PREFIX "../../../plugins/samplesink/bladerfoutput")
set(PLUGIN_PREFIX "../../../plugins/samplesink/bladerf1output")
set(bladerfoutput_SOURCES
${PLUGIN_PREFIX}/bladerfoutput.cpp
${PLUGIN_PREFIX}/bladerfoutputplugin.cpp
${PLUGIN_PREFIX}/bladerfoutputsettings.cpp
${PLUGIN_PREFIX}/bladerfoutputthread.cpp
set(bladerf1output_SOURCES
${PLUGIN_PREFIX}/bladerf1output.cpp
${PLUGIN_PREFIX}/bladerf1outputplugin.cpp
${PLUGIN_PREFIX}/bladerf1outputsettings.cpp
${PLUGIN_PREFIX}/bladerf1outputthread.cpp
)
set(bladerfoutput_HEADERS
${PLUGIN_PREFIX}/bladerfoutput.h
${PLUGIN_PREFIX}/bladerfoutputplugin.h
${PLUGIN_PREFIX}/bladerfoutputsettings.h
${PLUGIN_PREFIX}/bladerfoutputthread.h
set(bladerf1output_HEADERS
${PLUGIN_PREFIX}/bladerf1output.h
${PLUGIN_PREFIX}/bladerf1outputplugin.h
${PLUGIN_PREFIX}/bladerf1outputsettings.h
${PLUGIN_PREFIX}/bladerf1outputthread.h
)
if (BUILD_DEBIAN)
@ -40,13 +40,13 @@ add_definitions(${QT_DEFINITIONS})
add_definitions(-DQT_PLUGIN)
add_definitions(-DQT_SHARED)
add_library(outputbladerfsrv SHARED
${bladerfoutput_SOURCES}
${bladerfoutput_HEADERS_MOC}
add_library(outputbladerf1srv SHARED
${bladerf1output_SOURCES}
${bladerf1output_HEADERS_MOC}
)
if (BUILD_DEBIAN)
target_link_libraries(outputbladerfsrv
target_link_libraries(outputbladerf1srv
${QT_LIBRARIES}
bladerf
sdrbase
@ -54,7 +54,7 @@ target_link_libraries(outputbladerfsrv
bladerf1device
)
else (BUILD_DEBIAN)
target_link_libraries(outputbladerfsrv
target_link_libraries(outputbladerf1srv
${QT_LIBRARIES}
${LIBBLADERF_LIBRARIES}
sdrbase
@ -63,6 +63,6 @@ target_link_libraries(outputbladerfsrv
)
endif (BUILD_DEBIAN)
target_link_libraries(outputbladerfsrv Qt5::Core)
target_link_libraries(outputbladerf1srv Qt5::Core)
install(TARGETS outputbladerfsrv DESTINATION lib/pluginssrv/samplesink)
install(TARGETS outputbladerf1srv DESTINATION lib/pluginssrv/samplesink)

View File

@ -40,7 +40,7 @@ SUBDIRS += plugins/samplesource/plutosdrinput
SUBDIRS += plugins/samplesource/rtlsdr
SUBDIRS += plugins/samplesource/testsource
SUBDIRS += plugins/samplesink/filesink
SUBDIRS += plugins/samplesink/bladerfoutput
SUBDIRS += plugins/samplesink/bladerf1output
SUBDIRS += plugins/samplesink/hackrfoutput
SUBDIRS += plugins/samplesink/limesdroutput
SUBDIRS += plugins/samplesink/plutosdroutput

View File

@ -119,7 +119,7 @@ def setupDevice(options):
lpFIRBW = options.sample_rate / (1 << options.log2_interp)
lpfBW = lpFIRBW * 1.2
if options.device_hwid == "BladeRF":
if options.device_hwid == "BladeRF1":
settings['bladeRFOutputSettings']['centerFrequency'] = options.device_freq * 1000
settings['bladeRFOutputSettings']['devSampleRate'] = options.sample_rate
settings['bladeRFOutputSettings']['vga1'] = -20

View File

@ -65,7 +65,7 @@ copy plugins\samplesource\limesdrinput\%1\inputlimesdr.dll %2\plugins\samplesour
copy plugins\samplesource\plutosdrinput\%1\inputplutosdr.dll %2\plugins\samplesource
REM copy plugins\samplesource\sdrdaemonsource\%1\inputsdrdaemonsource.dll %2\plugins\samplesource
copy plugins\samplesink\filesink\%1\outputfilesink.dll %2\plugins\samplesink
copy plugins\samplesink\bladerfoutput\%1\outputbladerf.dll %2\plugins\samplesink
copy plugins\samplesink\bladerf1output\%1\outputbladerf1.dll %2\plugins\samplesink
copy plugins\samplesink\hackrfoutput\%1\outputhackrf.dll %2\plugins\samplesink
copy plugins\samplesink\limesdroutput\%1\outputlimesdr.dll %2\plugins\samplesink
copy plugins\samplesink\plutosdroutput\%1\outputplutosdr.dll %2\plugins\samplesink