1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-05-29 13:32:26 -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:
f4exb 2016-05-11 23:35:16 +02:00
parent 7992f3f428
commit ecd05096ad
31 changed files with 649 additions and 78 deletions

View File

@ -15,6 +15,8 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include <QDebug> #include <QDebug>
#include <QMessageBox>
#include <libairspy/airspy.h> #include <libairspy/airspy.h>
#include "airspygui.h" #include "airspygui.h"
@ -28,12 +30,17 @@ AirspyGui::AirspyGui(PluginAPI* pluginAPI, QWidget* parent) :
ui(new Ui::AirspyGui), ui(new Ui::AirspyGui),
m_pluginAPI(pluginAPI), m_pluginAPI(pluginAPI),
m_settings(), m_settings(),
m_sampleSource(0) m_sampleSource(0),
m_lastEngineState((DSPDeviceEngine::State)-1)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold)); ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
ui->centerFrequency->setValueRange(7, 24000U, 1900000U); ui->centerFrequency->setValueRange(7, 24000U, 1900000U);
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware())); connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
m_statusTimer.start(500);
displaySettings(); displaySettings();
m_sampleSource = new AirspyInput(); m_sampleSource = new AirspyInput();
@ -294,6 +301,23 @@ void AirspyGui::on_vga_valueChanged(int value)
sendSettings(); 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() void AirspyGui::updateHardware()
{ {
qDebug() << "AirspyGui::updateHardware"; qDebug() << "AirspyGui::updateHardware";
@ -302,6 +326,35 @@ void AirspyGui::updateHardware()
m_updateTimer.stop(); 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) uint32_t AirspyGui::getDevSampleRate(unsigned int rate_index)
{ {
if (rate_index < m_rates.size()) if (rate_index < m_rates.size())

View File

@ -57,8 +57,10 @@ private:
PluginAPI* m_pluginAPI; PluginAPI* m_pluginAPI;
AirspySettings m_settings; AirspySettings m_settings;
QTimer m_updateTimer; QTimer m_updateTimer;
QTimer m_statusTimer;
std::vector<uint32_t> m_rates; std::vector<uint32_t> m_rates;
SampleSource* m_sampleSource; SampleSource* m_sampleSource;
int m_lastEngineState;
void displaySettings(); void displaySettings();
void displaySampleRates(); void displaySampleRates();
@ -78,7 +80,9 @@ private slots:
void on_vga_valueChanged(int value); void on_vga_valueChanged(int value);
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 updateHardware(); void updateHardware();
void updateStatus();
void handleSourceMessages(); void handleSourceMessages();
}; };

View File

@ -35,7 +35,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_freq"> <layout class="QHBoxLayout" name="horizontalLayout_freq">
<item> <item>
<widget class="ButtonSwitch" name="startStopButton"> <widget class="ButtonSwitch" name="startStop">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>

View File

@ -15,6 +15,8 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include <QDebug> #include <QDebug>
#include <QMessageBox>
#include <libbladeRF.h> #include <libbladeRF.h>
#include "ui_bladerfgui.h" #include "ui_bladerfgui.h"
@ -28,7 +30,8 @@ BladerfGui::BladerfGui(PluginAPI* pluginAPI, QWidget* parent) :
ui(new Ui::BladerfGui), ui(new Ui::BladerfGui),
m_pluginAPI(pluginAPI), m_pluginAPI(pluginAPI),
m_settings(), m_settings(),
m_sampleSource(NULL) m_sampleSource(NULL),
m_lastEngineState((DSPDeviceEngine::State)-1)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold)); ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
@ -47,6 +50,9 @@ BladerfGui::BladerfGui(PluginAPI* pluginAPI, QWidget* parent) :
} }
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware())); connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
m_statusTimer.start(500);
displaySettings(); displaySettings();
m_sampleSource = new BladerfInput(); m_sampleSource = new BladerfInput();
@ -302,6 +308,23 @@ void BladerfGui::on_xb200_currentIndexChanged(int index)
sendSettings(); sendSettings();
} }
void BladerfGui::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 BladerfGui::updateHardware() void BladerfGui::updateHardware()
{ {
qDebug() << "BladerfGui::updateHardware"; qDebug() << "BladerfGui::updateHardware";
@ -310,6 +333,35 @@ void BladerfGui::updateHardware()
m_updateTimer.stop(); m_updateTimer.stop();
} }
void BladerfGui::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 : blue; }");
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;
}
}
unsigned int BladerfGui::getXb200Index(bool xb_200, bladerf_xb200_path xb200Path, bladerf_xb200_filter xb200Filter) unsigned int BladerfGui::getXb200Index(bool xb_200, bladerf_xb200_path xb200Path, bladerf_xb200_filter xb200Filter)
{ {
if (xb_200) if (xb_200)

View File

@ -53,8 +53,10 @@ private:
PluginAPI* m_pluginAPI; PluginAPI* m_pluginAPI;
BladeRFSettings m_settings; BladeRFSettings m_settings;
QTimer m_updateTimer; QTimer m_updateTimer;
QTimer m_statusTimer;
std::vector<int> m_gains; std::vector<int> m_gains;
SampleSource* m_sampleSource; SampleSource* m_sampleSource;
int m_lastEngineState;
void displaySettings(); void displaySettings();
void sendSettings(); void sendSettings();
@ -72,7 +74,9 @@ private slots:
void on_vga2_valueChanged(int value); void on_vga2_valueChanged(int value);
void on_xb200_currentIndexChanged(int index); void on_xb200_currentIndexChanged(int index);
void on_fcPos_currentIndexChanged(int index); void on_fcPos_currentIndexChanged(int index);
void on_startStop_toggled(bool checked);
void updateHardware(); void updateHardware();
void updateStatus();
}; };
class BladerfSampleRates { class BladerfSampleRates {

View File

@ -35,7 +35,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_freq"> <layout class="QHBoxLayout" name="horizontalLayout_freq">
<item> <item>
<widget class="ButtonSwitch" name="startStopButton"> <widget class="ButtonSwitch" name="startStop">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>

View File

@ -1,3 +1,21 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2015 Edouard Griffiths, F4EXB //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include <QMessageBox>
#include "ui_fcdprogui.h" #include "ui_fcdprogui.h"
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
#include "gui/colormapper.h" #include "gui/colormapper.h"
@ -10,7 +28,8 @@ FCDProGui::FCDProGui(PluginAPI* pluginAPI, QWidget* parent) :
ui(new Ui::FCDProGui), ui(new Ui::FCDProGui),
m_pluginAPI(pluginAPI), m_pluginAPI(pluginAPI),
m_settings(), m_settings(),
m_sampleSource(NULL) m_sampleSource(NULL),
m_lastEngineState((DSPDeviceEngine::State)-1)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold)); ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
@ -113,6 +132,9 @@ FCDProGui::FCDProGui(PluginAPI* pluginAPI, QWidget* parent) :
} }
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware())); connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
m_statusTimer.start(500);
displaySettings(); displaySettings();
m_sampleSource = new FCDProInput(); m_sampleSource = new FCDProInput();
@ -357,6 +379,52 @@ void FCDProGui::on_setDefaults_clicked(bool checked)
sendSettings(); sendSettings();
} }
void FCDProGui::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 FCDProGui::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;
}
}
void FCDProGui::updateHardware() void FCDProGui::updateHardware()
{ {
FCDProInput::MsgConfigureFCD* message = FCDProInput::MsgConfigureFCD::create(m_settings); FCDProInput::MsgConfigureFCD* message = FCDProInput::MsgConfigureFCD::create(m_settings);

View File

@ -1,3 +1,19 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2015 Edouard Griffiths, F4EXB //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDE_FCDPROGUI_H #ifndef INCLUDE_FCDPROGUI_H
#define INCLUDE_FCDPROGUI_H #define INCLUDE_FCDPROGUI_H
@ -37,8 +53,10 @@ private:
PluginAPI* m_pluginAPI; PluginAPI* m_pluginAPI;
FCDProSettings m_settings; FCDProSettings m_settings;
QTimer m_updateTimer; QTimer m_updateTimer;
QTimer m_statusTimer;
std::vector<int> m_gains; std::vector<int> m_gains;
SampleSource* m_sampleSource; SampleSource* m_sampleSource;
int m_lastEngineState;
void displaySettings(); void displaySettings();
void sendSettings(); void sendSettings();
@ -66,7 +84,9 @@ private slots:
void on_gain5_currentIndexChanged(int index); void on_gain5_currentIndexChanged(int index);
void on_gain6_currentIndexChanged(int index); void on_gain6_currentIndexChanged(int index);
void on_setDefaults_clicked(bool checked); void on_setDefaults_clicked(bool checked);
void on_startStop_toggled(bool checked);
void updateHardware(); void updateHardware();
void updateStatus();
}; };
#endif // INCLUDE_FCDPROGUI_H #endif // INCLUDE_FCDPROGUI_H

