protocol 2
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#define LOG_DATAIO
|
||||
|
||||
#include "cusdr_dataIO.h"
|
||||
#include "cusdr_protocol2_io.h"
|
||||
#include "soundout.h"
|
||||
|
||||
#if defined(Q_OS_WIN32)
|
||||
@@ -41,6 +42,7 @@ DataIO::DataIO(THPSDRParameter *ioData)
|
||||
, set(Settings::instance())
|
||||
, io(ioData)
|
||||
, m_dataIOSocketOn(false)
|
||||
, m_protocol2(0)
|
||||
, m_setNetworkDeviceHeader(true)
|
||||
, m_sequence(0)
|
||||
, m_oldSequence(-1)
|
||||
@@ -56,6 +58,7 @@ DataIO::DataIO(THPSDRParameter *ioData)
|
||||
, m_stopped(false)
|
||||
{
|
||||
m_dataIOSocket = 0;
|
||||
m_protocol2 = new Protocol2DataPath(set, io, this);
|
||||
|
||||
m_metisGetDataSignature.resize(3);
|
||||
m_metisGetDataSignature[0] = (char)0xEF;
|
||||
@@ -119,6 +122,9 @@ void DataIO::stop() {
|
||||
m_stopped = true;
|
||||
io->networkIOMutex.unlock();
|
||||
|
||||
if (m_protocol2 && m_protocol2->isActive())
|
||||
m_protocol2->stop();
|
||||
|
||||
if(m_pSoundCardOut) {
|
||||
SleeperThread::msleep(100);
|
||||
m_pSoundCardOut->Stop();
|
||||
@@ -128,6 +134,11 @@ void DataIO::stop() {
|
||||
|
||||
void DataIO::initDataReceiverSocket() {
|
||||
|
||||
if (m_protocol2 && m_protocol2->isActive()) {
|
||||
m_dataIOSocketOn = m_protocol2->initSockets();
|
||||
return;
|
||||
}
|
||||
|
||||
m_dataIOSocket = new QUdpSocket();
|
||||
|
||||
int newBufferSize;
|
||||
@@ -230,6 +241,9 @@ void DataIO::initDataReceiverSocket() {
|
||||
|
||||
void DataIO::readDeviceData() {
|
||||
|
||||
if (m_protocol2 && m_protocol2->isActive())
|
||||
return;
|
||||
|
||||
while (m_dataIOSocket->hasPendingDatagrams()) {
|
||||
|
||||
QMutexLocker locker(&io->networkIOMutex);
|
||||
@@ -357,6 +371,11 @@ void DataIO::readData() {
|
||||
|
||||
void DataIO::sendInitFramesToNetworkDevice(int rx) {
|
||||
|
||||
if (m_protocol2 && m_protocol2->isActive()) {
|
||||
m_protocol2->sendInitFramesToNetworkDevice(rx);
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray initDatagram;
|
||||
initDatagram.resize(1032);
|
||||
|
||||
@@ -446,6 +465,11 @@ void DataIO::sendInitFramesToNetworkDevice(int rx) {
|
||||
|
||||
void DataIO::networkDeviceStartStop(char value) {
|
||||
|
||||
if (m_protocol2 && m_protocol2->isActive()) {
|
||||
m_protocol2->networkDeviceStartStop(value);
|
||||
return;
|
||||
}
|
||||
|
||||
TNetworkDevicecard metis = set->getCurrentMetisCard();
|
||||
//QUdpSocket socket;
|
||||
|
||||
@@ -517,6 +541,9 @@ void DataIO::sendAudio(u_char *buf) {
|
||||
|
||||
void DataIO::writeData() {
|
||||
|
||||
if (m_protocol2 && m_protocol2->isActive())
|
||||
return;
|
||||
|
||||
if (m_setNetworkDeviceHeader) {
|
||||
|
||||
m_outDatagram.resize(0);
|
||||
@@ -561,6 +588,9 @@ void DataIO::setManualSocketBufferSize(QObject *sender, bool value) {
|
||||
|
||||
Q_UNUSED (sender)
|
||||
|
||||
if (m_protocol2 && m_protocol2->isActive())
|
||||
return;
|
||||
|
||||
m_manualBufferSize = value;
|
||||
DATAIO_DEBUG << "m_manualBufferSize to change = " << m_manualBufferSize;
|
||||
int socketBufferSize = 1032 * set->getSocketBufferSize();
|
||||
@@ -601,6 +631,9 @@ void DataIO::setSocketBufferSize(QObject *sender, int value) {
|
||||
|
||||
Q_UNUSED (sender)
|
||||
|
||||
if (m_protocol2 && m_protocol2->isActive())
|
||||
return;
|
||||
|
||||
int socketBufferSize = value * 1024;
|
||||
DATAIO_DEBUG << "m_socketBufferSize = " << value;
|
||||
|
||||
@@ -621,6 +654,9 @@ void DataIO::setSampleRate(QObject *sender, int value) {
|
||||
|
||||
Q_UNUSED(sender)
|
||||
|
||||
if (m_protocol2 && m_protocol2->isActive())
|
||||
return;
|
||||
|
||||
int bufferSize;
|
||||
io->networkIOMutex.lock();
|
||||
switch (value) {
|
||||
|
||||
Reference in New Issue
Block a user