1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-29 19:28:47 -05:00

UDP sink plugin: use channel marker address and port

This commit is contained in:
f4exb 2017-08-25 11:26:59 +02:00
parent ff23b6eb26
commit dd08c69282
5 changed files with 124 additions and 148 deletions

View File

@ -435,7 +435,7 @@ void UDPSink::configure(MessageQueue* messageQueue,
Real rfBandwidth,
int fmDeviation,
Real amModFactor,
QString& udpAddress,
const QString& udpAddress,
int udpPort,
bool channelMute,
Real gain,

View File

@ -63,7 +63,7 @@ public:
Real rfBandwidth,
int fmDeviation,
Real amModFactor,
QString& udpAddress,
const QString& udpAddress,
int udpPort,
bool channelMute,
Real gain,
@ -112,7 +112,7 @@ private:
Real rfBandwidth,
int fmDeviation,
Real amModFactor,
QString& udpAddress,
const QString& udpAddress,
int udpPort,
bool channelMute,
Real gain,
@ -162,7 +162,7 @@ private:
Real rfBandwidth,
int fmDeviation,
Real amModFactor,
QString& udpAddress,
const QString& udpAddress,
int udpPort,
bool channelMute,
Real gain,

View File

@ -68,8 +68,6 @@ void UDPSinkGUI::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->spectrumGUI->resetToDefaults();
ui->gain->setValue(10);
@ -85,10 +83,10 @@ QByteArray UDPSinkGUI::serialize() const
s.writeS32(3, m_sampleFormat);
s.writeReal(4, m_inputSampleRate);
s.writeReal(5, m_rfBandwidth);
s.writeS32(6, m_udpPort);
s.writeS32(6, m_channelMarker.getUDPReceivePort());
s.writeBlob(7, ui->spectrumGUI->serialize());
s.writeS32(8, m_channelMarker.getCenterFrequency());
s.writeString(9, m_udpAddress);
s.writeString(9, m_channelMarker.getUDPAddress());
s.writeS32(10, ui->gain->value());
s.writeS32(11, m_fmDeviation);
s.writeU32(12, m_channelMarker.getColor().rgb());
@ -137,13 +135,17 @@ bool UDPSinkGUI::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.setUDPReceivePort(s32tmp);
} else {
m_channelMarker.setUDPReceivePort(9999);
}
d.readBlob(7, &bytetmp);
ui->spectrumGUI->deserialize(bytetmp);
d.readS32(8, &s32tmp, 0);
m_channelMarker.setCenterFrequency(s32tmp);
d.readString(9, &strtmp, "127.0.0.1");
ui->udpAddress->setText(strtmp);
m_channelMarker.setUDPAddress(strtmp);
d.readS32(10, &s32tmp, 10);
ui->gain->setValue(s32tmp);
ui->gainText->setText(tr("%1").arg(s32tmp/10.0, 0, 'f', 1));
@ -291,15 +293,6 @@ void UDPSinkGUI::applySettings(bool force)
rfBandwidth = inputSampleRate;
}
m_udpAddress = ui->udpAddress->text();
int udpPort = ui->udpPort->text().toInt(&ok);
if((!ok) || (udpPort < 1024) || (udpPort > 65535))
{
udpPort = 9999;
}
int fmDeviation = ui->fmDeviation->text().toInt(&ok);
if ((!ok) || (fmDeviation < 1))
@ -318,8 +311,6 @@ void UDPSinkGUI::applySettings(bool force)
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
ui->sampleRate->setText(QString("%1").arg(inputSampleRate, 0));
ui->rfBandwidth->setText(QString("%1").arg(rfBandwidth, 0));
//ui->udpAddress->setText(m_udpAddress);
ui->udpPort->setText(QString("%1").arg(udpPort));
ui->fmDeviation->setText(QString("%1").arg(fmDeviation));
ui->amModPercent->setText(QString("%1").arg(amModPercent));
m_channelMarker.disconnect(this, SLOT(channelMarkerChanged()));
@ -373,7 +364,6 @@ void UDPSinkGUI::applySettings(bool force)
m_inputSampleRate = inputSampleRate;
m_rfBandwidth = rfBandwidth;
m_fmDeviation = fmDeviation;
m_udpPort = udpPort;
m_udpSink->configure(m_udpSink->getInputMessageQueue(),
sampleFormat,
@ -381,8 +371,8 @@ void UDPSinkGUI::applySettings(bool force)
rfBandwidth,
fmDeviation,
amModPercent / 100.0f,
m_udpAddress,
udpPort,
m_channelMarker.getUDPAddress(),
m_channelMarker.getUDPReceivePort(),
ui->channelMute->isChecked(),
ui->gain->value() / 10.0f,
ui->squelch->value() * 1.0f,
@ -402,11 +392,13 @@ void UDPSinkGUI::displaySettings()
ui->gainText->setText(tr("%1").arg(ui->gain->value()/10.0, 0, 'f', 1));
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").arg(m_channelMarker.getUDPAddress()).arg(m_channelMarker.getUDPReceivePort()));
}
void UDPSinkGUI::channelMarkerChanged()
{
this->setWindowTitle(m_channelMarker.getTitle());
displaySettings();
applySettings();
}