View File

@ -35,7 +35,7 @@
<item> <item>
<layout class="QHBoxLayout" name="layoutFrequency"> <layout class="QHBoxLayout" name="layoutFrequency">
<item> <item>
<widget class="ButtonSwitch" name="startStopButton"> <widget class="ButtonSwitch" name="startStop">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>

View File

@ -1,4 +1,22 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2015 Edouard Griffiths, F4EXB //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include <QDebug> #include <QDebug>
#include <QMessageBox>
#include "ui_fcdproplusgui.h" #include "ui_fcdproplusgui.h"
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
#include "gui/colormapper.h" #include "gui/colormapper.h"
@ -11,7 +29,8 @@ FCDProPlusGui::FCDProPlusGui(PluginAPI* pluginAPI, QWidget* parent) :
ui(new Ui::FCDProPlusGui), ui(new Ui::FCDProPlusGui),
m_pluginAPI(pluginAPI), m_pluginAPI(pluginAPI),
m_settings(), m_settings(),
m_sampleSource(NULL) m_sampleSource(NULL),
m_lastEngineState((DSPDeviceEngine::State)-1)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -31,6 +50,9 @@ FCDProPlusGui::FCDProPlusGui(PluginAPI* pluginAPI, QWidget* parent) :
} }
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware())); connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
m_statusTimer.start(500);
displaySettings(); displaySettings();
m_sampleSource = new FCDProPlusInput(); m_sampleSource = new FCDProPlusInput();
@ -148,6 +170,35 @@ void FCDProPlusGui::updateHardware()
m_updateTimer.stop(); m_updateTimer.stop();
} }
void FCDProPlusGui::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;
}
}
void FCDProPlusGui::on_checkBoxG_stateChanged(int state) void FCDProPlusGui::on_checkBoxG_stateChanged(int state)
{ {
m_settings.m_lnaGain = (state == Qt::Checked); m_settings.m_lnaGain = (state == Qt::Checked);
@ -192,3 +243,21 @@ void FCDProPlusGui::on_ppm_valueChanged(int value)
sendSettings(); sendSettings();
} }
void FCDProPlusGui::on_startStop_toggled(bool checked)
{
if (checked)
{
if (m_pluginAPI->initAcquisition())
{
m_pluginAPI->startAcquisition();
DSPEngine::instance()->startAudio();
}
}
else
{
m_pluginAPI->stopAcquistion();
DSPEngine::instance()->stopAudio();
}
}

