kopia lustrzana https://gitlab.com/eliggett/wfview
Merge remote-tracking branch 'origin/audio-enhance' into sequence
commit
ff5cebf475
|
@ -117,7 +117,7 @@ void pttyHandler::receiveDataFromRigToPtty(const QByteArray& data)
|
||||||
{
|
{
|
||||||
|
|
||||||
int fePos=data.lastIndexOf((char)0xfe);
|
int fePos=data.lastIndexOf((char)0xfe);
|
||||||
if (fePos>0)
|
if (fePos > 0 && data.length() > fePos+2)
|
||||||
fePos=fePos-1;
|
fePos=fePos-1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -125,7 +125,14 @@ void pttyHandler::receiveDataFromRigToPtty(const QByteArray& data)
|
||||||
printHex(data,false,true);
|
printHex(data,false,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isConnected && (unsigned char)data[fePos+2] != 0xE1 && (unsigned char)data[fePos+3] != 0xE1)
|
if (disableTransceive && ((unsigned char)data[fePos + 2] == 0x00 || (unsigned char)data[fePos + 3] == 0x00))
|
||||||
|
{
|
||||||
|
// Ignore data that is sent to/from transceive address as client has requested transceive disabled.
|
||||||
|
qDebug(logSerial()) << "Transceive command filtered";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isConnected && (unsigned char)data[fePos + 2] != 0xE1 && (unsigned char)data[fePos + 3] != 0xE1)
|
||||||
{
|
{
|
||||||
// send to the pseudo port as well
|
// send to the pseudo port as well
|
||||||
// index 2 is dest, 0xE1 is wfview, 0xE0 is assumed to be the other device.
|
// index 2 is dest, 0xE1 is wfview, 0xE0 is assumed to be the other device.
|
||||||
|
@ -133,7 +140,7 @@ void pttyHandler::receiveDataFromRigToPtty(const QByteArray& data)
|
||||||
// 0xE1 = wfview
|
// 0xE1 = wfview
|
||||||
// 0xE0 = pseudo-term host
|
// 0xE0 = pseudo-term host
|
||||||
// 0x00 = broadcast to all
|
// 0x00 = broadcast to all
|
||||||
//qInfo(logSerial()) << "Sending data from radio to pseudo-terminal";
|
//qInfo(logSerial()) << "Sending data from radio to pseudo-terminal";
|
||||||
sendDataOut(data);
|
sendDataOut(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -221,12 +228,16 @@ void pttyHandler::receiveDataIn(int fd) {
|
||||||
reply[3] = inPortData[2];
|
reply[3] = inPortData[2];
|
||||||
sendDataOut(inPortData); // Echo command back
|
sendDataOut(inPortData); // Echo command back
|
||||||
sendDataOut(reply);
|
sendDataOut(reply);
|
||||||
|
if (!disableTransceive) {
|
||||||
|
qInfo(logSerial()) << "pty requested CI-V Transceive disable";
|
||||||
|
disableTransceive = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (inPortData.length() > lastFE + 2 && ((quint8)inPortData[lastFE + 1] == civId || (quint8)inPortData[lastFE + 2] == civId))
|
else if (inPortData.length() > lastFE + 2 && ((quint8)inPortData[lastFE + 1] == civId || (quint8)inPortData[lastFE + 2] == civId))
|
||||||
{
|
{
|
||||||
emit haveDataFromPort(inPortData);
|
emit haveDataFromPort(inPortData);
|
||||||
//qInfo(logSerial()) << "Data from pseudo term:";
|
qDebug(logSerial()) << "Data from pseudo term:";
|
||||||
//printHex(inPortData, false, true);
|
printHex(inPortData, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rolledBack)
|
if (rolledBack)
|
||||||
|
|
|
@ -65,7 +65,7 @@ private:
|
||||||
bool isConnected=false; // port opened
|
bool isConnected=false; // port opened
|
||||||
mutable QMutex mutex;
|
mutable QMutex mutex;
|
||||||
void printHex(const QByteArray& pdata, bool printVert, bool printHoriz);
|
void printHex(const QByteArray& pdata, bool printVert, bool printHoriz);
|
||||||
|
bool disableTransceive = false;
|
||||||
QSocketNotifier *ptReader = nullptr;
|
QSocketNotifier *ptReader = nullptr;
|
||||||
quint8 civId=0;
|
quint8 civId=0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -195,7 +195,7 @@ void udpHandler::dataReceived()
|
||||||
if (txSetup.codec == 0) {
|
if (txSetup.codec == 0) {
|
||||||
txString = "(no tx)";
|
txString = "(no tx)";
|
||||||
}
|
}
|
||||||
emit haveNetworkStatus(QString("<pre>%1 rx latency: %2 ms / rtt: %3 ms / loss: %4/%5</pre>").arg(txString).arg(tempLatency).arg(latency, 3).arg(totallost, 3).arg(totalsent, 3));
|
emit haveNetworkStatus(QString("<pre>%1 rx latency: %2 / rtt: %3 ms / loss: %4/%5</pre>").arg(txString).arg(tempLatency).arg(latency, 3).arg(totallost, 3).arg(totalsent, 3));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1133,6 +1133,10 @@ void udpBase::dataReceived(QByteArray r)
|
||||||
{
|
{
|
||||||
rxBufferMutex.lock();
|
rxBufferMutex.lock();
|
||||||
if (rxSeqBuf.isEmpty()) {
|
if (rxSeqBuf.isEmpty()) {
|
||||||
|
if (rxSeqBuf.size() > 400)
|
||||||
|
{
|
||||||
|
rxSeqBuf.erase(rxSeqBuf.begin());
|
||||||
|
}
|
||||||
rxSeqBuf.insert(in->seq, QTime::currentTime());
|
rxSeqBuf.insert(in->seq, QTime::currentTime());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1153,6 +1157,10 @@ void udpBase::dataReceived(QByteArray r)
|
||||||
{
|
{
|
||||||
// Add incoming packet to the received buffer and if it is in the missing buffer, remove it.
|
// Add incoming packet to the received buffer and if it is in the missing buffer, remove it.
|
||||||
rxSeqBuf.insert(in->seq, QTime::currentTime());
|
rxSeqBuf.insert(in->seq, QTime::currentTime());
|
||||||
|
if (rxSeqBuf.size() > 400)
|
||||||
|
{
|
||||||
|
rxSeqBuf.erase(rxSeqBuf.begin());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// This is probably one of our missing packets!
|
// This is probably one of our missing packets!
|
||||||
|
@ -1208,7 +1216,15 @@ void udpBase::sendRetransmitRequest()
|
||||||
{
|
{
|
||||||
// We haven't seen this missing packet before
|
// We haven't seen this missing packet before
|
||||||
qDebug(logUdp()) << this->metaObject()->className() << ": Adding to missing buffer (len=" << rxMissing.size() << "): " << j;
|
qDebug(logUdp()) << this->metaObject()->className() << ": Adding to missing buffer (len=" << rxMissing.size() << "): " << j;
|
||||||
|
if (rxMissing.size() > 25)
|
||||||
|
{
|
||||||
|
rxMissing.erase(rxMissing.begin());
|
||||||
|
}
|
||||||
rxMissing.insert(j, 0);
|
rxMissing.insert(j, 0);
|
||||||
|
if (rxSeqBuf.size() > 400)
|
||||||
|
{
|
||||||
|
rxSeqBuf.erase(rxSeqBuf.begin());
|
||||||
|
}
|
||||||
rxSeqBuf.insert(j, QTime::currentTime()); // Add this missing packet to the rxbuffer as we now long about it.
|
rxSeqBuf.insert(j, QTime::currentTime()); // Add this missing packet to the rxbuffer as we now long about it.
|
||||||
packetsLost++;
|
packetsLost++;
|
||||||
}
|
}
|
||||||
|
@ -1351,11 +1367,17 @@ void udpBase::sendTrackedPacket(QByteArray d)
|
||||||
congestion = 0;
|
congestion = 0;
|
||||||
}
|
}
|
||||||
txSeqBuf.insert(sendSeq,s);
|
txSeqBuf.insert(sendSeq,s);
|
||||||
|
if (txSeqBuf.size() > 400)
|
||||||
|
{
|
||||||
|
txSeqBuf.erase(txSeqBuf.begin());
|
||||||
|
}
|
||||||
txBufferMutex.unlock();
|
txBufferMutex.unlock();
|
||||||
} else {
|
} else {
|
||||||
qInfo(logUdp()) << this->metaObject()->className() << ": txBuffer mutex is locked";
|
qInfo(logUdp()) << this->metaObject()->className() << ": txBuffer mutex is locked";
|
||||||
}
|
}
|
||||||
purgeOldEntries(); // Delete entries older than PURGE_SECONDS seconds (currently 5)
|
// Stop using purgeOldEntries() as it is likely slower than just removing the earliest packet.
|
||||||
|
//qInfo(logUdp()) << this->metaObject()->className() << "RX:" << rxSeqBuf.size() << "TX:" <<txSeqBuf.size() << "MISS:" << rxMissing.size();
|
||||||
|
//purgeOldEntries(); // Delete entries older than PURGE_SECONDS seconds (currently 5)
|
||||||
sendSeq++;
|
sendSeq++;
|
||||||
|
|
||||||
udpMutex.lock();
|
udpMutex.lock();
|
||||||
|
|
Ładowanie…
Reference in New Issue