mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-08-09 17:22:27 -04:00
AirspyHF: use float version as default
This commit is contained in:
parent
8a6ef95903
commit
f426139e45
@ -40,7 +40,7 @@ endif(LIBUSB_FOUND AND LIBAIRSPY_FOUND)
|
|||||||
find_package(LibAIRSPYHF)
|
find_package(LibAIRSPYHF)
|
||||||
if(LIBUSB_FOUND AND LIBAIRSPYHF_FOUND)
|
if(LIBUSB_FOUND AND LIBAIRSPYHF_FOUND)
|
||||||
add_subdirectory(airspyhf)
|
add_subdirectory(airspyhf)
|
||||||
add_subdirectory(airspyhff)
|
add_subdirectory(airspyhfi)
|
||||||
endif(LIBUSB_FOUND AND LIBAIRSPYHF_FOUND)
|
endif(LIBUSB_FOUND AND LIBAIRSPYHF_FOUND)
|
||||||
|
|
||||||
find_package(LibHACKRF)
|
find_package(LibHACKRF)
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
#include <libairspyhf/airspyhf.h>
|
#include <libairspyhf/airspyhf.h>
|
||||||
|
|
||||||
#include "airspyhfgui.h"
|
|
||||||
|
|
||||||
#include <device/devicesourceapi.h>
|
#include <device/devicesourceapi.h>
|
||||||
#include "device/deviceuiset.h"
|
#include "device/deviceuiset.h"
|
||||||
#include <dsp/filerecord.h>
|
#include <dsp/filerecord.h>
|
||||||
@ -30,6 +28,7 @@
|
|||||||
#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 "airspyhfgui.h"
|
||||||
|
|
||||||
AirspyHFGui::AirspyHFGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
AirspyHFGui::AirspyHFGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
@ -219,7 +218,6 @@ void AirspyHFGui::displaySettings()
|
|||||||
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
||||||
ui->LOppm->setValue(m_settings.m_LOppmTenths);
|
ui->LOppm->setValue(m_settings.m_LOppmTenths);
|
||||||
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)));
|
||||||
ui->autoCorr->setCurrentIndex(m_settings.m_autoCorrOptions);
|
|
||||||
ui->sampleRate->setCurrentIndex(m_settings.m_devSampleRateIndex);
|
ui->sampleRate->setCurrentIndex(m_settings.m_devSampleRateIndex);
|
||||||
ui->decim->setCurrentIndex(m_settings.m_log2Decim);
|
ui->decim->setCurrentIndex(m_settings.m_log2Decim);
|
||||||
ui->band->blockSignals(false);
|
ui->band->blockSignals(false);
|
||||||
@ -278,16 +276,6 @@ void AirspyHFGui::on_resetLOppm_clicked()
|
|||||||
ui->LOppm->setValue(0);
|
ui->LOppm->setValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFGui::on_autoCorr_currentIndexChanged(int index)
|
|
||||||
{
|
|
||||||
if ((index < 0) || (index > AirspyHFSettings::AutoCorrLast)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_settings.m_autoCorrOptions = (AirspyHFSettings::AutoCorrOptions) index;
|
|
||||||
sendSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AirspyHFGui::on_sampleRate_currentIndexChanged(int index)
|
void AirspyHFGui::on_sampleRate_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
m_settings.m_devSampleRateIndex = index;
|
m_settings.m_devSampleRateIndex = index;
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "util/messagequeue.h"
|
#include "util/messagequeue.h"
|
||||||
|
|
||||||
#include "airspyhfinput.h"
|
#include "airspyhfinput.h"
|
||||||
|
|
||||||
class DeviceUISet;
|
class DeviceUISet;
|
||||||
@ -79,7 +80,6 @@ private slots:
|
|||||||
void on_centerFrequency_changed(quint64 value);
|
void on_centerFrequency_changed(quint64 value);
|
||||||
void on_LOppm_valueChanged(int value);
|
void on_LOppm_valueChanged(int value);
|
||||||
void on_resetLOppm_clicked();
|
void on_resetLOppm_clicked();
|
||||||
void on_autoCorr_currentIndexChanged(int index);
|
|
||||||
void on_sampleRate_currentIndexChanged(int index);
|
void on_sampleRate_currentIndexChanged(int index);
|
||||||
void on_decim_currentIndexChanged(int index);
|
void on_decim_currentIndexChanged(int index);
|
||||||
void on_startStop_toggled(bool checked);
|
void on_startStop_toggled(bool checked);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>324</width>
|
<width>324</width>
|
||||||
<height>174</height>
|
<height>132</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -237,52 +237,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="autoCorrLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="autoCorrLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Corr</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="autoCorr">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>DC offset and IQ correction options</string>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>None</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>DC</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>DC+IQ</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="Line" name="line_freq">
|
<widget class="Line" name="line_freq">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -21,14 +21,15 @@
|
|||||||
#include "SWGDeviceSettings.h"
|
#include "SWGDeviceSettings.h"
|
||||||
#include "SWGDeviceState.h"
|
#include "SWGDeviceState.h"
|
||||||
|
|
||||||
#include "airspyhfgui.h"
|
|
||||||
#include "airspyhfinput.h"
|
|
||||||
#include "airspyhfplugin.h"
|
|
||||||
|
|
||||||
#include <device/devicesourceapi.h>
|
#include <device/devicesourceapi.h>
|
||||||
#include <dsp/filerecord.h>
|
#include <dsp/filerecord.h>
|
||||||
#include "dsp/dspcommands.h"
|
#include "dsp/dspcommands.h"
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
|
|
||||||
|
#include "airspyhfinput.h"
|
||||||
|
|
||||||
|
#include "airspyhfgui.h"
|
||||||
|
#include "airspyhfplugin.h"
|
||||||
#include "airspyhfsettings.h"
|
#include "airspyhfsettings.h"
|
||||||
#include "airspyhfthread.h"
|
#include "airspyhfthread.h"
|
||||||
|
|
||||||
@ -87,12 +88,12 @@ bool AirspyHFInput::openDevice()
|
|||||||
|
|
||||||
if ((m_dev = open_airspyhf_from_serial(m_deviceAPI->getSampleSourceSerial())) == 0)
|
if ((m_dev = open_airspyhf_from_serial(m_deviceAPI->getSampleSourceSerial())) == 0)
|
||||||
{
|
{
|
||||||
qCritical("AirspyHFInput::start: could not open Airspy with serial %s", qPrintable(m_deviceAPI->getSampleSourceSerial()));
|
qCritical("AirspyHFInput::start: could not open Airspy HF with serial %s", qPrintable(m_deviceAPI->getSampleSourceSerial()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug("AirspyHFInput::start: opened Airspy with serial %s", qPrintable(m_deviceAPI->getSampleSourceSerial()));
|
qDebug("AirspyHFInput::start: opened Airspy HF with serial %s", qPrintable(m_deviceAPI->getSampleSourceSerial()));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nbSampleRates;
|
uint32_t nbSampleRates;
|
||||||
@ -102,11 +103,11 @@ bool AirspyHFInput::openDevice()
|
|||||||
|
|
||||||
if (rc == AIRSPYHF_SUCCESS)
|
if (rc == AIRSPYHF_SUCCESS)
|
||||||
{
|
{
|
||||||
qDebug("AirspyHFInput::start: %d sample rates for AirspyHF", nbSampleRates);
|
qDebug("AirspyHFInput::start: %d sample rates for Airspy HF", nbSampleRates);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qCritical("AirspyHFInput::start: could not obtain the number of AirspyHF sample rates");
|
qCritical("AirspyHFInput::start: could not obtain the number of Airspy HF sample rates");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,11 +117,11 @@ bool AirspyHFInput::openDevice()
|
|||||||
|
|
||||||
if (rc == AIRSPYHF_SUCCESS)
|
if (rc == AIRSPYHF_SUCCESS)
|
||||||
{
|
{
|
||||||
qDebug("AirspyHFInput::start: obtained AirspyHF sample rates");
|
qDebug("AirspyHFInput::start: obtained Airspy HF sample rates");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qCritical("AirspyHFInput::start: could not obtain AirspyHF sample rates");
|
qCritical("AirspyHFInput::start: could not obtain Airspy HF sample rates");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +135,7 @@ bool AirspyHFInput::openDevice()
|
|||||||
|
|
||||||
delete[] sampleRates;
|
delete[] sampleRates;
|
||||||
|
|
||||||
airspyhf_set_sample_type(m_dev, AIRSPYHF_SAMPLE_INT16_NDSP_IQ);
|
airspyhf_set_sample_type(m_dev, AIRSPYHF_SAMPLE_FLOAT32_IQ);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -349,23 +350,6 @@ bool AirspyHFInput::applySettings(const AirspyHFSettings& settings, bool force)
|
|||||||
|
|
||||||
qDebug() << "AirspyHFInput::applySettings";
|
qDebug() << "AirspyHFInput::applySettings";
|
||||||
|
|
||||||
if ((m_settings.m_autoCorrOptions != settings.m_autoCorrOptions) || force)
|
|
||||||
{
|
|
||||||
switch(settings.m_autoCorrOptions)
|
|
||||||
{
|
|
||||||
case AirspyHFSettings::AutoCorrDC:
|
|
||||||
m_deviceAPI->configureCorrections(true, false);
|
|
||||||
break;
|
|
||||||
case AirspyHFSettings::AutoCorrDCAndIQ:
|
|
||||||
m_deviceAPI->configureCorrections(true, true);
|
|
||||||
break;
|
|
||||||
case AirspyHFSettings::AutoCorrNone:
|
|
||||||
default:
|
|
||||||
m_deviceAPI->configureCorrections(false, false);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((m_settings.m_devSampleRateIndex != settings.m_devSampleRateIndex) || force)
|
if ((m_settings.m_devSampleRateIndex != settings.m_devSampleRateIndex) || force)
|
||||||
{
|
{
|
||||||
forwardChange = true;
|
forwardChange = true;
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include <libairspyhf/airspyhf.h>
|
#include <libairspyhf/airspyhf.h>
|
||||||
#include <dsp/devicesamplesource.h>
|
#include <dsp/devicesamplesource.h>
|
||||||
|
|
||||||
#include "airspyhfsettings.h"
|
#include "airspyhfsettings.h"
|
||||||
|
|
||||||
class DeviceSourceAPI;
|
class DeviceSourceAPI;
|
||||||
|
@ -18,12 +18,11 @@
|
|||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <libairspyhf/airspyhf.h>
|
#include <libairspyhf/airspyhf.h>
|
||||||
|
|
||||||
#include "airspyhfgui.h"
|
|
||||||
#include "airspyhfplugin.h"
|
|
||||||
|
|
||||||
#include <device/devicesourceapi.h>
|
#include <device/devicesourceapi.h>
|
||||||
#include "plugin/pluginapi.h"
|
#include "plugin/pluginapi.h"
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
|
#include "airspyhfplugin.h"
|
||||||
|
#include "airspyhfgui.h"
|
||||||
|
|
||||||
|
|
||||||
const PluginDescriptor AirspyHFPlugin::m_pluginDescriptor = {
|
const PluginDescriptor AirspyHFPlugin::m_pluginDescriptor = {
|
||||||
@ -84,7 +83,7 @@ PluginInterface::SamplingDevices AirspyHFPlugin::enumSampleSources()
|
|||||||
1,
|
1,
|
||||||
0));
|
0));
|
||||||
|
|
||||||
qDebug("AirspyPlugin::enumSampleSources: enumerated Airspy device #%d", i);
|
qDebug("AirspyHFPlugin::enumSampleSources: enumerated Airspy HF device #%d", i);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -50,4 +50,4 @@ private:
|
|||||||
static const PluginDescriptor m_pluginDescriptor;
|
static const PluginDescriptor m_pluginDescriptor;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_AIRSPYPLUGIN_H
|
#endif // INCLUDE_AIRSPYHFPLUGIN_H
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
|
|
||||||
#include "airspyhfsettings.h"
|
#include "airspyhfsettings.h"
|
||||||
|
|
||||||
AirspyHFSettings::AirspyHFSettings()
|
AirspyHFSettings::AirspyHFSettings()
|
||||||
@ -32,7 +33,6 @@ void AirspyHFSettings::resetToDefaults()
|
|||||||
m_transverterMode = false;
|
m_transverterMode = false;
|
||||||
m_transverterDeltaFrequency = 0;
|
m_transverterDeltaFrequency = 0;
|
||||||
m_bandIndex = 0;
|
m_bandIndex = 0;
|
||||||
m_autoCorrOptions = AutoCorrNone;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray AirspyHFSettings::serialize() const
|
QByteArray AirspyHFSettings::serialize() const
|
||||||
@ -42,7 +42,6 @@ QByteArray AirspyHFSettings::serialize() const
|
|||||||
s.writeU32(1, m_devSampleRateIndex);
|
s.writeU32(1, m_devSampleRateIndex);
|
||||||
s.writeS32(2, m_LOppmTenths);
|
s.writeS32(2, m_LOppmTenths);
|
||||||
s.writeU32(3, m_log2Decim);
|
s.writeU32(3, m_log2Decim);
|
||||||
s.writeS32(4, (int) m_autoCorrOptions);
|
|
||||||
s.writeBool(7, m_transverterMode);
|
s.writeBool(7, m_transverterMode);
|
||||||
s.writeS64(8, m_transverterDeltaFrequency);
|
s.writeS64(8, m_transverterDeltaFrequency);
|
||||||
s.writeU32(9, m_bandIndex);
|
s.writeU32(9, m_bandIndex);
|
||||||
@ -69,13 +68,6 @@ bool AirspyHFSettings::deserialize(const QByteArray& data)
|
|||||||
d.readS32(2, &m_LOppmTenths, 0);
|
d.readS32(2, &m_LOppmTenths, 0);
|
||||||
d.readU32(3, &m_log2Decim, 0);
|
d.readU32(3, &m_log2Decim, 0);
|
||||||
d.readS32(4, &intval, 0);
|
d.readS32(4, &intval, 0);
|
||||||
|
|
||||||
if (intval < 0 || intval > (int) AutoCorrLast) {
|
|
||||||
m_autoCorrOptions = AutoCorrNone;
|
|
||||||
} else {
|
|
||||||
m_autoCorrOptions = (AutoCorrOptions) intval;
|
|
||||||
}
|
|
||||||
|
|
||||||
d.readBool(7, &m_transverterMode, false);
|
d.readBool(7, &m_transverterMode, false);
|
||||||
d.readS64(8, &m_transverterDeltaFrequency, 0);
|
d.readS64(8, &m_transverterDeltaFrequency, 0);
|
||||||
d.readU32(9, &uintval, 0);
|
d.readU32(9, &uintval, 0);
|
||||||
|
@ -14,18 +14,11 @@
|
|||||||
// 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 _AIRSPYHF_AIRSPYHFSETTINGS_H_
|
#ifndef _AIRSPYHFF_AIRSPYHFSETTINGS_H_
|
||||||
#define _AIRSPYHF_AIRSPYHFSETTINGS_H_
|
#define _AIRSPYHFF_AIRSPYHFSETTINGS_H_
|
||||||
|
|
||||||
struct AirspyHFSettings
|
struct AirspyHFSettings
|
||||||
{
|
{
|
||||||
typedef enum {
|
|
||||||
AutoCorrNone,
|
|
||||||
AutoCorrDC,
|
|
||||||
AutoCorrDCAndIQ,
|
|
||||||
AutoCorrLast,
|
|
||||||
} AutoCorrOptions;
|
|
||||||
|
|
||||||
quint64 m_centerFrequency;
|
quint64 m_centerFrequency;
|
||||||
qint32 m_LOppmTenths;
|
qint32 m_LOppmTenths;
|
||||||
quint32 m_devSampleRateIndex;
|
quint32 m_devSampleRateIndex;
|
||||||
@ -33,7 +26,6 @@ struct AirspyHFSettings
|
|||||||
bool m_transverterMode;
|
bool m_transverterMode;
|
||||||
qint64 m_transverterDeltaFrequency;
|
qint64 m_transverterDeltaFrequency;
|
||||||
quint32 m_bandIndex;
|
quint32 m_bandIndex;
|
||||||
AutoCorrOptions m_autoCorrOptions;
|
|
||||||
|
|
||||||
AirspyHFSettings();
|
AirspyHFSettings();
|
||||||
void resetToDefaults();
|
void resetToDefaults();
|
||||||
@ -41,4 +33,4 @@ struct AirspyHFSettings
|
|||||||
bool deserialize(const QByteArray& data);
|
bool deserialize(const QByteArray& data);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _AIRSPYHF_AIRSPYHFSETTINGS_H_ */
|
#endif /* _AIRSPYHFF_AIRSPYHFSETTINGS_H_ */
|
||||||
|
@ -17,9 +17,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "airspyhfthread.h"
|
|
||||||
|
|
||||||
#include "dsp/samplesinkfifo.h"
|
#include "dsp/samplesinkfifo.h"
|
||||||
|
#include "airspyhfthread.h"
|
||||||
|
|
||||||
AirspyHFThread *AirspyHFThread::m_this = 0;
|
AirspyHFThread *AirspyHFThread::m_this = 0;
|
||||||
|
|
||||||
@ -78,7 +77,7 @@ void AirspyHFThread::run()
|
|||||||
|
|
||||||
if (rc != AIRSPYHF_SUCCESS)
|
if (rc != AIRSPYHF_SUCCESS)
|
||||||
{
|
{
|
||||||
qCritical("AirspyHFThread::run: failed to start Airspy Rx");
|
qCritical("AirspyHFFThread::run: failed to start Airspy HF Rx");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -91,16 +90,16 @@ void AirspyHFThread::run()
|
|||||||
rc = (airspyhf_error) airspyhf_stop(m_dev);
|
rc = (airspyhf_error) airspyhf_stop(m_dev);
|
||||||
|
|
||||||
if (rc == AIRSPYHF_SUCCESS) {
|
if (rc == AIRSPYHF_SUCCESS) {
|
||||||
qDebug("AirspyHFThread::run: stopped Airspy Rx");
|
qDebug("AirspyHFFThread::run: stopped Airspy HF Rx");
|
||||||
} else {
|
} else {
|
||||||
qDebug("AirspyHFThread::run: failed to stop Airspy Rx");
|
qDebug("AirspyHFFThread::run: failed to stop Airspy HF Rx");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_running = false;
|
m_running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decimate according to specified log2 (ex: log2=4 => decim=16)
|
// Decimate according to specified log2 (ex: log2=4 => decim=16)
|
||||||
void AirspyHFThread::callback(const qint16* buf, qint32 len)
|
void AirspyHFThread::callback(const float* buf, qint32 len)
|
||||||
{
|
{
|
||||||
SampleVector::iterator it = m_convertBuffer.begin();
|
SampleVector::iterator it = m_convertBuffer.begin();
|
||||||
|
|
||||||
@ -137,7 +136,7 @@ void AirspyHFThread::callback(const qint16* buf, qint32 len)
|
|||||||
|
|
||||||
int AirspyHFThread::rx_callback(airspyhf_transfer_t* transfer)
|
int AirspyHFThread::rx_callback(airspyhf_transfer_t* transfer)
|
||||||
{
|
{
|
||||||
qint32 bytes_to_write = transfer->sample_count * sizeof(qint16);
|
qint32 nbIAndQ = transfer->sample_count * 2;
|
||||||
m_this->callback((qint16 *) transfer->samples, bytes_to_write);
|
m_this->callback((float *) transfer->samples, nbIAndQ);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include <libairspyhf/airspyhf.h>
|
#include <libairspyhf/airspyhf.h>
|
||||||
|
|
||||||
#include "dsp/samplesinkfifo.h"
|
#include "dsp/samplesinkfifo.h"
|
||||||
#include "dsp/decimators.h"
|
#include "dsp/decimatorsf.h"
|
||||||
|
|
||||||
#define AIRSPYHF_BLOCKSIZE (1<<17)
|
#define AIRSPYHF_BLOCKSIZE (1<<17)
|
||||||
|
|
||||||
@ -53,14 +53,10 @@ private:
|
|||||||
unsigned int m_log2Decim;
|
unsigned int m_log2Decim;
|
||||||
static AirspyHFThread *m_this;
|
static AirspyHFThread *m_this;
|
||||||
|
|
||||||
#ifdef SDR_RX_SAMPLE_24BIT
|
DecimatorsF m_decimators;
|
||||||
Decimators<qint64, qint16, SDR_RX_SAMP_SZ, 16> m_decimators;
|
|
||||||
#else
|
|
||||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16> m_decimators;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void run();
|
void run();
|
||||||
void callback(const qint16* buf, qint32 len);
|
void callback(const float* buf, qint32 len);
|
||||||
static int rx_callback(airspyhf_transfer_t* transfer);
|
static int rx_callback(airspyhf_transfer_t* transfer);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
project(airspyhff)
|
project(airspyhfi)
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||||
|
|
||||||
set(airspyhff_SOURCES
|
set(airspyhfi_SOURCES
|
||||||
airspyhffgui.cpp
|
airspyhfigui.cpp
|
||||||
airspyhffinput.cpp
|
airspyhfiinput.cpp
|
||||||
airspyhffplugin.cpp
|
airspyhfiplugin.cpp
|
||||||
airspyhffsettings.cpp
|
airspyhfisettings.cpp
|
||||||
airspyhffthread.cpp
|
airspyhfithread.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(airspyhff_HEADERS
|
set(airspyhfi_HEADERS
|
||||||
airspyhffgui.h
|
airspyhfigui.h
|
||||||
airspyhffinput.h
|
airspyhfiinput.h
|
||||||
airspyhffplugin.h
|
airspyhfiplugin.h
|
||||||
airspyhffsettings.h
|
airspyhfisettings.h
|
||||||
airspyhffthread.h
|
airspyhfithread.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(airspyhff_FORMS
|
set(airspyhfi_FORMS
|
||||||
airspyhffgui.ui
|
airspyhfigui.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
if (BUILD_DEBIAN)
|
if (BUILD_DEBIAN)
|
||||||
@ -45,25 +45,25 @@ add_definitions("${QT_DEFINITIONS} -DLIBAIRSPY_DYN_RATES")
|
|||||||
add_definitions(-DQT_PLUGIN)
|
add_definitions(-DQT_PLUGIN)
|
||||||
add_definitions(-DQT_SHARED)
|
add_definitions(-DQT_SHARED)
|
||||||
|
|
||||||
#qt4_wrap_cpp(airspyhff_HEADERS_MOC ${airspyhff_HEADERS})
|
#qt4_wrap_cpp(airspyhf_HEADERS_MOC ${airspyhf_HEADERS})
|
||||||
qt5_wrap_ui(airspyhff_FORMS_HEADERS ${airspyhff_FORMS})
|
qt5_wrap_ui(airspyhfi_FORMS_HEADERS ${airspyhfi_FORMS})
|
||||||
|
|
||||||
add_library(inputairspyhff SHARED
|
add_library(inputairspyhfi SHARED
|
||||||
${airspyhff_SOURCES}
|
${airspyhfi_SOURCES}
|
||||||
${airspyhff_HEADERS_MOC}
|
${airspyhfi_HEADERS_MOC}
|
||||||
${airspyhff_FORMS_HEADERS}
|
${airspyhfi_FORMS_HEADERS}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (BUILD_DEBIAN)
|
if (BUILD_DEBIAN)
|
||||||
target_link_libraries(inputairspyhff
|
target_link_libraries(inputairspyhfi
|
||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
airspyhff
|
airspyhf
|
||||||
sdrbase
|
sdrbase
|
||||||
sdrgui
|
sdrgui
|
||||||
swagger
|
swagger
|
||||||
)
|
)
|
||||||
else (BUILD_DEBIAN)
|
else (BUILD_DEBIAN)
|
||||||
target_link_libraries(inputairspyhff
|
target_link_libraries(inputairspyhfi
|
||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
${LIBAIRSPYHF_LIBRARIES}
|
${LIBAIRSPYHF_LIBRARIES}
|
||||||
sdrbase
|
sdrbase
|
||||||
@ -73,6 +73,6 @@ target_link_libraries(inputairspyhff
|
|||||||
endif (BUILD_DEBIAN)
|
endif (BUILD_DEBIAN)
|
||||||
|
|
||||||
|
|
||||||
qt5_use_modules(inputairspyhff Core Widgets)
|
qt5_use_modules(inputairspyhfi Core Widgets)
|
||||||
|
|
||||||
install(TARGETS inputairspyhff DESTINATION lib/plugins/samplesource)
|
install(TARGETS inputairspyhfi DESTINATION lib/plugins/samplesource)
|
@ -9,7 +9,7 @@ CONFIG += plugin
|
|||||||
|
|
||||||
QT += core gui widgets multimedia opengl
|
QT += core gui widgets multimedia opengl
|
||||||
|
|
||||||
TARGET = inputairspyhff
|
TARGET = inputairspyhfi
|
||||||
|
|
||||||
CONFIG(MINGW32):LIBAIRSPYHFSRC = "D:\softs\airspyhf"
|
CONFIG(MINGW32):LIBAIRSPYHFSRC = "D:\softs\airspyhf"
|
||||||
CONFIG(MINGW64):LIBAIRSPYHFSRC = "D:\softs\airspyhf"
|
CONFIG(MINGW64):LIBAIRSPYHFSRC = "D:\softs\airspyhf"
|
||||||
@ -28,19 +28,19 @@ QMAKE_CXXFLAGS += -std=c++11
|
|||||||
CONFIG(Release):build_subdir = release
|
CONFIG(Release):build_subdir = release
|
||||||
CONFIG(Debug):build_subdir = debug
|
CONFIG(Debug):build_subdir = debug
|
||||||
|
|
||||||
SOURCES += airspyhffgui.cpp\
|
SOURCES += airspyhfigui.cpp\
|
||||||
airspyhffinput.cpp\
|
airspyhfiinput.cpp\
|
||||||
airspyhffplugin.cpp\
|
airspyhfiplugin.cpp\
|
||||||
airspyhffsettings.cpp\
|
airspyhfisettings.cpp\
|
||||||
airspyhffthread.cpp
|
airspyhfithread.cpp
|
||||||
|
|
||||||
HEADERS += airspyhffgui.h\
|
HEADERS += airspyhfigui.h\
|
||||||
airspyhffinput.h\
|
airspyhfiinput.h\
|
||||||
airspyhffplugin.h\
|
airspyhfiplugin.h\
|
||||||
airspyhffsettings.h\
|
airspyhfisettings.h\
|
||||||
airspyhffthread.h
|
airspyhfithread.h
|
||||||
|
|
||||||
FORMS += airspyhffgui.ui
|
FORMS += airspyhfigui.ui
|
||||||
|
|
||||||
LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase
|
LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase
|
||||||
LIBS += -L../../../sdrgui/$${build_subdir} -lsdrgui
|
LIBS += -L../../../sdrgui/$${build_subdir} -lsdrgui
|
@ -23,16 +23,16 @@
|
|||||||
#include "device/deviceuiset.h"
|
#include "device/deviceuiset.h"
|
||||||
#include <dsp/filerecord.h>
|
#include <dsp/filerecord.h>
|
||||||
|
|
||||||
#include "ui_airspyhffgui.h"
|
#include "ui_airspyhfigui.h"
|
||||||
#include "gui/colormapper.h"
|
#include "gui/colormapper.h"
|
||||||
#include "gui/glspectrum.h"
|
#include "gui/glspectrum.h"
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
#include "dsp/dspcommands.h"
|
#include "dsp/dspcommands.h"
|
||||||
#include "airspyhffgui.h"
|
#include "airspyhfigui.h"
|
||||||
|
|
||||||
AirspyHFFGui::AirspyHFFGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
AirspyHFIGui::AirspyHFIGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::AirspyHFFGui),
|
ui(new Ui::AirspyHFIGui),
|
||||||
m_deviceUISet(deviceUISet),
|
m_deviceUISet(deviceUISet),
|
||||||
m_doApplySettings(true),
|
m_doApplySettings(true),
|
||||||
m_forceSettings(true),
|
m_forceSettings(true),
|
||||||
@ -40,7 +40,7 @@ AirspyHFFGui::AirspyHFFGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
|||||||
m_sampleSource(0),
|
m_sampleSource(0),
|
||||||
m_lastEngineState((DSPDeviceSourceEngine::State)-1)
|
m_lastEngineState((DSPDeviceSourceEngine::State)-1)
|
||||||
{
|
{
|
||||||
m_sampleSource = (AirspyHFFInput*) m_deviceUISet->m_deviceSourceAPI->getSampleSource();
|
m_sampleSource = (AirspyHFIInput*) m_deviceUISet->m_deviceSourceAPI->getSampleSource();
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
|
||||||
@ -52,58 +52,58 @@ AirspyHFFGui::AirspyHFFGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
|||||||
|
|
||||||
displaySettings();
|
displaySettings();
|
||||||
|
|
||||||
m_rates = ((AirspyHFFInput*) m_sampleSource)->getSampleRates();
|
m_rates = ((AirspyHFIInput*) m_sampleSource)->getSampleRates();
|
||||||
displaySampleRates();
|
displaySampleRates();
|
||||||
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
|
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
|
||||||
|
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
AirspyHFFGui::~AirspyHFFGui()
|
AirspyHFIGui::~AirspyHFIGui()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFGui::destroy()
|
void AirspyHFIGui::destroy()
|
||||||
{
|
{
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFGui::setName(const QString& name)
|
void AirspyHFIGui::setName(const QString& name)
|
||||||
{
|
{
|
||||||
setObjectName(name);
|
setObjectName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AirspyHFFGui::getName() const
|
QString AirspyHFIGui::getName() const
|
||||||
{
|
{
|
||||||
return objectName();
|
return objectName();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFGui::resetToDefaults()
|
void AirspyHFIGui::resetToDefaults()
|
||||||
{
|
{
|
||||||
m_settings.resetToDefaults();
|
m_settings.resetToDefaults();
|
||||||
displaySettings();
|
displaySettings();
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 AirspyHFFGui::getCenterFrequency() const
|
qint64 AirspyHFIGui::getCenterFrequency() const
|
||||||
{
|
{
|
||||||
return m_settings.m_centerFrequency;
|
return m_settings.m_centerFrequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFGui::setCenterFrequency(qint64 centerFrequency)
|
void AirspyHFIGui::setCenterFrequency(qint64 centerFrequency)
|
||||||
{
|
{
|
||||||
m_settings.m_centerFrequency = centerFrequency;
|
m_settings.m_centerFrequency = centerFrequency;
|
||||||
displaySettings();
|
displaySettings();
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray AirspyHFFGui::serialize() const
|
QByteArray AirspyHFIGui::serialize() const
|
||||||
{
|
{
|
||||||
return m_settings.serialize();
|
return m_settings.serialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AirspyHFFGui::deserialize(const QByteArray& data)
|
bool AirspyHFIGui::deserialize(const QByteArray& data)
|
||||||
{
|
{
|
||||||
if(m_settings.deserialize(data)) {
|
if(m_settings.deserialize(data)) {
|
||||||
displaySettings();
|
displaySettings();
|
||||||
@ -116,20 +116,20 @@ bool AirspyHFFGui::deserialize(const QByteArray& data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AirspyHFFGui::handleMessage(const Message& message)
|
bool AirspyHFIGui::handleMessage(const Message& message)
|
||||||
{
|
{
|
||||||
if (AirspyHFFInput::MsgConfigureAirspyHF::match(message))
|
if (AirspyHFIInput::MsgConfigureAirspyHFI::match(message))
|
||||||
{
|
{
|
||||||
const AirspyHFFInput::MsgConfigureAirspyHF& cfg = (AirspyHFFInput::MsgConfigureAirspyHF&) message;
|
const AirspyHFIInput::MsgConfigureAirspyHFI& cfg = (AirspyHFIInput::MsgConfigureAirspyHFI&) message;
|
||||||
m_settings = cfg.getSettings();
|
m_settings = cfg.getSettings();
|
||||||
blockApplySettings(true);
|
blockApplySettings(true);
|
||||||
displaySettings();
|
displaySettings();
|
||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (AirspyHFFInput::MsgStartStop::match(message))
|
else if (AirspyHFIInput::MsgStartStop::match(message))
|
||||||
{
|
{
|
||||||
AirspyHFFInput::MsgStartStop& notif = (AirspyHFFInput::MsgStartStop&) message;
|
AirspyHFIInput::MsgStartStop& notif = (AirspyHFIInput::MsgStartStop&) message;
|
||||||
blockApplySettings(true);
|
blockApplySettings(true);
|
||||||
ui->startStop->setChecked(notif.getStartStop());
|
ui->startStop->setChecked(notif.getStartStop());
|
||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
@ -142,7 +142,7 @@ bool AirspyHFFGui::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFGui::handleInputMessages()
|
void AirspyHFIGui::handleInputMessages()
|
||||||
{
|
{
|
||||||
Message* message;
|
Message* message;
|
||||||
|
|
||||||
@ -170,14 +170,14 @@ void AirspyHFFGui::handleInputMessages()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFGui::updateSampleRateAndFrequency()
|
void AirspyHFIGui::updateSampleRateAndFrequency()
|
||||||
{
|
{
|
||||||
m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate);
|
m_deviceUISet->getSpectrum()->setSampleRate(m_sampleRate);
|
||||||
m_deviceUISet->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
|
m_deviceUISet->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 AirspyHFFGui::updateFrequencyLimits()
|
void AirspyHFIGui::updateFrequencyLimits()
|
||||||
{
|
{
|
||||||
// values in kHz
|
// values in kHz
|
||||||
qint64 deltaFrequency = m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency/1000 : 0;
|
qint64 deltaFrequency = m_settings.m_transverterMode ? m_settings.m_transverterDeltaFrequency/1000 : 0;
|
||||||
@ -188,13 +188,13 @@ void AirspyHFFGui::updateFrequencyLimits()
|
|||||||
switch(m_settings.m_bandIndex)
|
switch(m_settings.m_bandIndex)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
minLimit = AirspyHFFInput::loLowLimitFreqVHF/1000 + deltaFrequency;
|
minLimit = AirspyHFIInput::loLowLimitFreqVHF/1000 + deltaFrequency;
|
||||||
maxLimit = AirspyHFFInput::loHighLimitFreqVHF/1000 + deltaFrequency;
|
maxLimit = AirspyHFIInput::loHighLimitFreqVHF/1000 + deltaFrequency;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
default:
|
default:
|
||||||
minLimit = AirspyHFFInput::loLowLimitFreqHF/1000 + deltaFrequency;
|
minLimit = AirspyHFIInput::loLowLimitFreqHF/1000 + deltaFrequency;
|
||||||
maxLimit = AirspyHFFInput::loHighLimitFreqHF/1000 + deltaFrequency;
|
maxLimit = AirspyHFIInput::loHighLimitFreqHF/1000 + deltaFrequency;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ void AirspyHFFGui::updateFrequencyLimits()
|
|||||||
ui->centerFrequency->setValueRange(7, minLimit, maxLimit);
|
ui->centerFrequency->setValueRange(7, minLimit, maxLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFGui::displaySettings()
|
void AirspyHFIGui::displaySettings()
|
||||||
{
|
{
|
||||||
blockApplySettings(true);
|
blockApplySettings(true);
|
||||||
ui->band->blockSignals(true);
|
ui->band->blockSignals(true);
|
||||||
@ -218,13 +218,14 @@ void AirspyHFFGui::displaySettings()
|
|||||||
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
||||||
ui->LOppm->setValue(m_settings.m_LOppmTenths);
|
ui->LOppm->setValue(m_settings.m_LOppmTenths);
|
||||||
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)));
|
||||||
|
ui->autoCorr->setCurrentIndex(m_settings.m_autoCorrOptions);
|
||||||
ui->sampleRate->setCurrentIndex(m_settings.m_devSampleRateIndex);
|
ui->sampleRate->setCurrentIndex(m_settings.m_devSampleRateIndex);
|
||||||
ui->decim->setCurrentIndex(m_settings.m_log2Decim);
|
ui->decim->setCurrentIndex(m_settings.m_log2Decim);
|
||||||
ui->band->blockSignals(false);
|
ui->band->blockSignals(false);
|
||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFGui::displaySampleRates()
|
void AirspyHFIGui::displaySampleRates()
|
||||||
{
|
{
|
||||||
unsigned int savedIndex = m_settings.m_devSampleRateIndex;
|
unsigned int savedIndex = m_settings.m_devSampleRateIndex;
|
||||||
ui->sampleRate->blockSignals(true);
|
ui->sampleRate->blockSignals(true);
|
||||||
@ -252,37 +253,47 @@ void AirspyHFFGui::displaySampleRates()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFGui::sendSettings()
|
void AirspyHFIGui::sendSettings()
|
||||||
{
|
{
|
||||||
if(!m_updateTimer.isActive())
|
if(!m_updateTimer.isActive())
|
||||||
m_updateTimer.start(100);
|
m_updateTimer.start(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFGui::on_centerFrequency_changed(quint64 value)
|
void AirspyHFIGui::on_centerFrequency_changed(quint64 value)
|
||||||
{
|
{
|
||||||
m_settings.m_centerFrequency = value * 1000;
|
m_settings.m_centerFrequency = value * 1000;
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFGui::on_LOppm_valueChanged(int value)
|
void AirspyHFIGui::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 AirspyHFFGui::on_resetLOppm_clicked()
|
void AirspyHFIGui::on_resetLOppm_clicked()
|
||||||
{
|
{
|
||||||
ui->LOppm->setValue(0);
|
ui->LOppm->setValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFGui::on_sampleRate_currentIndexChanged(int index)
|
void AirspyHFIGui::on_autoCorr_currentIndexChanged(int index)
|
||||||
|
{
|
||||||
|
if ((index < 0) || (index > AirspyHFISettings::AutoCorrLast)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_settings.m_autoCorrOptions = (AirspyHFISettings::AutoCorrOptions) index;
|
||||||
|
sendSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AirspyHFIGui::on_sampleRate_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
m_settings.m_devSampleRateIndex = index;
|
m_settings.m_devSampleRateIndex = index;
|
||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFGui::on_decim_currentIndexChanged(int index)
|
void AirspyHFIGui::on_decim_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
if ((index < 0) || (index > 5))
|
if ((index < 0) || (index > 5))
|
||||||
return;
|
return;
|
||||||
@ -290,16 +301,16 @@ void AirspyHFFGui::on_decim_currentIndexChanged(int index)
|
|||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFGui::on_startStop_toggled(bool checked)
|
void AirspyHFIGui::on_startStop_toggled(bool checked)
|
||||||
{
|
{
|
||||||
if (m_doApplySettings)
|
if (m_doApplySettings)
|
||||||
{
|
{
|
||||||
AirspyHFFInput::MsgStartStop *message = AirspyHFFInput::MsgStartStop::create(checked);
|
AirspyHFIInput::MsgStartStop *message = AirspyHFIInput::MsgStartStop::create(checked);
|
||||||
m_sampleSource->getInputMessageQueue()->push(message);
|
m_sampleSource->getInputMessageQueue()->push(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFGui::on_record_toggled(bool checked)
|
void AirspyHFIGui::on_record_toggled(bool checked)
|
||||||
{
|
{
|
||||||
if (checked) {
|
if (checked) {
|
||||||
ui->record->setStyleSheet("QToolButton { background-color : red; }");
|
ui->record->setStyleSheet("QToolButton { background-color : red; }");
|
||||||
@ -307,11 +318,11 @@ void AirspyHFFGui::on_record_toggled(bool checked)
|
|||||||
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||||
}
|
}
|
||||||
|
|
||||||
AirspyHFFInput::MsgFileRecord* message = AirspyHFFInput::MsgFileRecord::create(checked);
|
AirspyHFIInput::MsgFileRecord* message = AirspyHFIInput::MsgFileRecord::create(checked);
|
||||||
m_sampleSource->getInputMessageQueue()->push(message);
|
m_sampleSource->getInputMessageQueue()->push(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFGui::on_transverter_clicked()
|
void AirspyHFIGui::on_transverter_clicked()
|
||||||
{
|
{
|
||||||
m_settings.m_transverterMode = ui->transverter->getDeltaFrequencyAcive();
|
m_settings.m_transverterMode = ui->transverter->getDeltaFrequencyAcive();
|
||||||
m_settings.m_transverterDeltaFrequency = ui->transverter->getDeltaFrequency();
|
m_settings.m_transverterDeltaFrequency = ui->transverter->getDeltaFrequency();
|
||||||
@ -321,7 +332,7 @@ void AirspyHFFGui::on_transverter_clicked()
|
|||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFGui::on_band_currentIndexChanged(int index)
|
void AirspyHFIGui::on_band_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
if ((index < 0) || (index > 1)) {
|
if ((index < 0) || (index > 1)) {
|
||||||
return;
|
return;
|
||||||
@ -334,16 +345,16 @@ void AirspyHFFGui::on_band_currentIndexChanged(int index)
|
|||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFGui::updateHardware()
|
void AirspyHFIGui::updateHardware()
|
||||||
{
|
{
|
||||||
qDebug() << "AirspyHFGui::updateHardware";
|
qDebug() << "AirspyHFGui::updateHardware";
|
||||||
AirspyHFFInput::MsgConfigureAirspyHF* message = AirspyHFFInput::MsgConfigureAirspyHF::create(m_settings, m_forceSettings);
|
AirspyHFIInput::MsgConfigureAirspyHFI* message = AirspyHFIInput::MsgConfigureAirspyHFI::create(m_settings, m_forceSettings);
|
||||||
m_sampleSource->getInputMessageQueue()->push(message);
|
m_sampleSource->getInputMessageQueue()->push(message);
|
||||||
m_forceSettings = false;
|
m_forceSettings = false;
|
||||||
m_updateTimer.stop();
|
m_updateTimer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFGui::updateStatus()
|
void AirspyHFIGui::updateStatus()
|
||||||
{
|
{
|
||||||
int state = m_deviceUISet->m_deviceSourceAPI->state();
|
int state = m_deviceUISet->m_deviceSourceAPI->state();
|
||||||
|
|
||||||
@ -372,7 +383,7 @@ void AirspyHFFGui::updateStatus()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t AirspyHFFGui::getDevSampleRate(unsigned int rate_index)
|
uint32_t AirspyHFIGui::getDevSampleRate(unsigned int rate_index)
|
||||||
{
|
{
|
||||||
if (rate_index < m_rates.size())
|
if (rate_index < m_rates.size())
|
||||||
{
|
{
|
||||||
@ -384,7 +395,7 @@ uint32_t AirspyHFFGui::getDevSampleRate(unsigned int rate_index)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int AirspyHFFGui::getDevSampleRateIndex(uint32_t sampeRate)
|
int AirspyHFIGui::getDevSampleRateIndex(uint32_t sampeRate)
|
||||||
{
|
{
|
||||||
for (unsigned int i=0; i < m_rates.size(); i++)
|
for (unsigned int i=0; i < m_rates.size(); i++)
|
||||||
{
|
{
|
@ -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_AIRSPYHFFGUI_H
|
#ifndef INCLUDE_AIRSPYHFIGUI_H
|
||||||
#define INCLUDE_AIRSPYHFFGUI_H
|
#define INCLUDE_AIRSPYHFIGUI_H
|
||||||
|
|
||||||
#include <plugin/plugininstancegui.h>
|
#include <plugin/plugininstancegui.h>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
@ -23,21 +23,21 @@
|
|||||||
|
|
||||||
#include "util/messagequeue.h"
|
#include "util/messagequeue.h"
|
||||||
|
|
||||||
#include "airspyhffinput.h"
|
#include "airspyhfiinput.h"
|
||||||
|
|
||||||
class DeviceUISet;
|
class DeviceUISet;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AirspyHFFGui;
|
class AirspyHFIGui;
|
||||||
class AirspyHFFSampleRates;
|
class AirspyHFISampleRates;
|
||||||
}
|
}
|
||||||
|
|
||||||
class AirspyHFFGui : public QWidget, public PluginInstanceGUI {
|
class AirspyHFIGui : public QWidget, public PluginInstanceGUI {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AirspyHFFGui(DeviceUISet *deviceUISet, QWidget* parent = 0);
|
explicit AirspyHFIGui(DeviceUISet *deviceUISet, QWidget* parent = 0);
|
||||||
virtual ~AirspyHFFGui();
|
virtual ~AirspyHFIGui();
|
||||||
virtual void destroy();
|
virtual void destroy();
|
||||||
|
|
||||||
void setName(const QString& name);
|
void setName(const QString& name);
|
||||||
@ -54,12 +54,12 @@ public:
|
|||||||
int getDevSampleRateIndex(uint32_t sampleRate);
|
int getDevSampleRateIndex(uint32_t sampleRate);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AirspyHFFGui* ui;
|
Ui::AirspyHFIGui* ui;
|
||||||
|
|
||||||
DeviceUISet* m_deviceUISet;
|
DeviceUISet* m_deviceUISet;
|
||||||
bool m_doApplySettings;
|
bool m_doApplySettings;
|
||||||
bool m_forceSettings;
|
bool m_forceSettings;
|
||||||
AirspyHFFSettings m_settings;
|
AirspyHFISettings m_settings;
|
||||||
QTimer m_updateTimer;
|
QTimer m_updateTimer;
|
||||||
QTimer m_statusTimer;
|
QTimer m_statusTimer;
|
||||||
std::vector<uint32_t> m_rates;
|
std::vector<uint32_t> m_rates;
|
||||||
@ -80,6 +80,7 @@ private slots:
|
|||||||
void on_centerFrequency_changed(quint64 value);
|
void on_centerFrequency_changed(quint64 value);
|
||||||
void on_LOppm_valueChanged(int value);
|
void on_LOppm_valueChanged(int value);
|
||||||
void on_resetLOppm_clicked();
|
void on_resetLOppm_clicked();
|
||||||
|
void on_autoCorr_currentIndexChanged(int index);
|
||||||
void on_sampleRate_currentIndexChanged(int index);
|
void on_sampleRate_currentIndexChanged(int index);
|
||||||
void on_decim_currentIndexChanged(int index);
|
void on_decim_currentIndexChanged(int index);
|
||||||
void on_startStop_toggled(bool checked);
|
void on_startStop_toggled(bool checked);
|
||||||
@ -91,4 +92,4 @@ private slots:
|
|||||||
void handleInputMessages();
|
void handleInputMessages();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_AIRSPYHFGUI_H
|
#endif // INCLUDE_AIRSPYHFIGUI_H
|
@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>AirspyHFFGui</class>
|
<class>AirspyHFIGui</class>
|
||||||
<widget class="QWidget" name="AirspyHFFGui">
|
<widget class="QWidget" name="AirspyHFIGui">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>324</width>
|
<width>324</width>
|
||||||
<height>132</height>
|
<height>174</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -237,6 +237,52 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="autoCorrLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="autoCorrLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Corr</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="autoCorr">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>DC offset and IQ correction options</string>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>None</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>DC</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>DC+IQ</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="Line" name="line_freq">
|
<widget class="Line" name="line_freq">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
@ -26,28 +26,28 @@
|
|||||||
#include "dsp/dspcommands.h"
|
#include "dsp/dspcommands.h"
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
|
|
||||||
#include "airspyhffinput.h"
|
#include "airspyhfisettings.h"
|
||||||
|
#include "airspyhfiinput.h"
|
||||||
|
|
||||||
#include "airspyhffgui.h"
|
#include "airspyhfiplugin.h"
|
||||||
#include "airspyhffplugin.h"
|
#include "airspyhfithread.h"
|
||||||
#include "airspyhffsettings.h"
|
#include "airspyhfigui.h"
|
||||||
#include "airspyhffthread.h"
|
|
||||||
|
|
||||||
MESSAGE_CLASS_DEFINITION(AirspyHFFInput::MsgConfigureAirspyHF, Message)
|
MESSAGE_CLASS_DEFINITION(AirspyHFIInput::MsgConfigureAirspyHFI, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(AirspyHFFInput::MsgStartStop, Message)
|
MESSAGE_CLASS_DEFINITION(AirspyHFIInput::MsgStartStop, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(AirspyHFFInput::MsgFileRecord, Message)
|
MESSAGE_CLASS_DEFINITION(AirspyHFIInput::MsgFileRecord, Message)
|
||||||
|
|
||||||
const qint64 AirspyHFFInput::loLowLimitFreqHF = 9000L;
|
const qint64 AirspyHFIInput::loLowLimitFreqHF = 9000L;
|
||||||
const qint64 AirspyHFFInput::loHighLimitFreqHF = 31000000L;
|
const qint64 AirspyHFIInput::loHighLimitFreqHF = 31000000L;
|
||||||
const qint64 AirspyHFFInput::loLowLimitFreqVHF = 60000000L;
|
const qint64 AirspyHFIInput::loLowLimitFreqVHF = 60000000L;
|
||||||
const qint64 AirspyHFFInput::loHighLimitFreqVHF = 260000000L;
|
const qint64 AirspyHFIInput::loHighLimitFreqVHF = 260000000L;
|
||||||
|
|
||||||
AirspyHFFInput::AirspyHFFInput(DeviceSourceAPI *deviceAPI) :
|
AirspyHFIInput::AirspyHFIInput(DeviceSourceAPI *deviceAPI) :
|
||||||
m_deviceAPI(deviceAPI),
|
m_deviceAPI(deviceAPI),
|
||||||
m_settings(),
|
m_settings(),
|
||||||
m_dev(0),
|
m_dev(0),
|
||||||
m_airspyHFThread(0),
|
m_airspyHFThread(0),
|
||||||
m_deviceDescription("AirspyHFF"),
|
m_deviceDescription("AirspyHFI"),
|
||||||
m_running(false)
|
m_running(false)
|
||||||
{
|
{
|
||||||
openDevice();
|
openDevice();
|
||||||
@ -58,7 +58,7 @@ AirspyHFFInput::AirspyHFFInput(DeviceSourceAPI *deviceAPI) :
|
|||||||
m_deviceAPI->addSink(m_fileSink);
|
m_deviceAPI->addSink(m_fileSink);
|
||||||
}
|
}
|
||||||
|
|
||||||
AirspyHFFInput::~AirspyHFFInput()
|
AirspyHFIInput::~AirspyHFIInput()
|
||||||
{
|
{
|
||||||
if (m_running) { stop(); }
|
if (m_running) { stop(); }
|
||||||
m_deviceAPI->removeSink(m_fileSink);
|
m_deviceAPI->removeSink(m_fileSink);
|
||||||
@ -66,12 +66,12 @@ AirspyHFFInput::~AirspyHFFInput()
|
|||||||
closeDevice();
|
closeDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFInput::destroy()
|
void AirspyHFIInput::destroy()
|
||||||
{
|
{
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AirspyHFFInput::openDevice()
|
bool AirspyHFIInput::openDevice()
|
||||||
{
|
{
|
||||||
if (m_dev != 0)
|
if (m_dev != 0)
|
||||||
{
|
{
|
||||||
@ -82,18 +82,18 @@ bool AirspyHFFInput::openDevice()
|
|||||||
|
|
||||||
if (!m_sampleFifo.setSize(1<<19))
|
if (!m_sampleFifo.setSize(1<<19))
|
||||||
{
|
{
|
||||||
qCritical("AirspyHFFInput::start: could not allocate SampleFifo");
|
qCritical("AirspyHFInput::start: could not allocate SampleFifo");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_dev = open_airspyhf_from_serial(m_deviceAPI->getSampleSourceSerial())) == 0)
|
if ((m_dev = open_airspyhf_from_serial(m_deviceAPI->getSampleSourceSerial())) == 0)
|
||||||
{
|
{
|
||||||
qCritical("AirspyHFFInput::start: could not open Airspy HF with serial %s", qPrintable(m_deviceAPI->getSampleSourceSerial()));
|
qCritical("AirspyHFInput::start: could not open Airspy with serial %s", qPrintable(m_deviceAPI->getSampleSourceSerial()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug("AirspyHFFInput::start: opened Airspy HF with serial %s", qPrintable(m_deviceAPI->getSampleSourceSerial()));
|
qDebug("AirspyHFInput::start: opened Airspy with serial %s", qPrintable(m_deviceAPI->getSampleSourceSerial()));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nbSampleRates;
|
uint32_t nbSampleRates;
|
||||||
@ -103,11 +103,11 @@ bool AirspyHFFInput::openDevice()
|
|||||||
|
|
||||||
if (rc == AIRSPYHF_SUCCESS)
|
if (rc == AIRSPYHF_SUCCESS)
|
||||||
{
|
{
|
||||||
qDebug("AirspyHFFInput::start: %d sample rates for Airspy HF", nbSampleRates);
|
qDebug("AirspyHFInput::start: %d sample rates for AirspyHF", nbSampleRates);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qCritical("AirspyHFFInput::start: could not obtain the number of Airspy HF sample rates");
|
qCritical("AirspyHFInput::start: could not obtain the number of AirspyHF sample rates");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,11 +117,11 @@ bool AirspyHFFInput::openDevice()
|
|||||||
|
|
||||||
if (rc == AIRSPYHF_SUCCESS)
|
if (rc == AIRSPYHF_SUCCESS)
|
||||||
{
|
{
|
||||||
qDebug("AirspyHFFInput::start: obtained Airspy HF sample rates");
|
qDebug("AirspyHFInput::start: obtained AirspyHF sample rates");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qCritical("AirspyHFFInput::start: could not obtain Airspy HF sample rates");
|
qCritical("AirspyHFInput::start: could not obtain AirspyHF sample rates");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,22 +130,22 @@ bool AirspyHFFInput::openDevice()
|
|||||||
for (unsigned int i = 0; i < nbSampleRates; i++)
|
for (unsigned int i = 0; i < nbSampleRates; i++)
|
||||||
{
|
{
|
||||||
m_sampleRates.push_back(sampleRates[i]);
|
m_sampleRates.push_back(sampleRates[i]);
|
||||||
qDebug("AirspyHFFInput::start: sampleRates[%d] = %u Hz", i, sampleRates[i]);
|
qDebug("AirspyHFInput::start: sampleRates[%d] = %u Hz", i, sampleRates[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] sampleRates;
|
delete[] sampleRates;
|
||||||
|
|
||||||
airspyhf_set_sample_type(m_dev, AIRSPYHF_SAMPLE_FLOAT32_IQ);
|
airspyhf_set_sample_type(m_dev, AIRSPYHF_SAMPLE_INT16_NDSP_IQ);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFInput::init()
|
void AirspyHFIInput::init()
|
||||||
{
|
{
|
||||||
applySettings(m_settings, true);
|
applySettings(m_settings, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AirspyHFFInput::start()
|
bool AirspyHFIInput::start()
|
||||||
{
|
{
|
||||||
QMutexLocker mutexLocker(&m_mutex);
|
QMutexLocker mutexLocker(&m_mutex);
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ bool AirspyHFFInput::start()
|
|||||||
|
|
||||||
if (m_running) { stop(); }
|
if (m_running) { stop(); }
|
||||||
|
|
||||||
if ((m_airspyHFThread = new AirspyHFFThread(m_dev, &m_sampleFifo)) == 0)
|
if ((m_airspyHFThread = new AirspyHFIThread(m_dev, &m_sampleFifo)) == 0)
|
||||||
{
|
{
|
||||||
qFatal("AirspyHFInput::start: out of memory");
|
qFatal("AirspyHFInput::start: out of memory");
|
||||||
stop();
|
stop();
|
||||||
@ -177,7 +177,7 @@ bool AirspyHFFInput::start()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFInput::closeDevice()
|
void AirspyHFIInput::closeDevice()
|
||||||
{
|
{
|
||||||
if (m_dev != 0)
|
if (m_dev != 0)
|
||||||
{
|
{
|
||||||
@ -189,7 +189,7 @@ void AirspyHFFInput::closeDevice()
|
|||||||
m_deviceDescription.clear();
|
m_deviceDescription.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFInput::stop()
|
void AirspyHFIInput::stop()
|
||||||
{
|
{
|
||||||
qDebug("AirspyHFInput::stop");
|
qDebug("AirspyHFInput::stop");
|
||||||
QMutexLocker mutexLocker(&m_mutex);
|
QMutexLocker mutexLocker(&m_mutex);
|
||||||
@ -204,12 +204,12 @@ void AirspyHFFInput::stop()
|
|||||||
m_running = false;
|
m_running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray AirspyHFFInput::serialize() const
|
QByteArray AirspyHFIInput::serialize() const
|
||||||
{
|
{
|
||||||
return m_settings.serialize();
|
return m_settings.serialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AirspyHFFInput::deserialize(const QByteArray& data)
|
bool AirspyHFIInput::deserialize(const QByteArray& data)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
@ -219,54 +219,54 @@ bool AirspyHFFInput::deserialize(const QByteArray& data)
|
|||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MsgConfigureAirspyHF* message = MsgConfigureAirspyHF::create(m_settings, true);
|
MsgConfigureAirspyHFI* message = MsgConfigureAirspyHFI::create(m_settings, true);
|
||||||
m_inputMessageQueue.push(message);
|
m_inputMessageQueue.push(message);
|
||||||
|
|
||||||
if (m_guiMessageQueue)
|
if (m_guiMessageQueue)
|
||||||
{
|
{
|
||||||
MsgConfigureAirspyHF* messageToGUI = MsgConfigureAirspyHF::create(m_settings, true);
|
MsgConfigureAirspyHFI* messageToGUI = MsgConfigureAirspyHFI::create(m_settings, true);
|
||||||
m_guiMessageQueue->push(messageToGUI);
|
m_guiMessageQueue->push(messageToGUI);
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString& AirspyHFFInput::getDeviceDescription() const
|
const QString& AirspyHFIInput::getDeviceDescription() const
|
||||||
{
|
{
|
||||||
return m_deviceDescription;
|
return m_deviceDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AirspyHFFInput::getSampleRate() const
|
int AirspyHFIInput::getSampleRate() const
|
||||||
{
|
{
|
||||||
int rate = m_sampleRates[m_settings.m_devSampleRateIndex];
|
int rate = m_sampleRates[m_settings.m_devSampleRateIndex];
|
||||||
return (rate / (1<<m_settings.m_log2Decim));
|
return (rate / (1<<m_settings.m_log2Decim));
|
||||||
}
|
}
|
||||||
|
|
||||||
quint64 AirspyHFFInput::getCenterFrequency() const
|
quint64 AirspyHFIInput::getCenterFrequency() const
|
||||||
{
|
{
|
||||||
return m_settings.m_centerFrequency;
|
return m_settings.m_centerFrequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFInput::setCenterFrequency(qint64 centerFrequency)
|
void AirspyHFIInput::setCenterFrequency(qint64 centerFrequency)
|
||||||
{
|
{
|
||||||
AirspyHFFSettings settings = m_settings;
|
AirspyHFISettings settings = m_settings;
|
||||||
settings.m_centerFrequency = centerFrequency;
|
settings.m_centerFrequency = centerFrequency;
|
||||||
|
|
||||||
MsgConfigureAirspyHF* message = MsgConfigureAirspyHF::create(settings, false);
|
MsgConfigureAirspyHFI* message = MsgConfigureAirspyHFI::create(settings, false);
|
||||||
m_inputMessageQueue.push(message);
|
m_inputMessageQueue.push(message);
|
||||||
|
|
||||||
if (m_guiMessageQueue)
|
if (m_guiMessageQueue)
|
||||||
{
|
{
|
||||||
MsgConfigureAirspyHF* messageToGUI = MsgConfigureAirspyHF::create(settings, false);
|
MsgConfigureAirspyHFI* messageToGUI = MsgConfigureAirspyHFI::create(settings, false);
|
||||||
m_guiMessageQueue->push(messageToGUI);
|
m_guiMessageQueue->push(messageToGUI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AirspyHFFInput::handleMessage(const Message& message)
|
bool AirspyHFIInput::handleMessage(const Message& message)
|
||||||
{
|
{
|
||||||
if (MsgConfigureAirspyHF::match(message))
|
if (MsgConfigureAirspyHFI::match(message))
|
||||||
{
|
{
|
||||||
MsgConfigureAirspyHF& conf = (MsgConfigureAirspyHF&) message;
|
MsgConfigureAirspyHFI& conf = (MsgConfigureAirspyHFI&) message;
|
||||||
qDebug() << "MsgConfigureAirspyHF::handleMessage: MsgConfigureAirspyHF";
|
qDebug() << "MsgConfigureAirspyHF::handleMessage: MsgConfigureAirspyHF";
|
||||||
|
|
||||||
bool success = applySettings(conf.getSettings(), conf.getForce());
|
bool success = applySettings(conf.getSettings(), conf.getForce());
|
||||||
@ -318,7 +318,7 @@ bool AirspyHFFInput::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFInput::setDeviceCenterFrequency(quint64 freq_hz, const AirspyHFFSettings& settings)
|
void AirspyHFIInput::setDeviceCenterFrequency(quint64 freq_hz, const AirspyHFISettings& settings)
|
||||||
{
|
{
|
||||||
switch(settings.m_bandIndex)
|
switch(settings.m_bandIndex)
|
||||||
{
|
{
|
||||||
@ -340,7 +340,7 @@ void AirspyHFFInput::setDeviceCenterFrequency(quint64 freq_hz, const AirspyHFFSe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AirspyHFFInput::applySettings(const AirspyHFFSettings& settings, bool force)
|
bool AirspyHFIInput::applySettings(const AirspyHFISettings& settings, bool force)
|
||||||
{
|
{
|
||||||
QMutexLocker mutexLocker(&m_mutex);
|
QMutexLocker mutexLocker(&m_mutex);
|
||||||
|
|
||||||
@ -350,6 +350,23 @@ bool AirspyHFFInput::applySettings(const AirspyHFFSettings& settings, bool force
|
|||||||
|
|
||||||
qDebug() << "AirspyHFInput::applySettings";
|
qDebug() << "AirspyHFInput::applySettings";
|
||||||
|
|
||||||
|
if ((m_settings.m_autoCorrOptions != settings.m_autoCorrOptions) || force)
|
||||||
|
{
|
||||||
|
switch(settings.m_autoCorrOptions)
|
||||||
|
{
|
||||||
|
case AirspyHFISettings::AutoCorrDC:
|
||||||
|
m_deviceAPI->configureCorrections(true, false);
|
||||||
|
break;
|
||||||
|
case AirspyHFISettings::AutoCorrDCAndIQ:
|
||||||
|
m_deviceAPI->configureCorrections(true, true);
|
||||||
|
break;
|
||||||
|
case AirspyHFISettings::AutoCorrNone:
|
||||||
|
default:
|
||||||
|
m_deviceAPI->configureCorrections(false, false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((m_settings.m_devSampleRateIndex != settings.m_devSampleRateIndex) || force)
|
if ((m_settings.m_devSampleRateIndex != settings.m_devSampleRateIndex) || force)
|
||||||
{
|
{
|
||||||
forwardChange = true;
|
forwardChange = true;
|
||||||
@ -439,7 +456,7 @@ bool AirspyHFFInput::applySettings(const AirspyHFFSettings& settings, bool force
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
airspyhf_device_t *AirspyHFFInput::open_airspyhf_from_serial(const QString& serialStr)
|
airspyhf_device_t *AirspyHFIInput::open_airspyhf_from_serial(const QString& serialStr)
|
||||||
{
|
{
|
||||||
airspyhf_device_t *devinfo;
|
airspyhf_device_t *devinfo;
|
||||||
bool ok;
|
bool ok;
|
||||||
@ -464,7 +481,7 @@ airspyhf_device_t *AirspyHFFInput::open_airspyhf_from_serial(const QString& seri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int AirspyHFFInput::webapiRunGet(
|
int AirspyHFIInput::webapiRunGet(
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage __attribute__((unused)))
|
QString& errorMessage __attribute__((unused)))
|
||||||
{
|
{
|
||||||
@ -472,7 +489,7 @@ int AirspyHFFInput::webapiRunGet(
|
|||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AirspyHFFInput::webapiRun(
|
int AirspyHFIInput::webapiRun(
|
||||||
bool run,
|
bool run,
|
||||||
SWGSDRangel::SWGDeviceState& response,
|
SWGSDRangel::SWGDeviceState& response,
|
||||||
QString& errorMessage __attribute__((unused)))
|
QString& errorMessage __attribute__((unused)))
|
@ -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_AIRSPYHFFINPUT_H
|
#ifndef INCLUDE_AIRSPYHFIINPUT_H
|
||||||
#define INCLUDE_AIRSPYHFFINPUT_H
|
#define INCLUDE_AIRSPYHFIINPUT_H
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
@ -23,31 +23,31 @@
|
|||||||
#include <libairspyhf/airspyhf.h>
|
#include <libairspyhf/airspyhf.h>
|
||||||
#include <dsp/devicesamplesource.h>
|
#include <dsp/devicesamplesource.h>
|
||||||
|
|
||||||
#include "airspyhffsettings.h"
|
#include "airspyhfisettings.h"
|
||||||
|
|
||||||
class DeviceSourceAPI;
|
class DeviceSourceAPI;
|
||||||
class AirspyHFFThread;
|
class AirspyHFIThread;
|
||||||
class FileRecord;
|
class FileRecord;
|
||||||
|
|
||||||
class AirspyHFFInput : public DeviceSampleSource {
|
class AirspyHFIInput : public DeviceSampleSource {
|
||||||
public:
|
public:
|
||||||
class MsgConfigureAirspyHF : public Message {
|
class MsgConfigureAirspyHFI : public Message {
|
||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const AirspyHFFSettings& getSettings() const { return m_settings; }
|
const AirspyHFISettings& getSettings() const { return m_settings; }
|
||||||
bool getForce() const { return m_force; }
|
bool getForce() const { return m_force; }
|
||||||
|
|
||||||
static MsgConfigureAirspyHF* create(const AirspyHFFSettings& settings, bool force)
|
static MsgConfigureAirspyHFI* create(const AirspyHFISettings& settings, bool force)
|
||||||
{
|
{
|
||||||
return new MsgConfigureAirspyHF(settings, force);
|
return new MsgConfigureAirspyHFI(settings, force);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AirspyHFFSettings m_settings;
|
AirspyHFISettings m_settings;
|
||||||
bool m_force;
|
bool m_force;
|
||||||
|
|
||||||
MsgConfigureAirspyHF(const AirspyHFFSettings& settings, bool force) :
|
MsgConfigureAirspyHFI(const AirspyHFISettings& settings, bool force) :
|
||||||
Message(),
|
Message(),
|
||||||
m_settings(settings),
|
m_settings(settings),
|
||||||
m_force(force)
|
m_force(force)
|
||||||
@ -92,8 +92,8 @@ public:
|
|||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
AirspyHFFInput(DeviceSourceAPI *deviceAPI);
|
AirspyHFIInput(DeviceSourceAPI *deviceAPI);
|
||||||
virtual ~AirspyHFFInput();
|
virtual ~AirspyHFIInput();
|
||||||
virtual void destroy();
|
virtual void destroy();
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
@ -129,19 +129,19 @@ public:
|
|||||||
private:
|
private:
|
||||||
bool openDevice();
|
bool openDevice();
|
||||||
void closeDevice();
|
void closeDevice();
|
||||||
bool applySettings(const AirspyHFFSettings& settings, bool force);
|
bool applySettings(const AirspyHFISettings& settings, bool force);
|
||||||
airspyhf_device_t *open_airspyhf_from_serial(const QString& serialStr);
|
airspyhf_device_t *open_airspyhf_from_serial(const QString& serialStr);
|
||||||
void setDeviceCenterFrequency(quint64 freq, const AirspyHFFSettings& settings);
|
void setDeviceCenterFrequency(quint64 freq, const AirspyHFISettings& settings);
|
||||||
|
|
||||||
DeviceSourceAPI *m_deviceAPI;
|
DeviceSourceAPI *m_deviceAPI;
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
AirspyHFFSettings m_settings;
|
AirspyHFISettings m_settings;
|
||||||
airspyhf_device_t* m_dev;
|
airspyhf_device_t* m_dev;
|
||||||
AirspyHFFThread* m_airspyHFThread;
|
AirspyHFIThread* m_airspyHFThread;
|
||||||
QString m_deviceDescription;
|
QString m_deviceDescription;
|
||||||
std::vector<uint32_t> m_sampleRates;
|
std::vector<uint32_t> m_sampleRates;
|
||||||
bool m_running;
|
bool m_running;
|
||||||
FileRecord *m_fileSink; //!< File sink to record device I/Q output
|
FileRecord *m_fileSink; //!< File sink to record device I/Q output
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_AIRSPYHFFINPUT_H
|
#endif // INCLUDE_AIRSPYHFIINPUT_H
|
@ -21,12 +21,13 @@
|
|||||||
#include <device/devicesourceapi.h>
|
#include <device/devicesourceapi.h>
|
||||||
#include "plugin/pluginapi.h"
|
#include "plugin/pluginapi.h"
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
#include "airspyhffplugin.h"
|
#include "airspyhfiplugin.h"
|
||||||
#include "airspyhffgui.h"
|
|
||||||
|
#include "airspyhfigui.h"
|
||||||
|
|
||||||
|
|
||||||
const PluginDescriptor AirspyHFFPlugin::m_pluginDescriptor = {
|
const PluginDescriptor AirspyHFIPlugin::m_pluginDescriptor = {
|
||||||
QString("AirspyHF Input (float)"),
|
QString("AirspyHF Input (int)"),
|
||||||
QString("3.12.0"),
|
QString("3.12.0"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
QString("https://github.com/f4exb/sdrangel"),
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
@ -34,26 +35,26 @@ const PluginDescriptor AirspyHFFPlugin::m_pluginDescriptor = {
|
|||||||
QString("https://github.com/f4exb/sdrangel")
|
QString("https://github.com/f4exb/sdrangel")
|
||||||
};
|
};
|
||||||
|
|
||||||
const QString AirspyHFFPlugin::m_hardwareID = "AirspyHFF";
|
const QString AirspyHFIPlugin::m_hardwareID = "AirspyHFI";
|
||||||
const QString AirspyHFFPlugin::m_deviceTypeID = AIRSPYHFF_DEVICE_TYPE_ID;
|
const QString AirspyHFIPlugin::m_deviceTypeID = AIRSPYHFI_DEVICE_TYPE_ID;
|
||||||
const int AirspyHFFPlugin::m_maxDevices = 32;
|
const int AirspyHFIPlugin::m_maxDevices = 32;
|
||||||
|
|
||||||
AirspyHFFPlugin::AirspyHFFPlugin(QObject* parent) :
|
AirspyHFIPlugin::AirspyHFIPlugin(QObject* parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const PluginDescriptor& AirspyHFFPlugin::getPluginDescriptor() const
|
const PluginDescriptor& AirspyHFIPlugin::getPluginDescriptor() const
|
||||||
{
|
{
|
||||||
return m_pluginDescriptor;
|
return m_pluginDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFPlugin::initPlugin(PluginAPI* pluginAPI)
|
void AirspyHFIPlugin::initPlugin(PluginAPI* pluginAPI)
|
||||||
{
|
{
|
||||||
pluginAPI->registerSampleSource(m_deviceTypeID, this);
|
pluginAPI->registerSampleSource(m_deviceTypeID, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginInterface::SamplingDevices AirspyHFFPlugin::enumSampleSources()
|
PluginInterface::SamplingDevices AirspyHFIPlugin::enumSampleSources()
|
||||||
{
|
{
|
||||||
SamplingDevices result;
|
SamplingDevices result;
|
||||||
int nbDevices;
|
int nbDevices;
|
||||||
@ -63,7 +64,7 @@ PluginInterface::SamplingDevices AirspyHFFPlugin::enumSampleSources()
|
|||||||
|
|
||||||
if (nbDevices < 0)
|
if (nbDevices < 0)
|
||||||
{
|
{
|
||||||
qCritical("AirspyHFPlugin::enumSampleSources: failed to list Airspy HF devices");
|
qCritical("AirspyHFIPlugin::enumSampleSources: failed to list Airspy HF devices");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nbDevices; i++)
|
for (int i = 0; i < nbDevices; i++)
|
||||||
@ -71,7 +72,7 @@ PluginInterface::SamplingDevices AirspyHFFPlugin::enumSampleSources()
|
|||||||
if (deviceSerials[i])
|
if (deviceSerials[i])
|
||||||
{
|
{
|
||||||
QString serial_str = QString::number(deviceSerials[i], 16);
|
QString serial_str = QString::number(deviceSerials[i], 16);
|
||||||
QString displayedName(QString("AirspyHF(float)[%1] %2").arg(i).arg(serial_str));
|
QString displayedName(QString("AirspyHF(int)[%1] %2").arg(i).arg(serial_str));
|
||||||
|
|
||||||
result.append(SamplingDevice(displayedName,
|
result.append(SamplingDevice(displayedName,
|
||||||
m_hardwareID,
|
m_hardwareID,
|
||||||
@ -83,11 +84,11 @@ PluginInterface::SamplingDevices AirspyHFFPlugin::enumSampleSources()
|
|||||||
1,
|
1,
|
||||||
0));
|
0));
|
||||||
|
|
||||||
qDebug("AirspyHFFPlugin::enumSampleSources: enumerated Airspy HF device #%d", i);
|
qDebug("AirspyHFIPlugin::enumSampleSources: enumerated Airspy device #%d", i);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug("AirspyHFFPlugin::enumSampleSources: finished to enumerate Airspy HF. %d devices found", i);
|
qDebug("AirspyHFIPlugin::enumSampleSources: finished to enumerate Airspy HF. %d devices found", i);
|
||||||
break; // finished
|
break; // finished
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,14 +96,14 @@ PluginInterface::SamplingDevices AirspyHFFPlugin::enumSampleSources()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginInstanceGUI* AirspyHFFPlugin::createSampleSourcePluginInstanceGUI(
|
PluginInstanceGUI* AirspyHFIPlugin::createSampleSourcePluginInstanceGUI(
|
||||||
const QString& sourceId,
|
const QString& sourceId,
|
||||||
QWidget **widget,
|
QWidget **widget,
|
||||||
DeviceUISet *deviceUISet)
|
DeviceUISet *deviceUISet)
|
||||||
{
|
{
|
||||||
if (sourceId == m_deviceTypeID)
|
if (sourceId == m_deviceTypeID)
|
||||||
{
|
{
|
||||||
AirspyHFFGui* gui = new AirspyHFFGui(deviceUISet);
|
AirspyHFIGui* gui = new AirspyHFIGui(deviceUISet);
|
||||||
*widget = gui;
|
*widget = gui;
|
||||||
return gui;
|
return gui;
|
||||||
}
|
}
|
||||||
@ -112,11 +113,11 @@ PluginInstanceGUI* AirspyHFFPlugin::createSampleSourcePluginInstanceGUI(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceSampleSource *AirspyHFFPlugin::createSampleSourcePluginInstanceInput(const QString& sourceId, DeviceSourceAPI *deviceAPI)
|
DeviceSampleSource *AirspyHFIPlugin::createSampleSourcePluginInstanceInput(const QString& sourceId, DeviceSourceAPI *deviceAPI)
|
||||||
{
|
{
|
||||||
if (sourceId == m_deviceTypeID)
|
if (sourceId == m_deviceTypeID)
|
||||||
{
|
{
|
||||||
AirspyHFFInput* input = new AirspyHFFInput(deviceAPI);
|
AirspyHFIInput* input = new AirspyHFIInput(deviceAPI);
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
else
|
else
|
@ -14,23 +14,23 @@
|
|||||||
// 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_AIRSPYHFFPLUGIN_H
|
#ifndef INCLUDE_AIRSPYHFIPLUGIN_H
|
||||||
#define INCLUDE_AIRSPYHFFPLUGIN_H
|
#define INCLUDE_AIRSPYHFIPLUGIN_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include "plugin/plugininterface.h"
|
#include "plugin/plugininterface.h"
|
||||||
|
|
||||||
#define AIRSPYHFF_DEVICE_TYPE_ID "sdrangel.samplesource.airspyhff"
|
#define AIRSPYHFI_DEVICE_TYPE_ID "sdrangel.samplesource.airspyhfi"
|
||||||
|
|
||||||
class PluginAPI;
|
class PluginAPI;
|
||||||
|
|
||||||
class AirspyHFFPlugin : public QObject, public PluginInterface {
|
class AirspyHFIPlugin : public QObject, public PluginInterface {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(PluginInterface)
|
Q_INTERFACES(PluginInterface)
|
||||||
Q_PLUGIN_METADATA(IID AIRSPYHFF_DEVICE_TYPE_ID)
|
Q_PLUGIN_METADATA(IID AIRSPYHFI_DEVICE_TYPE_ID)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AirspyHFFPlugin(QObject* parent = 0);
|
explicit AirspyHFIPlugin(QObject* parent = 0);
|
||||||
|
|
||||||
const PluginDescriptor& getPluginDescriptor() const;
|
const PluginDescriptor& getPluginDescriptor() const;
|
||||||
void initPlugin(PluginAPI* pluginAPI);
|
void initPlugin(PluginAPI* pluginAPI);
|
||||||
@ -50,4 +50,4 @@ private:
|
|||||||
static const PluginDescriptor m_pluginDescriptor;
|
static const PluginDescriptor m_pluginDescriptor;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_AIRSPYHFFPLUGIN_H
|
#endif // INCLUDE_AIRSPYHFIPLUGIN_H
|
@ -16,15 +16,14 @@
|
|||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
|
#include "airspyhfisettings.h"
|
||||||
|
|
||||||
#include "airspyhffsettings.h"
|
AirspyHFISettings::AirspyHFISettings()
|
||||||
|
|
||||||
AirspyHFFSettings::AirspyHFFSettings()
|
|
||||||
{
|
{
|
||||||
resetToDefaults();
|
resetToDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFSettings::resetToDefaults()
|
void AirspyHFISettings::resetToDefaults()
|
||||||
{
|
{
|
||||||
m_centerFrequency = 7150*1000;
|
m_centerFrequency = 7150*1000;
|
||||||
m_LOppmTenths = 0;
|
m_LOppmTenths = 0;
|
||||||
@ -33,15 +32,17 @@ void AirspyHFFSettings::resetToDefaults()
|
|||||||
m_transverterMode = false;
|
m_transverterMode = false;
|
||||||
m_transverterDeltaFrequency = 0;
|
m_transverterDeltaFrequency = 0;
|
||||||
m_bandIndex = 0;
|
m_bandIndex = 0;
|
||||||
|
m_autoCorrOptions = AutoCorrNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray AirspyHFFSettings::serialize() const
|
QByteArray AirspyHFISettings::serialize() const
|
||||||
{
|
{
|
||||||
SimpleSerializer s(1);
|
SimpleSerializer s(1);
|
||||||
|
|
||||||
s.writeU32(1, m_devSampleRateIndex);
|
s.writeU32(1, m_devSampleRateIndex);
|
||||||
s.writeS32(2, m_LOppmTenths);
|
s.writeS32(2, m_LOppmTenths);
|
||||||
s.writeU32(3, m_log2Decim);
|
s.writeU32(3, m_log2Decim);
|
||||||
|
s.writeS32(4, (int) m_autoCorrOptions);
|
||||||
s.writeBool(7, m_transverterMode);
|
s.writeBool(7, m_transverterMode);
|
||||||
s.writeS64(8, m_transverterDeltaFrequency);
|
s.writeS64(8, m_transverterDeltaFrequency);
|
||||||
s.writeU32(9, m_bandIndex);
|
s.writeU32(9, m_bandIndex);
|
||||||
@ -49,7 +50,7 @@ QByteArray AirspyHFFSettings::serialize() const
|
|||||||
return s.final();
|
return s.final();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AirspyHFFSettings::deserialize(const QByteArray& data)
|
bool AirspyHFISettings::deserialize(const QByteArray& data)
|
||||||
{
|
{
|
||||||
SimpleDeserializer d(data);
|
SimpleDeserializer d(data);
|
||||||
|
|
||||||
@ -68,6 +69,13 @@ bool AirspyHFFSettings::deserialize(const QByteArray& data)
|
|||||||
d.readS32(2, &m_LOppmTenths, 0);
|
d.readS32(2, &m_LOppmTenths, 0);
|
||||||
d.readU32(3, &m_log2Decim, 0);
|
d.readU32(3, &m_log2Decim, 0);
|
||||||
d.readS32(4, &intval, 0);
|
d.readS32(4, &intval, 0);
|
||||||
|
|
||||||
|
if (intval < 0 || intval > (int) AutoCorrLast) {
|
||||||
|
m_autoCorrOptions = AutoCorrNone;
|
||||||
|
} else {
|
||||||
|
m_autoCorrOptions = (AutoCorrOptions) intval;
|
||||||
|
}
|
||||||
|
|
||||||
d.readBool(7, &m_transverterMode, false);
|
d.readBool(7, &m_transverterMode, false);
|
||||||
d.readS64(8, &m_transverterDeltaFrequency, 0);
|
d.readS64(8, &m_transverterDeltaFrequency, 0);
|
||||||
d.readU32(9, &uintval, 0);
|
d.readU32(9, &uintval, 0);
|
@ -14,11 +14,18 @@
|
|||||||
// 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 _AIRSPYHFF_AIRSPYHFFSETTINGS_H_
|
#ifndef _AIRSPYHF_AIRSPYHFISETTINGS_H_
|
||||||
#define _AIRSPYHFF_AIRSPYHFFSETTINGS_H_
|
#define _AIRSPYHF_AIRSPYHFISETTINGS_H_
|
||||||
|
|
||||||
struct AirspyHFFSettings
|
struct AirspyHFISettings
|
||||||
{
|
{
|
||||||
|
typedef enum {
|
||||||
|
AutoCorrNone,
|
||||||
|
AutoCorrDC,
|
||||||
|
AutoCorrDCAndIQ,
|
||||||
|
AutoCorrLast,
|
||||||
|
} AutoCorrOptions;
|
||||||
|
|
||||||
quint64 m_centerFrequency;
|
quint64 m_centerFrequency;
|
||||||
qint32 m_LOppmTenths;
|
qint32 m_LOppmTenths;
|
||||||
quint32 m_devSampleRateIndex;
|
quint32 m_devSampleRateIndex;
|
||||||
@ -26,11 +33,12 @@ struct AirspyHFFSettings
|
|||||||
bool m_transverterMode;
|
bool m_transverterMode;
|
||||||
qint64 m_transverterDeltaFrequency;
|
qint64 m_transverterDeltaFrequency;
|
||||||
quint32 m_bandIndex;
|
quint32 m_bandIndex;
|
||||||
|
AutoCorrOptions m_autoCorrOptions;
|
||||||
|
|
||||||
AirspyHFFSettings();
|
AirspyHFISettings();
|
||||||
void resetToDefaults();
|
void resetToDefaults();
|
||||||
QByteArray serialize() const;
|
QByteArray serialize() const;
|
||||||
bool deserialize(const QByteArray& data);
|
bool deserialize(const QByteArray& data);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _AIRSPYHFF_AIRSPYHFFSETTINGS_H_ */
|
#endif /* _AIRSPYHF_AIRSPYHFISETTINGS_H_ */
|
@ -18,15 +18,15 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "dsp/samplesinkfifo.h"
|
#include "dsp/samplesinkfifo.h"
|
||||||
#include "airspyhffthread.h"
|
#include "airspyhfithread.h"
|
||||||
|
|
||||||
AirspyHFFThread *AirspyHFFThread::m_this = 0;
|
AirspyHFIThread *AirspyHFIThread::m_this = 0;
|
||||||
|
|
||||||
AirspyHFFThread::AirspyHFFThread(airspyhf_device_t* dev, SampleSinkFifo* sampleFifo, QObject* parent) :
|
AirspyHFIThread::AirspyHFIThread(airspyhf_device_t* dev, SampleSinkFifo* sampleFifo, QObject* parent) :
|
||||||
QThread(parent),
|
QThread(parent),
|
||||||
m_running(false),
|
m_running(false),
|
||||||
m_dev(dev),
|
m_dev(dev),
|
||||||
m_convertBuffer(AIRSPYHFF_BLOCKSIZE),
|
m_convertBuffer(AIRSPYHFI_BLOCKSIZE),
|
||||||
m_sampleFifo(sampleFifo),
|
m_sampleFifo(sampleFifo),
|
||||||
m_samplerate(10),
|
m_samplerate(10),
|
||||||
m_log2Decim(0)
|
m_log2Decim(0)
|
||||||
@ -34,13 +34,13 @@ AirspyHFFThread::AirspyHFFThread(airspyhf_device_t* dev, SampleSinkFifo* sampleF
|
|||||||
m_this = this;
|
m_this = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
AirspyHFFThread::~AirspyHFFThread()
|
AirspyHFIThread::~AirspyHFIThread()
|
||||||
{
|
{
|
||||||
stopWork();
|
stopWork();
|
||||||
m_this = 0;
|
m_this = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFThread::startWork()
|
void AirspyHFIThread::startWork()
|
||||||
{
|
{
|
||||||
m_startWaitMutex.lock();
|
m_startWaitMutex.lock();
|
||||||
start();
|
start();
|
||||||
@ -49,24 +49,24 @@ void AirspyHFFThread::startWork()
|
|||||||
m_startWaitMutex.unlock();
|
m_startWaitMutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFThread::stopWork()
|
void AirspyHFIThread::stopWork()
|
||||||
{
|
{
|
||||||
qDebug("AirspyThread::stopWork");
|
qDebug("AirspyThread::stopWork");
|
||||||
m_running = false;
|
m_running = false;
|
||||||
wait();
|
wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFThread::setSamplerate(uint32_t samplerate)
|
void AirspyHFIThread::setSamplerate(uint32_t samplerate)
|
||||||
{
|
{
|
||||||
m_samplerate = samplerate;
|
m_samplerate = samplerate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFThread::setLog2Decimation(unsigned int log2_decim)
|
void AirspyHFIThread::setLog2Decimation(unsigned int log2_decim)
|
||||||
{
|
{
|
||||||
m_log2Decim = log2_decim;
|
m_log2Decim = log2_decim;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AirspyHFFThread::run()
|
void AirspyHFIThread::run()
|
||||||
{
|
{
|
||||||
airspyhf_error rc;
|
airspyhf_error rc;
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ void AirspyHFFThread::run()
|
|||||||
|
|
||||||
if (rc != AIRSPYHF_SUCCESS)
|
if (rc != AIRSPYHF_SUCCESS)
|
||||||
{
|
{
|
||||||
qCritical("AirspyHFFThread::run: failed to start Airspy HF Rx");
|
qCritical("AirspyHFThread::run: failed to start Airspy Rx");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -90,16 +90,16 @@ void AirspyHFFThread::run()
|
|||||||
rc = (airspyhf_error) airspyhf_stop(m_dev);
|
rc = (airspyhf_error) airspyhf_stop(m_dev);
|
||||||
|
|
||||||
if (rc == AIRSPYHF_SUCCESS) {
|
if (rc == AIRSPYHF_SUCCESS) {
|
||||||
qDebug("AirspyHFFThread::run: stopped Airspy HF Rx");
|
qDebug("AirspyHFThread::run: stopped Airspy Rx");
|
||||||
} else {
|
} else {
|
||||||
qDebug("AirspyHFFThread::run: failed to stop Airspy HF Rx");
|
qDebug("AirspyHFThread::run: failed to stop Airspy Rx");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_running = false;
|
m_running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decimate according to specified log2 (ex: log2=4 => decim=16)
|
// Decimate according to specified log2 (ex: log2=4 => decim=16)
|
||||||
void AirspyHFFThread::callback(const float* buf, qint32 len)
|
void AirspyHFIThread::callback(const qint16* buf, qint32 len)
|
||||||
{
|
{
|
||||||
SampleVector::iterator it = m_convertBuffer.begin();
|
SampleVector::iterator it = m_convertBuffer.begin();
|
||||||
|
|
||||||
@ -134,9 +134,9 @@ void AirspyHFFThread::callback(const float* buf, qint32 len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int AirspyHFFThread::rx_callback(airspyhf_transfer_t* transfer)
|
int AirspyHFIThread::rx_callback(airspyhf_transfer_t* transfer)
|
||||||
{
|
{
|
||||||
qint32 nbIAndQ = transfer->sample_count * 2;
|
qint32 bytes_to_write = transfer->sample_count * sizeof(qint16);
|
||||||
m_this->callback((float *) transfer->samples, nbIAndQ);
|
m_this->callback((qint16 *) transfer->samples, bytes_to_write);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
@ -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_AIRSPYHFFTHREAD_H
|
#ifndef INCLUDE_AIRSPYHFITHREAD_H
|
||||||
#define INCLUDE_AIRSPYHFFTHREAD_H
|
#define INCLUDE_AIRSPYHFITHREAD_H
|
||||||
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
@ -23,16 +23,16 @@
|
|||||||
#include <libairspyhf/airspyhf.h>
|
#include <libairspyhf/airspyhf.h>
|
||||||
|
|
||||||
#include "dsp/samplesinkfifo.h"
|
#include "dsp/samplesinkfifo.h"
|
||||||
#include "dsp/decimatorsf.h"
|
#include "dsp/decimators.h"
|
||||||
|
|
||||||
#define AIRSPYHFF_BLOCKSIZE (1<<17)
|
#define AIRSPYHFI_BLOCKSIZE (1<<17)
|
||||||
|
|
||||||
class AirspyHFFThread : public QThread {
|
class AirspyHFIThread : public QThread {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AirspyHFFThread(airspyhf_device_t* dev, SampleSinkFifo* sampleFifo, QObject* parent = 0);
|
AirspyHFIThread(airspyhf_device_t* dev, SampleSinkFifo* sampleFifo, QObject* parent = 0);
|
||||||
~AirspyHFFThread();
|
~AirspyHFIThread();
|
||||||
|
|
||||||
void startWork();
|
void startWork();
|
||||||
void stopWork();
|
void stopWork();
|
||||||
@ -45,19 +45,23 @@ private:
|
|||||||
bool m_running;
|
bool m_running;
|
||||||
|
|
||||||
airspyhf_device_t* m_dev;
|
airspyhf_device_t* m_dev;
|
||||||
qint16 m_buf[2*AIRSPYHFF_BLOCKSIZE];
|
qint16 m_buf[2*AIRSPYHFI_BLOCKSIZE];
|
||||||
SampleVector m_convertBuffer;
|
SampleVector m_convertBuffer;
|
||||||
SampleSinkFifo* m_sampleFifo;
|
SampleSinkFifo* m_sampleFifo;
|
||||||
|
|
||||||
int m_samplerate;
|
int m_samplerate;
|
||||||
unsigned int m_log2Decim;
|
unsigned int m_log2Decim;
|
||||||
static AirspyHFFThread *m_this;
|
static AirspyHFIThread *m_this;
|
||||||
|
|
||||||
DecimatorsF m_decimators;
|
#ifdef SDR_RX_SAMPLE_24BIT
|
||||||
|
Decimators<qint64, qint16, SDR_RX_SAMP_SZ, 16> m_decimators;
|
||||||
|
#else
|
||||||
|
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16> m_decimators;
|
||||||
|
#endif
|
||||||
|
|
||||||
void run();
|
void run();
|
||||||
void callback(const float* buf, qint32 len);
|
void callback(const qint16* buf, qint32 len);
|
||||||
static int rx_callback(airspyhf_transfer_t* transfer);
|
static int rx_callback(airspyhf_transfer_t* transfer);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_AIRSPYHFFTHREAD_H
|
#endif // INCLUDE_AIRSPYHFITHREAD_H
|
Loading…
x
Reference in New Issue
Block a user