forked from sdr/sdrangelove
gnuradioinput: implement dynamic gain sliders based on named gain API
This commit is contained in:
parent
86ee315fb6
commit
2d993c4f4a
|
@ -1,10 +1,11 @@
|
|||
project(gnuradio)
|
||||
|
||||
find_package(Boost)
|
||||
find_package(Gruel)
|
||||
find_package(GnuradioCore)
|
||||
find_package(GnuradioOsmosdr)
|
||||
|
||||
if(GRUEL_FOUND AND GNURADIO_CORE_FOUND AND GNURADIO_OSMOSDR_FOUND)
|
||||
if(Boost_FOUND AND GRUEL_FOUND AND GNURADIO_CORE_FOUND AND GNURADIO_OSMOSDR_FOUND)
|
||||
|
||||
set(gnuradio_SOURCES
|
||||
gnuradiogui.cpp
|
||||
|
@ -51,11 +52,10 @@ add_library(inputgnuradio SHARED
|
|||
|
||||
target_link_libraries(inputgnuradio
|
||||
${QT_LIBRARIES}
|
||||
${LIBUSB_LIBRARIES}
|
||||
${Boost_LIBRARIES}
|
||||
${GRUEL_LIBRARIES}
|
||||
${GNURADIO_CORE_LIBRARIES}
|
||||
${GNURADIO_OSMOSDR_LIBRARIES}
|
||||
)
|
||||
|
||||
endif(GRUEL_FOUND AND GNURADIO_CORE_FOUND AND GNURADIO_OSMOSDR_FOUND)
|
||||
endif(Boost_FOUND AND GRUEL_FOUND AND GNURADIO_CORE_FOUND AND GNURADIO_OSMOSDR_FOUND)
|
||||
|
|
|
@ -20,10 +20,13 @@
|
|||
#include "ui_gnuradiogui.h"
|
||||
|
||||
#include <osmosdr/osmosdr_device.h>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <iostream>
|
||||
#include <plugin/pluginapi.h>
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QSlider>
|
||||
|
||||
GNURadioGui::GNURadioGui(PluginAPI* pluginAPI, QWidget* parent) :
|
||||
PluginGUI(parent),
|
||||
ui(new Ui::GNURadioGui),
|
||||
|
@ -32,7 +35,6 @@ GNURadioGui::GNURadioGui(PluginAPI* pluginAPI, QWidget* parent) :
|
|||
m_sampleSource(NULL)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->centerFrequency->setValueRange(7, 20000U, 2200000U);
|
||||
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
|
||||
displaySettings();
|
||||
|
||||
|
@ -101,8 +103,10 @@ bool GNURadioGui::handleMessage(Message* message)
|
|||
{
|
||||
if(message->id() == GNURadioInput::MsgReportGNURadio::ID()) {
|
||||
GNURadioInput::MsgReportGNURadio* rep = (GNURadioInput::MsgReportGNURadio*)message;
|
||||
m_rfGains = rep->getRfGains();
|
||||
m_ifGains = rep->getIfGains();
|
||||
m_namedGains = rep->getNamedGains();
|
||||
m_freqMin = rep->getFreqMin();
|
||||
m_freqMax = rep->getFreqMax();
|
||||
m_freqCorr = rep->getFreqCorr();
|
||||
m_sampRates = rep->getSampRates();
|
||||
m_antennas = rep->getAntennas();
|
||||
m_iqbals = rep->getIQBals();
|
||||
|
@ -117,16 +121,21 @@ void GNURadioGui::displaySettings()
|
|||
{
|
||||
int oldIndex = 0;
|
||||
|
||||
oldIndex = ui->gnuradioDevices->currentIndex();
|
||||
ui->gnuradioDevices->clear();
|
||||
oldIndex = ui->cboDevices->currentIndex();
|
||||
ui->cboDevices->clear();
|
||||
|
||||
QString oldArgs = ui->deviceArguments->text();
|
||||
QString oldArgs = ui->txtDeviceArgs->text();
|
||||
|
||||
BOOST_FOREACH(osmosdr::device_t dev, osmosdr::device::find())
|
||||
osmosdr::devices_t devices = osmosdr::device::find();
|
||||
|
||||
for ( int i = 0; i < devices.size(); i++ )
|
||||
{
|
||||
osmosdr::device_t dev = devices[i];
|
||||
|
||||
QString label;
|
||||
|
||||
if ( dev.count( "label" ) ) {
|
||||
if ( dev.count( "label" ) )
|
||||
{
|
||||
label = QString(dev[ "label" ].c_str());
|
||||
dev.erase("label");
|
||||
}
|
||||
|
@ -134,57 +143,114 @@ void GNURadioGui::displaySettings()
|
|||
QPair< QString, QString > pair(label, dev.to_string().c_str());
|
||||
m_devs.append(pair);
|
||||
|
||||
ui->gnuradioDevices->addItem(label);
|
||||
ui->cboDevices->addItem(label);
|
||||
}
|
||||
|
||||
if ( ui->gnuradioDevices->count() && oldIndex >= 0 )
|
||||
if ( ui->cboDevices->count() && oldIndex >= 0 )
|
||||
{
|
||||
ui->gnuradioDevices->setCurrentIndex(oldIndex);
|
||||
if ( oldIndex > ui->cboDevices->count() - 1 )
|
||||
oldIndex = 0;
|
||||
|
||||
ui->cboDevices->setCurrentIndex(oldIndex);
|
||||
|
||||
if ( oldArgs.length() == 0 )
|
||||
ui->deviceArguments->setText(m_devs[oldIndex].second);
|
||||
ui->txtDeviceArgs->setText( m_devs[oldIndex].second );
|
||||
}
|
||||
|
||||
if ( oldArgs.length() )
|
||||
ui->deviceArguments->setText(oldArgs);
|
||||
ui->txtDeviceArgs->setText( oldArgs );
|
||||
|
||||
ui->centerFrequency->setValueRange(7,
|
||||
unsigned(m_freqMin / 1000.0),
|
||||
unsigned(m_freqMax / 1000.0));
|
||||
|
||||
ui->centerFrequency->setValue(m_generalSettings.m_centerFrequency / 1000);
|
||||
|
||||
if ( m_rfGains.size() ) {
|
||||
oldIndex = ui->sldRfGain->value();
|
||||
ui->sldRfGain->setMinimum(0);
|
||||
ui->sldRfGain->setMaximum(m_rfGains.size() - 1);
|
||||
ui->sldRfGain->setValue(oldIndex == 0 ? m_rfGains.size() / 2 : oldIndex);
|
||||
ui->sldRfGain->setEnabled(true);
|
||||
} else {
|
||||
ui->sldRfGain->setEnabled(false);
|
||||
ui->sldFreqCorr->setRange(-100, +100);
|
||||
ui->sldFreqCorr->setValue( m_freqCorr );
|
||||
ui->lblFreqCorr->setText(tr("%1").arg(ui->sldFreqCorr->value()));
|
||||
|
||||
m_gainControls.clear();
|
||||
QVBoxLayout *layoutGains = ui->verticalLayoutGains;
|
||||
QLayoutItem *layoutItem;
|
||||
|
||||
while ( ( layoutItem = layoutGains->takeAt( 0 ) ) != NULL )
|
||||
{
|
||||
QLayout *layout = layoutItem->layout();
|
||||
|
||||
if ( !layout )
|
||||
continue;
|
||||
|
||||
while ( ( layoutItem = layout->takeAt( 0 ) ) != NULL )
|
||||
{
|
||||
delete layoutItem->widget();
|
||||
delete layoutItem;
|
||||
}
|
||||
|
||||
delete layout;
|
||||
}
|
||||
|
||||
if ( m_ifGains.size() ) {
|
||||
oldIndex = ui->sldIfGain->value();
|
||||
ui->sldIfGain->setMinimum(0);
|
||||
ui->sldIfGain->setMaximum(m_ifGains.size() - 1);
|
||||
ui->sldIfGain->setValue(oldIndex == 0 ? m_ifGains.size() / 2 : oldIndex);
|
||||
ui->sldIfGain->setEnabled(true);
|
||||
} else {
|
||||
ui->sldIfGain->setEnabled(false);
|
||||
for ( int i = 0; i < m_namedGains.size(); i++ )
|
||||
{
|
||||
std::pair< QString, std::vector<double> > pair = m_namedGains[i];
|
||||
|
||||
QHBoxLayout *layout = new QHBoxLayout();
|
||||
QLabel *gainName = new QLabel( pair.first + " Gain" );
|
||||
QSlider *gainSlider = new QSlider(Qt::Horizontal);
|
||||
QLabel *gainLabel = new QLabel("0");
|
||||
gainLabel->setMinimumWidth(30);
|
||||
gainLabel->setAlignment(Qt::AlignHCenter | Qt::AlignHCenter);
|
||||
|
||||
QPair< QSlider*, QLabel* > pair2( gainSlider, gainLabel );
|
||||
m_gainControls.push_back( pair2 );
|
||||
|
||||
connect(gainSlider, SIGNAL(valueChanged(int)),
|
||||
this, SLOT(on_sldGain_valueChanged(int)));
|
||||
|
||||
layout->addWidget(gainName);
|
||||
layout->addWidget(gainSlider);
|
||||
layout->addWidget(gainLabel);
|
||||
|
||||
layoutGains->addLayout(layout);
|
||||
|
||||
std::vector<double> gain_values = pair.second;
|
||||
|
||||
if ( gain_values.size() ) {
|
||||
gainSlider->setRange(0, gain_values.size() - 1);
|
||||
gainSlider->setValue(gain_values.size() / 4);
|
||||
gainSlider->setEnabled(true);
|
||||
} else {
|
||||
gainSlider->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
oldIndex = ui->cboSampleRate->currentIndex();
|
||||
ui->cboSampleRate->clear();
|
||||
|
||||
for ( int i = 0; i < m_sampRates.size(); i++ )
|
||||
ui->cboSampleRate->addItem(QString("%1").arg( m_sampRates[i] ));
|
||||
ui->cboSampleRate->addItem( QString::number(m_sampRates[i] / 1e3, '.', 3) );
|
||||
|
||||
if ( oldIndex > ui->cboSampleRate->count() - 1 )
|
||||
oldIndex = 0;
|
||||
|
||||
if ( ui->cboSampleRate->count() && oldIndex >= 0 )
|
||||
ui->cboSampleRate->setCurrentIndex(oldIndex);
|
||||
|
||||
if ( ui->cboSampleRate->count() ) {
|
||||
ui->cboSampleRate->setEnabled(true);
|
||||
} else {
|
||||
ui->cboSampleRate->setEnabled(false);
|
||||
}
|
||||
|
||||
oldIndex = ui->cboAntennas->currentIndex();
|
||||
ui->cboAntennas->clear();
|
||||
|
||||
if ( m_antennas.size() ) {
|
||||
for ( int i = 0; i < m_antennas.size(); i++ )
|
||||
ui->cboAntennas->addItem(QString("%1").arg( m_antennas[i] ));
|
||||
ui->cboAntennas->addItem( m_antennas[i] );
|
||||
|
||||
if ( oldIndex > ui->cboAntennas->count() - 1 )
|
||||
oldIndex = 0;
|
||||
|
||||
if ( ui->cboAntennas->count() && oldIndex >= 0 )
|
||||
ui->cboAntennas->setCurrentIndex(oldIndex);
|
||||
|
@ -199,16 +265,15 @@ void GNURadioGui::displaySettings()
|
|||
|
||||
if ( m_iqbals.size() ) {
|
||||
for ( int i = 0; i < m_iqbals.size(); i++ )
|
||||
ui->cboIQBalance->addItem(QString("%1").arg( m_iqbals[i] ));
|
||||
ui->cboIQBalance->addItem( m_iqbals[i] );
|
||||
|
||||
if ( ui->cboIQBalance->count() && oldIndex >= 0 )
|
||||
ui->cboIQBalance->setCurrentIndex(oldIndex);
|
||||
ui->cboIQBalance->setCurrentIndex(oldIndex);
|
||||
|
||||
ui->cboIQBalance->setEnabled(true);
|
||||
} else {
|
||||
ui->cboIQBalance->setEnabled(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GNURadioGui::sendSettings()
|
||||
|
@ -224,12 +289,18 @@ void GNURadioGui::updateHardware()
|
|||
msg->submit(m_pluginAPI->getDSPEngineMessageQueue());
|
||||
}
|
||||
|
||||
void GNURadioGui::on_gnuradioDevices_currentIndexChanged(int index)
|
||||
void GNURadioGui::on_cboDevices_currentIndexChanged(int index)
|
||||
{
|
||||
if ( index < 0 || index >= m_devs.count() )
|
||||
return;
|
||||
|
||||
ui->deviceArguments->setText(m_devs[index].second);
|
||||
ui->txtDeviceArgs->setText( m_devs[index].second );
|
||||
}
|
||||
|
||||
void GNURadioGui::on_txtDeviceArgs_textChanged(const QString &arg1)
|
||||
{
|
||||
m_settings.m_args = arg1;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void GNURadioGui::on_centerFrequency_changed(quint64 value)
|
||||
|
@ -240,30 +311,32 @@ void GNURadioGui::on_centerFrequency_changed(quint64 value)
|
|||
|
||||
void GNURadioGui::on_sldFreqCorr_valueChanged(int value)
|
||||
{
|
||||
ui->lblFreqCorrValue->setText(tr("%1").arg(value));
|
||||
ui->lblFreqCorr->setText(tr("%1").arg(value));
|
||||
m_settings.m_freqCorr = value;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void GNURadioGui::on_sldRfGain_valueChanged(int value)
|
||||
void GNURadioGui::on_sldGain_valueChanged(int value)
|
||||
{
|
||||
if ( value >= m_rfGains.size() )
|
||||
return;
|
||||
m_settings.m_namedGains.clear();
|
||||
|
||||
double gain = m_rfGains[value];
|
||||
ui->lblRfGainValue->setText(tr("%1").arg(gain));
|
||||
m_settings.m_rfGain = gain;
|
||||
sendSettings();
|
||||
}
|
||||
for ( int i = 0; i < m_gainControls.size(); i++ )
|
||||
{
|
||||
QPair< QSlider*, QLabel* > controls = m_gainControls[i];
|
||||
|
||||
void GNURadioGui::on_sldIfGain_valueChanged(int value)
|
||||
{
|
||||
if ( value >= m_ifGains.size() )
|
||||
return;
|
||||
QSlider *slider = controls.first;
|
||||
QLabel *label = controls.second;
|
||||
|
||||
std::pair< QString, std::vector<double> > named_gain = m_namedGains[ i ];
|
||||
|
||||
int index = slider->value();
|
||||
double gain = named_gain.second[index];
|
||||
label->setText(tr("%1").arg(gain));
|
||||
|
||||
QPair< QString, double > named_gain2( named_gain.first, gain );
|
||||
m_settings.m_namedGains.push_back( named_gain2 );
|
||||
}
|
||||
|
||||
double gain = m_ifGains[value];
|
||||
ui->lblIfGainValue->setText(tr("%1").arg(gain));
|
||||
m_settings.m_ifGain = gain;
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
|
@ -272,13 +345,7 @@ void GNURadioGui::on_cboSampleRate_currentIndexChanged(int index)
|
|||
if ( index < 0 || index >= m_sampRates.size() )
|
||||
return;
|
||||
|
||||
m_settings.m_sampleRate = m_sampRates[index];
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void GNURadioGui::on_deviceArguments_textChanged(const QString &arg1)
|
||||
{
|
||||
m_settings.m_args = arg1;
|
||||
m_settings.m_sampRate = m_sampRates[index];
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,11 +23,13 @@
|
|||
#include <QPair>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QSlider>
|
||||
#include <QLabel>
|
||||
#include "plugin/plugingui.h"
|
||||
#include "gnuradioinput.h"
|
||||
|
||||
namespace Ui {
|
||||
class GNURadioGui;
|
||||
class GNURadioGui;
|
||||
}
|
||||
|
||||
class PluginAPI;
|
||||
|
@ -53,12 +55,19 @@ private:
|
|||
PluginAPI* m_pluginAPI;
|
||||
SampleSource* m_sampleSource;
|
||||
QList< QPair<QString, QString> > m_devs;
|
||||
std::vector<double> m_rfGains;
|
||||
std::vector<double> m_ifGains;
|
||||
std::vector< std::pair< QString, std::vector<double> > > m_namedGains;
|
||||
double m_freqMin;
|
||||
double m_freqMax;
|
||||
double m_freqCorr;
|
||||
std::vector<double> m_sampRates;
|
||||
std::vector<QString> m_antennas;
|
||||
std::vector<QString> m_iqbals;
|
||||
|
||||
std::vector< QSlider* > m_gainSliders;
|
||||
std::vector< QLabel* > m_gainLabels;
|
||||
|
||||
QList< QPair< QSlider*, QLabel* > > m_gainControls;
|
||||
|
||||
SampleSource::GeneralSettings m_generalSettings;
|
||||
GNURadioInput::Settings m_settings;
|
||||
QTimer m_updateTimer;
|
||||
|
@ -69,13 +78,14 @@ private:
|
|||
private slots:
|
||||
void updateHardware();
|
||||
|
||||
void on_gnuradioDevices_currentIndexChanged(int index);
|
||||
void on_cboDevices_currentIndexChanged(int index);
|
||||
void on_txtDeviceArgs_textChanged(const QString &arg1);
|
||||
void on_centerFrequency_changed(quint64 value);
|
||||
void on_sldFreqCorr_valueChanged(int value);
|
||||
void on_sldRfGain_valueChanged(int value);
|
||||
void on_sldIfGain_valueChanged(int value);
|
||||
|
||||
void on_sldGain_valueChanged(int value);
|
||||
|
||||
void on_cboSampleRate_currentIndexChanged(int index);
|
||||
void on_deviceArguments_textChanged(const QString &arg1);
|
||||
void on_cboAntennas_currentIndexChanged(const QString &arg1);
|
||||
void on_cboIQBalance_currentIndexChanged(const QString &arg1);
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>186</width>
|
||||
<height>268</height>
|
||||
<height>203</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
|
@ -43,7 +43,7 @@
|
|||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QComboBox" name="gnuradioDevices">
|
||||
<widget class="QComboBox" name="cboDevices">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
@ -62,7 +62,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="deviceArguments">
|
||||
<widget class="QLineEdit" name="txtDeviceArgs">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
@ -173,10 +173,10 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblFreqCorrValue">
|
||||
<widget class="QLabel" name="lblFreqCorr">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<width>30</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
|
@ -187,136 +187,14 @@
|
|||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblRfGainText">
|
||||
<property name="text">
|
||||
<string>RF Gain </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="sldRfGain">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::NoTicks</enum>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblRfGainValue">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblIfGain">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>IF Gain </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="sldIfGain">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblIfGainValue">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QVBoxLayout" name="verticalLayoutGains"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
|
@ -326,7 +204,10 @@
|
|||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Sample Rate</string>
|
||||
<string>Sample Rate (kHz)</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::AutoText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -339,13 +220,6 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<property name="spacing">
|
||||
|
@ -354,7 +228,7 @@
|
|||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Antenna</string>
|
||||
<string>Selected Antenna</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -363,13 +237,6 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<property name="spacing">
|
||||
|
@ -378,7 +245,7 @@
|
|||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>IQ Balance Corr.</string>
|
||||
<string>IQ Imbalance Corr.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <boost/foreach.hpp>
|
||||
#include "util/simpleserializer.h"
|
||||
#include "gnuradioinput.h"
|
||||
#include "gnuradiothread.h"
|
||||
|
@ -29,36 +28,30 @@ MessageRegistrator GNURadioInput::MsgReportGNURadio::ID("MsgReportGNURadio");
|
|||
|
||||
GNURadioInput::Settings::Settings() :
|
||||
m_args(""),
|
||||
m_sampleRate(2e6),
|
||||
m_freqCorr(0),
|
||||
m_rfGain(10),
|
||||
m_ifGain(15),
|
||||
m_sampRate(0),
|
||||
m_antenna(""),
|
||||
m_iqbal("Off")
|
||||
m_iqbal("")
|
||||
{
|
||||
}
|
||||
|
||||
void GNURadioInput::Settings::resetToDefaults()
|
||||
{
|
||||
m_args = "";
|
||||
m_sampleRate = 2e6;
|
||||
m_sampRate = 0;
|
||||
m_freqCorr = 0;
|
||||
m_rfGain = 10;
|
||||
m_ifGain = 15;
|
||||
m_antenna = "";
|
||||
m_iqbal = "Off";
|
||||
m_iqbal = "";
|
||||
}
|
||||
|
||||
QByteArray GNURadioInput::Settings::serialize() const
|
||||
{
|
||||
SimpleSerializer s(1);
|
||||
s.writeString(1, m_args);
|
||||
s.writeDouble(2, m_sampleRate);
|
||||
s.writeDouble(3, m_freqCorr);
|
||||
s.writeDouble(4, m_rfGain);
|
||||
s.writeDouble(5, m_ifGain);
|
||||
s.writeString(6, m_antenna);
|
||||
s.writeString(7, m_iqbal);
|
||||
// s.writeString(1, m_args);
|
||||
// s.writeDouble(2, m_freqCorr);
|
||||
// s.writeDouble(3, m_sampRate);
|
||||
// s.writeString(4, m_antenna);
|
||||
// s.writeString(5, m_iqbal);
|
||||
return s.final();
|
||||
}
|
||||
|
||||
|
@ -72,13 +65,11 @@ bool GNURadioInput::Settings::deserialize(const QByteArray& data)
|
|||
}
|
||||
|
||||
if(d.getVersion() == 1) {
|
||||
d.readString(1, &m_args, "");
|
||||
d.readDouble(2, &m_sampleRate, 2e6);
|
||||
d.readDouble(3, &m_freqCorr, 0);
|
||||
d.readDouble(4, &m_rfGain, 10);
|
||||
d.readDouble(5, &m_ifGain, 15);
|
||||
d.readString(6, &m_antenna, "");
|
||||
d.readString(7, &m_iqbal, "Off");
|
||||
// d.readString(1, &m_args, "");
|
||||
// d.readDouble(2, &m_freqCorr, 0);
|
||||
// d.readDouble(3, &m_sampRate, 0);
|
||||
// d.readString(4, &m_antenna, "");
|
||||
// d.readString(5, &m_iqbal, "");
|
||||
return true;
|
||||
} else {
|
||||
resetToDefaults();
|
||||
|
@ -101,12 +92,17 @@ GNURadioInput::~GNURadioInput()
|
|||
|
||||
bool GNURadioInput::startInput(int device)
|
||||
{
|
||||
double freqMin = 0, freqMax = 0, freqCorr = 0;
|
||||
std::vector< std::pair< QString, std::vector<double> > > namedGains;
|
||||
std::vector< double > sampRates;
|
||||
std::vector< QString > antennas;
|
||||
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
if(m_GnuradioThread != NULL)
|
||||
stopInput();
|
||||
|
||||
if(!m_sampleFifo.setSize(524288)) {
|
||||
if(!m_sampleFifo.setSize( 2 * 1024 * 1024 )) {
|
||||
qCritical("Could not allocate SampleFifo");
|
||||
return false;
|
||||
}
|
||||
|
@ -127,18 +123,38 @@ bool GNURadioInput::startInput(int device)
|
|||
if(m_GnuradioThread != NULL) {
|
||||
osmosdr_source_c_sptr radio = m_GnuradioThread->radio();
|
||||
|
||||
m_sampRates = radio->get_sample_rates().values();
|
||||
m_rfGains = radio->get_gain_range().values();
|
||||
osmosdr::freq_range_t freq_rage = radio->get_freq_range();
|
||||
freqMin = freq_rage.start();
|
||||
freqMax = freq_rage.stop();
|
||||
|
||||
/* we check that the gain stage is available, otherwise this will
|
||||
cause unexpected behavior when using ettus uhd based devices. */
|
||||
freqCorr = radio->get_freq_corr();
|
||||
|
||||
namedGains.clear();
|
||||
m_settings.m_namedGains.clear();
|
||||
std::vector< std::string > gain_names = radio->get_gain_names();
|
||||
if ( std::find( gain_names.begin(), gain_names.end(), "IF" ) != gain_names.end() )
|
||||
m_ifGains = radio->get_gain_range("IF").values();
|
||||
for ( int i = 0; i < gain_names.size(); i++ )
|
||||
{
|
||||
std::string gain_name = gain_names[i];
|
||||
|
||||
m_antennas.clear();
|
||||
BOOST_FOREACH( std::string antenna, radio->get_antennas() )
|
||||
m_antennas.push_back( QString( antenna.c_str() ) );
|
||||
std::vector< double > gain_values = \
|
||||
radio->get_gain_range( gain_name ).values();
|
||||
|
||||
std::pair< QString, std::vector<double> > pair( gain_name.c_str(),
|
||||
gain_values );
|
||||
|
||||
namedGains.push_back( pair );
|
||||
|
||||
QPair< QString, double > pair2( gain_name.c_str(), 0 );
|
||||
|
||||
m_settings.m_namedGains.push_back( pair2 );
|
||||
}
|
||||
|
||||
sampRates = radio->get_sample_rates().values();
|
||||
|
||||
antennas.clear();
|
||||
std::vector< std::string > ant = radio->get_antennas();
|
||||
for ( int i = 0; i < ant.size(); i++ )
|
||||
antennas.push_back( QString( ant[i].c_str() ) );
|
||||
|
||||
m_iqbals.clear();
|
||||
m_iqbals.push_back( "Off" );
|
||||
|
@ -147,7 +163,9 @@ bool GNURadioInput::startInput(int device)
|
|||
}
|
||||
|
||||
qDebug("GnuradioInput: start");
|
||||
MsgReportGNURadio::create(m_rfGains, m_ifGains, m_sampRates, m_antennas, m_iqbals)->submit(m_guiMessageQueue);
|
||||
MsgReportGNURadio::create(freqMin, freqMax, freqCorr, namedGains,
|
||||
sampRates, antennas, m_iqbals)
|
||||
->submit(m_guiMessageQueue);
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -176,7 +194,7 @@ const QString& GNURadioInput::getDeviceDescription() const
|
|||
|
||||
int GNURadioInput::getSampleRate() const
|
||||
{
|
||||
return m_settings.m_sampleRate;
|
||||
return m_settings.m_sampRate;
|
||||
}
|
||||
|
||||
quint64 GNURadioInput::getCenterFrequency() const
|
||||
|
@ -196,76 +214,62 @@ bool GNURadioInput::handleMessage(Message* message)
|
|||
}
|
||||
}
|
||||
|
||||
bool GNURadioInput::applySettings(const GeneralSettings& generalSettings, const Settings& settings, bool force)
|
||||
bool GNURadioInput::applySettings(const GeneralSettings& generalSettings,
|
||||
const Settings& settings,
|
||||
bool force)
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
m_settings.m_args = settings.m_args;
|
||||
|
||||
if ( NULL == m_GnuradioThread )
|
||||
return true;
|
||||
|
||||
osmosdr_source_c_sptr radio = m_GnuradioThread->radio();
|
||||
|
||||
try {
|
||||
|
||||
if((m_settings.m_freqCorr != settings.m_freqCorr) || force) {
|
||||
m_settings.m_freqCorr = settings.m_freqCorr;
|
||||
if(m_GnuradioThread != NULL) {
|
||||
m_GnuradioThread->radio()->set_freq_corr( m_settings.m_freqCorr );
|
||||
if((m_settings.m_freqCorr != settings.m_freqCorr) || force) {
|
||||
m_settings.m_freqCorr = settings.m_freqCorr;
|
||||
radio->set_freq_corr( m_settings.m_freqCorr );
|
||||
}
|
||||
}
|
||||
|
||||
if((m_generalSettings.m_centerFrequency != generalSettings.m_centerFrequency) || force) {
|
||||
m_generalSettings.m_centerFrequency = generalSettings.m_centerFrequency;
|
||||
if(m_GnuradioThread != NULL) {
|
||||
m_GnuradioThread->radio()->set_center_freq( m_generalSettings.m_centerFrequency );
|
||||
if((m_generalSettings.m_centerFrequency != generalSettings.m_centerFrequency) || force) {
|
||||
m_generalSettings.m_centerFrequency = generalSettings.m_centerFrequency;
|
||||
radio->set_center_freq( m_generalSettings.m_centerFrequency );
|
||||
}
|
||||
}
|
||||
|
||||
if((m_settings.m_rfGain != settings.m_rfGain) || force) {
|
||||
m_settings.m_rfGain = settings.m_rfGain;
|
||||
if(m_GnuradioThread != NULL) {
|
||||
m_GnuradioThread->radio()->set_gain( m_settings.m_rfGain );
|
||||
}
|
||||
}
|
||||
|
||||
if((m_settings.m_ifGain != settings.m_ifGain) || force) {
|
||||
m_settings.m_ifGain = settings.m_ifGain;
|
||||
if(m_GnuradioThread != NULL) {
|
||||
/* we check that the gain stage is available, otherwise this will
|
||||
cause unexpected behavior when using ettus uhd based devices. */
|
||||
std::vector< std::string > gain_names = m_GnuradioThread->radio()->get_gain_names();
|
||||
if ( std::find( gain_names.begin(), gain_names.end(), "IF" ) != gain_names.end() )
|
||||
m_GnuradioThread->radio()->set_gain( m_settings.m_ifGain, "IF" );
|
||||
}
|
||||
}
|
||||
|
||||
if((m_settings.m_sampleRate != settings.m_sampleRate) || force) {
|
||||
m_settings.m_sampleRate = settings.m_sampleRate;
|
||||
if(m_GnuradioThread != NULL) {
|
||||
m_GnuradioThread->radio()->set_sample_rate( m_settings.m_sampleRate );
|
||||
}
|
||||
}
|
||||
|
||||
if((m_settings.m_antenna != settings.m_antenna) || force) {
|
||||
m_settings.m_antenna = settings.m_antenna;
|
||||
if(m_GnuradioThread != NULL) {
|
||||
m_GnuradioThread->radio()->set_antenna( m_settings.m_antenna.toStdString() );
|
||||
}
|
||||
}
|
||||
|
||||
if((m_settings.m_iqbal != settings.m_iqbal) || force) {
|
||||
m_settings.m_iqbal = settings.m_iqbal;
|
||||
if(m_GnuradioThread != NULL) {
|
||||
int index = 0;
|
||||
BOOST_FOREACH( QString iqbal, m_iqbals )
|
||||
{
|
||||
if ( iqbal == m_settings.m_iqbal )
|
||||
{
|
||||
m_GnuradioThread->radio()->set_iq_balance_mode( index );
|
||||
break;
|
||||
}
|
||||
|
||||
index++;
|
||||
for ( int i = 0; i < settings.m_namedGains.size(); i++ )
|
||||
{
|
||||
if((m_settings.m_namedGains[i].second != settings.m_namedGains[i].second) || force) {
|
||||
m_settings.m_namedGains[i].second = settings.m_namedGains[i].second;
|
||||
radio->set_gain( settings.m_namedGains[i].second,
|
||||
settings.m_namedGains[i].first.toStdString() );
|
||||
}
|
||||
}
|
||||
|
||||
if((m_settings.m_sampRate != settings.m_sampRate) || force) {
|
||||
m_settings.m_sampRate = settings.m_sampRate;
|
||||
radio->set_sample_rate( m_settings.m_sampRate );
|
||||
}
|
||||
|
||||
if((m_settings.m_antenna != settings.m_antenna) || force) {
|
||||
m_settings.m_antenna = settings.m_antenna;
|
||||
radio->set_antenna( m_settings.m_antenna.toStdString() );
|
||||
}
|
||||
|
||||
if((m_settings.m_iqbal != settings.m_iqbal) || force) {
|
||||
m_settings.m_iqbal = settings.m_iqbal;
|
||||
|
||||
for ( int i = 0; i < m_iqbals.size(); i++ )
|
||||
{
|
||||
if ( m_iqbals[i] != m_settings.m_iqbal )
|
||||
continue;
|
||||
|
||||
radio->set_iq_balance_mode( i );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch ( std::exception &ex ) {
|
||||
qDebug(ex.what());
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "dsp/samplesource/samplesource.h"
|
||||
#include <QString>
|
||||
#include <QPair>
|
||||
|
||||
class GnuradioThread;
|
||||
|
||||
|
@ -28,10 +29,11 @@ class GNURadioInput : public SampleSource {
|
|||
public:
|
||||
struct Settings {
|
||||
QString m_args;
|
||||
double m_sampleRate;
|
||||
double m_freqMin;
|
||||
double m_freqMax;
|
||||
double m_freqCorr;
|
||||
double m_rfGain;
|
||||
double m_ifGain;
|
||||
QList< QPair< QString, double > > m_namedGains;
|
||||
double m_sampRate;
|
||||
QString m_antenna;
|
||||
QString m_iqbal;
|
||||
|
||||
|
@ -68,36 +70,46 @@ public:
|
|||
public:
|
||||
static MessageRegistrator ID;
|
||||
|
||||
const std::vector<double>& getRfGains() const { return m_rfGains; }
|
||||
const std::vector<double>& getIfGains() const { return m_ifGains; }
|
||||
const std::vector< std::pair< QString, std::vector<double> > >& getNamedGains() const { return m_namedGains; }
|
||||
const double getFreqMin() const { return m_freqMin; }
|
||||
const double getFreqMax() const { return m_freqMax; }
|
||||
const double getFreqCorr() const { return m_freqCorr; }
|
||||
const std::vector<double>& getSampRates() const { return m_sampRates; }
|
||||
const std::vector<QString>& getAntennas() const { return m_antennas; }
|
||||
const std::vector<QString>& getIQBals() const { return m_iqbals; }
|
||||
|
||||
static MsgReportGNURadio* create(const std::vector<double>& rfGains,
|
||||
const std::vector<double>& ifGains,
|
||||
static MsgReportGNURadio* create(const double freqMin,
|
||||
const double freqMax,
|
||||
const double freqCorr,
|
||||
const std::vector< std::pair< QString, std::vector<double> > >& namedGains,
|
||||
const std::vector<double>& sampRates,
|
||||
const std::vector<QString>& antennas,
|
||||
const std::vector<QString>& iqbals)
|
||||
{
|
||||
return new MsgReportGNURadio(rfGains, ifGains, sampRates, antennas, iqbals);
|
||||
return new MsgReportGNURadio(freqMin, freqMax, freqCorr, namedGains, sampRates, antennas, iqbals);
|
||||
}
|
||||
|
||||
protected:
|
||||
std::vector<double> m_rfGains;
|
||||
std::vector<double> m_ifGains;
|
||||
double m_freqMin;
|
||||
double m_freqMax;
|
||||
double m_freqCorr;
|
||||
std::vector< std::pair< QString, std::vector<double> > > m_namedGains;
|
||||
std::vector<double> m_sampRates;
|
||||
std::vector<QString> m_antennas;
|
||||
std::vector<QString> m_iqbals;
|
||||
|
||||
MsgReportGNURadio(const std::vector<double>& rfGains,
|
||||
const std::vector<double>& ifGains,
|
||||
MsgReportGNURadio(const double freqMin,
|
||||
const double freqMax,
|
||||
const double freqCorr,
|
||||
const std::vector< std::pair< QString, std::vector<double> > >& namedGains,
|
||||
const std::vector<double>& sampRates,
|
||||
const std::vector<QString>& antennas,
|
||||
const std::vector<QString>& iqbals) :
|
||||
Message(ID()),
|
||||
m_rfGains(rfGains),
|
||||
m_ifGains(ifGains),
|
||||
m_freqMin(freqMin),
|
||||
m_freqMax(freqMax),
|
||||
m_freqCorr(freqCorr),
|
||||
m_namedGains(namedGains),
|
||||
m_sampRates(sampRates),
|
||||
m_antennas(antennas),
|
||||
m_iqbals(iqbals)
|
||||
|
@ -121,71 +133,11 @@ private:
|
|||
Settings m_settings;
|
||||
GnuradioThread* m_GnuradioThread;
|
||||
QString m_deviceDescription;
|
||||
std::vector<double> m_rfGains;
|
||||
std::vector<double> m_ifGains;
|
||||
std::vector<double> m_sampRates;
|
||||
std::vector<QString> m_antennas;
|
||||
std::vector<QString> m_iqbals;
|
||||
std::vector< QString > m_iqbals;
|
||||
|
||||
bool applySettings(const GeneralSettings& generalSettings, const Settings& settings, bool force);
|
||||
bool applySettings(const GeneralSettings& generalSettings,
|
||||
const Settings& settings,
|
||||
bool force);
|
||||
};
|
||||
#if 0
|
||||
class DSPCmdConfigureSourceGnuradio : public DSPCmdGUIToSource {
|
||||
public:
|
||||
enum {
|
||||
SourceType = 3
|
||||
};
|
||||
|
||||
int sourceType() const;
|
||||
const GnuradioInput::Settings& getSettings() const { return m_settings; }
|
||||
|
||||
static DSPCmdConfigureSourceGnuradio* create(const GnuradioInput::Settings& settings)
|
||||
{
|
||||
return new DSPCmdConfigureSourceGnuradio(settings);
|
||||
}
|
||||
|
||||
protected:
|
||||
GnuradioInput::Settings m_settings;
|
||||
|
||||
DSPCmdConfigureSourceGnuradio(const GnuradioInput::Settings& settings) : m_settings(settings) { }
|
||||
};
|
||||
#endif
|
||||
#if 0
|
||||
class DSPCmdGUIInfoGnuradio : public DSPCmdSourceToGUI {
|
||||
public:
|
||||
enum {
|
||||
SourceType = 3
|
||||
};
|
||||
|
||||
int sourceType() const;
|
||||
const std::vector<double>& getRfGains() const { return m_rfGains; }
|
||||
const std::vector<double>& getIfGains() const { return m_ifGains; }
|
||||
const std::vector<double>& getSampRates() const { return m_sampRates; }
|
||||
const std::vector<QString>& getAntennas() const { return m_antennas; }
|
||||
|
||||
static DSPCmdGUIInfoGnuradio* create(const std::vector<double>& rfGains,
|
||||
const std::vector<double>& ifGains,
|
||||
const std::vector<double>& sampRates,
|
||||
const std::vector<QString>& antennas)
|
||||
{
|
||||
return new DSPCmdGUIInfoGnuradio(rfGains, ifGains, sampRates, antennas);
|
||||
}
|
||||
|
||||
protected:
|
||||
std::vector<double> m_rfGains;
|
||||
std::vector<double> m_ifGains;
|
||||
std::vector<double> m_sampRates;
|
||||
std::vector<QString> m_antennas;
|
||||
|
||||
DSPCmdGUIInfoGnuradio(const std::vector<double>& rfGains,
|
||||
const std::vector<double>& ifGains,
|
||||
const std::vector<double>& sampRates,
|
||||
const std::vector<QString>& antennas) :
|
||||
m_rfGains(rfGains),
|
||||
m_ifGains(ifGains),
|
||||
m_sampRates(sampRates),
|
||||
m_antennas(antennas)
|
||||
{ }
|
||||
};
|
||||
#endif
|
||||
#endif // INCLUDE_GNURADIOINPUT_H
|
||||
|
|
|
@ -27,35 +27,35 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
class gr_adaptor;
|
||||
|
||||
typedef boost::shared_ptr<gr_adaptor> gr_adaptor_sptr;
|
||||
typedef boost::shared_ptr< gr_adaptor > gr_adaptor_sptr;
|
||||
|
||||
gr_adaptor_sptr make_gr_adaptor (SampleFifo* sampleFifo);
|
||||
|
||||
class gr_adaptor : public gr_sync_block
|
||||
{
|
||||
public:
|
||||
gr_adaptor (SampleFifo* sampleFifo);
|
||||
~gr_adaptor ();
|
||||
gr_adaptor (SampleFifo* sampleFifo);
|
||||
~gr_adaptor ();
|
||||
|
||||
int work (int noutput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
int work (int noutput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items);
|
||||
|
||||
private:
|
||||
SampleFifo *m_sampleFifo;
|
||||
SampleFifo *m_sampleFifo;
|
||||
};
|
||||
|
||||
gr_adaptor_sptr
|
||||
make_gr_adaptor (SampleFifo *sampleFifo)
|
||||
{
|
||||
return gr_adaptor_sptr (new gr_adaptor (sampleFifo));
|
||||
return gr_adaptor_sptr (new gr_adaptor (sampleFifo));
|
||||
}
|
||||
|
||||
gr_adaptor::gr_adaptor (SampleFifo *sampleFifo)
|
||||
: gr_sync_block ("gr_adaptor",
|
||||
gr_make_io_signature (1, 1, sizeof (gr_complex)),
|
||||
gr_make_io_signature (0, 0, 0)),
|
||||
m_sampleFifo(sampleFifo)
|
||||
: gr_sync_block ("gr_adaptor",
|
||||
gr_make_io_signature (1, 1, sizeof (gr_complex)),
|
||||
gr_make_io_signature (0, 0, 0)),
|
||||
m_sampleFifo(sampleFifo)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -65,11 +65,10 @@ gr_adaptor::~gr_adaptor ()
|
|||
|
||||
int
|
||||
gr_adaptor::work (int noutput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
const gr_complex *in = (const gr_complex *) input_items[0];
|
||||
unsigned char *out = (unsigned char *) output_items[0];
|
||||
|
||||
std::vector<qint16> buffer(noutput_items * 2, 0);
|
||||
std::vector<qint16>::iterator it = buffer.begin();
|
||||
|
|
|
@ -32,13 +32,13 @@ class GnuradioThread : public QThread {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GnuradioThread(QString args, SampleFifo* sampleFifo, QObject* parent = NULL);
|
||||
~GnuradioThread();
|
||||
GnuradioThread(QString args, SampleFifo* sampleFifo, QObject* parent = NULL);
|
||||
~GnuradioThread();
|
||||
|
||||
void startWork();
|
||||
void stopWork();
|
||||
|
||||
osmosdr_source_c_sptr radio() { return m_src; }
|
||||
osmosdr_source_c_sptr radio() { return m_src; }
|
||||
|
||||
private:
|
||||
#pragma pack(push, 1)
|
||||
|
|
Loading…
Reference in New Issue