SDRDaemonSink: use QUdpSocket: cleanup

pull/228/head
f4exb 2018-09-17 03:53:46 +02:00
rodzic aac6d09622
commit 7bbb0b426d
4 zmienionych plików z 20 dodań i 20 usunięć

Wyświetl plik

@ -19,7 +19,6 @@ set(sdrdaemonsink_SOURCES
sdrdaemonsinkthread.cpp
udpsinkfec.cpp
udpsinkfecworker.cpp
UDPSocket.cpp
)
set(sdrdaemonsink_HEADERS
@ -30,7 +29,6 @@ set(sdrdaemonsink_HEADERS
sdrdaemonsinkthread.h
udpsinkfec.h
udpsinkfecworker.h
UDPSocket.h
)
set(sdrdaemonsink_FORMS

Wyświetl plik

@ -26,7 +26,7 @@ void SDRdaemonSinkSettings::resetToDefaults()
{
m_centerFrequency = 435000*1000;
m_sampleRate = 48000;
m_txDelay = 0.5;
m_txDelay = 0.35;
m_nbFECBlocks = 0;
m_apiAddress = "127.0.0.1";
m_apiPort = 9091;

Wyświetl plik

@ -24,6 +24,7 @@ MESSAGE_CLASS_DEFINITION(UDPSinkFECWorker::MsgStartStop, Message)
UDPSinkFECWorker::UDPSinkFECWorker() :
m_running(false),
m_udpSocket(0),
m_remotePort(9090)
{
m_cm256Valid = m_cm256.isInitialized();
@ -133,11 +134,14 @@ void UDPSinkFECWorker::encodeAndTransmit(SDRDaemonSuperBlock *txBlockx, uint16_t
if ((nbBlocksFEC == 0) || !m_cm256Valid)
{
for (unsigned int i = 0; i < SDRDaemonNbOrginalBlocks; i++)
if (m_udpSocket)
{
//m_socket.SendDataGram((const void *) &txBlockx[i], SDRDaemonUdpSize, m_remoteAddress.toStdString(), (uint32_t) m_remotePort);
m_udpSocket->writeDatagram((const char *) &txBlockx[i], SDRDaemonUdpSize, m_remoteHostAddress, m_remotePort);
usleep(txDelay);
for (unsigned int i = 0; i < SDRDaemonNbOrginalBlocks; i++)
{
//m_socket.SendDataGram((const void *) &txBlockx[i], SDRDaemonUdpSize, m_remoteAddress.toStdString(), (uint32_t) m_remotePort);
m_udpSocket->writeDatagram((const char *) &txBlockx[i], SDRDaemonUdpSize, m_remoteHostAddress, m_remotePort);
usleep(txDelay);
}
}
}
else
@ -176,18 +180,19 @@ void UDPSinkFECWorker::encodeAndTransmit(SDRDaemonSuperBlock *txBlockx, uint16_t
}
// Transmit all blocks
for (int i = 0; i < cm256Params.OriginalCount + cm256Params.RecoveryCount; i++)
if (m_udpSocket)
{
#ifdef SDRDAEMON_PUNCTURE
if (i == SDRDAEMON_PUNCTURE) {
continue;
}
#endif
for (int i = 0; i < cm256Params.OriginalCount + cm256Params.RecoveryCount; i++)
{
#ifdef SDRDAEMON_PUNCTURE
if (i == SDRDAEMON_PUNCTURE) {
continue;
}
#endif
//m_socket.SendDataGram((const void *) &txBlockx[i], SDRDaemonUdpSize, m_remoteAddress.toStdString(), (uint32_t) m_remotePort);
m_udpSocket->writeDatagram((const char *) &txBlockx[i], SDRDaemonUdpSize, m_remoteHostAddress, m_remotePort);
usleep(txDelay);
m_udpSocket->writeDatagram((const char *) &txBlockx[i], SDRDaemonUdpSize, m_remoteHostAddress, m_remotePort);
usleep(txDelay);
}
}
}
}

Wyświetl plik

@ -28,8 +28,6 @@
#include "util/message.h"
#include "channel/sdrdaemondatablock.h"
#include "UDPSocket.h"
class QUdpSocket;
class UDPSinkFECWorker : public QThread
@ -140,7 +138,6 @@ private:
bool m_running;
CM256 m_cm256; //!< CM256 library object
bool m_cm256Valid; //!< true if CM256 library is initialized correctly
UDPSocket m_socket;
QUdpSocket *m_udpSocket;
QString m_remoteAddress;
uint16_t m_remotePort;