1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 17:58:43 -05:00

SDRdaemon plugin: send configuration phase 1

This commit is contained in:
f4exb 2016-03-26 21:40:54 +01:00
parent 654a766804
commit 0822773fbb
8 changed files with 485 additions and 52 deletions

View File

@ -14,13 +14,21 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include <QDebug> #include <stdint.h>
#include <sstream>
#include <iostream>
#include <cassert>
#include <QDebug>
#include <QMessageBox>
#include <QTime> #include <QTime>
#include <QDateTime> #include <QDateTime>
#include <QString> #include <QString>
#include <QFileDialog> #include <QFileDialog>
#include <stdint.h>
#include <nanomsg/nn.h>
#include <nanomsg/pair.h>
#include "ui_sdrdaemongui.h" #include "ui_sdrdaemongui.h"
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
#include "gui/colormapper.h" #include "gui/colormapper.h"
@ -50,7 +58,11 @@ SDRdaemonGui::SDRdaemonGui(PluginAPI* pluginAPI, QWidget* parent) :
m_samplesCount(0), m_samplesCount(0),
m_tickCount(0), m_tickCount(0),
m_address("127.0.0.1"), m_address("127.0.0.1"),
m_port(9090), m_dataPort(9090),
m_controlPort(9091),
m_addressEdited(false),
m_dataPortEdited(false),
m_initSendConfiguration(false),
m_dcBlock(false), m_dcBlock(false),
m_iqCorrection(false), m_iqCorrection(false),
m_autoFollowRate(false) m_autoFollowRate(false)
@ -69,6 +81,7 @@ SDRdaemonGui::SDRdaemonGui(PluginAPI* pluginAPI, QWidget* parent) :
displaySettings(); displaySettings();
ui->applyButton->setEnabled(false); ui->applyButton->setEnabled(false);
ui->sendButton->setEnabled(false);
} }
SDRdaemonGui::~SDRdaemonGui() SDRdaemonGui::~SDRdaemonGui()
@ -94,7 +107,9 @@ QString SDRdaemonGui::getName() const
void SDRdaemonGui::resetToDefaults() void SDRdaemonGui::resetToDefaults()
{ {
m_address = "127.0.0.1"; m_address = "127.0.0.1";
m_port = 9090; m_remoteAddress = "127.0.0.1";
m_dataPort = 9090;
m_controlPort = 9091;
m_dcBlock = false; m_dcBlock = false;
m_iqCorrection = false; m_iqCorrection = false;
m_autoFollowRate = false; m_autoFollowRate = false;
@ -107,7 +122,7 @@ QByteArray SDRdaemonGui::serialize() const
SimpleSerializer s(1); SimpleSerializer s(1);
s.writeString(1, ui->address->text()); s.writeString(1, ui->address->text());
uint32_t uintval = ui->port->text().toInt(&ok); uint32_t uintval = ui->dataPort->text().toInt(&ok);
if((!ok) || (uintval < 1024) || (uintval > 65535)) { if((!ok) || (uintval < 1024) || (uintval > 65535)) {
uintval = 9090; uintval = 9090;
@ -119,6 +134,31 @@ QByteArray SDRdaemonGui::serialize() const
s.writeBool(5, m_autoFollowRate); s.writeBool(5, m_autoFollowRate);
s.writeBool(6, m_autoCorrBuffer); s.writeBool(6, m_autoCorrBuffer);
uintval = ui->controlPort->text().toInt(&ok);
if((!ok) || (uintval < 1024) || (uintval > 65535)) {
uintval = 9091;
}
s.writeU32(7, uintval);
uint32_t confFrequency = ui->freq->text().toInt(&ok);
if (ok) {
s.writeU32(8, confFrequency);
}
s.writeU32(9, ui->decim->currentIndex());
s.writeU32(10, ui->fcPos->currentIndex());
uint32_t sampleRate = ui->sampleRate->text().toInt(&ok);
if (ok) {
s.writeU32(11, sampleRate);
}
s.writeString(12, ui->specificParms->text());
return s.final(); return s.final();
} }
@ -127,11 +167,16 @@ bool SDRdaemonGui::deserialize(const QByteArray& data)
SimpleDeserializer d(data); SimpleDeserializer d(data);
QString address; QString address;
uint32_t uintval; uint32_t uintval;
quint16 port; quint16 dataPort;
bool dcBlock; bool dcBlock;
bool iqCorrection; bool iqCorrection;
bool autoFollowRate; bool autoFollowRate;
bool autoCorrBuffer; bool autoCorrBuffer;
uint32_t confFrequency;
uint32_t confSampleRate;
uint32_t confDecim;
uint32_t confFcPos;
QString confSpecificParms;
if (!d.isValid()) if (!d.isValid())
{ {
@ -147,20 +192,33 @@ bool SDRdaemonGui::deserialize(const QByteArray& data)
d.readU32(2, &uintval, 9090); d.readU32(2, &uintval, 9090);
if ((uintval > 1024) && (uintval < 65536)) { if ((uintval > 1024) && (uintval < 65536)) {
port = uintval; dataPort = uintval;
} else { } else {
port = 9090; dataPort = 9090;
} }
d.readBool(3, &dcBlock, false); d.readBool(3, &dcBlock, false);
d.readBool(4, &iqCorrection, false); d.readBool(4, &iqCorrection, false);
d.readBool(5, &autoFollowRate, false); d.readBool(5, &autoFollowRate, false);
d.readBool(6, &autoCorrBuffer, false); d.readBool(6, &autoCorrBuffer, false);
d.readU32(7, &uintval, 9091);
if ((address != m_address) || (port != m_port)) if ((uintval > 1024) && (uintval < 65536)) {
m_controlPort = uintval;
} else {
m_controlPort = 9091;
}
d.readU32(8, &confFrequency, 435000);
d.readU32(9, &confDecim, 3);
d.readU32(10, &confFcPos, 2);
d.readU32(11, &confSampleRate, 1000);
d.readString(12, &confSpecificParms, "");
if ((address != m_address) || (dataPort != m_dataPort))
{ {
m_address = address; m_address = address;
m_port = port; m_dataPort = dataPort;
configureUDPLink(); configureUDPLink();
} }
@ -179,12 +237,17 @@ bool SDRdaemonGui::deserialize(const QByteArray& data)
} }
displaySettings(); displaySettings();
displayConfigurationParameters(confFrequency, confDecim, confFcPos, confSampleRate, confSpecificParms);
m_initSendConfiguration = true;
return true; return true;
} }
else else
{ {
resetToDefaults(); resetToDefaults();
displaySettings(); displaySettings();
QString defaultSpecificParameters("");
displayConfigurationParameters(435000, 3, 2, 1000, defaultSpecificParameters);
m_initSendConfiguration = true;
return false; return false;
} }
} }
@ -264,38 +327,119 @@ void SDRdaemonGui::handleSourceMessages()
void SDRdaemonGui::displaySettings() void SDRdaemonGui::displaySettings()
{ {
ui->address->setText(m_address); ui->address->setText(m_address);
ui->port->setText(QString::number(m_port)); ui->dataPort->setText(QString::number(m_dataPort));
ui->controlPort->setText(QString::number(m_controlPort));
ui->dcOffset->setChecked(m_dcBlock); ui->dcOffset->setChecked(m_dcBlock);
ui->iqImbalance->setChecked(m_iqCorrection); ui->iqImbalance->setChecked(m_iqCorrection);
ui->autoFollowRate->setChecked(m_autoFollowRate); ui->autoFollowRate->setChecked(m_autoFollowRate);
ui->autoCorrBuffer->setChecked(m_autoCorrBuffer); ui->autoCorrBuffer->setChecked(m_autoCorrBuffer);
} }
void SDRdaemonGui::displayConfigurationParameters(uint32_t freq,
uint32_t log2Decim,
uint32_t fcPos,
uint32_t sampleRate,
QString& specParms)
{
ui->freq->setText(QString::number(freq));
ui->decim->setCurrentIndex(log2Decim);
ui->fcPos->setCurrentIndex(fcPos);
ui->sampleRate->setText(QString::number(sampleRate));
ui->specificParms->setText(specParms);
ui->specificParms->setCursorPosition(0);
}
void SDRdaemonGui::on_applyButton_clicked(bool checked) void SDRdaemonGui::on_applyButton_clicked(bool checked)
{ {
bool ok; bool dataOk, ctlOk;
QString udpAddress = ui->address->text(); QString udpAddress = ui->address->text();
int udpPort = ui->port->text().toInt(&ok); int udpDataPort = ui->dataPort->text().toInt(&dataOk);
int tcpCtlPort = ui->controlPort->text().toInt(&ctlOk);
if((!ok) || (udpPort < 1024) || (udpPort > 65535)) if((!dataOk) || (udpDataPort < 1024) || (udpDataPort > 65535))
{ {
udpPort = 9090; udpDataPort = 9090;
}
if((!ctlOk) || (tcpCtlPort < 1024) || (tcpCtlPort > 65535))
{
tcpCtlPort = 9091;
} }
m_address = udpAddress; m_address = udpAddress;
m_port = udpPort; m_dataPort = udpDataPort;
m_controlPort = tcpCtlPort;
if (m_addressEdited || m_dataPortEdited)
{
configureUDPLink(); configureUDPLink();
m_addressEdited = false;
m_dataPortEdited = false;
}
ui->applyButton->setEnabled(false); ui->applyButton->setEnabled(false);
} }
void SDRdaemonGui::on_sendButton_clicked(bool checked)
{
sendConfiguration();
ui->sendButton->setEnabled(false);
}
void SDRdaemonGui::sendConfiguration()
{
QString remoteAddress;
((SDRdaemonInput *) m_sampleSource)->getRemoteAddress(remoteAddress);
if (remoteAddress != m_remoteAddress)
{
m_remoteAddress = remoteAddress;
}
std::ostringstream os;
bool ok;
os << "decim=" << ui->decim->currentIndex()
<< ",fcpos=" << ui->fcPos->currentIndex();
uint64_t freq = ui->freq->text().toInt(&ok);
if (ok) {
os << ",freq=" << freq*1000LL;
} else {
QMessageBox::information(this, tr("Message"), tr("Invalid frequency"));
}
uint32_t srate = ui->sampleRate->text().toInt(&ok);
if (ok) {
os << ",srate=" << srate*1000;
} else {
QMessageBox::information(this, tr("Message"), tr("invalid sample rate"));
}
if ((ui->specificParms->text()).size() > 0) {
os << "," << ui->specificParms->text().toStdString();
}
qDebug() << "SDRdaemonGui::sendConfiguration:"
<< " remoteAddress: " << remoteAddress
<< " message: " << os.str().c_str();
}
void SDRdaemonGui::on_address_textEdited(const QString& arg1) void SDRdaemonGui::on_address_textEdited(const QString& arg1)
{ {
ui->applyButton->setEnabled(true); ui->applyButton->setEnabled(true);
m_addressEdited = true;
} }
void SDRdaemonGui::on_port_textEdited(const QString& arg1) void SDRdaemonGui::on_dataPort_textEdited(const QString& arg1)
{
ui->applyButton->setEnabled(true);
m_dataPortEdited = true;
}
void SDRdaemonGui::on_controlPort_textEdited(const QString& arg1)
{ {
ui->applyButton->setEnabled(true); ui->applyButton->setEnabled(true);
} }
@ -340,12 +484,38 @@ void SDRdaemonGui::on_resetIndexes_clicked(bool checked)
m_sampleSource->getInputMessageQueue()->push(message); m_sampleSource->getInputMessageQueue()->push(message);
} }
void SDRdaemonGui::on_freq_textEdited(const QString& arg1)
{
ui->sendButton->setEnabled(true);
}
void SDRdaemonGui::on_sampleRate_textEdited(const QString& arg1)
{
ui->sendButton->setEnabled(true);
}
void SDRdaemonGui::on_specificParms_textEdited(const QString& arg1)
{
ui->sendButton->setEnabled(true);
}
void SDRdaemonGui::on_decim_currentIndexChanged(int index)
{
ui->sendButton->setEnabled(true);
}
void SDRdaemonGui::on_fcPos_currentIndexChanged(int index)
{
ui->sendButton->setEnabled(true);
}
void SDRdaemonGui::configureUDPLink() void SDRdaemonGui::configureUDPLink()
{ {
qDebug() << "SDRdaemonGui::configureUDPLink: " << m_address.toStdString().c_str() qDebug() << "SDRdaemonGui::configureUDPLink: " << m_address.toStdString().c_str()
<< " : " << m_port; << " : " << m_dataPort;
SDRdaemonInput::MsgConfigureSDRdaemonUDPLink* message = SDRdaemonInput::MsgConfigureSDRdaemonUDPLink::create(m_address, m_port); SDRdaemonInput::MsgConfigureSDRdaemonUDPLink* message = SDRdaemonInput::MsgConfigureSDRdaemonUDPLink::create(m_address, m_dataPort);
m_sampleSource->getInputMessageQueue()->push(message); m_sampleSource->getInputMessageQueue()->push(message);
} }
@ -376,6 +546,12 @@ void SDRdaemonGui::updateWithStreamData()
QString s2 = QString::number(skewPerCent, 'f', 2); QString s2 = QString::number(skewPerCent, 'f', 2);
ui->skewRateText->setText(tr("%1").arg(s2)); ui->skewRateText->setText(tr("%1").arg(s2));
updateWithStreamTime(); updateWithStreamTime();
if (m_initSendConfiguration)
{
sendConfiguration();
m_initSendConfiguration = false;
}
} }
void SDRdaemonGui::updateWithStreamTime() void SDRdaemonGui::updateWithStreamTime()

