mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-14 04:11:48 -05:00
UDP Source: compiles
This commit is contained in:
parent
ffebc53586
commit
9ed6b40ba5
@ -16,14 +16,12 @@
|
||||
|
||||
#include "udpsrc.h"
|
||||
|
||||
#include <QTcpServer>
|
||||
#include <QTcpSocket>
|
||||
#include <QUdpSocket>
|
||||
#include <QThread>
|
||||
#include "dsp/channelizer.h"
|
||||
#include "udpsrcgui.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(UDPSrc::MsgUDPSrcConfigure, Message)
|
||||
MESSAGE_CLASS_DEFINITION(UDPSrc::MsgUDPSrcConnection, Message)
|
||||
MESSAGE_CLASS_DEFINITION(UDPSrc::MsgUDPSrcSpectrum, Message)
|
||||
|
||||
UDPSrc::UDPSrc(MessageQueue* uiMessageQueue, UDPSrcGUI* udpSrcGUI, SampleSink* spectrum) :
|
||||
@ -31,6 +29,8 @@ UDPSrc::UDPSrc(MessageQueue* uiMessageQueue, UDPSrcGUI* udpSrcGUI, SampleSink* s
|
||||
{
|
||||
setObjectName("UDPSrc");
|
||||
|
||||
m_socket = new QUdpSocket(this);
|
||||
|
||||
m_inputSampleRate = 96000;
|
||||
m_sampleFormat = FormatSSB;
|
||||
m_outputSampleRate = 48000;
|
||||
@ -58,12 +58,13 @@ UDPSrc::UDPSrc(MessageQueue* uiMessageQueue, UDPSrcGUI* udpSrcGUI, SampleSink* s
|
||||
|
||||
UDPSrc::~UDPSrc()
|
||||
{
|
||||
delete m_socket;
|
||||
if (UDPFilter) delete UDPFilter;
|
||||
}
|
||||
|
||||
void UDPSrc::configure(MessageQueue* messageQueue, SampleFormat sampleFormat, Real outputSampleRate, Real rfBandwidth, int udpPort, int boost)
|
||||
void UDPSrc::configure(MessageQueue* messageQueue, SampleFormat sampleFormat, Real outputSampleRate, Real rfBandwidth, QString& udpAddress, int udpPort, int boost)
|
||||
{
|
||||
Message* cmd = MsgUDPSrcConfigure::create(sampleFormat, outputSampleRate, rfBandwidth, udpPort, boost);
|
||||
Message* cmd = MsgUDPSrcConfigure::create(sampleFormat, outputSampleRate, rfBandwidth, udpAddress, udpPort, boost);
|
||||
messageQueue->push(cmd);
|
||||
}
|
||||
|
||||
@ -105,39 +106,43 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
m_spectrum->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), positiveOnly);
|
||||
}
|
||||
|
||||
for(int i = 0; i < m_s16leSockets.count(); i++)
|
||||
if (m_sampleFormat == FormatSSB)
|
||||
{
|
||||
m_s16leSockets[i].socket->write((const char*)&m_sampleBuffer[0], m_sampleBuffer.size() * 4);
|
||||
}
|
||||
|
||||
if((m_sampleFormat == FormatSSB) && (m_ssbSockets.count() > 0)) {
|
||||
for(SampleVector::const_iterator it = m_sampleBuffer.begin(); it != m_sampleBuffer.end(); ++it) {
|
||||
for(SampleVector::const_iterator it = m_sampleBuffer.begin(); it != m_sampleBuffer.end(); ++it)
|
||||
{
|
||||
//Complex cj(it->real() / 30000.0, it->imag() / 30000.0);
|
||||
Complex cj(it->real(), it->imag());
|
||||
int n_out = UDPFilter->runSSB(cj, &sideband, true);
|
||||
if (n_out) {
|
||||
for (int i = 0; i < n_out; i+=2) {
|
||||
|
||||
if (n_out)
|
||||
{
|
||||
for (int i = 0; i < n_out; i+=2)
|
||||
{
|
||||
//l = (sideband[i].real() + sideband[i].imag()) * 0.7 * 32000.0;
|
||||
//r = (sideband[i+1].real() + sideband[i+1].imag()) * 0.7 * 32000.0;
|
||||
l = (sideband[i].real() + sideband[i].imag()) * 0.7;
|
||||
r = (sideband[i+1].real() + sideband[i+1].imag()) * 0.7;
|
||||
m_sampleBufferSSB.push_back(Sample(l, r));
|
||||
}
|
||||
for(int i = 0; i < m_ssbSockets.count(); i++)
|
||||
m_ssbSockets[i].socket->write((const char*)&m_sampleBufferSSB[0], n_out * 2);
|
||||
|
||||
m_socket->writeDatagram((const char*)&m_sampleBufferSSB[0], (qint64 ) (n_out * 2), m_udpAddress, m_udpPort);
|
||||
m_sampleBufferSSB.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if((m_sampleFormat == FormatNFM) && (m_ssbSockets.count() > 0)) {
|
||||
for(SampleVector::const_iterator it = m_sampleBuffer.begin(); it != m_sampleBuffer.end(); ++it) {
|
||||
else if (m_sampleFormat == FormatNFM)
|
||||
{
|
||||
for(SampleVector::const_iterator it = m_sampleBuffer.begin(); it != m_sampleBuffer.end(); ++it)
|
||||
{
|
||||
Complex cj(it->real() / 32768.0f, it->imag() / 32768.0f);
|
||||
// An FFT filter here is overkill, but was already set up for SSB
|
||||
int n_out = UDPFilter->runFilt(cj, &sideband);
|
||||
if (n_out) {
|
||||
|
||||
if (n_out)
|
||||
{
|
||||
Real sum = 1.0;
|
||||
for (int i = 0; i < n_out; i+=2) {
|
||||
for (int i = 0; i < n_out; i+=2)
|
||||
{
|
||||
l = m_this.real() * (m_last.imag() - sideband[i].imag())
|
||||
- m_this.imag() * (m_last.real() - sideband[i].real());
|
||||
m_last = sideband[i];
|
||||
@ -149,32 +154,25 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
}
|
||||
// TODO: correct levels
|
||||
m_scale = 24000 * udpFftLen / sum;
|
||||
for(int i = 0; i < m_ssbSockets.count(); i++)
|
||||
m_ssbSockets[i].socket->write((const char*)&m_sampleBufferSSB[0], n_out * 2);
|
||||
m_socket->writeDatagram((const char*)&m_sampleBufferSSB[0], (qint64 ) (n_out * 2), m_udpAddress, m_udpPort);
|
||||
m_sampleBufferSSB.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_socket->writeDatagram((const char*)&m_sampleBuffer[0], (qint64 ) (m_sampleBuffer.size() * 4), m_udpAddress, m_udpPort);
|
||||
}
|
||||
|
||||
m_settingsMutex.unlock();
|
||||
}
|
||||
|
||||
void UDPSrc::start()
|
||||
{
|
||||
m_udpServer = new QTcpServer();
|
||||
connect(m_udpServer, SIGNAL(newConnection()), this, SLOT(onNewConnection()));
|
||||
connect(m_udpServer, SIGNAL(acceptError(QAbstractSocket::SocketError)), this, SLOT(onUdpServerError(QAbstractSocket::SocketError)));
|
||||
m_udpServer->listen(QHostAddress::Any, m_udpPort);
|
||||
}
|
||||
|
||||
void UDPSrc::stop()
|
||||
{
|
||||
closeAllSockets(&m_ssbSockets);
|
||||
closeAllSockets(&m_s16leSockets);
|
||||
|
||||
if(m_udpServer->isListening())
|
||||
m_udpServer->close();
|
||||
delete m_udpServer;
|
||||
}
|
||||
|
||||
bool UDPSrc::handleMessage(const Message& cmd)
|
||||
@ -209,16 +207,14 @@ bool UDPSrc::handleMessage(const Message& cmd)
|
||||
m_outputSampleRate = cfg.getOutputSampleRate();
|
||||
m_rfBandwidth = cfg.getRFBandwidth();
|
||||
|
||||
if (cfg.getUDPAddress() != m_udpAddress.toString())
|
||||
{
|
||||
m_udpAddress.setAddress(cfg.getUDPAddress());
|
||||
}
|
||||
|
||||
if (cfg.getUDPPort() != m_udpPort)
|
||||
{
|
||||
m_udpPort = cfg.getUDPPort();
|
||||
|
||||
if(m_udpServer->isListening())
|
||||
{
|
||||
m_udpServer->close();
|
||||
}
|
||||
|
||||
m_udpServer->listen(QHostAddress::Any, m_udpPort);
|
||||
}
|
||||
|
||||
m_boost = cfg.getBoost();
|
||||
@ -239,7 +235,9 @@ bool UDPSrc::handleMessage(const Message& cmd)
|
||||
qDebug() << " - MsgUDPSrcConfigure: m_sampleFormat: " << m_sampleFormat
|
||||
<< " m_outputSampleRate: " << m_outputSampleRate
|
||||
<< " m_rfBandwidth: " << m_rfBandwidth
|
||||
<< " m_boost: " << m_boost;
|
||||
<< " m_boost: " << m_boost
|
||||
<< " m_udpAddress: " << cfg.getUDPAddress()
|
||||
<< " m_udpPort: " << m_udpPort;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -265,104 +263,3 @@ bool UDPSrc::handleMessage(const Message& cmd)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UDPSrc::closeAllSockets(Sockets* sockets)
|
||||
{
|
||||
for(int i = 0; i < sockets->count(); ++i)
|
||||
{
|
||||
MsgUDPSrcConnection* msg = MsgUDPSrcConnection::create(false, sockets->at(i).id, QHostAddress(), 0);
|
||||
m_uiMessageQueue->push(msg);
|
||||
sockets->at(i).socket->close();
|
||||
}
|
||||
}
|
||||
|
||||
void UDPSrc::onNewConnection()
|
||||
{
|
||||
qDebug("UDPSrc::onNewConnection");
|
||||
|
||||
while(m_udpServer->hasPendingConnections())
|
||||
{
|
||||
qDebug("UDPSrc::onNewConnection: has a pending connection");
|
||||
QTcpSocket* connection = m_udpServer->nextPendingConnection();
|
||||
connection->setSocketOption(QAbstractSocket:: KeepAliveOption, 1);
|
||||
connect(connection, SIGNAL(disconnected()), this, SLOT(onDisconnected()));
|
||||
|
||||
switch(m_sampleFormat) {
|
||||
|
||||
case FormatNFM:
|
||||
case FormatSSB:
|
||||
{
|
||||
quint32 id = (FormatSSB << 24) | m_nextSSBId;
|
||||
MsgUDPSrcConnection* msg = MsgUDPSrcConnection::create(true, id, connection->peerAddress(), connection->peerPort());
|
||||
m_nextSSBId = (m_nextSSBId + 1) & 0xffffff;
|
||||
m_ssbSockets.push_back(Socket(id, connection));
|
||||
m_uiMessageQueue->push(msg);
|
||||
break;
|
||||
}
|
||||
|
||||
case FormatS16LE:
|
||||
{
|
||||
qDebug("UDPSrc::onNewConnection: establish new S16LE connection");
|
||||
quint32 id = (FormatS16LE << 24) | m_nextS16leId;
|
||||
MsgUDPSrcConnection* msg = MsgUDPSrcConnection::create(true, id, connection->peerAddress(), connection->peerPort());
|
||||
m_nextS16leId = (m_nextS16leId + 1) & 0xffffff;
|
||||
m_s16leSockets.push_back(Socket(id, connection));
|
||||
m_uiMessageQueue->push(msg);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
delete connection;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UDPSrc::onDisconnected()
|
||||
{
|
||||
quint32 id;
|
||||
QTcpSocket* socket = 0;
|
||||
|
||||
qDebug("UDPSrc::onDisconnected");
|
||||
|
||||
for(int i = 0; i < m_ssbSockets.count(); i++)
|
||||
{
|
||||
if(m_ssbSockets[i].socket == sender())
|
||||
{
|
||||
id = m_ssbSockets[i].id;
|
||||
socket = m_ssbSockets[i].socket;
|
||||
socket->close();
|
||||
m_ssbSockets.removeAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(socket == 0)
|
||||
{
|
||||
for(int i = 0; i < m_s16leSockets.count(); i++)
|
||||
{
|
||||
if(m_s16leSockets[i].socket == sender())
|
||||
{
|
||||
qDebug("UDPSrc::onDisconnected: remove S16LE socket #%d", i);
|
||||
|
||||
id = m_s16leSockets[i].id;
|
||||
socket = m_s16leSockets[i].socket;
|
||||
socket->close();
|
||||
m_s16leSockets.removeAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(socket != 0)
|
||||
{
|
||||
MsgUDPSrcConnection* msg = MsgUDPSrcConnection::create(false, id, QHostAddress(), 0);
|
||||
m_uiMessageQueue->push(msg);
|
||||
socket->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
void UDPSrc::onUdpServerError(QAbstractSocket::SocketError socketError)
|
||||
{
|
||||
qDebug("UDPSrc::onUdpServerError: %s", qPrintable(m_udpServer->errorString()));
|
||||
}
|
||||
|
@ -11,8 +11,7 @@
|
||||
|
||||
#define udpFftLen 2048
|
||||
|
||||
class QTcpServer;
|
||||
class QTcpSocket;
|
||||
class QUdpSocket;
|
||||
class UDPSrcGUI;
|
||||
|
||||
class UDPSrc : public SampleSink {
|
||||
@ -29,7 +28,7 @@ public:
|
||||
UDPSrc(MessageQueue* uiMessageQueue, UDPSrcGUI* udpSrcGUI, SampleSink* spectrum);
|
||||
virtual ~UDPSrc();
|
||||
|
||||
void configure(MessageQueue* messageQueue, SampleFormat sampleFormat, Real outputSampleRate, Real rfBandwidth, int udpPort, int boost);
|
||||
void configure(MessageQueue* messageQueue, SampleFormat sampleFormat, Real outputSampleRate, Real rfBandwidth, QString& udpAddress, int udpPort, int boost);
|
||||
void setSpectrum(MessageQueue* messageQueue, bool enabled);
|
||||
Real getMagSq() const { return m_magsq; }
|
||||
|
||||
@ -38,35 +37,6 @@ public:
|
||||
virtual void stop();
|
||||
virtual bool handleMessage(const Message& cmd);
|
||||
|
||||
class MsgUDPSrcConnection : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
bool getConnect() const { return m_connect; }
|
||||
quint32 getID() const { return m_id; }
|
||||
const QHostAddress& getPeerAddress() const { return m_peerAddress; }
|
||||
int getPeerPort() const { return m_peerPort; }
|
||||
|
||||
static MsgUDPSrcConnection* create(bool connect, quint32 id, const QHostAddress& peerAddress, int peerPort)
|
||||
{
|
||||
return new MsgUDPSrcConnection(connect, id, peerAddress, peerPort);
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_connect;
|
||||
quint32 m_id;
|
||||
QHostAddress m_peerAddress;
|
||||
int m_peerPort;
|
||||
|
||||
MsgUDPSrcConnection(bool connect, quint32 id, const QHostAddress& peerAddress, int peerPort) :
|
||||
Message(),
|
||||
m_connect(connect),
|
||||
m_id(id),
|
||||
m_peerAddress(peerAddress),
|
||||
m_peerPort(peerPort)
|
||||
{ }
|
||||
};
|
||||
|
||||
protected:
|
||||
class MsgUDPSrcConfigure : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
@ -75,26 +45,29 @@ protected:
|
||||
SampleFormat getSampleFormat() const { return m_sampleFormat; }
|
||||
Real getOutputSampleRate() const { return m_outputSampleRate; }
|
||||
Real getRFBandwidth() const { return m_rfBandwidth; }
|
||||
const QString& getUDPAddress() const { return m_udpAddress; }
|
||||
int getUDPPort() const { return m_udpPort; }
|
||||
int getBoost() const { return m_boost; }
|
||||
|
||||
static MsgUDPSrcConfigure* create(SampleFormat sampleFormat, Real sampleRate, Real rfBandwidth, int udpPort, int boost)
|
||||
static MsgUDPSrcConfigure* create(SampleFormat sampleFormat, Real sampleRate, Real rfBandwidth, QString& udpAddress, int udpPort, int boost)
|
||||
{
|
||||
return new MsgUDPSrcConfigure(sampleFormat, sampleRate, rfBandwidth, udpPort, boost);
|
||||
return new MsgUDPSrcConfigure(sampleFormat, sampleRate, rfBandwidth, udpAddress, udpPort, boost);
|
||||
}
|
||||
|
||||
private:
|
||||
SampleFormat m_sampleFormat;
|
||||
Real m_outputSampleRate;
|
||||
Real m_rfBandwidth;
|
||||
QString m_udpAddress;
|
||||
int m_udpPort;
|
||||
int m_boost;
|
||||
|
||||
MsgUDPSrcConfigure(SampleFormat sampleFormat, Real outputSampleRate, Real rfBandwidth, int udpPort, int boost) :
|
||||
MsgUDPSrcConfigure(SampleFormat sampleFormat, Real outputSampleRate, Real rfBandwidth, QString& udpAddress, int udpPort, int boost) :
|
||||
Message(),
|
||||
m_sampleFormat(sampleFormat),
|
||||
m_outputSampleRate(outputSampleRate),
|
||||
m_rfBandwidth(rfBandwidth),
|
||||
m_udpAddress(udpAddress),
|
||||
m_udpPort(udpPort),
|
||||
m_boost(boost)
|
||||
{ }
|
||||
@ -121,13 +94,15 @@ protected:
|
||||
|
||||
MessageQueue* m_uiMessageQueue;
|
||||
UDPSrcGUI* m_udpSrcGUI;
|
||||
QUdpSocket *m_socket;
|
||||
|
||||
int m_inputSampleRate;
|
||||
|
||||
int m_sampleFormat;
|
||||
Real m_outputSampleRate;
|
||||
Real m_rfBandwidth;
|
||||
int m_udpPort;
|
||||
QHostAddress m_udpAddress;
|
||||
quint16 m_udpPort;
|
||||
int m_boost;
|
||||
Real m_magsq;
|
||||
|
||||
@ -144,29 +119,10 @@ protected:
|
||||
SampleSink* m_spectrum;
|
||||
bool m_spectrumEnabled;
|
||||
|
||||
QTcpServer* m_udpServer;
|
||||
struct Socket {
|
||||
quint32 id;
|
||||
QTcpSocket* socket;
|
||||
Socket(quint32 _id, QTcpSocket* _socket) :
|
||||
id(_id),
|
||||
socket(_socket)
|
||||
{ }
|
||||
};
|
||||
typedef QList<Socket> Sockets;
|
||||
Sockets m_ssbSockets;
|
||||
Sockets m_s16leSockets;
|
||||
quint32 m_nextSSBId;
|
||||
quint32 m_nextS16leId;
|
||||
|
||||
QMutex m_settingsMutex;
|
||||
|
||||
void closeAllSockets(Sockets* sockets);
|
||||
|
||||
protected slots:
|
||||
void onNewConnection();
|
||||
void onDisconnected();
|
||||
void onUdpServerError(QAbstractSocket::SocketError socketError);
|
||||
};
|
||||
|
||||
#endif // INCLUDE_UDPSRC_H
|
||||
|
@ -51,6 +51,7 @@ void UDPSrcGUI::resetToDefaults()
|
||||
ui->sampleFormat->setCurrentIndex(0);
|
||||
ui->sampleRate->setText("48000");
|
||||
ui->rfBandwidth->setText("32000");
|
||||
ui->udpAddress->setText("127.0.0.1");
|
||||
ui->udpPort->setText("9999");
|
||||
ui->spectrumGUI->resetToDefaults();
|
||||
ui->boost->setValue(1);
|
||||
@ -71,6 +72,7 @@ QByteArray UDPSrcGUI::serialize() const
|
||||
s.writeBlob(7, ui->spectrumGUI->serialize());
|
||||
s.writeS32(8, (qint32)m_boost);
|
||||
s.writeS32(9, m_channelMarker.getCenterFrequency());
|
||||
s.writeString(10, m_udpAddress);
|
||||
return s.final();
|
||||
}
|
||||
|
||||
@ -87,6 +89,7 @@ bool UDPSrcGUI::deserialize(const QByteArray& data)
|
||||
if (d.getVersion() == 1)
|
||||
{
|
||||
QByteArray bytetmp;
|
||||
QString strtmp;
|
||||
qint32 s32tmp;
|
||||
Real realtmp;
|
||||
|
||||
@ -124,6 +127,8 @@ bool UDPSrcGUI::deserialize(const QByteArray& data)
|
||||
ui->boost->setValue(s32tmp);
|
||||
d.readS32(9, &s32tmp, 0);
|
||||
m_channelMarker.setCenterFrequency(s32tmp);
|
||||
d.readString(10, &strtmp, "127.0.0.1");
|
||||
ui->udpAddress->setText(strtmp);
|
||||
|
||||
blockApplySettings(false);
|
||||
m_channelMarker.blockSignals(false);
|
||||
@ -141,31 +146,7 @@ bool UDPSrcGUI::deserialize(const QByteArray& data)
|
||||
bool UDPSrcGUI::handleMessage(const Message& message)
|
||||
{
|
||||
qDebug() << "UDPSrcGUI::handleMessage";
|
||||
|
||||
if (UDPSrc::MsgUDPSrcConnection::match(message))
|
||||
{
|
||||
UDPSrc::MsgUDPSrcConnection& con = (UDPSrc::MsgUDPSrcConnection&) message;
|
||||
|
||||
if(con.getConnect())
|
||||
{
|
||||
addConnection(con.getID(), con.getPeerAddress(), con.getPeerPort());
|
||||
}
|
||||
else
|
||||
{
|
||||
delConnection(con.getID());
|
||||
}
|
||||
|
||||
qDebug() << "UDPSrcGUI::handleMessage: UDPSrc::MsgUDPSrcConnection: " << con.getConnect()
|
||||
<< " ID: " << con.getID()
|
||||
<< " peerAddress: " << con.getPeerAddress()
|
||||
<< " peerPort: " << con.getPeerPort();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void UDPSrcGUI::channelMarkerChanged()
|
||||
@ -264,6 +245,7 @@ void UDPSrcGUI::applySettings()
|
||||
rfBandwidth = outputSampleRate;
|
||||
}
|
||||
|
||||
m_udpAddress = ui->udpAddress->text();
|
||||
int udpPort = ui->udpPort->text().toInt(&ok);
|
||||
|
||||
if((!ok) || (udpPort < 1) || (udpPort > 65535))
|
||||
@ -278,6 +260,7 @@ void UDPSrcGUI::applySettings()
|
||||
ui->deltaMinus->setChecked(m_channelMarker.getCenterFrequency() < 0);
|
||||
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->boost->setValue(boost);
|
||||
m_channelMarker.disconnect(this, SLOT(channelMarkerChanged()));
|
||||
@ -317,6 +300,7 @@ void UDPSrcGUI::applySettings()
|
||||
sampleFormat,
|
||||
outputSampleRate,
|
||||
rfBandwidth,
|
||||
m_udpAddress,
|
||||
udpPort,
|
||||
boost);
|
||||
|
||||
@ -393,24 +377,3 @@ void UDPSrcGUI::onMenuDoubleClicked()
|
||||
bcsw->show();
|
||||
}
|
||||
}
|
||||
|
||||
void UDPSrcGUI::addConnection(quint32 id, const QHostAddress& peerAddress, int peerPort)
|
||||
{
|
||||
QStringList l;
|
||||
l.append(QString("%1:%2").arg(peerAddress.toString()).arg(peerPort));
|
||||
new QTreeWidgetItem(ui->connections, l, id);
|
||||
ui->connectedClientsBox->setWindowTitle(tr("Connected Clients (%1)").arg(ui->connections->topLevelItemCount()));
|
||||
}
|
||||
|
||||
void UDPSrcGUI::delConnection(quint32 id)
|
||||
{
|
||||
for(int i = 0; i < ui->connections->topLevelItemCount(); i++)
|
||||
{
|
||||
if(ui->connections->topLevelItem(i)->type() == (int)id)
|
||||
{
|
||||
delete ui->connections->topLevelItem(i);
|
||||
ui->connectedClientsBox->setWindowTitle(tr("Connected Clients (%1)").arg(ui->connections->topLevelItemCount()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ private slots:
|
||||
void on_sampleFormat_currentIndexChanged(int index);
|
||||
void on_sampleRate_textEdited(const QString& arg1);
|
||||
void on_rfBandwidth_textEdited(const QString& arg1);
|
||||
void on_udpAddress_textEdited(const QString& arg1);
|
||||
void on_udpPort_textEdited(const QString& arg1);
|
||||
void on_applyBtn_clicked();
|
||||
void onWidgetRolled(QWidget* widget, bool rollDown);
|
||||
@ -63,6 +64,7 @@ private:
|
||||
Real m_outputSampleRate;
|
||||
Real m_rfBandwidth;
|
||||
int m_boost;
|
||||
QString m_udpAddress;
|
||||
int m_udpPort;
|
||||
bool m_basicSettingsShown;
|
||||
bool m_doApplySettings;
|
||||
@ -77,9 +79,6 @@ private:
|
||||
|
||||
void blockApplySettings(bool block);
|
||||
void applySettings();
|
||||
|
||||
void addConnection(quint32 id, const QHostAddress& peerAddress, int peerPort);
|
||||
void delConnection(quint32 id);
|
||||
};
|
||||
|
||||
#endif // INCLUDE_UDPSRCGUI_H
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>443</height>
|
||||
<width>294</width>
|
||||
<height>434</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -18,7 +18,7 @@
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>5</y>
|
||||
<width>201</width>
|
||||
<width>241</width>
|
||||
<height>142</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -44,83 +44,84 @@
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Sample Format</string>
|
||||
<string>Format</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QComboBox" name="sampleFormat">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="ChannelPowerLayout">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>S16LE SSB</string>
|
||||
</property>
|
||||
<spacer name="horizontalSpacer">
|
||||
<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>
|
||||
<property name="text">
|
||||
<string>S16LE NFM</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="channelPower">
|
||||
<property name="toolTip">
|
||||
<string>Channel power</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>S16LE I/Q</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="channelPowerUnits">
|
||||
<property name="text">
|
||||
<string> dB</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="rfBandwidth">
|
||||
<property name="text">
|
||||
<string>32000</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>RF Bandwidth (Hz)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Samplerate (Hz)</string>
|
||||
<string>Rate (Hz)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>UDP Port</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="sampleRate">
|
||||
<property name="text">
|
||||
<string>48000</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLineEdit" name="udpPort">
|
||||
<property name="text">
|
||||
<string>9999</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QPushButton" name="applyBtn">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Apply</string>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="7" column="1">
|
||||
<layout class="QHBoxLayout" name="BoostLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="boostLabel">
|
||||
<property name="text">
|
||||
<string>Boost</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="boost">
|
||||
<property name="maximum">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="boostText">
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="DeltaFrequencyLayout">
|
||||
@ -252,69 +253,90 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="ChannelPowerLayout">
|
||||
<item row="5" column="0">
|
||||
<layout class="QHBoxLayout" name="PortLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<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="QLabel" name="channelPower">
|
||||
<property name="toolTip">
|
||||
<string>Channel power</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<widget class="QLabel" name="udpPortlabel">
|
||||
<property name="text">
|
||||
<string>0.0</string>
|
||||
<string>Port</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="channelPowerUnits">
|
||||
<widget class="QLineEdit" name="udpPort">
|
||||
<property name="text">
|
||||
<string> dB</string>
|
||||
<string>9999</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<layout class="QHBoxLayout" name="BoostLayout">
|
||||
<widget class="QLineEdit" name="rfBandwidth">
|
||||
<property name="text">
|
||||
<string>32000</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QPushButton" name="applyBtn">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Apply</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>RF BW (Hz)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="sampleRate">
|
||||
<property name="text">
|
||||
<string>48000</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QComboBox" name="sampleFormat">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="boostLabel">
|
||||
<property name="text">
|
||||
<string>S16LE SSB</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>S16LE NFM</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>S16LE I/Q</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<layout class="QHBoxLayout" name="AddressLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="Addresslabel">
|
||||
<property name="text">
|
||||
<string>Boost</string>
|
||||
<string>Addr</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="boost">
|
||||
<property name="maximum">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="boostText">
|
||||
<widget class="QLineEdit" name="udpAddress">
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
<string>127.0.0.1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
Reference in New Issue
Block a user