Refactoring for better compound message display

This commit is contained in:
Jordan Sherer 2018-08-01 22:36:50 -04:00
parent 479d647456
commit 96f7b9fd66
3 changed files with 39 additions and 5 deletions

View File

@ -3366,6 +3366,7 @@ void MainWindow::readFromStdout() //readFromStdout
d.isLowConfidence = decodedtext.isLowConfidence(); d.isLowConfidence = decodedtext.isLowConfidence();
d.isFree = !decodedtext.isStandardMessage(); d.isFree = !decodedtext.isStandardMessage();
d.isCompound = decodedtext.isCompoundMessage(); d.isCompound = decodedtext.isCompoundMessage();
d.isDirected = decodedtext.isDirectedMessage();
d.bits = decodedtext.bits(); d.bits = decodedtext.bits();
d.freq = offset; d.freq = offset;
d.text = decodedtext.message(); d.text = decodedtext.message();
@ -6125,12 +6126,15 @@ bool MainWindow::prepareNextMessageFrame()
} }
bool MainWindow::isFreqOffsetFree(int f, int bw){ bool MainWindow::isFreqOffsetFree(int f, int bw){
foreach(int offset, m_bandActivity.keys()){ // TODO: jsherer - figure out a better way to determine if the frequency is suitable for tx
#if 0
foreach(int offset, m_bandActivity.keys()){
if(qAbs(offset - f) < bw){ if(qAbs(offset - f) < bw){
return false; return false;
} }
} }
#endif
return true; return true;
} }
@ -8741,6 +8745,12 @@ void MainWindow::processRxActivity() {
while (!m_rxActivityQueue.isEmpty()) { while (!m_rxActivityQueue.isEmpty()) {
ActivityDetail d = m_rxActivityQueue.dequeue(); ActivityDetail d = m_rxActivityQueue.dequeue();
// if this is a compound message or it's a directed message needing a compound call, skip.
// these messages will be displayed when the compound calls come through
if(d.isCompound || (d.isDirected && d.text.contains("<....>"))){
continue;
}
int freq = d.freq / 10 * 10; int freq = d.freq / 10 * 10;
bool shouldDisplay = abs(freq - currentFreq()) <= 10; bool shouldDisplay = abs(freq - currentFreq()) <= 10;
@ -8816,6 +8826,7 @@ void MainWindow::processCompoundActivity() {
auto d = buffer.compound.dequeue(); auto d = buffer.compound.dequeue();
buffer.cmd.from = d.call; buffer.cmd.from = d.call;
buffer.cmd.grid = d.grid; buffer.cmd.grid = d.grid;
buffer.cmd.isCompound = true;
if (d.bits == Varicode::FT8CallLast) { if (d.bits == Varicode::FT8CallLast) {
buffer.cmd.bits = d.bits; buffer.cmd.bits = d.bits;
@ -8825,6 +8836,7 @@ void MainWindow::processCompoundActivity() {
if (buffer.cmd.to == "<....>") { if (buffer.cmd.to == "<....>") {
auto d = buffer.compound.dequeue(); auto d = buffer.compound.dequeue();
buffer.cmd.to = d.call; buffer.cmd.to = d.call;
buffer.cmd.isCompound = true;
if (d.bits == Varicode::FT8CallLast) { if (d.bits == Varicode::FT8CallLast) {
buffer.cmd.bits = d.bits; buffer.cmd.bits = d.bits;
@ -8870,6 +8882,7 @@ void MainWindow::processBufferedActivity() {
if (Varicode::checksum16Valid(checksum, message)) { if (Varicode::checksum16Valid(checksum, message)) {
buffer.cmd.text = message; buffer.cmd.text = message;
buffer.cmd.isBuffered = true;
m_rxCommandQueue.append(buffer.cmd); m_rxCommandQueue.append(buffer.cmd);
} else { } else {
qDebug() << "Buffered message failed checksum...discarding"; qDebug() << "Buffered message failed checksum...discarding";
@ -8931,6 +8944,20 @@ void MainWindow::processCommandActivity() {
} }
#endif #endif
#if 0
if(d.isCompound){
// this is a command with a compound call... we need to log it to the rx activity!
ActivityDetail ad;
ad.bits = d.bits;
ad.freq = d.freq;
ad.isDirected = true;
ad.snr = d.snr;
ad.text = QString("%1: %2%3 %4 %5 ").arg(d.from).arg(d.to).arg(d.cmd).arg(d.grid).arg(d.text);
ad.utcTimestamp = d.utcTimestamp;
m_bandActivity[d.freq].append(ad);
}
#endif
// log call activity... // log call activity...
CallDetail cd; CallDetail cd;
cd.call = d.from; cd.call = d.from;
@ -8987,6 +9014,7 @@ void MainWindow::processCommandActivity() {
}); });
QStringList lines; QStringList lines;
foreach(auto call, calls) { foreach(auto call, calls) {
if (i >= maxStations) { if (i >= maxStations) {
break; break;
@ -8994,9 +9022,7 @@ void MainWindow::processCommandActivity() {
auto d = m_callActivity[call]; auto d = m_callActivity[call];
lines.append(QString("%1 SNR %2").arg(d.call).arg(Varicode::formatSNR(d.snr)));
//lines.append(QString("%1 SNR %2").arg(d.call).arg(Varicode::formatSNR(d.snr)));
i++; i++;
} }
@ -9204,6 +9230,12 @@ void MainWindow::displayBandActivity() {
if (item.text.isEmpty()) { if (item.text.isEmpty()) {
continue; continue;
} }
#if 0
if (item.isCompound || (item.isDirected && item.text.contains("<....>"))){
//continue;
item.text = "[...]";
}
#endif
if (item.isLowConfidence) { if (item.isLowConfidence) {
item.text = QString("[%1]").arg(item.text); item.text = QString("[%1]").arg(item.text);
} }

View File

@ -669,6 +669,8 @@ private:
struct CommandDetail struct CommandDetail
{ {
bool isCompound;
bool isBuffered;
QString from; QString from;
QString to; QString to;
QString cmd; QString cmd;
@ -685,6 +687,7 @@ private:
bool isFree; bool isFree;
bool isLowConfidence; bool isLowConfidence;
bool isCompound; bool isCompound;
bool isDirected;
int bits; int bits;
int freq; int freq;
QString text; QString text;

View File

@ -1109,7 +1109,6 @@ QStringList Varicode::unpackCompoundFrame(const QString &text, bool *isBeacon, q
return unpacked; return unpacked;
} }
quint32 packed_base = Varicode::bitsToInt(Varicode::strToBits(bits.mid(3, 28))); quint32 packed_base = Varicode::bitsToInt(Varicode::strToBits(bits.mid(3, 28)));
quint32 packed_fix = Varicode::bitsToInt(Varicode::strToBits(bits.mid(31, 22))); quint32 packed_fix = Varicode::bitsToInt(Varicode::strToBits(bits.mid(31, 22)));
quint16 packed_11 = Varicode::bitsToInt(Varicode::strToBits(bits.mid(53, 11))); quint16 packed_11 = Varicode::bitsToInt(Varicode::strToBits(bits.mid(53, 11)));