View File

@ -8,6 +8,22 @@
class PluginAPI; class PluginAPI;
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2015 Edouard Griffiths, F4EXB //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
namespace Ui { namespace Ui {
class FCDProPlusGui; class FCDProPlusGui;
} }
@ -37,8 +53,10 @@ private:
PluginAPI* m_pluginAPI; PluginAPI* m_pluginAPI;
FCDProPlusSettings m_settings; FCDProPlusSettings m_settings;
QTimer m_updateTimer; QTimer m_updateTimer;
QTimer m_statusTimer;
std::vector<int> m_gains; std::vector<int> m_gains;
SampleSource* m_sampleSource; SampleSource* m_sampleSource;
int m_lastEngineState;
void displaySettings(); void displaySettings();
void sendSettings(); void sendSettings();
@ -54,7 +72,9 @@ private slots:
void on_filterRF_currentIndexChanged(int index); void on_filterRF_currentIndexChanged(int index);
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 updateHardware(); void updateHardware();
void updateStatus();
}; };
#endif // INCLUDE_FCDGUI_H #endif // INCLUDE_FCDGUI_H

View File

@ -35,7 +35,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<widget class="ButtonSwitch" name="startStopButton"> <widget class="ButtonSwitch" name="startStop">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>

View File

@ -20,6 +20,8 @@
#include <QDateTime> #include <QDateTime>
#include <QString> #include <QString>
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox>
#include "ui_filesourcegui.h" #include "ui_filesourcegui.h"
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
#include "gui/colormapper.h" #include "gui/colormapper.h"
@ -42,15 +44,20 @@ FileSourceGui::FileSourceGui(PluginAPI* pluginAPI, QWidget* parent) :
m_startingTimeStamp(0), m_startingTimeStamp(0),
m_samplesCount(0), m_samplesCount(0),
m_tickCount(0), m_tickCount(0),
m_enableNavTime(false) m_enableNavTime(false),
m_lastEngineState((DSPDeviceEngine::State)-1)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold)); ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
ui->centerFrequency->setValueRange(7, 0, pow(10,7)); ui->centerFrequency->setValueRange(7, 0, pow(10,7));
ui->fileNameText->setText(m_fileName); ui->fileNameText->setText(m_fileName);
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
connect(&(m_pluginAPI->getMainWindow()->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick())); connect(&(m_pluginAPI->getMainWindow()->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick()));
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
m_statusTimer.start(500);
displaySettings(); displaySettings();
ui->navTimeSlider->setEnabled(false); ui->navTimeSlider->setEnabled(false);
ui->playLoop->setChecked(true); // FIXME: always play in a loop ui->playLoop->setChecked(true); // FIXME: always play in a loop
ui->playLoop->setEnabled(false); ui->playLoop->setEnabled(false);
@ -168,15 +175,57 @@ void FileSourceGui::sendSettings()
{ {
} }
void FileSourceGui::updateHardware()
{
}
void FileSourceGui::on_playLoop_toggled(bool checked) void FileSourceGui::on_playLoop_toggled(bool checked)
{ {
// TODO: do something about it! // TODO: do something about it!
} }
void FileSourceGui::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 FileSourceGui::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;
}
}
void FileSourceGui::on_play_toggled(bool checked) void FileSourceGui::on_play_toggled(bool checked)
{ {
FileSourceInput::MsgConfigureFileSourceWork* message = FileSourceInput::MsgConfigureFileSourceWork::create(checked); FileSourceInput::MsgConfigureFileSourceWork* message = FileSourceInput::MsgConfigureFileSourceWork::create(checked);

View File

@ -51,7 +51,7 @@ private:
PluginAPI* m_pluginAPI; PluginAPI* m_pluginAPI;
FileSourceInput::Settings m_settings; FileSourceInput::Settings m_settings;
QTimer m_updateTimer; QTimer m_statusTimer;
std::vector<int> m_gains; std::vector<int> m_gains;
SampleSource* m_sampleSource; SampleSource* m_sampleSource;
bool m_acquisition; bool m_acquisition;
@ -63,11 +63,11 @@ private:
int m_samplesCount; int m_samplesCount;
std::size_t m_tickCount; std::size_t m_tickCount;
bool m_enableNavTime; bool m_enableNavTime;
int m_lastEngineState;
void displaySettings(); void displaySettings();
void displayTime(); void displayTime();
void sendSettings(); void sendSettings();
void updateHardware();
void configureFileName(); void configureFileName();
void updateWithAcquisition(); void updateWithAcquisition();
void updateWithStreamData(); void updateWithStreamData();
@ -75,10 +75,12 @@ private:
private slots: private slots:
void handleSourceMessages(); void handleSourceMessages();
void on_startStop_toggled(bool checked);
void on_playLoop_toggled(bool checked); void on_playLoop_toggled(bool checked);
void on_play_toggled(bool checked); void on_play_toggled(bool checked);
void on_navTimeSlider_valueChanged(int value); void on_navTimeSlider_valueChanged(int value);
void on_showFileDialog_clicked(bool checked); void on_showFileDialog_clicked(bool checked);
void updateStatus();
void tick(); void tick();
}; };

