From 68c15aa83e2eedce3bb9bd9b3728f740b4f86bbd Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Thu, 3 Jan 2019 12:39:48 -0500 Subject: [PATCH] Added heard activity graph logging --- mainwindow.cpp | 35 +++++++++++++++++++++++++++++++++++ mainwindow.h | 5 +++++ 2 files changed, 40 insertions(+) diff --git a/mainwindow.cpp b/mainwindow.cpp index 4940e58..ac49e0b 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -4019,6 +4019,7 @@ void MainWindow::readFromStdout() //readFromStdout cmdcd.ackTimestamp = cmd.to == m_config.my_callsign() ? cmd.utcTimestamp : QDateTime{}; cmdcd.tdrift = cmd.tdrift; logCallActivity(cmdcd, false); + logHeardGraph(cmd); } hasExistingMessageBuffer(cmd.freq, true, nullptr); @@ -4051,6 +4052,7 @@ void MainWindow::readFromStdout() //readFromStdout td.utcTimestamp = cmd.utcTimestamp; td.tdrift = cmd.tdrift; logCallActivity(td, true); + logHeardGraph(cmd); } } #endif @@ -4264,6 +4266,27 @@ void MainWindow::logCallActivity(CallDetail d, bool spot){ } } +void MainWindow::logHeardGraph(CommandDetail d){ + auto from = d.from; + auto to = d.to; + + if(to == "@ALLCALL"){ + return; + } + + if(m_heardGraphOutgoing.contains(from)){ + m_heardGraphOutgoing[from].insert(to); + } else { + m_heardGraphOutgoing[from] = { to }; + } + + if(m_heardGraphIncoming.contains(to)){ + m_heardGraphIncoming[to].insert(from); + } else { + m_heardGraphIncoming[to] = { from }; + } +} + QString MainWindow::lookupCallInCompoundCache(QString const &call){ QString myBaseCall = Radio::base_callsign(m_config.my_callsign()); if(call == myBaseCall){ @@ -9407,6 +9430,7 @@ void MainWindow::processCommandActivity() { cd.utcTimestamp = d.utcTimestamp; cd.tdrift = d.tdrift; logCallActivity(cd, true); + logHeardGraph(d); // we're only responding to allcall, groupcalls, and our callsign at this point, so we'll end after logging the callsigns we've heard if (!isAllCall && !toMe && !isGroupCall) { @@ -10454,6 +10478,17 @@ void MainWindow::displayCallActivity() { auto displayItem = new QTableWidgetItem(displayCall); displayItem->setData(Qt::UserRole, QVariant(d.call)); + auto hearing = m_heardGraphOutgoing.value(d.call).values().join(", "); + auto heardby = m_heardGraphIncoming.value(d.call).values().join(", "); + QStringList tip = {}; + if(!hearing.isEmpty()){ + tip.append(QString("HEARING: %1").arg(hearing)); + } + if(!heardby.isEmpty()){ + tip.append(QString("HEARD BY: %1").arg(heardby)); + } + displayItem->setToolTip(tip.join("\n")); + ui->tableWidgetCalls->setItem(row, col++, displayItem); auto flagItem = new QTableWidgetItem(flag); diff --git a/mainwindow.h b/mainwindow.h index 9f4d2cd..9945278 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -101,6 +101,7 @@ class MainWindow : public QMainWindow Q_OBJECT; struct CallDetail; + struct CommandDetail; public: using Frequency = Radio::Frequency; using FrequencyDelta = Radio::FrequencyDelta; @@ -135,6 +136,7 @@ public slots: bool hasExistingMessageBufferToMe(int *pOffset); bool hasExistingMessageBuffer(int offset, bool drift, int *pPrevOffset); void logCallActivity(CallDetail d, bool spot=true); + void logHeardGraph(CommandDetail d); QString lookupCallInCompoundCache(QString const &call); void cacheActivity(QString key); void restoreActivity(QString key); @@ -817,6 +819,9 @@ private: QQueue m_txHeartbeatQueue; // ping frames to be sent QMap m_aprsCallCache; + QMap> m_heardGraphOutgoing; // callsign -> [stations who've this callsign has heard] + QMap> m_heardGraphIncoming; // callsign -> [stations who've heard this callsign] + QMap m_rxInboxCountCache; // call -> count QMap> m_callActivityCache; // band -> call activity