1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-06-12 11:32:33 -04:00

HackRF Tx support: rename Rx files and classes

This commit is contained in:
f4exb 2016-12-27 02:25:06 +01:00
parent b677fe4d32
commit da53b153ab
13 changed files with 130 additions and 131 deletions

View File

@ -1,23 +1,23 @@
project(hackrf) project(hackrf)
set(hackrf_SOURCES set(hackrf_SOURCES
hackrfgui.cpp hackrfinputgui.cpp
hackrfinput.cpp hackrfinput.cpp
hackrfplugin.cpp hackrfinputplugin.cpp
hackrfsettings.cpp hackrfinputsettings.cpp
hackrfthread.cpp hackrfinputthread.cpp
) )
set(hackrf_HEADERS set(hackrf_HEADERS
hackrfgui.h hackrfinputgui.h
hackrfinput.h hackrfinput.h
hackrfplugin.h hackrfinputplugin.h
hackrfsettings.h hackrfinputsettings.h
hackrfthread.h hackrfinputthread.h
) )
set(hackrf_FORMS set(hackrf_FORMS
hackrfgui.ui hackrfinputgui.ui
) )
if (BUILD_DEBIAN) if (BUILD_DEBIAN)

View File

@ -25,19 +25,19 @@ INCLUDEPATH += $$LIBHACKRFSRC
CONFIG(Release):build_subdir = release CONFIG(Release):build_subdir = release
CONFIG(Debug):build_subdir = debug CONFIG(Debug):build_subdir = debug
SOURCES += hackrfgui.cpp\ SOURCES += hackrfinputgui.cpp\
hackrfinput.cpp\ hackrfinput.cpp\
hackrfplugin.cpp\ hackrfinputplugin.cpp\
hackrfsettings.cpp\ hackrfinputsettings.cpp\
hackrfthread.cpp hackrfinputthread.cpp
HEADERS += hackrfgui.h\ HEADERS += hackrfinputgui.h\
hackrfinput.h\ hackrfinput.h\
hackrfplugin.h\ hackrfinputplugin.h\
hackrfsettings.h\ hackrfinputsettings.h\
hackrfthread.h hackrfinputthread.h
FORMS += hackrfgui.ui FORMS += hackrfinputgui.ui
LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase
LIBS += -L../../../libhackrf/$${build_subdir} -llibhackrf LIBS += -L../../../libhackrf/$${build_subdir} -llibhackrf

View File