View File

@ -35,7 +35,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_freq"> <layout class="QHBoxLayout" name="horizontalLayout_freq">
<item> <item>
<widget class="ButtonSwitch" name="startStopButton"> <widget class="ButtonSwitch" name="startStop">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>

View File

@ -15,6 +15,8 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include <QDebug> #include <QDebug>
#include <QMessageBox>
#include <libhackrf/hackrf.h> #include <libhackrf/hackrf.h>
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
@ -28,12 +30,17 @@ HackRFGui::HackRFGui(PluginAPI* pluginAPI, QWidget* parent) :
ui(new Ui::HackRFGui), ui(new Ui::HackRFGui),
m_pluginAPI(pluginAPI), m_pluginAPI(pluginAPI),
m_settings(), m_settings(),
m_sampleSource(NULL) m_sampleSource(NULL),
m_lastEngineState((DSPDeviceEngine::State)-1)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold)); ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
ui->centerFrequency->setValueRange(7, 0U, 7250000U); ui->centerFrequency->setValueRange(7, 0U, 7250000U);
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware())); connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
m_statusTimer.start(500);
displaySettings(); displaySettings();
m_sampleSource = new HackRFInput(); m_sampleSource = new HackRFInput();
@ -277,6 +284,23 @@ void HackRFGui::on_vga_valueChanged(int value)
sendSettings(); sendSettings();
} }
void HackRFGui::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 HackRFGui::updateHardware() void HackRFGui::updateHardware()
{ {
qDebug() << "HackRFGui::updateHardware"; qDebug() << "HackRFGui::updateHardware";
@ -285,6 +309,35 @@ void HackRFGui::updateHardware()
m_updateTimer.stop(); m_updateTimer.stop();
} }
void HackRFGui::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;
}
}
unsigned int HackRFSampleRates::m_rates_k[] = {2400, 3200, 4800, 5600, 6400, 8000, 9600, 12800, 19200}; unsigned int HackRFSampleRates::m_rates_k[] = {2400, 3200, 4800, 5600, 6400, 8000, 9600, 12800, 19200};
unsigned int HackRFSampleRates::getRate(unsigned int rate_index) unsigned int HackRFSampleRates::getRate(unsigned int rate_index)

View File

