Fixed incremental print for directed messages.

Fixed compound calls in the heard list
This commit is contained in:
Jordan Sherer 2018-10-10 09:04:56 -04:00
parent f0e30dc7b0
commit f79ca47a93
2 changed files with 80 additions and 66 deletions

View File

@ -3629,6 +3629,12 @@ void MainWindow::readFromStdout() //readFromStdout
qDebug() << "valid" << bValidFrame << "decoded text" << decodedtext.message(); qDebug() << "valid" << bValidFrame << "decoded text" << decodedtext.message();
ActivityDetail d = {};
CallDetail cd = {};
CommandDetail cmd = {};
CallDetail td = {};
//Left (Band activity) window //Left (Band activity) window
if(bValidFrame) { if(bValidFrame) {
// Parse General Activity // Parse General Activity
@ -3650,7 +3656,7 @@ void MainWindow::readFromStdout() //readFromStdout
} }
} }
ActivityDetail d = {}; //ActivityDetail d = {};
d.isLowConfidence = decodedtext.isLowConfidence(); d.isLowConfidence = decodedtext.isLowConfidence();
d.isFree = !decodedtext.isStandardMessage(); d.isFree = !decodedtext.isStandardMessage();
d.isCompound = decodedtext.isCompound(); d.isCompound = decodedtext.isCompound();
@ -3674,6 +3680,7 @@ void MainWindow::readFromStdout() //readFromStdout
qDebug() << "buffering data" << d.freq << d.text; qDebug() << "buffering data" << d.freq << d.text;
d.isBuffered = true; d.isBuffered = true;
m_messageBuffer[d.freq].msgs.append(d); m_messageBuffer[d.freq].msgs.append(d);
// TODO: incremental display if it's "to" me.
} }
m_rxActivityQueue.append(d); m_rxActivityQueue.append(d);
@ -3682,16 +3689,13 @@ void MainWindow::readFromStdout() //readFromStdout
m_bandActivity[offset].removeFirst(); m_bandActivity[offset].removeFirst();
} }
} }
#endif #endif
// Process compound callsign commands (put them in cache)" // Process compound callsign commands (put them in cache)"
#if 1 #if 1
qDebug() << "decoded" << decodedtext.frameType() << decodedtext.isCompound() << decodedtext.isDirectedMessage() << decodedtext.isBeacon(); qDebug() << "decoded" << decodedtext.frameType() << decodedtext.isCompound() << decodedtext.isDirectedMessage() << decodedtext.isBeacon();
bool shouldProcessCompound = true; bool shouldProcessCompound = true;
if(shouldProcessCompound && decodedtext.isCompound() && !decodedtext.isDirectedMessage()){ if(shouldProcessCompound && decodedtext.isCompound() && !decodedtext.isDirectedMessage()){
CallDetail cd = {};
cd.call = decodedtext.compoundCall(); cd.call = decodedtext.compoundCall();
cd.grid = decodedtext.extra(); // compound calls via beacons may contain grid... cd.grid = decodedtext.extra(); // compound calls via beacons may contain grid...
cd.snr = decodedtext.snr(); cd.snr = decodedtext.snr();
@ -3701,18 +3705,23 @@ void MainWindow::readFromStdout() //readFromStdout
// Only respond to BEACONS...remember that CQ messages are "Alt" beacons // Only respond to BEACONS...remember that CQ messages are "Alt" beacons
if(decodedtext.isBeacon()){ if(decodedtext.isBeacon()){
if(!decodedtext.isAlt()){ if(decodedtext.isAlt()){
// this is a cq with a compound call, ala "KN4CRD/P: CQCQCQ"
// it is not processed elsewhere, so we need to just log it here.
logCallActivity(cd, true);
} else {
// convert BEACON to a directed command and process... // convert BEACON to a directed command and process...
CommandDetail d = {}; cmd.from = cd.call;
d.from = cd.call; cmd.to = "ALLCALL";
d.to = "ALLCALL"; cmd.cmd = " BEACON";
d.cmd = " BEACON"; cmd.snr = cd.snr;
d.snr = cd.snr; cmd.bits = cd.bits;
d.bits = cd.bits; cmd.grid = cd.grid;
d.grid = cd.grid; cmd.freq = cd.freq;
d.freq = cd.freq; cmd.utcTimestamp = cd.utcTimestamp;
d.utcTimestamp = cd.utcTimestamp; m_rxCommandQueue.append(cmd);
m_rxCommandQueue.append(d);
} }
} else { } else {
@ -3731,61 +3740,55 @@ void MainWindow::readFromStdout() //readFromStdout
if(shouldProcessDirected && decodedtext.isDirectedMessage()){ if(shouldProcessDirected && decodedtext.isDirectedMessage()){
auto parts = decodedtext.directedMessage(); auto parts = decodedtext.directedMessage();
CommandDetail d = {}; cmd.from = parts.at(0);
d.from = parts.at(0); cmd.to = parts.at(1);
d.to = parts.at(1); cmd.cmd = parts.at(2);
d.cmd = parts.at(2); cmd.freq = decodedtext.frequencyOffset();
d.freq = decodedtext.frequencyOffset(); cmd.snr = decodedtext.snr();
d.snr = decodedtext.snr(); cmd.utcTimestamp = DriftingDateTime::currentDateTimeUtc();
d.utcTimestamp = DriftingDateTime::currentDateTimeUtc(); cmd.bits = decodedtext.bits();
d.bits = decodedtext.bits(); cmd.extra = parts.length() > 2 ? parts.mid(3).join(" ") : "";
d.extra = parts.length() > 2 ? parts.mid(3).join(" ") : "";
// if the command is a buffered command and its not the last frame OR we have from or to in a separate message (compound call) // if the command is a buffered command and its not the last frame OR we have from or to in a separate message (compound call)
if((Varicode::isCommandBuffered(d.cmd) && (d.bits & Varicode::JS8CallLast) != Varicode::JS8CallLast) || d.from == "<....>" || d.to == "<....>"){ if((Varicode::isCommandBuffered(cmd.cmd) && (cmd.bits & Varicode::JS8CallLast) != Varicode::JS8CallLast) || cmd.from == "<....>" || cmd.to == "<....>"){
qDebug() << "buffering cmd" << d.freq << d.cmd << d.from << d.to; qDebug() << "buffering cmd" << cmd.freq << cmd.cmd << cmd.from << cmd.to;
hasExistingMessageBuffer(d.freq, true, nullptr); hasExistingMessageBuffer(cmd.freq, true, nullptr);
m_messageBuffer[d.freq].cmd = d;
m_messageBuffer[d.freq].msgs.clear(); if(cmd.to == m_config.my_callsign()){
} else { d.shouldDisplay = true;
m_rxCommandQueue.append(d);
} }
/* m_messageBuffer[cmd.freq].cmd = cmd;
// DISABLED FOR NOW... m_messageBuffer[cmd.freq].msgs.clear();
CallDetail cd; } else {
cd.bits = d.bits; m_rxCommandQueue.append(cmd);
cd.call = d.from; }
cd.grid = "";
cd.snr = d.snr;
cd.freq = d.freq;
cd.utcTimestamp = d.utcTimestamp;
logCallActivity(cd);
*/
#if 0
bool shouldCaptureThirdPartyCallsigns = false;
// check to see if this is a station we've heard 3rd party // check to see if this is a station we've heard 3rd party
if(shouldCaptureThirdPartyCallsigns && Radio::base_callsign(d.to) != Radio::base_callsign(m_config.my_callsign())){ bool shouldCaptureThirdPartyCallsigns = false;
QString relayCall = QString("%1|%2").arg(Radio::base_callsign(d.from)).arg(Radio::base_callsign(d.to)); if(shouldCaptureThirdPartyCallsigns && Radio::base_callsign(cmd.to) != Radio::base_callsign(m_config.my_callsign())){
QString relayCall = QString("%1|%2").arg(Radio::base_callsign(cmd.from)).arg(Radio::base_callsign(cmd.to));
int snr = -100; int snr = -100;
if(parts.length() == 4){ if(parts.length() == 4){
snr = QString(parts.at(3)).toInt(); snr = QString(parts.at(3)).toInt();
} }
CallDetail td;
td.through = d.from; //CallDetail td = {};
td.call = d.to; td.through = cmd.from;
td.call = cmd.to;
td.grid = ""; td.grid = "";
td.snr = snr; td.snr = snr;
td.freq = d.freq; td.freq = cmd.freq;
td.utcTimestamp = d.utcTimestamp; td.utcTimestamp = cmd.utcTimestamp;
m_callActivity[relayCall] = td; m_callActivity[relayCall] = td;
} }
#endif
} }
#endif #endif
// Parse CQs // Parse CQs
#if 0 #if 0
bool shouldParseCQs = true; bool shouldParseCQs = true;
@ -3851,6 +3854,7 @@ void MainWindow::readFromStdout() //readFromStdout
#endif #endif
} }
#if 0
//Right (Rx Frequency) window //Right (Rx Frequency) window
bool bDisplayRight=bAvgMsg; bool bDisplayRight=bAvgMsg;
int audioFreq=decodedtext.frequencyOffset(); int audioFreq=decodedtext.frequencyOffset();
@ -3905,9 +3909,12 @@ void MainWindow::readFromStdout() //readFromStdout
} }
} }
} }
#endif
} }
} }
// See MainWindow::postDecode for displaying the latest decodes // See MainWindow::postDecode for displaying the latest decodes
} }
@ -8179,6 +8186,15 @@ void MainWindow::processRxActivity() {
while (!m_rxActivityQueue.isEmpty()) { while (!m_rxActivityQueue.isEmpty()) {
ActivityDetail d = m_rxActivityQueue.dequeue(); ActivityDetail d = m_rxActivityQueue.dequeue();
// use the actual frequency and check its delta from our current frequency
// meaning, if our current offset is 1502 and the d.freq is 1492, the delta is <= 10;
bool shouldDisplay = abs(d.freq - currentFreqOffset()) <= 10;
int prevOffset = d.freq;
if(hasExistingMessageBuffer(d.freq, false, &prevOffset) && m_messageBuffer[prevOffset].cmd.to == m_config.my_callsign()){
d.isBuffered = true;
shouldDisplay = true;
} else {
// if this is a _partial_ directed message, skip until the complete call comes through. // if this is a _partial_ directed message, skip until the complete call comes through.
if(d.isDirected && d.text.contains("<....>")){ if(d.isDirected && d.text.contains("<....>")){
continue; continue;
@ -8191,10 +8207,7 @@ void MainWindow::processRxActivity() {
if(ui->selcalButton->isChecked()){ if(ui->selcalButton->isChecked()){
continue; continue;
} }
}
// use the actual frequency and check its delta from our current frequency
// meaning, if our current offset is 1502 and the d.freq is 1492, the delta is <= 10;
bool shouldDisplay = abs(d.freq - currentFreqOffset()) <= 10;
#if 0 #if 0
// if this is a recent non-directed offset, bump the cache and display... // if this is a recent non-directed offset, bump the cache and display...
@ -8518,7 +8531,7 @@ void MainWindow::processCommandActivity() {
c.movePosition(QTextCursor::End); c.movePosition(QTextCursor::End);
ui->textEditRX->setTextCursor(c); ui->textEditRX->setTextCursor(c);
if(isRecentOffset(d.freq) && ui->textEditRX->find(d.utcTimestamp.time().toString(), QTextDocument::FindBackward)){ if(/*isRecentOffset(d.freq) &&*/ ui->textEditRX->find(d.utcTimestamp.time().toString(), QTextDocument::FindBackward)){
// ... maybe we could delete the last line that had this message on this frequency... // ... maybe we could delete the last line that had this message on this frequency...
c = ui->textEditRX->textCursor(); c = ui->textEditRX->textCursor();
c.movePosition(QTextCursor::StartOfBlock); c.movePosition(QTextCursor::StartOfBlock);

View File

@ -717,6 +717,7 @@ private:
QString text; QString text;
QDateTime utcTimestamp; QDateTime utcTimestamp;
int snr; int snr;
bool shouldDisplay;
}; };
struct MessageBuffer { struct MessageBuffer {