mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-09-03 13:47:50 -04:00
SDRdaemon plugin: removed references to file input
This commit is contained in:
parent
becf359db9
commit
1602525e0c
@ -193,6 +193,7 @@ See the v1.0.1 first official relase [release notes](https://github.com/f4exb/sd
|
||||
|
||||
<h2>To Do</h2>
|
||||
|
||||
- UDP source plugin: add the possibility to launch an external command that will process the samples like a GNUradio headless flowgraph
|
||||
- Allow the handling of more than one device at the same time. For Rx/Tx devices like the BladeRF Rx and Tx appear as two logical devices with two plugin instances and a common handler for the physical device services both plugins. This effectively opens Tx support.
|
||||
- Tx channels
|
||||
- Possibility to connect channels for example Rx to Tx or single Rx channel to dual Rx channel supporting MI(MO) features like 360 degree polarization detection.
|
||||
@ -202,7 +203,7 @@ See the v1.0.1 first official relase [release notes](https://github.com/f4exb/sd
|
||||
- Headless mode based on a saved configuration in above human readable form
|
||||
- Allow arbitrary sample rate for channelizers and demodulators (not multiple of 48 kHz). Prerequisite for polyphase channelizer
|
||||
- Implement polyphase channelizer
|
||||
- Level calibration
|
||||
- Level calibration
|
||||
- Even more demods ...
|
||||
|
||||
<h1>Developper's notes</h1>
|
||||
|
@ -305,7 +305,7 @@ void UDPSrcGUI::applySettings()
|
||||
|
||||
int udpPort = ui->udpPort->text().toInt(&ok);
|
||||
|
||||
if((!ok) || (udpPort < 1) || (udpPort > 65535))
|
||||
if((!ok) || (udpPort < 1024) || (udpPort > 65535))
|
||||
{
|
||||
udpPort = 9999;
|
||||
}
|
||||
|
@ -20,11 +20,13 @@
|
||||
#include <QDateTime>
|
||||
#include <QString>
|
||||
#include <QFileDialog>
|
||||
#include <stdint.h>
|
||||
#include "ui_sdrdaemongui.h"
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "gui/colormapper.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "mainwindow.h"
|
||||
#include "util/simpleserializer.h"
|
||||
|
||||
#include "sdrdaemongui.h"
|
||||
|
||||
@ -32,10 +34,8 @@ SDRdaemonGui::SDRdaemonGui(PluginAPI* pluginAPI, QWidget* parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::SDRdaemonGui),
|
||||
m_pluginAPI(pluginAPI),
|
||||
m_settings(),
|
||||
m_sampleSource(NULL),
|
||||
m_acquisition(false),
|
||||
m_fileName("..."),
|
||||
m_sampleRate(0),
|
||||
m_centerFrequency(0),
|
||||
m_startingTimeStamp(0),
|
||||
@ -45,14 +45,14 @@ SDRdaemonGui::SDRdaemonGui(PluginAPI* pluginAPI, QWidget* parent) :
|
||||
ui->setupUi(this);
|
||||
ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
|
||||
ui->centerFrequency->setValueRange(7, 0, pow(10,7));
|
||||
ui->fileNameText->setText(m_fileName);
|
||||
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(updateHardware()));
|
||||
connect(&(m_pluginAPI->getMainWindow()->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick()));
|
||||
displaySettings();
|
||||
|
||||
m_sampleSource = new SDRdaemonInput(m_pluginAPI->getMainWindow()->getMasterTimer());
|
||||
connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
||||
DSPEngine::instance()->setSource(m_sampleSource);
|
||||
|
||||
displaySettings();
|
||||
}
|
||||
|
||||
SDRdaemonGui::~SDRdaemonGui()
|
||||
@ -77,11 +77,54 @@ QString SDRdaemonGui::getName() const
|
||||
|
||||
void SDRdaemonGui::resetToDefaults()
|
||||
{
|
||||
m_settings.resetToDefaults();
|
||||
displaySettings();
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
QByteArray SDRdaemonGui::serialize() const
|
||||
{
|
||||
bool ok;
|
||||
SimpleSerializer s(1);
|
||||
s.writeString(1, ui->address->text());
|
||||
uint32_t uintval = ui->port->text().toInt(&ok);
|
||||
if((!ok) || (uintval < 1024) || (uintval > 65535)) {
|
||||
uintval = 9090;
|
||||
}
|
||||
s.writeU32(2, uintval);
|
||||
return s.final();
|
||||
}
|
||||
|
||||
bool SDRdaemonGui::deserialize(const QByteArray& data)
|
||||
{
|
||||
SimpleDeserializer d(data);
|
||||
QString address;
|
||||
uint32_t uintval;
|
||||
quint16 port;
|
||||
|
||||
if(!d.isValid()) {
|
||||
resetToDefaults();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(d.getVersion() == 1) {
|
||||
uint32_t uintval;
|
||||
d.readString(1, &address, "127.0.0.1");
|
||||
d.readU32(2, &uintval, 9090);
|
||||
if ((uintval > 1024) && (uintval < 65536)) {
|
||||
port = uintval;
|
||||
} else {
|
||||
port = 9090;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
resetToDefaults();
|
||||
return false;
|
||||
}
|
||||
|
||||
ui->address->setText(address);
|
||||
ui->port->setText(QString::number(port));
|
||||
}
|
||||
|
||||
|
||||
qint64 SDRdaemonGui::getCenterFrequency() const
|
||||
{
|
||||
return m_centerFrequency;
|
||||
@ -91,24 +134,6 @@ void SDRdaemonGui::setCenterFrequency(qint64 centerFrequency)
|
||||
{
|
||||
m_centerFrequency = centerFrequency;
|
||||
displaySettings();
|
||||
sendSettings();
|
||||
}
|
||||
|
||||
QByteArray SDRdaemonGui::serialize() const
|
||||
{
|
||||
return m_settings.serialize();
|
||||
}
|
||||
|
||||
bool SDRdaemonGui::deserialize(const QByteArray& data)
|
||||
{
|
||||
if(m_settings.deserialize(data)) {
|
||||
displaySettings();
|
||||
sendSettings();
|
||||
return true;
|
||||
} else {
|
||||
resetToDefaults();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool SDRdaemonGui::handleMessage(const Message& message)
|
||||
@ -158,45 +183,37 @@ void SDRdaemonGui::displaySettings()
|
||||
{
|
||||
}
|
||||
|
||||
void SDRdaemonGui::sendSettings()
|
||||
{
|
||||
}
|
||||
|
||||
void SDRdaemonGui::updateHardware()
|
||||
{
|
||||
}
|
||||
|
||||
void SDRdaemonGui::on_play_toggled(bool checked)
|
||||
{
|
||||
SDRdaemonInput::MsgConfigureSDRdaemonWork* message = SDRdaemonInput::MsgConfigureSDRdaemonWork::create(checked);
|
||||
m_sampleSource->getInputMessageQueue()->push(message);
|
||||
}
|
||||
|
||||
void SDRdaemonGui::on_showFileDialog_clicked(bool checked)
|
||||
void SDRdaemonGui::on_applyButton_clicked(bool checked)
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
tr("Open I/Q record file"), ".", tr("SDR I/Q Files (*.sdriq)"));
|
||||
|
||||
if (fileName != "")
|
||||
{
|
||||
m_fileName = fileName;
|
||||
ui->fileNameText->setText(m_fileName);
|
||||
configureFileName();
|
||||
}
|
||||
configureUDPLink();
|
||||
}
|
||||
|
||||
void SDRdaemonGui::configureFileName()
|
||||
void SDRdaemonGui::configureUDPLink()
|
||||
{
|
||||
qDebug() << "SDRdaemonGui::configureFileName: " << m_fileName.toStdString().c_str();
|
||||
SDRdaemonInput::MsgConfigureSDRdaemonName* message = SDRdaemonInput::MsgConfigureSDRdaemonName::create(m_fileName);
|
||||
bool ok;
|
||||
QString udpAddress = ui->address->text();
|
||||
int udpPort = ui->port->text().toInt(&ok);
|
||||
|
||||
if((!ok) || (udpPort < 1024) || (udpPort > 65535))
|
||||
{
|
||||
udpPort = 9090;
|
||||
}
|
||||
|
||||
qDebug() << "SDRdaemonGui::configureUDPLink: " << udpAddress.toStdString().c_str()
|
||||
<< " : " << udpPort;
|
||||
|
||||
SDRdaemonInput::MsgConfigureSDRdaemonUDPLink* message = SDRdaemonInput::MsgConfigureSDRdaemonUDPLink::create(udpAddress, udpPort);
|
||||
m_sampleSource->getInputMessageQueue()->push(message);
|
||||
}
|
||||
|
||||
void SDRdaemonGui::updateWithAcquisition()
|
||||
{
|
||||
ui->play->setEnabled(m_acquisition);
|
||||
ui->play->setChecked(m_acquisition);
|
||||
ui->showFileDialog->setEnabled(!m_acquisition);
|
||||
}
|
||||
|
||||
void SDRdaemonGui::updateWithStreamData()
|
||||
@ -204,7 +221,6 @@ void SDRdaemonGui::updateWithStreamData()
|
||||
ui->centerFrequency->setValue(m_centerFrequency/1000);
|
||||
QString s = QString::number(m_sampleRate/1000.0, 'f', 0);
|
||||
ui->sampleRateText->setText(tr("%1k").arg(s));
|
||||
ui->play->setEnabled(m_acquisition);
|
||||
updateWithStreamTime(); // TODO: remove when time data is implemented
|
||||
}
|
||||
|
||||
@ -222,7 +238,6 @@ void SDRdaemonGui::updateWithStreamTime()
|
||||
t = t.addSecs(t_sec);
|
||||
t = t.addMSecs(t_msec);
|
||||
QString s_time = t.toString("hh:mm:ss.zzz");
|
||||
ui->relTimeText->setText(s_time);
|
||||
|
||||
quint64 startingTimeStampMsec = m_startingTimeStamp * 1000;
|
||||
QDateTime dt = QDateTime::fromMSecsSinceEpoch(startingTimeStampMsec);
|
||||
|
@ -40,22 +40,19 @@ public:
|
||||
QString getName() const;
|
||||
|
||||
void resetToDefaults();
|
||||
virtual qint64 getCenterFrequency() const;
|
||||
virtual void setCenterFrequency(qint64 centerFrequency);
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
virtual qint64 getCenterFrequency() const;
|
||||
virtual void setCenterFrequency(qint64 centerFrequency);
|
||||
virtual bool handleMessage(const Message& message);
|
||||
|
||||
private:
|
||||
Ui::SDRdaemonGui* ui;
|
||||
|
||||
PluginAPI* m_pluginAPI;
|
||||
SDRdaemonInput::Settings m_settings;
|
||||
QTimer m_updateTimer;
|
||||
std::vector<int> m_gains;
|
||||
SampleSource* m_sampleSource;
|
||||
bool m_acquisition;
|
||||
QString m_fileName;
|
||||
int m_sampleRate;
|
||||
quint64 m_centerFrequency;
|
||||
std::time_t m_startingTimeStamp;
|
||||
@ -64,9 +61,7 @@ private:
|
||||
|
||||
void displaySettings();
|
||||
void displayTime();
|
||||
void sendSettings();
|
||||
void updateHardware();
|
||||
void configureFileName();
|
||||
void configureUDPLink();
|
||||
void updateWithAcquisition();
|
||||
void updateWithStreamData();
|
||||
void updateWithStreamTime();
|
||||
@ -75,7 +70,7 @@ private slots:
|
||||
void handleSourceMessages();
|
||||
void on_playLoop_toggled(bool checked);
|
||||
void on_play_toggled(bool checked);
|
||||
void on_showFileDialog_clicked(bool checked);
|
||||
void on_applyButton_clicked(bool checked);
|
||||
void tick();
|
||||
};
|
||||
|
||||
|
@ -147,7 +147,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addressApplyButton">
|
||||
<widget class="QPushButton" name="applyButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
@ -235,108 +235,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="decimLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_decim">
|
||||
<property name="text">
|
||||
<string>Dec.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="decim">
|
||||
<property name="toolTip">
|
||||
<string>Decimation factor</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="decimText">
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="decimRate">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0k</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="fileSelectionLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="showFileDialog">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Open file</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrbase/resources/res.qrc">
|
||||
<normaloff>:/preset-load.png</normaloff>:/preset-load.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="fileNameText">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>File currently opened</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_file">
|
||||
<property name="orientation">
|
||||
@ -345,104 +243,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_rate">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="playControllLayout">
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="playLoop">
|
||||
<property name="toolTip">
|
||||
<string>Play in a loop</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrbase/resources/res.qrc">
|
||||
<normaloff>:/playloop.png</normaloff>:/playloop.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="play">
|
||||
<property name="toolTip">
|
||||
<string>Stopped / Play / Pause</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrbase/resources/res.qrc">
|
||||
<normaloff>:/play.png</normaloff>
|
||||
<normalon>:/pause.png</normalon>
|
||||
<disabledoff>:/stop.png</disabledoff>
|
||||
<disabledon>:/stop.png</disabledon>
|
||||
<activeoff>:/play.png</activeoff>
|
||||
<activeon>:/pause.png</activeon>
|
||||
<selectedoff>:/play.png</selectedoff>
|
||||
<selectedon>:/pause.png</selectedon>:/play.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="relTimeLine">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="relTimeText">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Record time from start</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>00:00:00.000</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<layout class="QHBoxLayout" name="statusLayout"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@ -453,11 +254,6 @@
|
||||
<header>gui/valuedial.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ButtonSwitch</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>gui/buttonswitch.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../sdrbase/resources/res.qrc"/>
|
||||
|
@ -27,55 +27,18 @@
|
||||
#include "sdrdaemoninput.h"
|
||||
#include "sdrdaemonthread.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(SDRdaemonInput::MsgConfigureSDRdaemon, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SDRdaemonInput::MsgConfigureSDRdaemonName, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SDRdaemonInput::MsgConfigureSDRdaemonUDPLink, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SDRdaemonInput::MsgConfigureSDRdaemonWork, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SDRdaemonInput::MsgConfigureSDRdaemonStreamTiming, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SDRdaemonInput::MsgReportSDRdaemonAcquisition, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SDRdaemonInput::MsgReportSDRdaemonStreamData, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SDRdaemonInput::MsgReportSDRdaemonStreamTiming, Message)
|
||||
|
||||
SDRdaemonInput::Settings::Settings() :
|
||||
m_fileName("./test.sdriq")
|
||||
{
|
||||
}
|
||||
|
||||
void SDRdaemonInput::Settings::resetToDefaults()
|
||||
{
|
||||
m_fileName = "./test.sdriq";
|
||||
}
|
||||
|
||||
QByteArray SDRdaemonInput::Settings::serialize() const
|
||||
{
|
||||
SimpleSerializer s(1);
|
||||
s.writeString(1, m_fileName);
|
||||
return s.final();
|
||||
}
|
||||
|
||||
bool SDRdaemonInput::Settings::deserialize(const QByteArray& data)
|
||||
{
|
||||
SimpleDeserializer d(data);
|
||||
|
||||
if(!d.isValid()) {
|
||||
resetToDefaults();
|
||||
return false;
|
||||
}
|
||||
|
||||
if(d.getVersion() == 1) {
|
||||
int intval;
|
||||
d.readString(1, &m_fileName, "./test.sdriq");
|
||||
return true;
|
||||
} else {
|
||||
resetToDefaults();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
SDRdaemonInput::SDRdaemonInput(const QTimer& masterTimer) :
|
||||
m_settings(),
|
||||
m_address("127.0.0.1"),
|
||||
m_port(9090),
|
||||
m_SDRdaemonThread(NULL),
|
||||
m_deviceDescription(),
|
||||
m_fileName("..."),
|
||||
m_sampleRate(0),
|
||||
m_centerFrequency(0),
|
||||
m_startingTimeStamp(0),
|
||||
@ -164,10 +127,10 @@ std::time_t SDRdaemonInput::getStartingTimeStamp() const
|
||||
|
||||
bool SDRdaemonInput::handleMessage(const Message& message)
|
||||
{
|
||||
if (MsgConfigureSDRdaemonName::match(message))
|
||||
if (MsgConfigureSDRdaemonUDPLink::match(message))
|
||||
{
|
||||
MsgConfigureSDRdaemonName& conf = (MsgConfigureSDRdaemonName&) message;
|
||||
m_fileName = conf.getFileName();
|
||||
MsgConfigureSDRdaemonUDPLink& conf = (MsgConfigureSDRdaemonUDPLink&) message;
|
||||
updateLink(conf.getAddress(), conf.getPort());
|
||||
return true;
|
||||
}
|
||||
else if (MsgConfigureSDRdaemonWork::match(message))
|
||||
@ -210,14 +173,50 @@ bool SDRdaemonInput::handleMessage(const Message& message)
|
||||
}
|
||||
}
|
||||
|
||||
bool SDRdaemonInput::applySettings(const Settings& settings, bool force)
|
||||
void SDRdaemonInput::updateLink(const QString& address, quint16 port)
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
bool wasRunning = false;
|
||||
|
||||
if((m_settings.m_fileName != settings.m_fileName) || force)
|
||||
if ((m_address != address) || (m_port != port))
|
||||
{
|
||||
m_settings.m_fileName = settings.m_fileName;
|
||||
if (m_SDRdaemonThread != 0)
|
||||
{
|
||||
wasRunning = m_SDRdaemonThread->isRunning();
|
||||
|
||||
if (wasRunning)
|
||||
{
|
||||
m_SDRdaemonThread->stopWork();
|
||||
}
|
||||
}
|
||||
|
||||
if (m_SDRdaemonThread != 0)
|
||||
{
|
||||
m_SDRdaemonThread->updateLink(address, port);
|
||||
|
||||
if (wasRunning)
|
||||
{
|
||||
m_SDRdaemonThread->startWork();
|
||||
}
|
||||
}
|
||||
|
||||
m_address = address;
|
||||
m_port = port;
|
||||
|
||||
qDebug() << "SDRdaemonInput::updateLink:"
|
||||
<< " address: " << m_address.toStdString().c_str()
|
||||
<< "port: " << m_port;
|
||||
}
|
||||
}
|
||||
|
||||
void SDRdaemonInput:: updateSampleRate(int sampleRate)
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
bool wasRunning = false;
|
||||
|
||||
if (m_sampleRate != sampleRate)
|
||||
{
|
||||
m_sampleRate = sampleRate;
|
||||
|
||||
if (m_SDRdaemonThread != 0)
|
||||
{
|
||||
@ -242,11 +241,7 @@ bool SDRdaemonInput::applySettings(const Settings& settings, bool force)
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(m_sampleRate, m_centerFrequency);
|
||||
DSPEngine::instance()->getInputMessageQueue()->push(notif);
|
||||
|
||||
qDebug() << "SDRdaemonInput::applySettings:"
|
||||
<< " center freq: " << m_centerFrequency << " Hz"
|
||||
<< " sample rate: " << m_sampleRate
|
||||
<< " Unix timestamp: " << m_startingTimeStamp;
|
||||
qDebug() << "SDRdaemonInput::updateSampleRate:"
|
||||
<< " sample rate: " << m_sampleRate;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -27,52 +27,26 @@ class SDRdaemonThread;
|
||||
|
||||
class SDRdaemonInput : public SampleSource {
|
||||
public:
|
||||
struct Settings {
|
||||
QString m_fileName;
|
||||
|
||||
Settings();
|
||||
void resetToDefaults();
|
||||
QByteArray serialize() const;
|
||||
bool deserialize(const QByteArray& data);
|
||||
};
|
||||
|
||||
class MsgConfigureSDRdaemon : public Message {
|
||||
class MsgConfigureSDRdaemonUDPLink : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
const Settings& getSettings() const { return m_settings; }
|
||||
const QString& getAddress() const { return m_address; }
|
||||
quint16 getPort() const { return m_port; }
|
||||
|
||||
static MsgConfigureSDRdaemon* create(const Settings& settings)
|
||||
static MsgConfigureSDRdaemonUDPLink* create(const QString& address, quint16 port)
|
||||
{
|
||||
return new MsgConfigureSDRdaemon(settings);
|
||||
return new MsgConfigureSDRdaemonUDPLink(address, port);
|
||||
}
|
||||
|
||||
private:
|
||||
Settings m_settings;
|
||||
QString m_address;
|
||||
quint16 m_port;
|
||||
|
||||
MsgConfigureSDRdaemon(const Settings& settings) :
|
||||
MsgConfigureSDRdaemonUDPLink(const QString& address, quint16 port) :
|
||||
Message(),
|
||||
m_settings(settings)
|
||||
{ }
|
||||
};
|
||||
|
||||
class MsgConfigureSDRdaemonName : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
const QString& getFileName() const { return m_fileName; }
|
||||
|
||||
static MsgConfigureSDRdaemonName* create(const QString& fileName)
|
||||
{
|
||||
return new MsgConfigureSDRdaemonName(fileName);
|
||||
}
|
||||
|
||||
private:
|
||||
QString m_fileName;
|
||||
|
||||
MsgConfigureSDRdaemonName(const QString& fileName) :
|
||||
Message(),
|
||||
m_fileName(fileName)
|
||||
m_address(address),
|
||||
m_port(port)
|
||||
{ }
|
||||
};
|
||||
|
||||
@ -195,16 +169,17 @@ public:
|
||||
|
||||
private:
|
||||
QMutex m_mutex;
|
||||
Settings m_settings;
|
||||
QString m_address;
|
||||
quint16 m_port;
|
||||
SDRdaemonThread* m_SDRdaemonThread;
|
||||
QString m_deviceDescription;
|
||||
QString m_fileName;
|
||||
int m_sampleRate;
|
||||
quint64 m_centerFrequency;
|
||||
std::time_t m_startingTimeStamp;
|
||||
const QTimer& m_masterTimer;
|
||||
|
||||
bool applySettings(const Settings& settings, bool force);
|
||||
void updateLink(const QString& address, quint16 port);
|
||||
void updateSampleRate(int sampleRate);
|
||||
};
|
||||
|
||||
#endif // INCLUDE_SDRDAEMONINPUT_H
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
void startWork();
|
||||
void stopWork();
|
||||
void setSamplerate(uint32_t samplerate);
|
||||
void updateLink(const QString& address, quint16 port);
|
||||
bool isRunning() const { return m_running; }
|
||||
std::size_t getSamplesCount() const { return m_samplesCount; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user