support protocol2

This commit is contained in:
2026-07-26 14:57:44 +03:00
parent 6ca18411cf
commit ec4af751cd
27 changed files with 7099 additions and 6108 deletions
+46 -6
View File
@@ -24,8 +24,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#define LOG_DATAIO
#include "cusdr_dataIO.h"
#include "cusdr_protocol2_io.h"
#include "soundout.h"
@@ -155,7 +153,21 @@ void DataIO::initDataReceiverSocket() {
}
else {
if (io->samplerate == 384000) {
if (io->samplerate == 1536000) {
newBufferSize = 512*1024;//512 * 1032;
io->networkIOMutex.lock();
DATAIO_DEBUG << "socket buffer size set to 512 kB.";
io->networkIOMutex.unlock();
}
else if (io->samplerate == 768000) {
newBufferSize = 256*1024;//256 * 1032;
io->networkIOMutex.lock();
DATAIO_DEBUG << "socket buffer size set to 256 kB.";
io->networkIOMutex.unlock();
}
else if (io->samplerate == 384000) {
newBufferSize = 128*1024;//128 * 1032;
io->networkIOMutex.lock();
@@ -185,9 +197,27 @@ void DataIO::initDataReceiverSocket() {
}
}
if (m_dataIOSocket->bind(QHostAddress(set->getHPSDRDeviceLocalAddr()),
set->getMetisPort(),
QUdpSocket::DontShareAddress))
const QHostAddress localAddress(set->getHPSDRDeviceLocalAddr());
const quint16 requestedPort = set->getMetisPort();
bool socketBound = m_dataIOSocket->bind(localAddress,
requestedPort,
QUdpSocket::DontShareAddress);
if (!socketBound && requestedPort != 0) {
io->networkIOMutex.lock();
DATAIO_DEBUG << "data receiver socket binding failed on port " << requestedPort
<< ", trying an ephemeral local port.";
io->networkIOMutex.unlock();
m_dataIOSocket->close();
socketBound = m_dataIOSocket->bind(localAddress,
0,
QUdpSocket::DontShareAddress);
if (socketBound)
set->setMetisPort(this, m_dataIOSocket->localPort());
}
if (socketBound)
//QUdpSocket::ReuseAddressHint | QUdpSocket::ShareAddress))
{
@@ -684,6 +714,16 @@ void DataIO::setSampleRate(QObject *sender, int value) {
DATAIO_DEBUG << "socket buffer size set to 128 kB.";
break;
case 768000:
bufferSize = 256*1024;//256 * 1032
DATAIO_DEBUG << "socket buffer size set to 256 kB.";
break;
case 1536000:
bufferSize = 512*1024;//512 * 1032
DATAIO_DEBUG << "socket buffer size set to 512 kB.";
break;
default:
DATAIO_DEBUG << "invalid sample rate !\n";
break;