UDP source plugin: use channel marker address and port

pull/60/head
f4exb 2017-08-25 12:12:46 +02:00
rodzic dd08c69282
commit a7d6b3a75d
5 zmienionych plików z 216 dodań i 269 usunięć

Wyświetl plik

@ -105,7 +105,7 @@ void UDPSrc::configure(MessageQueue* messageQueue,
Real outputSampleRate,
Real rfBandwidth,
int fmDeviation,
QString& udpAddress,
const QString& udpAddress,
int udpPort,
int audioPort,
bool force)

Wyświetl plik

@ -62,7 +62,7 @@ public:
Real outputSampleRate,
Real rfBandwidth,
int fmDeviation,
QString& udpAddress,
const QString& udpAddress,
int udpPort,
int audioPort,
bool force);
@ -110,7 +110,7 @@ protected:
Real sampleRate,
Real rfBandwidth,
int fmDeviation,
QString& udpAddress,
const QString& udpAddress,
int udpPort,
int audioPort,
bool force)
@ -139,7 +139,7 @@ protected:
Real outputSampleRate,
Real rfBandwidth,
int fmDeviation,
QString& udpAddress,
const QString& udpAddress,
int udpPort,
int audioPort,
bool force) :

Wyświetl plik

@ -25,7 +25,7 @@
#include "dsp/dspengine.h"
#include "util/simpleserializer.h"
#include "util/db.h"
#include "gui/basicchannelsettingswidget.h"
#include "gui/basicchannelsettingsdialog.h"
#include "ui_udpsrcgui.h"
#include "mainwindow.h"
@ -73,15 +73,15 @@ void UDPSrcGUI::resetToDefaults()
ui->sampleRate->setText("48000");
ui->rfBandwidth->setText("32000");
ui->fmDeviation->setText("2500");
ui->udpAddress->setText("127.0.0.1");
ui->udpPort->setText("9999");
ui->audioPort->setText("9999");
ui->spectrumGUI->resetToDefaults();
ui->gain->setValue(10);
ui->volume->setValue(20);
ui->audioActive->setChecked(false);
ui->audioStereo->setChecked(false);
ui->agc->setChecked(false);
m_channelMarker.setUDPAddress("127.0.0.1");
m_channelMarker.setUDPSendPort(9999);
m_channelMarker.setUDPReceivePort(9998);
blockApplySettings(false);
applySettingsImmediate();
@ -96,14 +96,14 @@ QByteArray UDPSrcGUI::serialize() const
s.writeS32(3, m_sampleFormat);
s.writeReal(4, m_outputSampleRate);
s.writeReal(5, m_rfBandwidth);
s.writeS32(6, m_udpPort);
s.writeS32(6, m_channelMarker.getUDPSendPort());
s.writeBlob(7, ui->spectrumGUI->serialize());
s.writeS32(8, ui->gain->value());
s.writeS32(9, m_channelMarker.getCenterFrequency());
s.writeString(10, m_udpAddress);
s.writeString(10, m_channelMarker.getUDPAddress());
s.writeBool(11, m_audioActive);
s.writeS32(12, (qint32)m_volume);
s.writeS32(13, m_audioPort);
s.writeS32(13, m_channelMarker.getUDPReceivePort());
s.writeBool(14, m_audioStereo);
s.writeS32(15, m_fmDeviation);
s.writeS32(16, ui->squelch->value());
@ -178,7 +178,11 @@ bool UDPSrcGUI::deserialize(const QByteArray& data)
d.readReal(5, &realtmp, 32000);
ui->rfBandwidth->setText(QString("%1").arg(realtmp, 0));
d.readS32(6, &s32tmp, 9999);
ui->udpPort->setText(QString("%1").arg(s32tmp));
if ((s32tmp > 1024) && (s32tmp < 65536)) {
m_channelMarker.setUDPSendPort(s32tmp);
} else {
m_channelMarker.setUDPSendPort(9999);
}
d.readBlob(7, &bytetmp);
ui->spectrumGUI->deserialize(bytetmp);
d.readS32(8, &s32tmp, 10);
@ -187,14 +191,18 @@ bool UDPSrcGUI::deserialize(const QByteArray& data)
d.readS32(9, &s32tmp, 0);
m_channelMarker.setCenterFrequency(s32tmp);
d.readString(10, &strtmp, "127.0.0.1");
ui->udpAddress->setText(strtmp);
m_channelMarker.setUDPAddress(strtmp);
d.readBool(11, &booltmp, false);
ui->audioActive->setChecked(booltmp);
d.readS32(12, &s32tmp, 20);
ui->volume->setValue(s32tmp);
ui->volumeText->setText(QString("%1").arg(s32tmp));
d.readS32(13, &s32tmp, 9998);
ui->audioPort->setText(QString("%1").arg(s32tmp));
if ((s32tmp > 1024) && (s32tmp < 65536)) {
m_channelMarker.setUDPReceivePort(s32tmp);
} else {
m_channelMarker.setUDPReceivePort(9998);
}
d.readBool(14, &booltmp, false);
ui->audioStereo->setChecked(booltmp);
d.readS32(15, &s32tmp, 2500);
@ -230,6 +238,8 @@ bool UDPSrcGUI::handleMessage(const Message& message __attribute__((unused)))
void UDPSrcGUI::channelMarkerChanged()
{
this->setWindowTitle(m_channelMarker.getTitle());
displaySettings();
applySettings();
}
@ -267,12 +277,11 @@ UDPSrcGUI::UDPSrcGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget*
m_tickCount(0),
m_gain(1.0),
m_volume(20),
m_basicSettingsShown(false),
m_doApplySettings(true)
{
ui->setupUi(this);
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
connect(this, SIGNAL(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked()));
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
setAttribute(Qt::WA_DeleteOnClose, true);
m_spectrumVis = new SpectrumVis(ui->glSpectrum);
@ -300,7 +309,11 @@ UDPSrcGUI::UDPSrcGUI(PluginAPI* pluginAPI, DeviceSourceAPI *deviceAPI, QWidget*
//m_channelMarker = new ChannelMarker(this);
m_channelMarker.setBandwidth(16000);
m_channelMarker.setCenterFrequency(0);
m_channelMarker.setTitle("UDP Sample Source");
m_channelMarker.setColor(Qt::green);
m_channelMarker.setUDPAddress("127.0.0.1");
m_channelMarker.setUDPSendPort(9999);
m_channelMarker.setUDPReceivePort(9998);
m_channelMarker.setVisible(true);
connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged()));
@ -339,6 +352,7 @@ void UDPSrcGUI::displaySettings()
ui->volumeText->setText(QString("%1").arg(ui->volume->value()));
ui->squelchText->setText(tr("%1").arg(ui->squelch->value()*1.0, 0, 'f', 0));
ui->squelchGateText->setText(tr("%1").arg(ui->squelchGate->value()*10.0, 0, 'f', 0));
ui->addressText->setText(tr("%1:%2/%3").arg(m_channelMarker.getUDPAddress()).arg(m_channelMarker.getUDPSendPort()).arg(m_channelMarker.getUDPReceivePort()));
}
void UDPSrcGUI::applySettingsImmediate(bool force)
@ -384,22 +398,6 @@ void UDPSrcGUI::applySettings(bool force)
rfBandwidth = outputSampleRate;
}
m_udpAddress = ui->udpAddress->text();
int udpPort = ui->udpPort->text().toInt(&ok);
if((!ok) || (udpPort < 1024) || (udpPort > 65535))
{
udpPort = 9999;
}
int audioPort = ui->audioPort->text().toInt(&ok);
if((!ok) || (audioPort < 1) || (audioPort > 65535) || (audioPort == udpPort))
{
audioPort = udpPort - 1;
}
int fmDeviation = ui->fmDeviation->text().toInt(&ok);
if ((!ok) || (fmDeviation < 1))
@ -411,9 +409,6 @@ void UDPSrcGUI::applySettings(bool force)
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
ui->sampleRate->setText(QString("%1").arg(outputSampleRate, 0));
ui->rfBandwidth->setText(QString("%1").arg(rfBandwidth, 0));
//ui->udpAddress->setText(m_udpAddress);
ui->udpPort->setText(QString("%1").arg(udpPort));
ui->audioPort->setText(QString("%1").arg(audioPort));
ui->fmDeviation->setText(QString("%1").arg(fmDeviation));
m_channelMarker.disconnect(this, SLOT(channelMarkerChanged()));
m_channelMarker.setBandwidth((int)rfBandwidth);
@ -478,17 +473,15 @@ void UDPSrcGUI::applySettings(bool force)
m_outputSampleRate = outputSampleRate;
m_rfBandwidth = rfBandwidth;
m_fmDeviation = fmDeviation;
m_udpPort = udpPort;
m_audioPort = audioPort;
m_udpSrc->configure(m_udpSrc->getInputMessageQueue(),
sampleFormat,
outputSampleRate,
rfBandwidth,
fmDeviation,
m_udpAddress,
udpPort,
audioPort,
m_channelMarker.getUDPAddress(),
m_channelMarker.getUDPSendPort(),
m_channelMarker.getUDPReceivePort(),
force);
ui->applyBtn->setEnabled(false);
@ -609,14 +602,11 @@ void UDPSrcGUI::onWidgetRolled(QWidget* widget, bool rollDown)
}
}
void UDPSrcGUI::onMenuDoubleClicked()
void UDPSrcGUI::onMenuDialogCalled(const QPoint &p)
{
if (!m_basicSettingsShown)
{
m_basicSettingsShown = true;
BasicChannelSettingsWidget* bcsw = new BasicChannelSettingsWidget(&m_channelMarker, this);
bcsw->show();
}
BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.move(p);
dialog.exec();
}
void UDPSrcGUI::leaveEvent(QEvent*)

