1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-18 07:35:47 -05: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)
set(hackrf_SOURCES
hackrfgui.cpp
hackrfinputgui.cpp
hackrfinput.cpp
hackrfplugin.cpp
hackrfsettings.cpp
hackrfthread.cpp
hackrfinputplugin.cpp
hackrfinputsettings.cpp
hackrfinputthread.cpp
)
set(hackrf_HEADERS
hackrfgui.h
hackrfinputgui.h
hackrfinput.h
hackrfplugin.h
hackrfsettings.h
hackrfthread.h
hackrfinputplugin.h
hackrfinputsettings.h
hackrfinputthread.h
)
set(hackrf_FORMS
hackrfgui.ui
hackrfinputgui.ui
)
if (BUILD_DEBIAN)

View File

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

View File

@ -25,8 +25,8 @@
#include <device/devicesourceapi.h>
#include "hackrfgui.h"
#include "hackrfthread.h"
#include "hackrfinputgui.h"
#include "hackrfinputthread.h"
MESSAGE_CLASS_DEFINITION(HackRFInput::MsgConfigureHackRF, Message)
MESSAGE_CLASS_DEFINITION(HackRFInput::MsgReportHackRF, Message)
@ -79,7 +79,7 @@ bool HackRFInput::start(int device)
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");
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);
@ -247,19 +247,19 @@ bool HackRFInput::applySettings(const HackRFSettings& settings, bool force)
m_settings.m_centerFrequency = settings.m_centerFrequency;
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;
f_img = deviceCenterFrequency;
}
else
{
if (settings.m_fcPos == HackRFSettings::FC_POS_INFRA)
if (settings.m_fcPos == HackRFInputSettings::FC_POS_INFRA)
{
deviceCenterFrequency = m_settings.m_centerFrequency + (devSampleRate / 4);
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);
f_img = deviceCenterFrequency - devSampleRate/2;

View File

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

View File

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

View File

@ -14,8 +14,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDE_HACKRFGUI_H
#define INCLUDE_HACKRFGUI_H
#ifndef INCLUDE_HACKRFINPUTGUI_H
#define INCLUDE_HACKRFINPUTGUI_H
#include <QTimer>
@ -28,10 +28,10 @@ class DeviceSourceAPI;
class FileRecord;
namespace Ui {
class HackRFGui;
class HackRFInputGui;
}
class HackRFGui : public QWidget, public PluginGUI {
class HackRFInputGui : public QWidget, public PluginGUI {
Q_OBJECT
public:
@ -43,8 +43,8 @@ public:
HACKRF_IMGREJ_NB
} HackRFImgRejValue;
explicit HackRFGui(DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
virtual ~HackRFGui();
explicit HackRFInputGui(DeviceSourceAPI *deviceAPI, QWidget* parent = NULL);
virtual ~HackRFInputGui();
void destroy();
void setName(const QString& name);
@ -58,10 +58,10 @@ public:
virtual bool handleMessage(const Message& message);
private:
Ui::HackRFGui* ui;
Ui::HackRFInputGui* ui;
DeviceSourceAPI* m_deviceAPI;
HackRFSettings m_settings;
HackRFInputSettings m_settings;
QTimer m_updateTimer;
QTimer m_statusTimer;
DeviceSampleSource* m_sampleSource;
@ -112,4 +112,4 @@ public:
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"?>
<ui version="4.0">
<class>HackRFGui</class>
<widget class="QWidget" name="HackRFGui">
<class>HackRFInputGui</class>
<widget class="QWidget" name="HackRFInputGui">
<property name="geometry">
<rect>
<x>0</x>

View File

@ -18,15 +18,14 @@
#include <QAction>
#include "libhackrf/hackrf.h"
#include "hackrfplugin.h"
#include <device/devicesourceapi.h>
#include "hackrfgui.h"
#include "plugin/pluginapi.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("2.0.0"),
QString("(c) Edouard Griffiths, F4EXB"),
@ -35,24 +34,24 @@ const PluginDescriptor HackRFPlugin::m_pluginDescriptor = {
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)
{
}
const PluginDescriptor& HackRFPlugin::getPluginDescriptor() const
const PluginDescriptor& HackRFInputPlugin::getPluginDescriptor() const
{
return m_pluginDescriptor;
}
void HackRFPlugin::initPlugin(PluginAPI* pluginAPI)
void HackRFInputPlugin::initPlugin(PluginAPI* pluginAPI)
{
pluginAPI->registerSampleSource(m_deviceTypeID, this);
}
PluginInterface::SamplingDevices HackRFPlugin::enumSampleSources()
PluginInterface::SamplingDevices HackRFInputPlugin::enumSampleSources()
{
hackrf_error rc = (hackrf_error) hackrf_init();
@ -112,11 +111,11 @@ PluginInterface::SamplingDevices HackRFPlugin::enumSampleSources()
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)
{
HackRFGui* gui = new HackRFGui(deviceAPI);
HackRFInputGui* gui = new HackRFInputGui(deviceAPI);
*widget = gui;
return gui;
}

View File

@ -14,8 +14,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDE_HACKRFPLUGIN_H
#define INCLUDE_HACKRFPLUGIN_H
#ifndef INCLUDE_HACKRFINPUTPLUGIN_H
#define INCLUDE_HACKRFINPUTPLUGIN_H
#include <QObject>
#include "plugin/plugininterface.h"
@ -24,13 +24,13 @@
class PluginAPI;
class HackRFPlugin : public QObject, public PluginInterface {
class HackRFInputPlugin : public QObject, public PluginInterface {
Q_OBJECT
Q_INTERFACES(PluginInterface)
Q_PLUGIN_METADATA(IID HACKRF_DEVICE_TYPE_ID)
public:
explicit HackRFPlugin(QObject* parent = NULL);
explicit HackRFInputPlugin(QObject* parent = NULL);
const PluginDescriptor& getPluginDescriptor() const;
void initPlugin(PluginAPI* pluginAPI);
@ -44,4 +44,4 @@ private:
static const PluginDescriptor m_pluginDescriptor;
};
#endif // INCLUDE_HACKRFPLUGIN_H
#endif // INCLUDE_HACKRFINPUTPLUGIN_H

View File

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

View File

@ -14,10 +14,10 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef _HACKRF_HACKRFSETTINGS_H_
#define _HACKRF_HACKRFSETTINGS_H_
#ifndef _HACKRF_HACKRFINPUTSETTINGS_H_
#define _HACKRF_HACKRFINPUTSETTINGS_H_
struct HackRFSettings {
struct HackRFInputSettings {
typedef enum {
FC_POS_INFRA = 0,
FC_POS_SUPRA,
@ -37,10 +37,10 @@ struct HackRFSettings {
bool m_dcBlock;
bool m_iqCorrection;
HackRFSettings();
HackRFInputSettings();
void resetToDefaults();
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
};
#endif /* _HACKRF_HACKRFSETTINGS_H_ */
#endif /* _HACKRF_HACKRFINPUTSETTINGS_H_ */

View File

@ -17,12 +17,12 @@
#include <stdio.h>
#include <errno.h>
#include "hackrfthread.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),
m_running(false),
m_dev(dev),
@ -35,13 +35,13 @@ HackRFThread::HackRFThread(hackrf_device* dev, SampleSinkFifo* sampleFifo, QObje
m_this = this;
}
HackRFThread::~HackRFThread()
HackRFInputThread::~HackRFInputThread()
{
stopWork();
m_this = 0;
}
void HackRFThread::startWork()
void HackRFInputThread::startWork()
{
//m_startWaitMutex.lock();
m_running = true;
@ -52,29 +52,29 @@ void HackRFThread::startWork()
m_startWaitMutex.unlock();*/
}
void HackRFThread::stopWork()
void HackRFInputThread::stopWork()
{
qDebug("HackRFThread::stopWork");
m_running = false;
wait();
}
void HackRFThread::setSamplerate(uint32_t samplerate)
void HackRFInputThread::setSamplerate(uint32_t samplerate)
{
m_samplerate = samplerate;
}
void HackRFThread::setLog2Decimation(unsigned int log2_decim)
void HackRFInputThread::setLog2Decimation(unsigned int log2_decim)
{
m_log2Decim = log2_decim;
}
void HackRFThread::setFcPos(int fcPos)
void HackRFInputThread::setFcPos(int fcPos)
{
m_fcPos = fcPos;
}
void HackRFThread::run()
void HackRFInputThread::run()
{
hackrf_error rc;
@ -110,7 +110,7 @@ void HackRFThread::run()
}
// 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();
@ -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;
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/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDE_HACKRFTHREAD_H
#define INCLUDE_HACKRFTHREAD_H
#ifndef INCLUDE_HACKRFINPUTTHREAD_H
#define INCLUDE_HACKRFINPUTTHREAD_H
#include <QThread>
#include <QMutex>
#include <QWaitCondition>
#include <libhackrf/hackrf.h>
#include "../../../sdrbase/dsp/samplesinkfifo.h"
#include "dsp/samplesinkfifo.h"
#include "dsp/decimators.h"
#define HACKRF_BLOCKSIZE (1<<17)
class HackRFThread : public QThread {
class HackRFInputThread : public QThread {
Q_OBJECT
public:
HackRFThread(hackrf_device* dev, SampleSinkFifo* sampleFifo, QObject* parent = NULL);
~HackRFThread();
HackRFInputThread(hackrf_device* dev, SampleSinkFifo* sampleFifo, QObject* parent = NULL);
~HackRFInputThread();
void startWork();
void stopWork();
@ -53,7 +53,7 @@ private:
int m_samplerate;
unsigned int m_log2Decim;
int m_fcPos;
static HackRFThread *m_this;
static HackRFInputThread *m_this;
Decimators<qint8, SDR_SAMP_SZ, 8> m_decimators;
@ -62,4 +62,4 @@ private:
static int rx_callback(hackrf_transfer* transfer);
};
#endif // INCLUDE_HACKRFTHREAD_H
#endif // INCLUDE_HACKRFINPUTTHREAD_H