View File

@ -95,8 +95,6 @@ private:
Real m_inputSampleRate;
Real m_rfBandwidth;
int m_fmDeviation;
QString m_udpAddress;
int m_udpPort;
bool m_doApplySettings;
explicit UDPSinkGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* parent = NULL);

View File

@ -71,7 +71,7 @@
<property name="spacing">
<number>3</number>
</property>
<item row="1" column="2">
<item row="2" column="2">
<layout class="QHBoxLayout" name="SampleRateLayout">
<item>
<widget class="QLabel" name="sampleRateLabel">
@ -101,51 +101,7 @@
</item>
</layout>
</item>
<item row="3" column="0">
<layout class="QHBoxLayout" name="AddressLayout">
<item>
<widget class="QLabel" name="Addresslabel">
<property name="text">
<string>Addr</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="udpAddress">
<property name="toolTip">
<string>Address of listening interface (local)</string>
</property>
<property name="inputMask">
<string>000.000.000.000</string>
</property>
<property name="text">
<string>127.0.0.1</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="udpPortlabel">
<property name="text">
<string>D</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="udpPort">
<property name="toolTip">
<string>Listening data port</string>
</property>
<property name="inputMask">
<string>00000</string>
</property>
<property name="text">
<string>9999</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="2">
<item row="4" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_3">
@ -175,7 +131,7 @@
</item>
</layout>
</item>
<item row="9" column="0">
<item row="10" column="0">
<layout class="QHBoxLayout" name="BufferGaugeLayout">
<item>
<widget class="QProgressBar" name="bufferGaugeNegative">
@ -242,77 +198,7 @@
</item>
</layout>
</item>
<item row="1" column="0" rowspan="2">
<layout class="QHBoxLayout" name="FormatLayout">
<item>
<widget class="QLabel" name="sampleFormatLabel">
<property name="maximumSize">
<size>
<width>30</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Fmt</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="sampleFormat">
<property name="toolTip">
<string>Samples format</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>S16LE I/Q</string>
</property>
</item>
<item>
<property name="text">
<string>S16LE NFM</string>
</property>
</item>
<item>
<property name="text">
<string>S16LE LSB</string>
</property>
</item>
<item>
<property name="text">
<string>S16LE USB</string>
</property>
</item>
<item>
<property name="text">
<string>S16LE AM</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QToolButton" name="stereoInput">
<property name="toolTip">
<string>Toggle mono (1 channel) or stereo (2 channels) input</string>
</property>
<property name="text">
<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="8" column="0">
<item row="9" column="0">
<layout class="QHBoxLayout" name="VUMeterLayout">
<item>
<widget class="LevelMeterVU" name="volumeMeter" native="true">
@ -329,7 +215,7 @@
</item>
</layout>
</item>
<item row="8" column="2">
<item row="9" column="2">
<layout class="QHBoxLayout" name="GainLayout">
<item>
<widget class="QLabel" name="gainLabel">
@ -381,7 +267,7 @@
</item>
</layout>
</item>
<item row="9" column="2">
<item row="10" column="2">
<layout class="QHBoxLayout" name="bufferControlLayout">
<item>
<widget class="QLabel" name="bufferRWBalanceText">
@ -464,7 +350,7 @@
</item>
</layout>
</item>
<item row="4" column="2">
<item row="5" column="2">
<layout class="QHBoxLayout" name="SquelchLayout">
<item>
<widget class="QLabel" name="squelchLabel">
@ -563,7 +449,7 @@
</item>
</layout>
</item>
<item row="4" column="0">
<item row="5" column="0">
<layout class="QHBoxLayout" name="FMDevLayout">
<item>
<widget class="QLabel" name="fmDevLabel">
@ -848,6 +734,106 @@
</item>
</layout>
</item>
<item row="4" column="0">
<layout class="QHBoxLayout" name="FormatLayout">
<item>
<widget class="QLabel" name="sampleFormatLabel">
<property name="maximumSize">
<size>
<width>30</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Fmt</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="sampleFormat">
<property name="toolTip">
<string>Samples format</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>S16LE I/Q</string>
</property>
</item>
<item>
<property name="text">
<string>S16LE NFM</string>
</property>
</item>
<item>
<property name="text">
<string>S16LE LSB</string>
</property>
</item>
<item>
<property name="text">
<string>S16LE USB</string>
</property>
</item>
<item>
<property name="text">
<string>S16LE AM</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QToolButton" name="stereoInput">
<property name="toolTip">
<string>Toggle mono (1 channel) or stereo (2 channels) input</string>
</property>
<property name="text">
<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="2" column="0">
<layout class="QHBoxLayout" name="AddressLayout">
<item>
<widget class="QLabel" name="addresslabel">
<property name="maximumSize">
<size>
<width>35</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Addr</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="addressText">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>000.000.000.000:00000</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="spectrumBox" native="true">