View File

@ -72,13 +72,26 @@ private:
std::size_t m_tickCount; std::size_t m_tickCount;
QString m_address; QString m_address;
quint16 m_port; QString m_remoteAddress;
quint16 m_dataPort;
quint16 m_controlPort;
bool m_addressEdited;
bool m_dataPortEdited;
bool m_initSendConfiguration;
bool m_dcBlock; bool m_dcBlock;
bool m_iqCorrection; bool m_iqCorrection;
bool m_autoFollowRate; bool m_autoFollowRate;
bool m_autoCorrBuffer; bool m_autoCorrBuffer;
void displaySettings(); void displaySettings();
void displayConfigurationParameters(uint32_t freq,
uint32_t log2Decim,
uint32_t fcPos,
uint32_t sampleRate,
QString& specParms);
void displayTime(); void displayTime();
void configureUDPLink(); void configureUDPLink();
void configureAutoCorrections(); void configureAutoCorrections();
@ -86,6 +99,7 @@ private:
void updateWithAcquisition(); void updateWithAcquisition();
void updateWithStreamData(); void updateWithStreamData();
void updateWithStreamTime(); void updateWithStreamTime();
void sendConfiguration();
private slots: private slots:
void handleSourceMessages(); void handleSourceMessages();
@ -96,7 +110,14 @@ private slots:
void on_autoCorrBuffer_toggled(bool checked); void on_autoCorrBuffer_toggled(bool checked);
void on_resetIndexes_clicked(bool checked); void on_resetIndexes_clicked(bool checked);
void on_address_textEdited(const QString& arg1); void on_address_textEdited(const QString& arg1);
void on_port_textEdited(const QString& arg1); void on_dataPort_textEdited(const QString& arg1);
void on_controlPort_textEdited(const QString& arg1);
void on_sendButton_clicked(bool checked);
void on_freq_textEdited(const QString& arg1);
void on_sampleRate_textEdited(const QString& arg1);
void on_specificParms_textEdited(const QString& arg1);
void on_decim_currentIndexChanged(int index);
void on_fcPos_currentIndexChanged(int index);
void tick(); void tick();
}; };

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>398</width> <width>363</width>
<height>175</height> <height>365</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
@ -583,7 +583,7 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="Line" name="line_freq"> <widget class="Line" name="line">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
@ -605,41 +605,64 @@
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>150</width> <width>120</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Data connection IP address</string> <string>Local data connection IP address</string>
</property> </property>
<property name="text"> <property name="text">
<string>127.0.0.1</string> <string>000.000.000.000</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="portLabel"> <widget class="QLabel" name="dataPortLabel">
<property name="text"> <property name="text">
<string>Port:</string> <string>D:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="port"> <widget class="QLineEdit" name="dataPort">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>80</width> <width>16777215</width>
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Data connection port</string> <string>Local data connection port</string>
</property> </property>
<property name="text"> <property name="text">
<string>9090</string> <string>00000</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="controlPortLabel">
<property name="text">
<string>C:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="controlPort">
<property name="toolTip">
<string>Remote control port</string>
</property>
<property name="text">
<string>00000</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -677,6 +700,224 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<widget class="Line" name="line_freq">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="controlLayout1">
<item>
<widget class="QLabel" name="freqLabel">
<property name="text">
<string>Fc:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="freq">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>90</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Set center frequency (kHz)</string>
</property>
<property name="text">
<string>00000000</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="decimLabel">
<property name="text">
<string>k Dec:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="decim">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Decimation</string>
</property>
<property name="currentIndex">
<number>3</number>
</property>
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>4</string>
</property>
</item>
<item>
<property name="text">
<string>8</string>
</property>
</item>
<item>
<property name="text">
<string>16</string>
</property>
</item>
<item>
<property name="text">
<string>32</string>
</property>
</item>
<item>
<property name="text">
<string>64</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="fcPosLabel">
<property name="text">
<string> Fp:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="fcPos">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Center frequency position (Infradyne, Supradyne, Centered)</string>
</property>
<property name="currentIndex">
<number>2</number>
</property>
<item>
<property name="text">
<string>Inf</string>
</property>
</item>
<item>
<property name="text">
<string>Sup</string>
</property>
</item>
<item>
<property name="text">
<string>Cen</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<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="QPushButton" name="sendButton">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Send commands to remote SDRdaemon instance</string>
</property>
<property name="text">
<string>Send</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="controlLayout2">
<item>
<widget class="QLabel" name="sampleRateLabel">
<property name="text">
<string>SR:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="sampleRate">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Sample rate (kS/s)</string>
</property>
<property name="text">
<string>00000</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="specificParmsLAbel">
<property name="text">
<string>k Sp:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="specificParms">
<property name="toolTip">
<string>Other parameters that are hardware specific</string>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>

