From b85748603c9cf683024c05a02d9b61ffb8b4ce44 Mon Sep 17 00:00:00 2001 From: "Edson W. R. Pereira" Date: Fri, 4 Oct 2013 20:02:48 +0000 Subject: [PATCH] Fixed a recently introduced bug that allowed sending receiving station reports to PSK Reporter when PSK Reporter was disabled. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3589 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- psk_reporter.cpp | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/psk_reporter.cpp b/psk_reporter.cpp index 91d7bb6ae..1e2164547 100644 --- a/psk_reporter.cpp +++ b/psk_reporter.cpp @@ -62,6 +62,10 @@ void PSK_Reporter::addRemoteStation(QString call, QString grid, QString freq, QS void PSK_Reporter::sendReport() { + if (m_spotQueue.isEmpty()) { + return; + } + QString report_h; // Header @@ -80,26 +84,21 @@ void PSK_Reporter::sendReport() rxInfoData_h.replace("50E2llll", "50E2" + QString("%1").arg(rxInfoData_h.length()/2,4,16,QChar('0'))); // Sender information - if (! m_spotQueue.isEmpty()) { - QString txInfoData_h = "50E3llll"; - while (!m_spotQueue.isEmpty()) { - QHash spot = m_spotQueue.dequeue(); - txInfoData_h += QString("%1").arg(spot["call"].length(),2,16,QChar('0')) + spot["call"].toUtf8().toHex(); - txInfoData_h += QString("%1").arg(spot["freq"].toLongLong(),8,16,QChar('0')); - txInfoData_h += QString("%1").arg(spot["snr"].toInt(),8,16,QChar('0')).right(2); - txInfoData_h += QString("%1").arg(spot["mode"].length(),2,16,QChar('0')) + spot["mode"].toUtf8().toHex(); - txInfoData_h += QString("%1").arg(spot["grid"].length(),2,16,QChar('0')) + spot["grid"].toUtf8().toHex(); - txInfoData_h += QString("%1").arg(1,2,16,QChar('0')); // REPORTER_SOURCE_AUTOMATIC - txInfoData_h += QString("%1").arg(spot["time"].toInt(),8,16,QChar('0')); - } - txInfoData_h += "0000"; - txInfoData_h.replace("50E3llll", "50E3" + QString("%1").arg(txInfoData_h.length()/2,4,16,QChar('0'))); - report_h = header_h + m_rxInfoDescriptor_h + m_txInfoDescriptor_h + rxInfoData_h + txInfoData_h; - //qDebug() << "Sending Report TX: "; - } else { - report_h = header_h + m_rxInfoDescriptor_h + rxInfoData_h; - //qDebug() << "Sending Report RX: "; + QString txInfoData_h = "50E3llll"; + while (!m_spotQueue.isEmpty()) { + QHash spot = m_spotQueue.dequeue(); + txInfoData_h += QString("%1").arg(spot["call"].length(),2,16,QChar('0')) + spot["call"].toUtf8().toHex(); + txInfoData_h += QString("%1").arg(spot["freq"].toLongLong(),8,16,QChar('0')); + txInfoData_h += QString("%1").arg(spot["snr"].toInt(),8,16,QChar('0')).right(2); + txInfoData_h += QString("%1").arg(spot["mode"].length(),2,16,QChar('0')) + spot["mode"].toUtf8().toHex(); + txInfoData_h += QString("%1").arg(spot["grid"].length(),2,16,QChar('0')) + spot["grid"].toUtf8().toHex(); + txInfoData_h += QString("%1").arg(1,2,16,QChar('0')); // REPORTER_SOURCE_AUTOMATIC + txInfoData_h += QString("%1").arg(spot["time"].toInt(),8,16,QChar('0')); } + txInfoData_h += "0000"; + txInfoData_h.replace("50E3llll", "50E3" + QString("%1").arg(txInfoData_h.length()/2,4,16,QChar('0'))); + report_h = header_h + m_rxInfoDescriptor_h + m_txInfoDescriptor_h + rxInfoData_h + txInfoData_h; + //qDebug() << "Sending Report TX: "; report_h.replace("000Allll", "000A" + QString("%1").arg(report_h.length()/2,4,16,QChar('0'))); QByteArray report = QByteArray::fromHex(report_h.toUtf8());