mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-08-02 14:02:27 -04:00
Multi device support: Aligned Airspy plugin
This commit is contained in:
parent
8885f9bcdd
commit
deee1ada34
@ -23,7 +23,10 @@
|
|||||||
#include "ui_airspygui.h"
|
#include "ui_airspygui.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"
|
||||||
|
|
||||||
AirspyGui::AirspyGui(PluginAPI* pluginAPI, QWidget* parent) :
|
AirspyGui::AirspyGui(PluginAPI* pluginAPI, QWidget* parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
@ -48,10 +51,19 @@ AirspyGui::AirspyGui(PluginAPI* pluginAPI, QWidget* parent) :
|
|||||||
displaySampleRates();
|
displaySampleRates();
|
||||||
connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
AirspyGui::~AirspyGui()
|
AirspyGui::~AirspyGui()
|
||||||
{
|
{
|
||||||
|
m_pluginAPI->removeSink(m_fileSink);
|
||||||
|
delete m_fileSink;
|
||||||
delete m_sampleSource; // Valgrind memcheck
|
delete m_sampleSource; // Valgrind memcheck
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
@ -122,6 +134,28 @@ bool AirspyGui::handleMessage(const Message& message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AirspyGui::handleDSPMessages()
|
||||||
|
{
|
||||||
|
Message* message;
|
||||||
|
|
||||||
|
while ((message = m_pluginAPI->getDeviceOutputMessageQueue()->pop()) != 0)
|
||||||
|
{
|
||||||
|
qDebug("AirspyGui::handleDSPMessages: message: %s", message->getIdentifier());
|
||||||
|
|
||||||
|
if (DSPSignalNotification::match(*message))
|
||||||
|
{
|
||||||
|
DSPSignalNotification* notif = (DSPSignalNotification*) message;
|
||||||
|
m_sampleRate = notif->getSampleRate();
|
||||||
|
m_deviceCenterFrequency = notif->getCenterFrequency();
|
||||||
|
qDebug("AirspyGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
|
||||||
|
updateSampleRateAndFrequency();
|
||||||
|
m_fileSink->handleMessage(*notif); // forward to file sink
|
||||||
|
|
||||||
|
delete message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AirspyGui::handleSourceMessages()
|
void AirspyGui::handleSourceMessages()
|
||||||
{
|
{
|
||||||
Message* message;
|
Message* message;
|
||||||
@ -137,6 +171,13 @@ void AirspyGui::handleSourceMessages()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AirspyGui::updateSampleRateAndFrequency()
|
||||||
|
{
|
||||||
|
m_pluginAPI->getSpectrum()->setSampleRate(m_sampleRate);
|
||||||
|
m_pluginAPI->getSpectrum()->setCenterFrequency(m_deviceCenterFrequency);
|
||||||
|
ui->deviceRateText->setText(tr("%1k").arg((float)m_sampleRate / 1000));
|
||||||
|
}
|
||||||
|
|
||||||
void AirspyGui::displaySettings()
|
void AirspyGui::displaySettings()
|
||||||
{
|
{
|
||||||
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
|
||||||
@ -318,6 +359,20 @@ void AirspyGui::on_startStop_toggled(bool checked)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AirspyGui::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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AirspyGui::updateHardware()
|
void AirspyGui::updateHardware()
|
||||||
{
|
{
|
||||||
qDebug() << "AirspyGui::updateHardware";
|
qDebug() << "AirspyGui::updateHardware";
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#define AIRSPY_MAX_DEVICE (32)
|
#define AIRSPY_MAX_DEVICE (32)
|
||||||
|
|
||||||
class PluginAPI;
|
class PluginAPI;
|
||||||
|
class FileSink;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AirspyGui;
|
class AirspyGui;
|
||||||
@ -60,13 +61,18 @@ private:
|
|||||||
QTimer m_statusTimer;
|
QTimer m_statusTimer;
|
||||||
std::vector<uint32_t> m_rates;
|
std::vector<uint32_t> m_rates;
|
||||||
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 displaySampleRates();
|
void displaySampleRates();
|
||||||
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_LOppm_valueChanged(int value);
|
void on_LOppm_valueChanged(int value);
|
||||||
void on_dcOffset_toggled(bool checked);
|
void on_dcOffset_toggled(bool checked);
|
||||||
@ -81,6 +87,7 @@ private slots:
|
|||||||
void on_lnaAGC_stateChanged(int state);
|
void on_lnaAGC_stateChanged(int state);
|
||||||
void on_mixAGC_stateChanged(int state);
|
void on_mixAGC_stateChanged(int state);
|
||||||
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();
|
||||||
void handleSourceMessages();
|
void handleSourceMessages();
|
||||||
|
@ -35,19 +35,58 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_freq">
|
<layout class="QHBoxLayout" name="horizontalLayout_freq">
|
||||||
<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="freqLeftSpacer">
|
<spacer name="freqLeftSpacer">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user