View File

@ -101,6 +101,14 @@ std::time_t SDRdaemonInput::getStartingTimeStamp() const
return m_startingTimeStamp; return m_startingTimeStamp;
} }
void SDRdaemonInput::getRemoteAddress(QString &s)
{
if (m_SDRdaemonUDPHandler) {
m_SDRdaemonUDPHandler->getRemoteAddress(s);
}
}
bool SDRdaemonInput::handleMessage(const Message& message) bool SDRdaemonInput::handleMessage(const Message& message)
{ {
if (MsgConfigureSDRdaemonUDPLink::match(message)) if (MsgConfigureSDRdaemonUDPLink::match(message))

View File

@ -284,6 +284,7 @@ public:
virtual int getSampleRate() const; virtual int getSampleRate() const;
virtual quint64 getCenterFrequency() const; virtual quint64 getCenterFrequency() const;
std::time_t getStartingTimeStamp() const; std::time_t getStartingTimeStamp() const;
void getRemoteAddress(QString &s);
virtual bool handleMessage(const Message& message); virtual bool handleMessage(const Message& message);

View File

@ -27,6 +27,7 @@ SDRdaemonUDPHandler::SDRdaemonUDPHandler(SampleFifo *sampleFifo, MessageQueue *o
m_sdrDaemonBuffer(m_rateDivider), m_sdrDaemonBuffer(m_rateDivider),
m_dataSocket(0), m_dataSocket(0),
m_dataAddress(QHostAddress::LocalHost), m_dataAddress(QHostAddress::LocalHost),
m_remoteAddress(QHostAddress::LocalHost),
m_dataPort(9090), m_dataPort(9090),
m_dataConnected(false), m_dataConnected(false),
m_udpBuf(0), m_udpBuf(0),
@ -128,7 +129,7 @@ void SDRdaemonUDPHandler::dataReadyRead()
while (m_dataSocket->hasPendingDatagrams()) while (m_dataSocket->hasPendingDatagrams())
{ {
qint64 pendingDataSize = m_dataSocket->pendingDatagramSize(); qint64 pendingDataSize = m_dataSocket->pendingDatagramSize();
m_udpReadBytes = m_dataSocket->readDatagram(m_udpBuf, pendingDataSize, 0, 0); m_udpReadBytes = m_dataSocket->readDatagram(m_udpBuf, pendingDataSize, &m_remoteAddress, 0);
processData(); processData();
} }
} }

View File

@ -41,6 +41,7 @@ public:
void start(); void start();
void stop(); void stop();
void configureUDPLink(const QString& address, quint16 port); void configureUDPLink(const QString& address, quint16 port);
void getRemoteAddress(QString& s) const { s = m_remoteAddress.toString(); }
void setAutoFollowRate(bool autoFollowRate) { m_sdrDaemonBuffer.setAutoFollowRate(autoFollowRate); } void setAutoFollowRate(bool autoFollowRate) { m_sdrDaemonBuffer.setAutoFollowRate(autoFollowRate); }
void setAutoCorrBuffer(bool autoCorrBuffer) { m_autoCorrBuffer = autoCorrBuffer; m_sdrDaemonBuffer.setAutoCorrBuffer(autoCorrBuffer); } void setAutoCorrBuffer(bool autoCorrBuffer) { m_autoCorrBuffer = autoCorrBuffer; m_sdrDaemonBuffer.setAutoCorrBuffer(autoCorrBuffer); }
void resetIndexes() { m_sdrDaemonBuffer.setResetIndexes(); } void resetIndexes() { m_sdrDaemonBuffer.setResetIndexes(); }
@ -51,6 +52,7 @@ private:
SDRdaemonBuffer m_sdrDaemonBuffer; SDRdaemonBuffer m_sdrDaemonBuffer;
QUdpSocket *m_dataSocket; QUdpSocket *m_dataSocket;
QHostAddress m_dataAddress; QHostAddress m_dataAddress;
QHostAddress m_remoteAddress;
quint16 m_dataPort; quint16 m_dataPort;
bool m_dataConnected; bool m_dataConnected;
char *m_udpBuf; char *m_udpBuf;

View File

@ -25,22 +25,6 @@
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Receiver Hardware</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTreeWidget" name="treeWidget">
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2"> <widget class="QWidget" name="tab_2">
<attribute name="title"> <attribute name="title">
<string>Audio Output</string> <string>Audio Output</string>
@ -74,7 +58,6 @@
<tabstops> <tabstops>
<tabstop>buttonBox</tabstop> <tabstop>buttonBox</tabstop>
<tabstop>tabWidget</tabstop> <tabstop>tabWidget</tabstop>
<tabstop>treeWidget</tabstop>
<tabstop>audioTree</tabstop> <tabstop>audioTree</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>