@ -62,7 +62,9 @@ private:
PluginAPI* m_pluginAPI; PluginAPI* m_pluginAPI;
HackRFSettings m_settings; HackRFSettings m_settings;
QTimer m_updateTimer; QTimer m_updateTimer;
QTimer m_statusTimer;
SampleSource* m_sampleSource; SampleSource* m_sampleSource;
int m_lastEngineState;
void displaySettings(); void displaySettings();
void displaySampleRates(); void displaySampleRates();
@ -82,7 +84,9 @@ private slots:
void on_lna_valueChanged(int value); void on_lna_valueChanged(int value);
void on_bbFilter_currentIndexChanged(int index); void on_bbFilter_currentIndexChanged(int index);
void on_vga_valueChanged(int value); void on_vga_valueChanged(int value);
void on_startStop_toggled(bool checked);
void updateHardware(); void updateHardware();
void updateStatus();
}; };
class HackRFSampleRates { class HackRFSampleRates {

View File

@ -41,7 +41,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_freq"> <layout class="QHBoxLayout" name="horizontalLayout_freq">
<item> <item>
<widget class="ButtonSwitch" name="startStopButton"> <widget class="ButtonSwitch" name="startStop">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>

View File

@ -1,4 +1,6 @@
#include <QDebug> #include <QDebug>
#include <QMessageBox>
#include "rtlsdrgui.h" #include "rtlsdrgui.h"
#include "ui_rtlsdrgui.h" #include "ui_rtlsdrgui.h"
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
@ -10,7 +12,8 @@ RTLSDRGui::RTLSDRGui(PluginAPI* pluginAPI, QWidget* parent) :
ui(new Ui::RTLSDRGui), ui(new Ui::RTLSDRGui),
m_pluginAPI(pluginAPI), m_pluginAPI(pluginAPI),
m_settings(), m_settings(),
m_sampleSource(0) m_sampleSource(0),
m_lastEngineState((DSPDeviceEngine::State)-1)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold)); ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
@ -24,6 +27,9 @@ RTLSDRGui::RTLSDRGui(PluginAPI* pluginAPI, QWidget* parent) :
} }
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware())); connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
m_statusTimer.start(500);
displaySettings(); displaySettings();
m_sampleSource = new RTLSDRInput(); m_sampleSource = new RTLSDRInput();
@ -246,6 +252,23 @@ void RTLSDRGui::on_sampleRate_currentIndexChanged(int index)
sendSettings(); sendSettings();
} }
void RTLSDRGui::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 RTLSDRGui::updateHardware() void RTLSDRGui::updateHardware()
{ {
RTLSDRInput::MsgConfigureRTLSDR* message = RTLSDRInput::MsgConfigureRTLSDR::create(m_settings); RTLSDRInput::MsgConfigureRTLSDR* message = RTLSDRInput::MsgConfigureRTLSDR::create(m_settings);
@ -253,6 +276,35 @@ void RTLSDRGui::updateHardware()
m_updateTimer.stop(); m_updateTimer.stop();
} }
void RTLSDRGui::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;
}
}
void RTLSDRGui::on_checkBox_stateChanged(int state) void RTLSDRGui::on_checkBox_stateChanged(int state)
{ {
if (state == Qt::Checked) if (state == Qt::Checked)

View File

@ -36,8 +36,10 @@ private:
PluginAPI* m_pluginAPI; PluginAPI* m_pluginAPI;
RTLSDRSettings m_settings; RTLSDRSettings m_settings;
QTimer m_updateTimer; QTimer m_updateTimer;
QTimer m_statusTimer;
std::vector<int> m_gains; std::vector<int> m_gains;
SampleSource* m_sampleSource; SampleSource* m_sampleSource;
int m_lastEngineState;
void displaySettings(); void displaySettings();
void sendSettings(); void sendSettings();
@ -52,7 +54,9 @@ private slots:
void on_gain_valueChanged(int value); void on_gain_valueChanged(int value);
void on_sampleRate_currentIndexChanged(int index); void on_sampleRate_currentIndexChanged(int index);
void on_checkBox_stateChanged(int state); void on_checkBox_stateChanged(int state);
void on_startStop_toggled(bool checked);
void updateHardware(); void updateHardware();
void updateStatus();
void handleSourceMessages(); void handleSourceMessages();
}; };

View File

@ -35,7 +35,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_freq"> <layout class="QHBoxLayout" name="horizontalLayout_freq">
<item> <item>
<widget class="ButtonSwitch" name="startStopButton"> <widget class="ButtonSwitch" name="startStop">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>

View File