Wyświetl plik

@ -71,7 +71,7 @@ private slots:
void on_audioStereo_toggled(bool stereo);
void on_applyBtn_clicked();
void onWidgetRolled(QWidget* widget, bool rollDown);
void onMenuDoubleClicked();
void onMenuDialogCalled(const QPoint& p);
void on_gain_valueChanged(int value);
void on_volume_valueChanged(int value);
void on_squelch_valueChanged(int value);
@ -98,10 +98,6 @@ private:
bool m_audioActive;
bool m_audioStereo;
int m_volume;
QString m_udpAddress;
int m_udpPort;
int m_audioPort;
bool m_basicSettingsShown;
bool m_doApplySettings;
// RF path

Wyświetl plik

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>342</width>
<width>354</width>
<height>355</height>
</rect>
</property>
@ -31,18 +31,21 @@
<property name="windowTitle">
<string>UDP Sample Source</string>
</property>
<property name="statusTip">
<string>UDP Sample Source</string>
</property>
<widget class="QWidget" name="widget" native="true">
<property name="geometry">
<rect>
<x>2</x>
<y>2</y>
<width>340</width>
<width>350</width>
<height>142</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>340</width>
<width>350</width>
<height>0</height>
</size>
</property>
@ -270,191 +273,92 @@
</item>
</layout>
</item>
<item row="6" column="0">
<layout class="QHBoxLayout" name="PortLayout">
<item row="1" column="1">
<layout class="QHBoxLayout" name="SampleRateLayout">
<item>
<widget class="QLabel" name="udpPortlabel">
<widget class="QLabel" name="sampleRateLabel">
<property name="text">
<string>D</string>
<string>SRout</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="udpPort">
<widget class="QLineEdit" name="sampleRate">
<property name="toolTip">
<string>Remote data port</string>
</property>
<property name="inputMask">
<string>00000</string>
<string>Output sample rate (S/s)</string>
</property>
<property name="text">
<string>9999</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="audioPortlabel">
<property name="text">
<string>A</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="audioPort">
<property name="toolTip">
<string>Local audio input port</string>
</property>
<property name="inputMask">
<string>00000</string>
</property>
<property name="text">
<string>9998</string>
<string>48000</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="7" column="0">
<layout class="QHBoxLayout" name="AudioPortLayout">
<item row="4" column="1">
<layout class="QHBoxLayout" name="RFBandwidthLayout">
<item>
<widget class="QLabel" name="fmDevLabel">
<widget class="QLabel" name="rfBandwidthLabel">
<property name="text">
<string>FMd</string>
<string>RFBW</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="fmDeviation">
<widget class="QLineEdit" name="rfBandwidth">
<property name="toolTip">
<string>FM deviation in Hz (for S16LE NFM format)</string>
<string>Signal bandwidth (Hz)</string>
</property>
<property name="text">
<string>2500</string>
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="agc">
<property name="toolTip">
<string>Toggle AGC (only for AM and SSB)</string>
</property>
<property name="text">
<string>AGC</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="audioActive">
<property name="toolTip">
<string>Toggle audio input</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../../sdrbase/resources/res.qrc">
<normaloff>:/sound_off.png</normaloff>
<normalon>:/sound_on.png</normalon>:/sound_off.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="audioStereo">
<property name="toolTip">
<string>Toggle mono/stereo audio input</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../../sdrbase/resources/res.qrc">
<normaloff>:/mono.png</normaloff>
<normalon>:/stereo.png</normalon>:/mono.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
<string>32000</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0">
<item row="6" column="1">
<widget class="QPushButton" name="applyBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Apply text input and/or samples format</string>
</property>
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="AddressLayout">
<item>
<widget class="QLabel" name="Addresslabel">
<property name="maximumSize">
<size>
<width>30</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Addr</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="udpAddress">
<property name="toolTip">
<string>Remote address</string>
</property>
<property name="inputMask">
<string>000.000.000.000</string>
</property>
<property name="text">
<string>127.0.0.1</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="8" column="0">
<layout class="QHBoxLayout" name="VolumeLayout">
<item>
<widget class="QLabel" name="volumeLabel">
<property name="text">
<string>Vol</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="volume">
<property name="toolTip">
<string>Audio volume</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>20</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="volumeText">
<widget class="QLabel" name="addressText">
<property name="minimumSize">
<size>
<width>18</width>
<width>170</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>20</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<string>00.000.000.000:0000/0000</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<item row="4" column="0">
<layout class="QHBoxLayout" name="FormatLayout">
<item>
<widget class="QLabel" name="label">
@ -531,49 +435,168 @@
</item>
</layout>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="SampleRateLayout">
<item row="6" column="0">
<layout class="QHBoxLayout" name="AudioPortLayout">
<item>
<widget class="QLabel" name="sampleRateLabel">
<widget class="QLabel" name="fmDevLabel">
<property name="text">
<string>SRout</string>
<string>FMd</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="sampleRate">
<widget class="QLineEdit" name="fmDeviation">
<property name="toolTip">
<string>Output sample rate (S/s)</string>
<string>FM deviation in Hz (for S16LE NFM format)</string>
</property>
<property name="text">
<string>48000</string>
<string>2500</string>
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="agc">
<property name="toolTip">
<string>Toggle AGC (only for AM and SSB)</string>
</property>
<property name="text">
<string>AGC</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="audioActive">
<property name="toolTip">
<string>Toggle audio input</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../../sdrbase/resources/res.qrc">
<normaloff>:/sound_off.png</normaloff>
<normalon>:/sound_on.png</normalon>:/sound_off.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="audioStereo">
<property name="toolTip">
<string>Toggle mono/stereo audio input</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../../sdrbase/resources/res.qrc">
<normaloff>:/mono.png</normaloff>
<normalon>:/stereo.png</normalon>:/mono.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="RFBandwidthLayout">
<item row="7" column="0">
<layout class="QHBoxLayout" name="VolumeLayout">
<item>
<widget class="QLabel" name="rfBandwidthLabel">
<widget class="QLabel" name="volumeLabel">
<property name="text">
<string>RFBW</string>
<string>Vol</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="rfBandwidth">
<widget class="QSlider" name="volume">
<property name="toolTip">
<string>Signal bandwidth (Hz)</string>
<string>Audio volume</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>20</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="volumeText">
<property name="minimumSize">
<size>
<width>18</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>32000</string>
<string>20</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="gainLabel">
<property name="text">
<string> Gain</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="gain">
<property name="toolTip">
<string>Output linear gain</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>10</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="gainText">
<property name="minimumSize">
<size>
<width>28</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Output linear gain</string>
</property>
<property name="text">
<string>00.0</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="8" column="1">
<item row="7" column="1">
<layout class="QHBoxLayout" name="SquelchLayout">
<item>
<widget class="QLabel" name="squelchLabel">
@ -672,68 +695,6 @@
</item>
</layout>
</item>
<item row="7" column="1">
<layout class="QHBoxLayout" name="GainLayout">
<item>
<widget class="QLabel" name="gainLabel">
<property name="text">
<string>Gain</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="gain">
<property name="toolTip">
<string>Output linear gain</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>10</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="gainText">
<property name="minimumSize">
<size>
<width>28</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Output linear gain</string>
</property>
<property name="text">
<string>00.0</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="6" column="1">
<widget class="QPushButton" name="applyBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Apply text input and/or samples format</string>
</property>
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="spectrumBox" native="true">