mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-07 08:24:43 -04:00
Multi device support: moved DSPDeviceEngine start/stop actions and status from main window to each source plugin GUI
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QDebug>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <libairspy/airspy.h>
|
||||
|
||||
#include "airspygui.h"
|
||||
@@ -28,12 +30,17 @@ AirspyGui::AirspyGui(PluginAPI* pluginAPI, QWidget* parent) :
|
||||
ui(new Ui::AirspyGui),
|
||||
m_pluginAPI(pluginAPI),
|
||||
m_settings(),
|
||||
m_sampleSource(0)
|
||||
m_sampleSource(0),
|
||||
m_lastEngineState((DSPDeviceEngine::State)-1)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
|
||||
ui->centerFrequency->setValueRange(7, 24000U, 1900000U);
|
||||
|
||||
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
|
||||
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
|
||||
m_statusTimer.start(500);
|
||||
|
||||
displaySettings();
|
||||
|
||||
m_sampleSource = new AirspyInput();
|
||||
@@ -294,6 +301,23 @@ void AirspyGui::on_vga_valueChanged(int value)
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
void AirspyGui::on_startStop_toggled(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
if (m_pluginAPI->initAcquisition())
|
||||
{
|
||||
m_pluginAPI->startAcquisition();
|
||||
DSPEngine::instance()->startAudio();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pluginAPI->stopAcquistion();
|
||||
DSPEngine::instance()->stopAudio();
|
||||
}
|
||||
}
|
||||
|
||||
void AirspyGui::updateHardware()
|
||||
{
|
||||
qDebug() << "AirspyGui::updateHardware";
|
||||
@@ -302,6 +326,35 @@ void AirspyGui::updateHardware()
|
||||
m_updateTimer.stop();
|
||||
}
|
||||
|
||||
void AirspyGui::updateStatus()
|
||||
{
|
||||
int state = m_pluginAPI->state();
|
||||
|
||||
if(m_lastEngineState != state)
|
||||
{
|
||||
switch(state)
|
||||
{
|
||||
case DSPDeviceEngine::StNotStarted:
|
||||
ui->startStop->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
|
||||
break;
|
||||
case DSPDeviceEngine::StIdle:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : cyan; }");
|
||||
break;
|
||||
case DSPDeviceEngine::StRunning:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : green; }");
|
||||
break;
|
||||
case DSPDeviceEngine::StError:
|
||||
ui->startStop->setStyleSheet("QToolButton { background-color : red; }");
|
||||
QMessageBox::information(this, tr("Message"), m_pluginAPI->errorMessage());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
m_lastEngineState = state;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t AirspyGui::getDevSampleRate(unsigned int rate_index)
|
||||
{
|
||||
if (rate_index < m_rates.size())
|
||||
|
||||
@@ -57,8 +57,10 @@ private:
|
||||
PluginAPI* m_pluginAPI;
|
||||
AirspySettings m_settings;
|
||||
QTimer m_updateTimer;
|
||||
QTimer m_statusTimer;
|
||||
std::vector<uint32_t> m_rates;
|
||||
SampleSource* m_sampleSource;
|
||||
int m_lastEngineState;
|
||||
|
||||
void displaySettings();
|
||||
void displaySampleRates();
|
||||
@@ -78,7 +80,9 @@ private slots:
|
||||
void on_vga_valueChanged(int value);
|
||||
void on_lnaAGC_stateChanged(int state);
|
||||
void on_mixAGC_stateChanged(int state);
|
||||
void on_startStop_toggled(bool checked);
|
||||
void updateHardware();
|
||||
void updateStatus();
|
||||
void handleSourceMessages();
|
||||
};
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_freq">
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="startStopButton">
|
||||
<widget class="ButtonSwitch" name="startStop">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
|
||||
Reference in New Issue
Block a user