@ -44,6 +44,7 @@ SDRdaemonGui::SDRdaemonGui(PluginAPI* pluginAPI, QWidget* parent) :
m_pluginAPI(pluginAPI), m_pluginAPI(pluginAPI),
m_sampleSource(NULL), m_sampleSource(NULL),
m_acquisition(false), m_acquisition(false),
m_lastEngineState((DSPDeviceEngine::State)-1),
m_sampleRate(0), m_sampleRate(0),
m_sampleRateStream(0), m_sampleRateStream(0),
m_centerFrequency(0), m_centerFrequency(0),
@ -78,7 +79,10 @@ SDRdaemonGui::SDRdaemonGui(PluginAPI* pluginAPI, QWidget* parent) :
ui->setupUi(this); ui->setupUi(this);
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold)); ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
ui->centerFrequency->setValueRange(7, 0, pow(10,7)); ui->centerFrequency->setValueRange(7, 0, pow(10,7));
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware())); connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
m_statusTimer.start(500);
connect(&(m_pluginAPI->getMainWindow()->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick())); connect(&(m_pluginAPI->getMainWindow()->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick()));
m_sampleSource = new SDRdaemonInput(m_pluginAPI->getMainWindow()->getMasterTimer()); m_sampleSource = new SDRdaemonInput(m_pluginAPI->getMainWindow()->getMasterTimer());
@ -536,6 +540,22 @@ void SDRdaemonGui::on_fcPos_currentIndexChanged(int index)
ui->sendButton->setEnabled(true); ui->sendButton->setEnabled(true);
} }
void SDRdaemonGui::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 SDRdaemonGui::configureUDPLink() void SDRdaemonGui::configureUDPLink()
{ {
@ -622,6 +642,35 @@ void SDRdaemonGui::updateWithStreamTime()
ui->bufferGaugePositive->setValue((m_bufferGauge < 0 ? 0 : 50 - m_bufferGauge)); ui->bufferGaugePositive->setValue((m_bufferGauge < 0 ? 0 : 50 - m_bufferGauge));
} }
void SDRdaemonGui::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;
}
}
void SDRdaemonGui::tick() void SDRdaemonGui::tick()
{ {
if ((++m_tickCount & 0xf) == 0) { if ((++m_tickCount & 0xf) == 0) {

View File

@ -52,8 +52,10 @@ private:
PluginAPI* m_pluginAPI; PluginAPI* m_pluginAPI;
QTimer m_updateTimer; QTimer m_updateTimer;
QTimer m_statusTimer;
SampleSource* m_sampleSource; SampleSource* m_sampleSource;
bool m_acquisition; bool m_acquisition;
int m_lastEngineState;
int m_sampleRate; int m_sampleRate;
int m_sampleRateStream; int m_sampleRateStream;
@ -119,6 +121,8 @@ private slots:
void on_specificParms_textEdited(const QString& arg1); void on_specificParms_textEdited(const QString& arg1);
void on_decim_currentIndexChanged(int index); void on_decim_currentIndexChanged(int index);
void on_fcPos_currentIndexChanged(int index); void on_fcPos_currentIndexChanged(int index);
void on_startStop_toggled(bool checked);
void updateStatus();
void tick(); void tick();
}; };

View File

@ -35,7 +35,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_freq"> <layout class="QHBoxLayout" name="horizontalLayout_freq">
<item> <item>
<widget class="ButtonSwitch" name="startStopButton"> <widget class="ButtonSwitch" name="startStop">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>

View File

@ -20,7 +20,8 @@
#include "dsp/dspengine.h" #include "dsp/dspengine.h"
DSPEngine::DSPEngine() : DSPEngine::DSPEngine() :
m_audioSampleRate(48000) // Use default output device at 48 kHz m_audioSampleRate(48000), // Use default output device at 48 kHz
m_audioUsageCount(0)
{ {
m_deviceEngines.push_back(new DSPDeviceEngine(0)); // TODO: multi device support m_deviceEngines.push_back(new DSPDeviceEngine(0)); // TODO: multi device support
m_dvSerialSupport = false; m_dvSerialSupport = false;
@ -86,6 +87,30 @@ bool DSPEngine::startAcquisition(uint deviceIndex)
return started; return started;
} }
void DSPEngine::startAudio()
{
if (m_audioUsageCount == 0)
{
m_audioOutput.start(-1, m_audioSampleRate);
m_audioSampleRate = m_audioOutput.getRate(); // update with actual rate
}
m_audioUsageCount++;
}
void DSPEngine::stopAudio()
{
if (m_audioUsageCount > 0)
{
m_audioUsageCount--;
if (m_audioUsageCount == 0)
{
m_audioOutput.stop();
}
}
}
void DSPEngine::stopAcquistion(uint deviceIndex) void DSPEngine::stopAcquistion(uint deviceIndex)
{ {
qDebug("DSPEngine::stopAcquistion(%d)", deviceIndex); qDebug("DSPEngine::stopAcquistion(%d)", deviceIndex);

View File

@ -50,6 +50,9 @@ public:
bool startAcquisition(uint deviceIndex = 0); //!< Start acquisition sequence bool startAcquisition(uint deviceIndex = 0); //!< Start acquisition sequence
void stopAcquistion(uint deviceIndex = 0); //!< Stop acquisition sequence void stopAcquistion(uint deviceIndex = 0); //!< Stop acquisition sequence
void startAudio();
void stopAudio();
void setSource(SampleSource* source, uint deviceIndex = 0); //!< Set the sample source type void setSource(SampleSource* source, uint deviceIndex = 0); //!< Set the sample source type
void setSourceSequence(int sequence, uint deviceIndex = 0); //!< Set the sample source sequence in type void setSourceSequence(int sequence, uint deviceIndex = 0); //!< Set the sample source sequence in type
@ -103,6 +106,7 @@ private:
AudioOutput m_audioOutput; AudioOutput m_audioOutput;
uint m_audioSampleRate; uint m_audioSampleRate;
bool m_dvSerialSupport; bool m_dvSerialSupport;
uint m_audioUsageCount;
#ifdef DSD_USE_SERIALDV #ifdef DSD_USE_SERIALDV
DVSerialEngine m_dvSerialEngine; DVSerialEngine m_dvSerialEngine;
#endif #endif

View File

@ -96,8 +96,8 @@ MainWindow::MainWindow(QWidget* parent) :
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleMessages()), Qt::QueuedConnection); connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleMessages()), Qt::QueuedConnection);
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus())); // connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
m_statusTimer.start(500); // m_statusTimer.start(500);
m_masterTimer.start(50); m_masterTimer.start(50);
@ -418,55 +418,55 @@ void MainWindow::handleMessages()
} }
} }
void MainWindow::updateStatus() //void MainWindow::updateStatus()
{ //{
int state = m_dspEngine->state(); // int state = m_dspEngine->state();
if(m_lastEngineState != state) { // if(m_lastEngineState != state) {
switch(state) { // switch(state) {
case DSPDeviceEngine::StNotStarted: // case DSPDeviceEngine::StNotStarted:
m_engineIdle->setColor(Qt::gray); // m_engineIdle->setColor(Qt::gray);
m_engineRunning->setColor(Qt::gray); // m_engineRunning->setColor(Qt::gray);
m_engineError->setColor(Qt::gray); // m_engineError->setColor(Qt::gray);
statusBar()->clearMessage(); // statusBar()->clearMessage();
break; // break;
//
// case DSPDeviceEngine::StIdle:
// m_engineIdle->setColor(Qt::cyan);
// m_engineRunning->setColor(Qt::gray);
// m_engineError->setColor(Qt::gray);
// statusBar()->clearMessage();
// break;
//
// case DSPDeviceEngine::StRunning:
// m_engineIdle->setColor(Qt::gray);
// m_engineRunning->setColor(Qt::green);
// m_engineError->setColor(Qt::gray);
// statusBar()->showMessage(tr("Sampling from %1").arg(m_dspEngine->sourceDeviceDescription()));
// break;
//
// case DSPDeviceEngine::StError:
// m_engineIdle->setColor(Qt::gray);
// m_engineRunning->setColor(Qt::gray);
// m_engineError->setColor(Qt::red);
// statusBar()->showMessage(tr("Error: %1").arg(m_dspEngine->errorMessage()));
// break;
// }
// m_lastEngineState = state;
// }
//}
case DSPDeviceEngine::StIdle: //void MainWindow::on_action_Start_triggered()
m_engineIdle->setColor(Qt::cyan); //{
m_engineRunning->setColor(Qt::gray); // if (m_dspEngine->initAcquisition())
m_engineError->setColor(Qt::gray); // {
statusBar()->clearMessage(); // m_dspEngine->startAcquisition();
break; // }
//}
case DSPDeviceEngine::StRunning: //
m_engineIdle->setColor(Qt::gray); //void MainWindow::on_action_Stop_triggered()
m_engineRunning->setColor(Qt::green); //{
m_engineError->setColor(Qt::gray); // m_dspEngine->stopAcquistion();
statusBar()->showMessage(tr("Sampling from %1").arg(m_dspEngine->sourceDeviceDescription())); //}
break;
case DSPDeviceEngine::StError:
m_engineIdle->setColor(Qt::gray);
m_engineRunning->setColor(Qt::gray);
m_engineError->setColor(Qt::red);
statusBar()->showMessage(tr("Error: %1").arg(m_dspEngine->errorMessage()));
break;
}
m_lastEngineState = state;
}
}
void MainWindow::on_action_Start_triggered()
{
if (m_dspEngine->initAcquisition())
{
m_dspEngine->startAcquisition();
}
}
void MainWindow::on_action_Stop_triggered()
{
m_dspEngine->stopAcquistion();
}
void MainWindow::on_action_Start_Recording_triggered() void MainWindow::on_action_Start_Recording_triggered()
{ {

View File

@ -103,7 +103,7 @@ private:
DSPEngine* m_dspEngine; DSPEngine* m_dspEngine;
QTimer m_masterTimer; QTimer m_masterTimer;
QTimer m_statusTimer; //QTimer m_statusTimer;
int m_lastEngineState; int m_lastEngineState;
QLabel* m_sampleRateWidget; QLabel* m_sampleRateWidget;
@ -138,9 +138,9 @@ private:
private slots: private slots:
void handleDSPMessages(); void handleDSPMessages();
void handleMessages(); void handleMessages();
void updateStatus(); //void updateStatus();
void on_action_Start_triggered(); //void on_action_Start_triggered();
void on_action_Stop_triggered(); //void on_action_Stop_triggered();
void on_action_Start_Recording_triggered(); void on_action_Start_Recording_triggered();
void on_action_Stop_Recording_triggered(); void on_action_Stop_Recording_triggered();
void on_action_View_Fullscreen_toggled(bool checked); void on_action_View_Fullscreen_toggled(bool checked);

View File

@ -2,7 +2,6 @@
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
#include "plugin/pluginmanager.h" #include "plugin/pluginmanager.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "dsp/dspengine.h"
QDockWidget* PluginAPI::createMainWindowDock(Qt::DockWidgetArea dockWidgetArea, const QString& title) QDockWidget* PluginAPI::createMainWindowDock(Qt::DockWidgetArea dockWidgetArea, const QString& title)
{ {
@ -69,6 +68,31 @@ void PluginAPI::removeThreadedSink(ThreadedSampleSink* sink)
m_pluginManager->removeThreadedSink(sink); m_pluginManager->removeThreadedSink(sink);
} }
bool PluginAPI::initAcquisition()
{
return m_pluginManager->initAcquisition();
}
bool PluginAPI::startAcquisition()
{
return m_pluginManager->startAcquisition();
}
void PluginAPI::stopAcquistion()
{
m_pluginManager->stopAcquistion();
}
DSPDeviceEngine::State PluginAPI::state() const
{
return m_pluginManager->state();
}
QString PluginAPI::errorMessage()
{
return m_pluginManager->errorMessage();
}
PluginAPI::PluginAPI(PluginManager* pluginManager, MainWindow* mainWindow) : PluginAPI::PluginAPI(PluginManager* pluginManager, MainWindow* mainWindow) :
QObject(mainWindow), QObject(mainWindow),
m_pluginManager(pluginManager), m_pluginManager(pluginManager),

View File

@ -3,6 +3,7 @@
#include <QObject> #include <QObject>
#include "util/export.h" #include "util/export.h"
#include "dsp/dspdeviceengine.h"
class QDockWidget; class QDockWidget;
class QAction; class QAction;
@ -43,6 +44,11 @@ public:
// Device engine stuff // Device engine stuff
void addThreadedSink(ThreadedSampleSink* sink); void addThreadedSink(ThreadedSampleSink* sink);
void removeThreadedSink(ThreadedSampleSink* sink); void removeThreadedSink(ThreadedSampleSink* sink);
bool initAcquisition(); //!< Initialize device engine acquisition sequence
bool startAcquisition(); //!< Start device engine acquisition sequence
void stopAcquistion(); //!< Stop device engine acquisition sequence
DSPDeviceEngine::State state() const; //!< device engine state
QString errorMessage(); //!< Return the current device engine error message
// R/O access to main window // R/O access to main window
const MainWindow* getMainWindow() const { return m_mainWindow; } const MainWindow* getMainWindow() const { return m_mainWindow; }

View File

@ -51,6 +51,11 @@ public:
void addThreadedSink(ThreadedSampleSink* sink); void addThreadedSink(ThreadedSampleSink* sink);
void removeThreadedSink(ThreadedSampleSink* sink); void removeThreadedSink(ThreadedSampleSink* sink);
bool initAcquisition() { return m_dspDeviceEngine->initAcquisition(); } //!< Initialize device engine acquisition sequence
bool startAcquisition() { return m_dspDeviceEngine->startAcquisition(); } //!< Start device engine acquisition sequence
void stopAcquistion() { m_dspDeviceEngine->stopAcquistion(); } //!< Stop device engine acquisition sequence
DSPDeviceEngine::State state() const { return m_dspDeviceEngine->state(); }
QString errorMessage() { return m_dspDeviceEngine->errorMessage(); } //!< Return the current device engine error message
void loadSettings(const Preset* preset); void loadSettings(const Preset* preset);
void loadSourceSettings(const Preset* preset); void loadSourceSettings(const Preset* preset);