1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -05:00

LibbladeRF2: migrate bladerfinput to bladerf1input (1)

This commit is contained in:
f4exb 2018-09-19 08:56:39 +02:00
parent 0e79f4eccf
commit 3726664132
13 changed files with 168 additions and 168 deletions

View File

@ -3,19 +3,19 @@ project(bladerfinput)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(bladerfinput_SOURCES
bladerfinputgui.cpp
bladerfinput.cpp
bladerfinputplugin.cpp
bladerfinputsettings.cpp
bladerfinputthread.cpp
bladerf1inputgui.cpp
bladerf1input.cpp
bladerf1inputplugin.cpp
bladerf1inputsettings.cpp
bladerf1inputthread.cpp
)
set(bladerfinput_HEADERS
bladerfinputgui.h
bladerfinput.h
bladerfinputplugin.h
bladerfinputsettings.h
bladerfinputthread.h
bladerf1inputgui.h
bladerf1input.h
bladerf1inputplugin.h
bladerf1inputsettings.h
bladerf1inputthread.h
)
set(bladerfinput_FORMS

View File

@ -14,7 +14,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "bladerfinput.h"
#include "bladerf1input.h"
#include <string.h>
#include <errno.h>
@ -30,13 +30,13 @@
#include "device/devicesourceapi.h"
#include "device/devicesinkapi.h"
#include "bladerfinputthread.h"
#include "bladerf1inputthread.h"
MESSAGE_CLASS_DEFINITION(BladerfInput::MsgConfigureBladerf, Message)
MESSAGE_CLASS_DEFINITION(BladerfInput::MsgStartStop, Message)
MESSAGE_CLASS_DEFINITION(BladerfInput::MsgFileRecord, Message)
MESSAGE_CLASS_DEFINITION(Bladerf1Input::MsgConfigureBladerf1, Message)
MESSAGE_CLASS_DEFINITION(Bladerf1Input::MsgStartStop, Message)
MESSAGE_CLASS_DEFINITION(Bladerf1Input::MsgFileRecord, Message)
BladerfInput::BladerfInput(DeviceSourceAPI *deviceAPI) :
Bladerf1Input::Bladerf1Input(DeviceSourceAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_settings(),
m_dev(0),
@ -51,7 +51,7 @@ BladerfInput::BladerfInput(DeviceSourceAPI *deviceAPI) :
m_deviceAPI->setBuddySharedPtr(&m_sharedParams);
}
BladerfInput::~BladerfInput()
Bladerf1Input::~Bladerf1Input()
{
if (m_running) stop();
m_deviceAPI->removeSink(m_fileSink);
@ -60,12 +60,12 @@ BladerfInput::~BladerfInput()
m_deviceAPI->setBuddySharedPtr(0);
}
void BladerfInput::destroy()
void Bladerf1Input::destroy()
{
delete this;
}
bool BladerfInput::openDevice()
bool Bladerf1Input::openDevice()
{
if (m_dev != 0)
{
@ -127,12 +127,12 @@ bool BladerfInput::openDevice()
return true;
}
void BladerfInput::init()
void Bladerf1Input::init()
{
applySettings(m_settings, true);
}
bool BladerfInput::start()
bool Bladerf1Input::start()
{
// QMutexLocker mutexLocker(&m_mutex);
@ -144,7 +144,7 @@ bool BladerfInput::start()
if (m_running) stop();
m_bladerfThread = new BladerfInputThread(m_dev, &m_sampleFifo);
m_bladerfThread = new Bladerf1InputThread(m_dev, &m_sampleFifo);
m_bladerfThread->setLog2Decimation(m_settings.m_log2Decim);
m_bladerfThread->setFcPos((int) m_settings.m_fcPos);
@ -159,7 +159,7 @@ bool BladerfInput::start()
return true;
}
void BladerfInput::closeDevice()
void Bladerf1Input::closeDevice()
{
int res;
@ -186,7 +186,7 @@ void BladerfInput::closeDevice()
m_dev = 0;
}
void BladerfInput::stop()
void Bladerf1Input::stop()
{
// QMutexLocker mutexLocker(&m_mutex);
@ -200,12 +200,12 @@ void BladerfInput::stop()
m_running = false;
}
QByteArray BladerfInput::serialize() const
QByteArray Bladerf1Input::serialize() const
{
return m_settings.serialize();
}
bool BladerfInput::deserialize(const QByteArray& data)
bool Bladerf1Input::deserialize(const QByteArray& data)
{
bool success = true;
@ -215,55 +215,55 @@ bool BladerfInput::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& BladerfInput::getDeviceDescription() const
const QString& Bladerf1Input::getDeviceDescription() const
{
return m_deviceDescription;
}
int BladerfInput::getSampleRate() const
int Bladerf1Input::getSampleRate() const
{
int rate = m_settings.m_devSampleRate;
return (rate / (1<<m_settings.m_log2Decim));
}
quint64 BladerfInput::getCenterFrequency() const
quint64 Bladerf1Input::getCenterFrequency() const
{
return m_settings.m_centerFrequency;
}
void BladerfInput::setCenterFrequency(qint64 centerFrequency)
void Bladerf1Input::setCenterFrequency(qint64 centerFrequency)
{
BladeRFInputSettings settings = m_settings;
BladeRF1InputSettings 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 BladerfInput::handleMessage(const Message& message)
bool Bladerf1Input::handleMessage(const Message& message)
{
if (MsgConfigureBladerf::match(message))
if (MsgConfigureBladerf1::match(message))
{
MsgConfigureBladerf& conf = (MsgConfigureBladerf&) message;
qDebug() << "BladerfInput::handleMessage: MsgConfigureBladerf";
MsgConfigureBladerf1& conf = (MsgConfigureBladerf1&) message;
qDebug() << "Bladerf1Input::handleMessage: MsgConfigureBladerf1";
if (!applySettings(conf.getSettings(), conf.getForce()))
{
@ -319,7 +319,7 @@ bool BladerfInput::handleMessage(const Message& message)
}
}
bool BladerfInput::applySettings(const BladeRFInputSettings& settings, bool force)
bool Bladerf1Input::applySettings(const BladeRF1InputSettings& settings, bool force)
{
bool forwardChange = false;
// QMutexLocker mutexLocker(&m_mutex);
@ -591,7 +591,7 @@ bool BladerfInput::applySettings(const BladeRFInputSettings& settings, bool forc
return true;
}
bladerf_lna_gain BladerfInput::getLnaGain(int lnaGain)
bladerf_lna_gain Bladerf1Input::getLnaGain(int lnaGain)
{
if (lnaGain == 2)
{
@ -607,7 +607,7 @@ bladerf_lna_gain BladerfInput::getLnaGain(int lnaGain)
}
}
int BladerfInput::webapiSettingsGet(
int Bladerf1Input::webapiSettingsGet(
SWGSDRangel::SWGDeviceSettings& response,
QString& errorMessage __attribute__((unused)))
{
@ -617,7 +617,7 @@ int BladerfInput::webapiSettingsGet(
return 200;
}
void BladerfInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const BladeRFInputSettings& settings)
void Bladerf1Input::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const BladeRF1InputSettings& settings)
{
response.getBladeRf1InputSettings()->setCenterFrequency(settings.m_centerFrequency);
response.getBladeRf1InputSettings()->setDevSampleRate(settings.m_devSampleRate);
@ -640,13 +640,13 @@ void BladerfInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& re
}
}
int BladerfInput::webapiSettingsPutPatch(
int Bladerf1Input::webapiSettingsPutPatch(
bool force,
const QStringList& deviceSettingsKeys,
SWGSDRangel::SWGDeviceSettings& response, // query + response
QString& errorMessage __attribute__((unused)))
{
BladeRFInputSettings settings = m_settings;
BladeRF1InputSettings settings = m_settings;
if (deviceSettingsKeys.contains("centerFrequency")) {
settings.m_centerFrequency = response.getBladeRf1InputSettings()->getCenterFrequency();
@ -670,7 +670,7 @@ int BladerfInput::webapiSettingsPutPatch(
settings.m_log2Decim = response.getBladeRf1InputSettings()->getLog2Decim();
}
if (deviceSettingsKeys.contains("fcPos")) {
settings.m_fcPos = static_cast<BladeRFInputSettings::fcPos_t>(response.getBladeRf1InputSettings()->getFcPos());
settings.m_fcPos = static_cast<BladeRF1InputSettings::fcPos_t>(response.getBladeRf1InputSettings()->getFcPos());
}
if (deviceSettingsKeys.contains("xb200")) {
settings.m_xb200 = response.getBladeRf1InputSettings()->getXb200() == 0 ? 0 : 1;
@ -691,12 +691,12 @@ int BladerfInput::webapiSettingsPutPatch(
settings.m_fileRecordName = *response.getBladeRf1InputSettings()->getFileRecordName();
}
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);
}
@ -704,7 +704,7 @@ int BladerfInput::webapiSettingsPutPatch(
return 200;
}
int BladerfInput::webapiRunGet(
int Bladerf1Input::webapiRunGet(
SWGSDRangel::SWGDeviceState& response,
QString& errorMessage __attribute__((unused)))
{
@ -712,7 +712,7 @@ int BladerfInput::webapiRunGet(
return 200;
}
int BladerfInput::webapiRun(
int Bladerf1Input::webapiRun(
bool run,
SWGSDRangel::SWGDeviceState& response,
QString& errorMessage __attribute__((unused)))

View File

@ -25,31 +25,31 @@
#include "../../../devices/bladerf1/devicebladerf1.h"
#include "../../../devices/bladerf1/devicebladerf1param.h"
#include "bladerfinputsettings.h"
#include "bladerf1inputsettings.h"
class DeviceSourceAPI;
class BladerfInputThread;
class Bladerf1InputThread;
class FileRecord;
class BladerfInput : public DeviceSampleSource {
class Bladerf1Input : public DeviceSampleSource {
public:
class MsgConfigureBladerf : public Message {
class MsgConfigureBladerf1 : public Message {
MESSAGE_CLASS_DECLARATION
public:
const BladeRFInputSettings& getSettings() const { return m_settings; }
const BladeRF1InputSettings& getSettings() const { return m_settings; }
bool getForce() const { return m_force; }
static MsgConfigureBladerf* create(const BladeRFInputSettings& settings, bool force)
static MsgConfigureBladerf1* create(const BladeRF1InputSettings& settings, bool force)
{
return new MsgConfigureBladerf(settings, force);
return new MsgConfigureBladerf1(settings, force);
}
private:
BladeRFInputSettings m_settings;
BladeRF1InputSettings m_settings;
bool m_force;
MsgConfigureBladerf(const BladeRFInputSettings& settings, bool force) :
MsgConfigureBladerf1(const BladeRF1InputSettings& settings, bool force) :
Message(),
m_settings(settings),
m_force(force)
@ -94,8 +94,8 @@ public:
{ }
};
BladerfInput(DeviceSourceAPI *deviceAPI);
virtual ~BladerfInput();
Bladerf1Input(DeviceSourceAPI *deviceAPI);
virtual ~Bladerf1Input();
virtual void destroy();
virtual void init();
@ -135,15 +135,15 @@ public:
private:
bool openDevice();
void closeDevice();
bool applySettings(const BladeRFInputSettings& settings, bool force);
bool applySettings(const BladeRF1InputSettings& settings, bool force);
bladerf_lna_gain getLnaGain(int lnaGain);
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const BladeRFInputSettings& settings);
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const BladeRF1InputSettings& settings);
DeviceSourceAPI *m_deviceAPI;
QMutex m_mutex;
BladeRFInputSettings m_settings;
BladeRF1InputSettings m_settings;
struct bladerf* m_dev;
BladerfInputThread* m_bladerfThread;
Bladerf1InputThread* m_bladerfThread;
QString m_deviceDescription;
DeviceBladeRF1Params m_sharedParams;
bool m_running;

View File

@ -14,7 +14,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "bladerfinputgui.h"
#include "bladerf1inputgui.h"
#include <QDebug>
#include <QMessageBox>
@ -29,7 +29,7 @@
#include <device/devicesourceapi.h>
#include "device/deviceuiset.h"
BladerfInputGui::BladerfInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
Bladerf1InputGui::Bladerf1InputGui(DeviceUISet *deviceUISet, QWidget* parent) :
QWidget(parent),
ui(new Ui::Bladerf1InputGui),
m_deviceUISet(deviceUISet),
@ -40,7 +40,7 @@ BladerfInputGui::BladerfInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
m_sampleRate(0),
m_lastEngineState(DSPDeviceSourceEngine::StNotStarted)
{
m_sampleSource = (BladerfInput*) m_deviceUISet->m_deviceSourceAPI->getSampleSource();
m_sampleSource = (Bladerf1Input*) m_deviceUISet->m_deviceSourceAPI->getSampleSource();
ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
@ -68,51 +68,51 @@ BladerfInputGui::BladerfInputGui(DeviceUISet *deviceUISet, QWidget* parent) :
sendSettings();
}
BladerfInputGui::~BladerfInputGui()
Bladerf1InputGui::~Bladerf1InputGui()
{
delete ui;
}
void BladerfInputGui::destroy()
void Bladerf1InputGui::destroy()
{
delete this;
}
void BladerfInputGui::setName(const QString& name)
void Bladerf1InputGui::setName(const QString& name)
{
setObjectName(name);
}
QString BladerfInputGui::getName() const
QString Bladerf1InputGui::getName() const
{
return objectName();
}
void BladerfInputGui::resetToDefaults()
void Bladerf1InputGui::resetToDefaults()
{
m_settings.resetToDefaults();
displaySettings();
sendSettings();
}
qint64 BladerfInputGui::getCenterFrequency() const
qint64 Bladerf1InputGui::getCenterFrequency() const
{
return m_settings.m_centerFrequency;
}
void BladerfInputGui::setCenterFrequency(qint64 centerFrequency)
void Bladerf1InputGui::setCenterFrequency(qint64 centerFrequency)
{
m_settings.m_centerFrequency = centerFrequency;
displaySettings();
sendSettings();
}
QByteArray BladerfInputGui::serialize() const
QByteArray Bladerf1InputGui::serialize() const
{
return m_settings.serialize();
}
bool BladerfInputGui::deserialize(const QByteArray& data)
bool Bladerf1InputGui::deserialize(const QByteArray& data)
{
if(m_settings.deserialize(data)) {
displaySettings();
@ -125,20 +125,20 @@ bool BladerfInputGui::deserialize(const QByteArray& data)
}
}
bool BladerfInputGui::handleMessage(const Message& message)
bool Bladerf1InputGui::handleMessage(const Message& message)
{
if (BladerfInput::MsgConfigureBladerf::match(message))
if (Bladerf1Input::MsgConfigureBladerf1::match(message))
{
const BladerfInput::MsgConfigureBladerf& cfg = (BladerfInput::MsgConfigureBladerf&) message;
const Bladerf1Input::MsgConfigureBladerf1& cfg = (Bladerf1Input::MsgConfigureBladerf1&) message;
m_settings = cfg.getSettings();
blockApplySettings(true);
displaySettings();
blockApplySettings(false);
return true;
}
else if (BladerfInput::MsgStartStop::match(message))
else if (Bladerf1Input::MsgStartStop::match(message))
{
BladerfInput::MsgStartStop& notif = (BladerfInput::MsgStartStop&) message;
Bladerf1Input::MsgStartStop& notif = (Bladerf1Input::MsgStartStop&) message;
blockApplySettings(true);
ui->startStop->setChecked(notif.getStartStop());
blockApplySettings(false);
@ -151,7 +151,7 @@ bool BladerfInputGui::handleMessage(const Message& message)
}
}
void BladerfInputGui::handleInputMessages()
void Bladerf1InputGui::handleInputMessages()
{
Message* message;
@ -179,14 +179,14 @@ void BladerfInputGui::handleInputMessages()
}
}
void BladerfInputGui::updateSampleRateAndFrequency()
void Bladerf1InputGui::updateSampleRateAndFrequency()
{
m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate);
m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
ui->deviceRateLabel->setText(tr("%1k").arg(QString::number(m_sampleRate / 1000.0f, 'g', 5)));
}
void BladerfInputGui::displaySettings()
void Bladerf1InputGui::displaySettings()
{
blockApplySettings(true);
@ -216,44 +216,44 @@ void BladerfInputGui::displaySettings()
blockApplySettings(false);
}
void BladerfInputGui::sendSettings()
void Bladerf1InputGui::sendSettings()
{
if(!m_updateTimer.isActive())
m_updateTimer.start(100);
}
void BladerfInputGui::on_centerFrequency_changed(quint64 value)
void Bladerf1InputGui::on_centerFrequency_changed(quint64 value)
{
m_settings.m_centerFrequency = value * 1000;
sendSettings();
}
void BladerfInputGui::on_sampleRate_changed(quint64 value)
void Bladerf1InputGui::on_sampleRate_changed(quint64 value)
{
m_settings.m_devSampleRate = value;
sendSettings();
}
void BladerfInputGui::on_dcOffset_toggled(bool checked)
void Bladerf1InputGui::on_dcOffset_toggled(bool checked)
{
m_settings.m_dcBlock = checked;
sendSettings();
}
void BladerfInputGui::on_iqImbalance_toggled(bool checked)
void Bladerf1InputGui::on_iqImbalance_toggled(bool checked)
{
m_settings.m_iqCorrection = checked;
sendSettings();
}
void BladerfInputGui::on_bandwidth_currentIndexChanged(int index)
void Bladerf1InputGui::on_bandwidth_currentIndexChanged(int index)
{
int newbw = BladerfBandwidths::getBandwidth(index);
m_settings.m_bandwidth = newbw * 1000;
sendSettings();
}
void BladerfInputGui::on_decim_currentIndexChanged(int index)
void Bladerf1InputGui::on_decim_currentIndexChanged(int index)
{
if ((index <0) || (index > 6))
return;
@ -261,21 +261,21 @@ void BladerfInputGui::on_decim_currentIndexChanged(int index)
sendSettings();
}
void BladerfInputGui::on_fcPos_currentIndexChanged(int index)
void Bladerf1InputGui::on_fcPos_currentIndexChanged(int index)
{
if (index == 0) {
m_settings.m_fcPos = BladeRFInputSettings::FC_POS_INFRA;
m_settings.m_fcPos = BladeRF1InputSettings::FC_POS_INFRA;
sendSettings();
} else if (index == 1) {
m_settings.m_fcPos = BladeRFInputSettings::FC_POS_SUPRA;
m_settings.m_fcPos = BladeRF1InputSettings::FC_POS_SUPRA;
sendSettings();
} else if (index == 2) {
m_settings.m_fcPos = BladeRFInputSettings::FC_POS_CENTER;
m_settings.m_fcPos = BladeRF1InputSettings::FC_POS_CENTER;
sendSettings();
}
}
void BladerfInputGui::on_lna_currentIndexChanged(int index)
void Bladerf1InputGui::on_lna_currentIndexChanged(int index)
{
qDebug() << "BladerfGui: LNA gain = " << index * 3 << " dB";
@ -286,7 +286,7 @@ void BladerfInputGui::on_lna_currentIndexChanged(int index)
sendSettings();
}
void BladerfInputGui::on_vga1_valueChanged(int value)
void Bladerf1InputGui::on_vga1_valueChanged(int value)
{
if ((value < BLADERF_RXVGA1_GAIN_MIN) || (value > BLADERF_RXVGA1_GAIN_MAX))
return;
@ -296,7 +296,7 @@ void BladerfInputGui::on_vga1_valueChanged(int value)
sendSettings();
}
void BladerfInputGui::on_vga2_valueChanged(int value)
void Bladerf1InputGui::on_vga2_valueChanged(int value)
{
if ((value < BLADERF_RXVGA2_GAIN_MIN) || (value > BLADERF_RXVGA2_GAIN_MAX))
return;
@ -306,7 +306,7 @@ void BladerfInputGui::on_vga2_valueChanged(int value)
sendSettings();
}
void BladerfInputGui::on_xb200_currentIndexChanged(int index)
void Bladerf1InputGui::on_xb200_currentIndexChanged(int index)
{
if (index == 1) // bypass
{
@ -366,16 +366,16 @@ void BladerfInputGui::on_xb200_currentIndexChanged(int index)
sendSettings();
}
void BladerfInputGui::on_startStop_toggled(bool checked)
void Bladerf1InputGui::on_startStop_toggled(bool checked)
{
if (m_doApplySettings)
{
BladerfInput::MsgStartStop *message = BladerfInput::MsgStartStop::create(checked);
Bladerf1Input::MsgStartStop *message = Bladerf1Input::MsgStartStop::create(checked);
m_sampleSource->getInputMessageQueue()->push(message);
}
}
void BladerfInputGui::on_record_toggled(bool checked)
void Bladerf1InputGui::on_record_toggled(bool checked)
{
if (checked) {
ui->record->setStyleSheet("QToolButton { background-color : red; }");
@ -383,28 +383,28 @@ void BladerfInputGui::on_record_toggled(bool checked)
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
}
BladerfInput::MsgFileRecord* message = BladerfInput::MsgFileRecord::create(checked);
Bladerf1Input::MsgFileRecord* message = Bladerf1Input::MsgFileRecord::create(checked);
m_sampleSource->getInputMessageQueue()->push(message);
}
void BladerfInputGui::updateHardware()
void Bladerf1InputGui::updateHardware()
{
if (m_doApplySettings)
{
qDebug() << "BladerfGui::updateHardware";
BladerfInput::MsgConfigureBladerf* message = BladerfInput::MsgConfigureBladerf::create(m_settings, m_forceSettings);
Bladerf1Input::MsgConfigureBladerf1* message = Bladerf1Input::MsgConfigureBladerf1::create(m_settings, m_forceSettings);
m_sampleSource->getInputMessageQueue()->push(message);
m_forceSettings = false;
m_updateTimer.stop();
}
}
void BladerfInputGui::blockApplySettings(bool block)
void Bladerf1InputGui::blockApplySettings(bool block)
{
m_doApplySettings = !block;
}
void BladerfInputGui::updateStatus()
void Bladerf1InputGui::updateStatus()
{
int state = m_deviceUISet->m_deviceSourceAPI->state();
@ -433,7 +433,7 @@ void BladerfInputGui::updateStatus()
}
}
unsigned int BladerfInputGui::getXb200Index(bool xb_200, bladerf_xb200_path xb200Path, bladerf_xb200_filter xb200Filter)
unsigned int Bladerf1InputGui::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 "bladerfinput.h"
#include "bladerf1input.h"
class DeviceUISet;
@ -31,12 +31,12 @@ namespace Ui {
class Bladerf1InputGui;
}
class BladerfInputGui : public QWidget, public PluginInstanceGUI {
class Bladerf1InputGui : public QWidget, public PluginInstanceGUI {
Q_OBJECT
public:
explicit BladerfInputGui(DeviceUISet *deviceUISet, QWidget* parent = 0);
virtual ~BladerfInputGui();
explicit Bladerf1InputGui(DeviceUISet *deviceUISet, QWidget* parent = 0);
virtual ~Bladerf1InputGui();
virtual void destroy();
void setName(const QString& name);
@ -56,7 +56,7 @@ private:
DeviceUISet* m_deviceUISet;
bool m_forceSettings;
bool m_doApplySettings;
BladeRFInputSettings m_settings;
BladeRF1InputSettings m_settings;
QTimer m_updateTimer;
QTimer m_statusTimer;
std::vector<int> m_gains;

View File

@ -14,7 +14,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "bladerfinputplugin.h"
#include "bladerf1inputplugin.h"
#include <QtPlugin>
#include <libbladeRF.h>
@ -23,12 +23,12 @@
#include <device/devicesourceapi.h>
#ifdef SERVER_MODE
#include "bladerfinput.h"
#include "bladerf1input.h"
#else
#include "bladerfinputgui.h"
#include "bladerf1inputgui.h"
#endif
const PluginDescriptor BlderfInputPlugin::m_pluginDescriptor = {
const PluginDescriptor Blderf1InputPlugin::m_pluginDescriptor = {
QString("BladeRF1 Input"),
QString("4.2.0"),
QString("(c) Edouard Griffiths, F4EXB"),
@ -37,25 +37,25 @@ const PluginDescriptor BlderfInputPlugin::m_pluginDescriptor = {
QString("https://github.com/f4exb/sdrangel")
};
const QString BlderfInputPlugin::m_hardwareID = "BladeRF1";
const QString BlderfInputPlugin::m_deviceTypeID = BLADERF1INPUT_DEVICE_TYPE_ID;
const QString Blderf1InputPlugin::m_hardwareID = "BladeRF1";
const QString Blderf1InputPlugin::m_deviceTypeID = BLADERF1INPUT_DEVICE_TYPE_ID;
BlderfInputPlugin::BlderfInputPlugin(QObject* parent) :
Blderf1InputPlugin::Blderf1InputPlugin(QObject* parent) :
QObject(parent)
{
}
const PluginDescriptor& BlderfInputPlugin::getPluginDescriptor() const
const PluginDescriptor& Blderf1InputPlugin::getPluginDescriptor() const
{
return m_pluginDescriptor;
}
void BlderfInputPlugin::initPlugin(PluginAPI* pluginAPI)
void Blderf1InputPlugin::initPlugin(PluginAPI* pluginAPI)
{
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices BlderfInputPlugin::enumSampleSources()
PluginInterface::SamplingDevices Blderf1InputPlugin::enumSampleSources()
{
SamplingDevices result;
struct bladerf_devinfo *devinfo = 0;
@ -108,7 +108,7 @@ PluginInterface::SamplingDevices BlderfInputPlugin::enumSampleSources()
}
#ifdef SERVER_MODE
PluginInstanceGUI* BlderfInputPlugin::createSampleSourcePluginInstanceGUI(
PluginInstanceGUI* Blderf1InputPlugin::createSampleSourcePluginInstanceGUI(
const QString& sourceId __attribute__((unused)),
QWidget **widget __attribute__((unused)),
DeviceUISet *deviceUISet __attribute__((unused)))
@ -116,14 +116,14 @@ PluginInstanceGUI* BlderfInputPlugin::createSampleSourcePluginInstanceGUI(
return 0;
}
#else
PluginInstanceGUI* BlderfInputPlugin::createSampleSourcePluginInstanceGUI(
PluginInstanceGUI* Blderf1InputPlugin::createSampleSourcePluginInstanceGUI(
const QString& sourceId,
QWidget **widget,
DeviceUISet *deviceUISet)
{
if(sourceId == m_deviceTypeID)
{
BladerfInputGui* gui = new BladerfInputGui(deviceUISet);
Bladerf1InputGui* gui = new Bladerf1InputGui(deviceUISet);
*widget = gui;
return gui;
}
@ -134,11 +134,11 @@ PluginInstanceGUI* BlderfInputPlugin::createSampleSourcePluginInstanceGUI(
}
#endif
DeviceSampleSource *BlderfInputPlugin::createSampleSourcePluginInstanceInput(const QString& sourceId, DeviceSourceAPI *deviceAPI)
DeviceSampleSource *Blderf1InputPlugin::createSampleSourcePluginInstanceInput(const QString& sourceId, DeviceSourceAPI *deviceAPI)
{
if (sourceId == m_deviceTypeID)
{
BladerfInput *input = new BladerfInput(deviceAPI);
Bladerf1Input *input = new Bladerf1Input(deviceAPI);
return input;
}
else

View File

@ -26,13 +26,13 @@ class DeviceUISet;
#define BLADERF1INPUT_DEVICE_TYPE_ID "sdrangel.samplesource.bladerf1input"
class BlderfInputPlugin : public QObject, public PluginInterface {
class Blderf1InputPlugin : public QObject, public PluginInterface {
Q_OBJECT
Q_INTERFACES(PluginInterface)
Q_PLUGIN_METADATA(IID BLADERF1INPUT_DEVICE_TYPE_ID)
public:
explicit BlderfInputPlugin(QObject* parent = NULL);
explicit Blderf1InputPlugin(QObject* parent = NULL);
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);

View File

@ -14,18 +14,18 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "bladerfinputsettings.h"
#include "bladerf1inputsettings.h"
#include <QtGlobal>
#include "util/simpleserializer.h"
BladeRFInputSettings::BladeRFInputSettings()
BladeRF1InputSettings::BladeRF1InputSettings()
{
resetToDefaults();
}
void BladeRFInputSettings::resetToDefaults()
void BladeRF1InputSettings::resetToDefaults()
{
m_centerFrequency = 435000*1000;
m_devSampleRate = 3072000;
@ -43,7 +43,7 @@ void BladeRFInputSettings::resetToDefaults()
m_fileRecordName = "";
}
QByteArray BladeRFInputSettings::serialize() const
QByteArray BladeRF1InputSettings::serialize() const
{
SimpleSerializer s(1);
@ -63,7 +63,7 @@ QByteArray BladeRFInputSettings::serialize() const
return s.final();
}
bool BladeRFInputSettings::deserialize(const QByteArray& data)
bool BladeRF1InputSettings::deserialize(const QByteArray& data)
{
SimpleDeserializer d(data);

View File

@ -21,7 +21,7 @@
#include <QString>
#include <libbladeRF.h>
struct BladeRFInputSettings {
struct BladeRF1InputSettings {
typedef enum {
FC_POS_INFRA = 0,
FC_POS_SUPRA,
@ -43,7 +43,7 @@ struct BladeRFInputSettings {
bool m_iqCorrection;
QString m_fileRecordName;
BladeRFInputSettings();
BladeRF1InputSettings();
void resetToDefaults();
QByteArray serialize() const;
bool deserialize(const QByteArray& data);

View File

@ -14,7 +14,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "../bladerfinput/bladerfinputthread.h"
#include "bladerf1inputthread.h"
#include <stdio.h>
#include <errno.h>
@ -23,7 +23,7 @@
BladerfInputThread::BladerfInputThread(struct bladerf* dev, SampleSinkFifo* sampleFifo, QObject* parent) :
Bladerf1InputThread::Bladerf1InputThread(struct bladerf* dev, SampleSinkFifo* sampleFifo, QObject* parent) :
QThread(parent),
m_running(false),
m_dev(dev),
@ -35,12 +35,12 @@ BladerfInputThread::BladerfInputThread(struct bladerf* dev, SampleSinkFifo* samp
std::fill(m_buf, m_buf + 2*BLADERF_BLOCKSIZE, 0);
}
BladerfInputThread::~BladerfInputThread()
Bladerf1InputThread::~Bladerf1InputThread()
{
stopWork();
}
void BladerfInputThread::startWork()
void Bladerf1InputThread::startWork()
{
m_startWaitMutex.lock();
start();
@ -49,23 +49,23 @@ void BladerfInputThread::startWork()
m_startWaitMutex.unlock();
}
void BladerfInputThread::stopWork()
void Bladerf1InputThread::stopWork()
{
m_running = false;
wait();
}
void BladerfInputThread::setLog2Decimation(unsigned int log2_decim)
void Bladerf1InputThread::setLog2Decimation(unsigned int log2_decim)
{
m_log2Decim = log2_decim;
}
void BladerfInputThread::setFcPos(int fcPos)
void Bladerf1InputThread::setFcPos(int fcPos)
{
m_fcPos = fcPos;
}
void BladerfInputThread::run()
void Bladerf1InputThread::run()
{
int res;
@ -85,7 +85,7 @@ void BladerfInputThread::run()
}
// Decimate according to specified log2 (ex: log2=4 => decim=16)
void BladerfInputThread::callback(const qint16* buf, qint32 len)
void Bladerf1InputThread::callback(const qint16* buf, qint32 len)
{
SampleVector::iterator it = m_convertBuffer.begin();

View File

@ -26,12 +26,12 @@
#define BLADERF_BLOCKSIZE (1<<14)
class BladerfInputThread : public QThread {
class Bladerf1InputThread : public QThread {
Q_OBJECT
public:
BladerfInputThread(struct bladerf* dev, SampleSinkFifo* sampleFifo, QObject* parent = NULL);
~BladerfInputThread();
Bladerf1InputThread(struct bladerf* dev, SampleSinkFifo* sampleFifo, QObject* parent = NULL);
~Bladerf1InputThread();
void startWork();
void stopWork();

View File

@ -30,17 +30,17 @@ INCLUDEPATH += $$LIBBLADERFSRC
CONFIG(Release):build_subdir = release
CONFIG(Debug):build_subdir = debug
SOURCES += bladerfinputgui.cpp\
bladerfinput.cpp\
bladerfinputplugin.cpp\
bladerfinputsettings.cpp\
bladerfinputthread.cpp
SOURCES += bladerf1inputgui.cpp\
bladerf1input.cpp\
bladerf1inputplugin.cpp\
bladerf1inputsettings.cpp\
bladerf1inputthread.cpp
HEADERS += bladerfinputgui.h\
bladerfinput.h\
bladerfinputplugin.h\
bladerfinputsettings.h\
bladerfinputthread.h
HEADERS += bladerf1inputgui.h\
bladerf1input.h\
bladerf1inputplugin.h\
bladerf1inputsettings.h\
bladerf1inputthread.h
FORMS += bladerfinputgui.ui

View File

@ -4,17 +4,17 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(PLUGIN_PREFIX "../../../plugins/samplesource/bladerfinput")
set(bladerfinput_SOURCES
${PLUGIN_PREFIX}/bladerfinput.cpp
${PLUGIN_PREFIX}/bladerfinputplugin.cpp
${PLUGIN_PREFIX}/bladerfinputsettings.cpp
${PLUGIN_PREFIX}/bladerfinputthread.cpp
${PLUGIN_PREFIX}/bladerf1input.cpp
${PLUGIN_PREFIX}/bladerf1inputplugin.cpp
${PLUGIN_PREFIX}/bladerf1inputsettings.cpp
${PLUGIN_PREFIX}/bladerf1inputthread.cpp
)
set(bladerfinput_HEADERS
${PLUGIN_PREFIX}/bladerfinput.h
${PLUGIN_PREFIX}/bladerfinputplugin.h
${PLUGIN_PREFIX}/bladerfinputsettings.h
${PLUGIN_PREFIX}/bladerfinputthread.h
${PLUGIN_PREFIX}/bladerf1input.h
${PLUGIN_PREFIX}/bladerf1inputplugin.h
${PLUGIN_PREFIX}/bladerf1inputsettings.h
${PLUGIN_PREFIX}/bladerf1inputthread.h
)
if (BUILD_DEBIAN)