@ -25,8 +25,8 @@
#include <device/devicesourceapi.h> #include <device/devicesourceapi.h>
#include "hackrfgui.h" #include "hackrfinputgui.h"
#include "hackrfthread.h" #include "hackrfinputthread.h"
MESSAGE_CLASS_DEFINITION(HackRFInput::MsgConfigureHackRF, Message) MESSAGE_CLASS_DEFINITION(HackRFInput::MsgConfigureHackRF, Message)
MESSAGE_CLASS_DEFINITION(HackRFInput::MsgReportHackRF, Message) MESSAGE_CLASS_DEFINITION(HackRFInput::MsgReportHackRF, Message)
@ -79,7 +79,7 @@ bool HackRFInput::start(int device)
return false; return false;
} }
if((m_hackRFThread = new HackRFThread(m_dev, &m_sampleFifo)) == 0) if((m_hackRFThread = new HackRFInputThread(m_dev, &m_sampleFifo)) == 0)
{ {
qFatal("HackRFInput::start: out of memory"); qFatal("HackRFInput::start: out of memory");
stop(); stop();
@ -174,7 +174,7 @@ void HackRFInput::setCenterFrequency(quint64 freq_hz)
} }
} }
bool HackRFInput::applySettings(const HackRFSettings& settings, bool force) bool HackRFInput::applySettings(const HackRFInputSettings& settings, bool force)
{ {
QMutexLocker mutexLocker(&m_mutex); QMutexLocker mutexLocker(&m_mutex);
@ -247,19 +247,19 @@ bool HackRFInput::applySettings(const HackRFSettings& settings, bool force)
m_settings.m_centerFrequency = settings.m_centerFrequency; m_settings.m_centerFrequency = settings.m_centerFrequency;
m_settings.m_LOppmTenths = settings.m_LOppmTenths; m_settings.m_LOppmTenths = settings.m_LOppmTenths;
if ((m_settings.m_log2Decim == 0) || (settings.m_fcPos == HackRFSettings::FC_POS_CENTER)) if ((m_settings.m_log2Decim == 0) || (settings.m_fcPos == HackRFInputSettings::FC_POS_CENTER))
{ {
deviceCenterFrequency = m_settings.m_centerFrequency; deviceCenterFrequency = m_settings.m_centerFrequency;
f_img = deviceCenterFrequency; f_img = deviceCenterFrequency;
} }
else else
{ {
if (settings.m_fcPos == HackRFSettings::FC_POS_INFRA) if (settings.m_fcPos == HackRFInputSettings::FC_POS_INFRA)
{ {
deviceCenterFrequency = m_settings.m_centerFrequency + (devSampleRate / 4); deviceCenterFrequency = m_settings.m_centerFrequency + (devSampleRate / 4);
f_img = deviceCenterFrequency + devSampleRate/2; f_img = deviceCenterFrequency + devSampleRate/2;
} }
else if (settings.m_fcPos == HackRFSettings::FC_POS_SUPRA) else if (settings.m_fcPos == HackRFInputSettings::FC_POS_SUPRA)
{ {
deviceCenterFrequency = m_settings.m_centerFrequency - (devSampleRate / 4); deviceCenterFrequency = m_settings.m_centerFrequency - (devSampleRate / 4);
f_img = deviceCenterFrequency - devSampleRate/2; f_img = deviceCenterFrequency - devSampleRate/2;

View File

@ -19,11 +19,11 @@
#include <dsp/devicesamplesource.h> #include <dsp/devicesamplesource.h>
#include "libhackrf/hackrf.h" #include "libhackrf/hackrf.h"
#include "hackrfsettings.h"
#include <QString> #include <QString>
#include "hackrfinputsettings.h"
class DeviceSourceAPI; class DeviceSourceAPI;
class HackRFThread; class HackRFInputThread;
class HackRFInput : public DeviceSampleSource { class HackRFInput : public DeviceSampleSource {
public: public:
@ -32,17 +32,17 @@ public:
MESSAGE_CLASS_DECLARATION MESSAGE_CLASS_DECLARATION
public: public:
const HackRFSettings& getSettings() const { return m_settings; } const HackRFInputSettings& getSettings() const { return m_settings; }
static MsgConfigureHackRF* create(const HackRFSettings& settings) static MsgConfigureHackRF* create(const HackRFInputSettings& settings)
{ {
return new MsgConfigureHackRF(settings); return new MsgConfigureHackRF(settings);
} }
private: private:
HackRFSettings m_settings; HackRFInputSettings m_settings;
MsgConfigureHackRF(const HackRFSettings& settings) : MsgConfigureHackRF(const HackRFInputSettings& 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 HackRFSettings& settings, bool force); bool applySettings(const HackRFInputSettings& settings, bool force);
hackrf_device *open_hackrf_from_sequence(int sequence); hackrf_device *open_hackrf_from_sequence(int sequence);
void setCenterFrequency(quint64 freq); void setCenterFrequency(quint64 freq);
DeviceSourceAPI *m_deviceAPI; DeviceSourceAPI *m_deviceAPI;
QMutex m_mutex; QMutex m_mutex;
HackRFSettings m_settings; HackRFInputSettings m_settings;
struct hackrf_device* m_dev; struct hackrf_device* m_dev;
HackRFThread* m_hackRFThread; HackRFInputThread* m_hackRFThread;
QString m_deviceDescription; QString m_deviceDescription;
}; };

View File

@ -23,16 +23,15 @@
#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 "hackrfgui.h"
#include <device/devicesourceapi.h> #include <device/devicesourceapi.h>
#include <dsp/filerecord.h> #include <dsp/filerecord.h>
#include "ui_hackrfgui.h" #include "hackrfinputgui.h"
#include "ui_hackrfinputgui.h"
HackRFGui::HackRFGui(DeviceSourceAPI *deviceAPI, QWidget* parent) : HackRFInputGui::HackRFInputGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::HackRFGui), ui(new Ui::HackRFInputGui),
m_deviceAPI(deviceAPI), m_deviceAPI(deviceAPI),
m_settings(), m_settings(),
m_sampleSource(NULL), m_sampleSource(NULL),
@ -63,7 +62,7 @@ HackRFGui::HackRFGui(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);
} }
HackRFGui::~HackRFGui() HackRFInputGui::~HackRFInputGui()
{ {
m_deviceAPI->removeSink(m_fileSink); m_deviceAPI->removeSink(m_fileSink);
delete m_fileSink; delete m_fileSink;
@ -71,46 +70,46 @@ HackRFGui::~HackRFGui()
delete ui; delete ui;
} }
void HackRFGui::destroy() void HackRFInputGui::destroy()
{ {
delete this; delete this;
} }
void HackRFGui::setName(const QString& name) void HackRFInputGui::setName(const QString& name)
{ {
setObjectName(name); setObjectName(name);
} }
QString HackRFGui::getName() const QString HackRFInputGui::getName() const
{ {
return objectName(); return objectName();
} }
void HackRFGui::resetToDefaults() void HackRFInputGui::resetToDefaults()
{ {
m_settings.resetToDefaults(); m_settings.resetToDefaults();
displaySettings(); displaySettings();
sendSettings(); sendSettings();
} }
qint64 HackRFGui::getCenterFrequency() const qint64 HackRFInputGui::getCenterFrequency() const
{ {
return m_settings.m_centerFrequency; return m_settings.m_centerFrequency;
} }
void HackRFGui::setCenterFrequency(qint64 centerFrequency) void HackRFInputGui::setCenterFrequency(qint64 centerFrequency)
{ {
m_settings.m_centerFrequency = centerFrequency; m_settings.m_centerFrequency = centerFrequency;
displaySettings(); displaySettings();
sendSettings(); sendSettings();
} }
QByteArray HackRFGui::serialize() const QByteArray HackRFInputGui::serialize() const
{ {
return m_settings.serialize(); return m_settings.serialize();
} }
bool HackRFGui::deserialize(const QByteArray& data) bool HackRFInputGui::deserialize(const QByteArray& data)
{ {
if(m_settings.deserialize(data)) { if(m_settings.deserialize(data)) {
displaySettings(); displaySettings();
@ -122,12 +121,12 @@ bool HackRFGui::deserialize(const QByteArray& data)
} }
} }
bool HackRFGui::handleMessage(const Message& message) bool HackRFInputGui::handleMessage(const Message& message)
{ {
return false; return false;
} }
void HackRFGui::handleDSPMessages() void HackRFInputGui::handleDSPMessages()
{ {
Message* message; Message* message;
@ -149,14 +148,14 @@ void HackRFGui::handleDSPMessages()
} }
} }
void HackRFGui::updateSampleRateAndFrequency() void HackRFInputGui::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->deviceRateText->setText(tr("%1k").arg((float)m_sampleRate / 1000)); ui->deviceRateText->setText(tr("%1k").arg((float)m_sampleRate / 1000));
} }
void HackRFGui::displaySettings() void HackRFInputGui::displaySettings()
{ {
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000); ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
@ -184,7 +183,7 @@ void HackRFGui::displaySettings()
ui->vga->setValue(m_settings.m_vgaGain); ui->vga->setValue(m_settings.m_vgaGain);
} }
void HackRFGui::displaySampleRates() void HackRFInputGui::displaySampleRates()
{ {
int savedIndex = m_settings.m_devSampleRateIndex; int savedIndex = m_settings.m_devSampleRateIndex;
ui->sampleRate->blockSignals(true); ui->sampleRate->blockSignals(true);
@ -207,7 +206,7 @@ void HackRFGui::displaySampleRates()
} }
} }
void HackRFGui::displayBandwidths() void HackRFInputGui::displayBandwidths()
{ {
int savedIndex = m_settings.m_bandwidthIndex; int savedIndex = m_settings.m_bandwidthIndex;
ui->bbFilter->blockSignals(true); ui->bbFilter->blockSignals(true);
@ -230,62 +229,62 @@ void HackRFGui::displayBandwidths()
} }
} }
void HackRFGui::sendSettings() void HackRFInputGui::sendSettings()
{ {
if(!m_updateTimer.isActive()) if(!m_updateTimer.isActive())
m_updateTimer.start(100); m_updateTimer.start(100);
} }
void HackRFGui::on_centerFrequency_changed(quint64 value) void HackRFInputGui::on_centerFrequency_changed(quint64 value)
{ {
m_settings.m_centerFrequency = value * 1000; m_settings.m_centerFrequency = value * 1000;
sendSettings(); sendSettings();
} }
void HackRFGui::on_LOppm_valueChanged(int value) void HackRFInputGui::on_LOppm_valueChanged(int value)
{ {
m_settings.m_LOppmTenths = value; m_settings.m_LOppmTenths = value;
ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1))); ui->LOppmText->setText(QString("%1").arg(QString::number(m_settings.m_LOppmTenths/10.0, 'f', 1)));
sendSettings(); sendSettings();
} }
void HackRFGui::on_dcOffset_toggled(bool checked) void HackRFInputGui::on_dcOffset_toggled(bool checked)
{ {
m_settings.m_dcBlock = checked; m_settings.m_dcBlock = checked;
sendSettings(); sendSettings();
} }
void HackRFGui::on_iqImbalance_toggled(bool checked) void HackRFInputGui::on_iqImbalance_toggled(bool checked)
{ {
m_settings.m_iqCorrection = checked; m_settings.m_iqCorrection = checked;
sendSettings(); sendSettings();
} }
void HackRFGui::on_sampleRate_currentIndexChanged(int index) void HackRFInputGui::on_sampleRate_currentIndexChanged(int index)
{ {
m_settings.m_devSampleRateIndex = index; m_settings.m_devSampleRateIndex = index;
sendSettings(); sendSettings();
} }
void HackRFGui::on_bbFilter_currentIndexChanged(int index) void HackRFInputGui::on_bbFilter_currentIndexChanged(int index)
{ {
m_settings.m_bandwidthIndex = index; m_settings.m_bandwidthIndex = index;
sendSettings(); sendSettings();
} }
void HackRFGui::on_biasT_stateChanged(int state) void HackRFInputGui::on_biasT_stateChanged(int state)
{ {
m_settings.m_biasT = (state == Qt::Checked); m_settings.m_biasT = (state == Qt::Checked);
sendSettings(); sendSettings();
} }
void HackRFGui::on_lnaExt_stateChanged(int state) void HackRFInputGui::on_lnaExt_stateChanged(int state)
{ {
m_settings.m_lnaExt = (state == Qt::Checked); m_settings.m_lnaExt = (state == Qt::Checked);
sendSettings(); sendSettings();
} }
void HackRFGui::on_decim_currentIndexChanged(int index) void HackRFInputGui::on_decim_currentIndexChanged(int index)
{ {
if ((index <0) || (index > 6)) if ((index <0) || (index > 6))
return; return;
@ -293,21 +292,21 @@ void HackRFGui::on_decim_currentIndexChanged(int index)
sendSettings(); sendSettings();
} }
void HackRFGui::on_fcPos_currentIndexChanged(int index) void HackRFInputGui::on_fcPos_currentIndexChanged(int index)
{ {
if (index == 0) { if (index == 0) {
m_settings.m_fcPos = HackRFSettings::FC_POS_INFRA; m_settings.m_fcPos = HackRFInputSettings::FC_POS_INFRA;
sendSettings(); sendSettings();
} else if (index == 1) { } else if (index == 1) {
m_settings.m_fcPos = HackRFSettings::FC_POS_SUPRA; m_settings.m_fcPos = HackRFInputSettings::FC_POS_SUPRA;
sendSettings(); sendSettings();
} else if (index == 2) { } else if (index == 2) {
m_settings.m_fcPos = HackRFSettings::FC_POS_CENTER; m_settings.m_fcPos = HackRFInputSettings::FC_POS_CENTER;
sendSettings(); sendSettings();
} }
} }
void HackRFGui::on_lna_valueChanged(int value) void HackRFInputGui::on_lna_valueChanged(int value)
{ {
if ((value < 0) || (value > 40)) if ((value < 0) || (value > 40))
return; return;
@ -317,7 +316,7 @@ void HackRFGui::on_lna_valueChanged(int value)
sendSettings(); sendSettings();
} }
void HackRFGui::on_vga_valueChanged(int value) void HackRFInputGui::on_vga_valueChanged(int value)
{ {
if ((value < 0) || (value > 62)) if ((value < 0) || (value > 62))
return; return;
@ -327,7 +326,7 @@ void HackRFGui::on_vga_valueChanged(int value)
sendSettings(); sendSettings();
} }
void HackRFGui::on_startStop_toggled(bool checked) void HackRFInputGui::on_startStop_toggled(bool checked)
{ {
if (checked) if (checked)
{ {
@ -344,7 +343,7 @@ void HackRFGui::on_startStop_toggled(bool checked)
} }
} }
void HackRFGui::on_record_toggled(bool checked) void HackRFInputGui::on_record_toggled(bool checked)
{ {
if (checked) if (checked)
{ {
@ -358,7 +357,7 @@ void HackRFGui::on_record_toggled(bool checked)
} }
} }
void HackRFGui::updateHardware() void HackRFInputGui::updateHardware()
{ {
qDebug() << "HackRFGui::updateHardware"; qDebug() << "HackRFGui::updateHardware";
HackRFInput::MsgConfigureHackRF* message = HackRFInput::MsgConfigureHackRF::create( m_settings); HackRFInput::MsgConfigureHackRF* message = HackRFInput::MsgConfigureHackRF::create( m_settings);
@ -366,7 +365,7 @@ void HackRFGui::updateHardware()
m_updateTimer.stop(); m_updateTimer.stop();
} }
void HackRFGui::updateStatus() void HackRFInputGui::updateStatus()
{ {
int state = m_deviceAPI->state(); int state = m_deviceAPI->state();

View File

@ -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_HACKRFGUI_H #ifndef INCLUDE_HACKRFINPUTGUI_H
#define INCLUDE_HACKRFGUI_H #define INCLUDE_HACKRFINPUTGUI_H
#include <QTimer> #include <QTimer>
@ -28,10 +28,10 @@ class DeviceSourceAPI;
class FileRecord; class FileRecord;
namespace Ui { namespace Ui {
class HackRFGui; class HackRFInputGui;
} }
class HackRFGui : public QWidget, public PluginGUI { class HackRFInputGui : public QWidget, public PluginGUI {
Q_OBJECT Q_OBJECT
public: public:
@ -43,8 +43,8 @@ public:
HACKRF_IMGREJ_NB HACKRF_IMGREJ_NB
} HackRFImgRejValue; } HackRFImgRejValue;
explicit HackRFGui(DeviceSourceAPI *deviceAPI, QWidget* parent = NULL); explicit HackRFInputGui(DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
virtual ~HackRFGui(); virtual ~HackRFInputGui();
void destroy(); void destroy();
void setName(const QString& name); void setName(const QString& name);
@ -58,10 +58,10 @@ public:
virtual bool handleMessage(const Message& message); virtual bool handleMessage(const Message& message);
private: private:
Ui::HackRFGui* ui; Ui::HackRFInputGui* ui;
DeviceSourceAPI* m_deviceAPI; DeviceSourceAPI* m_deviceAPI;
HackRFSettings m_settings; HackRFInputSettings m_settings;
QTimer m_updateTimer; QTimer m_updateTimer;
QTimer m_statusTimer; QTimer m_statusTimer;
DeviceSampleSource* m_sampleSource; DeviceSampleSource* m_sampleSource;
@ -112,4 +112,4 @@ public:
static unsigned int m_bw_k[m_nb_bw]; static unsigned int m_bw_k[m_nb_bw];
}; };
#endif // INCLUDE_HACKRFGUI_H #endif // INCLUDE_HACKRFINPUTGUI_H

View File

@ -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>HackRFGui</class> <class>HackRFInputGui</class>
<widget class="QWidget" name="HackRFGui"> <widget class="QWidget" name="HackRFInputGui">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>

View File

@ -18,15 +18,14 @@
#include <QAction> #include <QAction>
#include "libhackrf/hackrf.h" #include "libhackrf/hackrf.h"
#include "hackrfplugin.h"
#include <device/devicesourceapi.h> #include <device/devicesourceapi.h>
#include "hackrfgui.h"
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
#include "util/simpleserializer.h" #include "util/simpleserializer.h"
#include "hackrfinputplugin.h"
#include "hackrfinputgui.h"
const PluginDescriptor HackRFPlugin::m_pluginDescriptor = { const PluginDescriptor HackRFInputPlugin::m_pluginDescriptor = {
QString("HackRF Input"), QString("HackRF Input"),
QString("2.0.0"), QString("2.0.0"),
QString("(c) Edouard Griffiths, F4EXB"), QString("(c) Edouard Griffiths, F4EXB"),
@ -35,24 +34,24 @@ const PluginDescriptor HackRFPlugin::m_pluginDescriptor = {
QString("https://github.com/f4exb/sdrangel") QString("https://github.com/f4exb/sdrangel")
}; };
const QString HackRFPlugin::m_deviceTypeID = HACKRF_DEVICE_TYPE_ID; const QString HackRFInputPlugin::m_deviceTypeID = HACKRF_DEVICE_TYPE_ID;
HackRFPlugin::HackRFPlugin(QObject* parent) : HackRFInputPlugin::HackRFInputPlugin(QObject* parent) :
QObject(parent) QObject(parent)
{ {
} }
const PluginDescriptor& HackRFPlugin::getPluginDescriptor() const const PluginDescriptor& HackRFInputPlugin::getPluginDescriptor() const
{ {
return m_pluginDescriptor; return m_pluginDescriptor;
} }
void HackRFPlugin::initPlugin(PluginAPI* pluginAPI) void HackRFInputPlugin::initPlugin(PluginAPI* pluginAPI)
{ {
pluginAPI->registerSampleSource(m_deviceTypeID, this); pluginAPI->registerSampleSource(m_deviceTypeID, this);
} }
PluginInterface::SamplingDevices HackRFPlugin::enumSampleSources() PluginInterface::SamplingDevices HackRFInputPlugin::enumSampleSources()
{ {
hackrf_error rc = (hackrf_error) hackrf_init(); hackrf_error rc = (hackrf_error) hackrf_init();
@ -112,11 +111,11 @@ PluginInterface::SamplingDevices HackRFPlugin::enumSampleSources()
return result; return result;
} }
PluginGUI* HackRFPlugin::createSampleSourcePluginGUI(const QString& sourceId, QWidget **widget, DeviceSourceAPI *deviceAPI) PluginGUI* HackRFInputPlugin::createSampleSourcePluginGUI(const QString& sourceId, QWidget **widget, DeviceSourceAPI *deviceAPI)
{ {
if(sourceId == m_deviceTypeID) if(sourceId == m_deviceTypeID)
{ {
HackRFGui* gui = new HackRFGui(deviceAPI); HackRFInputGui* gui = new HackRFInputGui(deviceAPI);
*widget = gui; *widget = gui;
return gui; return gui;
} }

View File

@ -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_HACKRFPLUGIN_H #ifndef INCLUDE_HACKRFINPUTPLUGIN_H
#define INCLUDE_HACKRFPLUGIN_H #define INCLUDE_HACKRFINPUTPLUGIN_H
#include <QObject> #include <QObject>
#include "plugin/plugininterface.h" #include "plugin/plugininterface.h"
@ -24,13 +24,13 @@
class PluginAPI; class PluginAPI;
class HackRFPlugin : public QObject, public PluginInterface { class HackRFInputPlugin : public QObject, public PluginInterface {
Q_OBJECT Q_OBJECT
Q_INTERFACES(PluginInterface) Q_INTERFACES(PluginInterface)
Q_PLUGIN_METADATA(IID HACKRF_DEVICE_TYPE_ID) Q_PLUGIN_METADATA(IID HACKRF_DEVICE_TYPE_ID)
public: public:
explicit HackRFPlugin(QObject* parent = NULL); explicit HackRFInputPlugin(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_HACKRFPLUGIN_H #endif // INCLUDE_HACKRFINPUTPLUGIN_H

View File

@ -16,14 +16,15 @@
#include <QtGlobal> #include <QtGlobal>
#include "util/simpleserializer.h" #include "util/simpleserializer.h"
#include "hackrfsettings.h"
HackRFSettings::HackRFSettings() #include "hackrfinputsettings.h"
HackRFInputSettings::HackRFInputSettings()
{ {
resetToDefaults(); resetToDefaults();
} }
void HackRFSettings::resetToDefaults() void HackRFInputSettings::resetToDefaults()
{ {
m_centerFrequency = 435000 * 1000; m_centerFrequency = 435000 * 1000;
m_LOppmTenths = 0; m_LOppmTenths = 0;
@ -39,7 +40,7 @@ void HackRFSettings::resetToDefaults()
m_iqCorrection = false; m_iqCorrection = false;
} }
QByteArray HackRFSettings::serialize() const QByteArray HackRFInputSettings::serialize() const
{ {
SimpleSerializer s(1); SimpleSerializer s(1);
@ -58,7 +59,7 @@ QByteArray HackRFSettings::serialize() const
return s.final(); return s.final();
} }
bool HackRFSettings::deserialize(const QByteArray& data) bool HackRFInputSettings::deserialize(const QByteArray& data)
{ {
SimpleDeserializer d(data); SimpleDeserializer d(data);

View File

@ -14,10 +14,10 @@
// 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 _HACKRF_HACKRFSETTINGS_H_ #ifndef _HACKRF_HACKRFINPUTSETTINGS_H_
#define _HACKRF_HACKRFSETTINGS_H_ #define _HACKRF_HACKRFINPUTSETTINGS_H_
struct HackRFSettings { struct HackRFInputSettings {
typedef enum { typedef enum {
FC_POS_INFRA = 0, FC_POS_INFRA = 0,
FC_POS_SUPRA, FC_POS_SUPRA,
@ -37,10 +37,10 @@ struct HackRFSettings {
bool m_dcBlock; bool m_dcBlock;
bool m_iqCorrection; bool m_iqCorrection;
HackRFSettings(); HackRFInputSettings();
void resetToDefaults(); void resetToDefaults();
QByteArray serialize() const; QByteArray serialize() const;
bool deserialize(const QByteArray& data); bool deserialize(const QByteArray& data);
}; };
#endif /* _HACKRF_HACKRFSETTINGS_H_ */ #endif /* _HACKRF_HACKRFINPUTSETTINGS_H_ */

View File

@ -17,12 +17,12 @@
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include "hackrfthread.h"
#include "../../../sdrbase/dsp/samplesinkfifo.h" #include "../../../sdrbase/dsp/samplesinkfifo.h"
#include "hackrfinputthread.h"
HackRFThread *HackRFThread::m_this = 0; HackRFInputThread *HackRFInputThread::m_this = 0;
HackRFThread::HackRFThread(hackrf_device* dev, SampleSinkFifo* sampleFifo, QObject* parent) : HackRFInputThread::HackRFInputThread(hackrf_device* dev, SampleSinkFifo* sampleFifo, QObject* parent) :
QThread(parent), QThread(parent),
m_running(false), m_running(false),
m_dev(dev), m_dev(dev),
@ -35,13 +35,13 @@ HackRFThread::HackRFThread(hackrf_device* dev, SampleSinkFifo* sampleFifo, QObje
m_this = this; m_this = this;
} }
HackRFThread::~HackRFThread() HackRFInputThread::~HackRFInputThread()
{ {
stopWork(); stopWork();
m_this = 0; m_this = 0;
} }
void HackRFThread::startWork() void HackRFInputThread::startWork()
{ {
//m_startWaitMutex.lock(); //m_startWaitMutex.lock();
m_running = true; m_running = true;
@ -52,29 +52,29 @@ void HackRFThread::startWork()
m_startWaitMutex.unlock();*/ m_startWaitMutex.unlock();*/
} }
void HackRFThread::stopWork() void HackRFInputThread::stopWork()
{ {
qDebug("HackRFThread::stopWork"); qDebug("HackRFThread::stopWork");
m_running = false; m_running = false;
wait(); wait();
} }
void HackRFThread::setSamplerate(uint32_t samplerate) void HackRFInputThread::setSamplerate(uint32_t samplerate)
{ {
m_samplerate = samplerate; m_samplerate = samplerate;
} }
void HackRFThread::setLog2Decimation(unsigned int log2_decim) void HackRFInputThread::setLog2Decimation(unsigned int log2_decim)
{ {
m_log2Decim = log2_decim; m_log2Decim = log2_decim;
} }
void HackRFThread::setFcPos(int fcPos) void HackRFInputThread::setFcPos(int fcPos)
{ {
m_fcPos = fcPos; m_fcPos = fcPos;
} }
void HackRFThread::run() void HackRFInputThread::run()
{ {
hackrf_error rc; hackrf_error rc;
@ -110,7 +110,7 @@ void HackRFThread::run()
} }
// Decimate according to specified log2 (ex: log2=4 => decim=16) // Decimate according to specified log2 (ex: log2=4 => decim=16)
void HackRFThread::callback(const qint8* buf, qint32 len) void HackRFInputThread::callback(const qint8* buf, qint32 len)
{ {
SampleVector::iterator it = m_convertBuffer.begin(); SampleVector::iterator it = m_convertBuffer.begin();
@ -204,7 +204,7 @@ void HackRFThread::callback(const qint8* buf, qint32 len)
} }
int HackRFThread::rx_callback(hackrf_transfer* transfer) int HackRFInputThread::rx_callback(hackrf_transfer* transfer)
{ {
qint32 bytes_to_write = transfer->valid_length; qint32 bytes_to_write = transfer->valid_length;
m_this->callback((qint8 *) transfer->buffer, bytes_to_write); m_this->callback((qint8 *) transfer->buffer, bytes_to_write);

View File

@ -14,25 +14,25 @@
// 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_HACKRFTHREAD_H #ifndef INCLUDE_HACKRFINPUTTHREAD_H
#define INCLUDE_HACKRFTHREAD_H #define INCLUDE_HACKRFINPUTTHREAD_H
#include <QThread> #include <QThread>
#include <QMutex> #include <QMutex>
#include <QWaitCondition> #include <QWaitCondition>
#include <libhackrf/hackrf.h> #include <libhackrf/hackrf.h>
#include "../../../sdrbase/dsp/samplesinkfifo.h" #include "dsp/samplesinkfifo.h"
#include "dsp/decimators.h" #include "dsp/decimators.h"
#define HACKRF_BLOCKSIZE (1<<17) #define HACKRF_BLOCKSIZE (1<<17)
class HackRFThread : public QThread { class HackRFInputThread : public QThread {
Q_OBJECT Q_OBJECT
public: public:
HackRFThread(hackrf_device* dev, SampleSinkFifo* sampleFifo, QObject* parent = NULL); HackRFInputThread(hackrf_device* dev, SampleSinkFifo* sampleFifo, QObject* parent = NULL);
~HackRFThread(); ~HackRFInputThread();
void startWork(); void startWork();
void stopWork(); void stopWork();
@ -53,7 +53,7 @@ private:
int m_samplerate; int m_samplerate;
unsigned int m_log2Decim; unsigned int m_log2Decim;
int m_fcPos; int m_fcPos;
static HackRFThread *m_this; static HackRFInputThread *m_this;
Decimators<qint8, SDR_SAMP_SZ, 8> m_decimators; Decimators<qint8, SDR_SAMP_SZ, 8> m_decimators;
@ -62,4 +62,4 @@ private:
static int rx_callback(hackrf_transfer* transfer); static int rx_callback(hackrf_transfer* transfer);
}; };
#endif // INCLUDE_HACKRFTHREAD_H #endif // INCLUDE_HACKRFINPUTTHREAD_H