mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-09-04 22:27:53 -04:00
Multi device support: Aligned Funcube Pro+ plugin
This commit is contained in:
parent
25197faa7a
commit
7159004bbe
@ -20,7 +20,10 @@
|
|||||||
#include "ui_fcdproplusgui.h"
|
#include "ui_fcdproplusgui.h"
|
||||||
#include "plugin/pluginapi.h"
|
#include "plugin/pluginapi.h"
|
||||||
#include "gui/colormapper.h"
|
#include "gui/colormapper.h"
|
||||||
|
#include "gui/glspectrum.h"
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
|
#include "dsp/dspcommands.h"
|
||||||
|
#include "dsp/filesink.h"
|
||||||
#include "fcdproplusgui.h"
|
#include "fcdproplusgui.h"
|
||||||
#include "fcdproplusconst.h"
|
#include "fcdproplusconst.h"
|
||||||
|
|
||||||
@ -57,10 +60,19 @@ FCDProPlusGui::FCDProPlusGui(PluginAPI* pluginAPI, QWidget* parent) :
|
|||||||
|
|
||||||
m_sampleSource = new FCDProPlusInput();
|
m_sampleSource = new FCDProPlusInput();
|
||||||
DSPEngine::instance()->setSource(m_sampleSource);
|
DSPEngine::instance()->setSource(m_sampleSource);
|
||||||
|
|
||||||
|
char recFileNameCStr[30];
|
||||||
|
sprintf(recFileNameCStr, "test_%d.sdriq", m_pluginAPI->getDeviceUID());
|
||||||
|
m_fileSink = new FileSink(std::string(recFileNameCStr));
|
||||||
|
m_pluginAPI->addSink(m_fileSink);
|
||||||
|
|
||||||
|
connect(m_pluginAPI->getDeviceOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
FCDProPlusGui::~FCDProPlusGui()
|
FCDProPlusGui::~FCDProPlusGui()
|
||||||
{
|
{
|
||||||
|
m_pluginAPI->removeSink(m_fileSink);
|
||||||
|
delete m_fileSink;
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,6 +135,35 @@ bool FCDProPlusGui::handleMessage(const Message& message)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FCDProPlusGui::handleDSPMessages()
|
||||||
|
{
|
||||||
|
Message* message;
|
||||||
|
|
||||||
|
while ((message = m_pluginAPI->getDeviceOutputMessageQueue()->pop()) != 0)
|
||||||
|
{
|
||||||
|
qDebug("RTLSDRGui::handleDSPMessages: message: %s", message->getIdentifier());
|
||||||
|
|
||||||
|
if (DSPSignalNotification::match(*message))
|
||||||
|
{
|
||||||
|
DSPSignalNotification* notif = (DSPSignalNotification*) message;
|
||||||
|
m_sampleRate = notif->getSampleRate();
|
||||||
|
m_deviceCenterFrequency = notif->getCenterFrequency();
|
||||||
|
qDebug("RTLSDRGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
|
||||||
|
updateSampleRateAndFrequency();
|
||||||
|
m_fileSink->handleMessage(*notif); // forward to file sink
|
||||||
|
|
||||||
|
delete message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FCDProPlusGui::updateSampleRateAndFrequency()
|
||||||
|
{
|
||||||
|
m_pluginAPI->getSpectrum()->setSampleRate(m_sampleRate);
|
||||||
|
m_pluginAPI->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
|
||||||
|
ui->deviceRateText->setText(tr("%1k").arg((float)m_sampleRate / 1000));
|
||||||
|
}
|
||||||
|
|
||||||
void FCDProPlusGui::displaySettings()
|
void FCDProPlusGui::displaySettings()
|
||||||
{
|
{
|
||||||
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
||||||
@ -260,4 +301,16 @@ void FCDProPlusGui::on_startStop_toggled(bool checked)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FCDProPlusGui::on_record_toggled(bool checked)
|
||||||
|
{
|
||||||
|
if (checked)
|
||||||
|
{
|
||||||
|
ui->record->setStyleSheet("QToolButton { background-color : red; }");
|
||||||
|
m_fileSink->startRecording();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->record->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||||
|
m_fileSink->stopRecording();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,13 +1,3 @@
|
|||||||
#ifndef INCLUDE_FCDGUI_H
|
|
||||||
#define INCLUDE_FCDGUI_H
|
|
||||||
|
|
||||||
#include <QTimer>
|
|
||||||
|
|
||||||
#include "fcdproplusinput.h"
|
|
||||||
#include "plugin/plugingui.h"
|
|
||||||
|
|
||||||
class PluginAPI;
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
// Copyright (C) 2015 Edouard Griffiths, F4EXB //
|
// Copyright (C) 2015 Edouard Griffiths, F4EXB //
|
||||||
// //
|
// //
|
||||||
@ -24,6 +14,17 @@ class PluginAPI;
|
|||||||
// 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_FCDGUI_H
|
||||||
|
#define INCLUDE_FCDGUI_H
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
#include "fcdproplusinput.h"
|
||||||
|
#include "plugin/plugingui.h"
|
||||||
|
|
||||||
|
class PluginAPI;
|
||||||
|
class FileSink;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class FCDProPlusGui;
|
class FCDProPlusGui;
|
||||||
}
|
}
|
||||||
@ -56,12 +57,17 @@ private:
|
|||||||
QTimer m_statusTimer;
|
QTimer m_statusTimer;
|
||||||
std::vector<int> m_gains;
|
std::vector<int> m_gains;
|
||||||
SampleSource* m_sampleSource;
|
SampleSource* m_sampleSource;
|
||||||
|
FileSink *m_fileSink; //!< File sink to record device I/Q output
|
||||||
|
int m_sampleRate;
|
||||||
|
quint64 m_deviceCenterFrequency; //!< Center frequency in device
|
||||||
int m_lastEngineState;
|
int m_lastEngineState;
|
||||||
|
|
||||||
void displaySettings();
|
void displaySettings();
|
||||||
void sendSettings();
|
void sendSettings();
|
||||||
|
void updateSampleRateAndFrequency();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void handleDSPMessages();
|
||||||
void on_centerFrequency_changed(quint64 value);
|
void on_centerFrequency_changed(quint64 value);
|
||||||
void on_dcOffset_toggled(bool checked);
|
void on_dcOffset_toggled(bool checked);
|
||||||
void on_iqImbalance_toggled(bool checked);
|
void on_iqImbalance_toggled(bool checked);
|
||||||
@ -73,6 +79,7 @@ private slots:
|
|||||||
void on_filterIF_currentIndexChanged(int index);
|
void on_filterIF_currentIndexChanged(int index);
|
||||||
void on_ppm_valueChanged(int value);
|
void on_ppm_valueChanged(int value);
|
||||||
void on_startStop_toggled(bool checked);
|
void on_startStop_toggled(bool checked);
|
||||||
|
void on_record_toggled(bool checked);
|
||||||
void updateHardware();
|
void updateHardware();
|
||||||
void updateStatus();
|
void updateStatus();
|
||||||
};
|
};
|
||||||
|
@ -33,21 +33,60 @@
|
|||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="frequencyLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="ButtonSwitch" name="startStop">
|
<layout class="QVBoxLayout" name="deviceUILayout">
|
||||||
<property name="toolTip">
|
<item>
|
||||||
<string>start/stop acquisition</string>
|
<layout class="QHBoxLayout" name="deviceButtonsLayout">
|
||||||
</property>
|
<item>
|
||||||
<property name="text">
|
<widget class="ButtonSwitch" name="startStop">
|
||||||
<string/>
|
<property name="toolTip">
|
||||||
</property>
|
<string>start/stop acquisition</string>
|
||||||
<property name="icon">
|
</property>
|
||||||
<iconset resource="../../../sdrbase/resources/res.qrc">
|
<property name="text">
|
||||||
<normaloff>:/play.png</normaloff>
|
<string/>
|
||||||
<normalon>:/stop.png</normalon>:/play.png</iconset>
|
</property>
|
||||||
</property>
|
<property name="icon">
|
||||||
</widget>
|
<iconset resource="../../../sdrbase/resources/res.qrc">
|
||||||
|
<normaloff>:/play.png</normaloff>
|
||||||
|
<normalon>:/stop.png</normalon>:/play.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="ButtonSwitch" name="record">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Toggle record I/Q samples from device</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../sdrbase/resources/res.qrc">
|
||||||
|
<normaloff>:/record_off.png</normaloff>:/record_off.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="deviceRateLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="deviceRateText">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>I/Q sample rate kS/s</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>00000k</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user