Added heard activity graph logging

This commit is contained in:
Jordan Sherer 2019-01-03 12:39:48 -05:00
parent e098fe75c2
commit 68c15aa83e
2 changed files with 40 additions and 0 deletions

View File

@ -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);

View File

@ -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<QString> m_txHeartbeatQueue; // ping frames to be sent
QMap<QString, QDateTime> m_aprsCallCache;
QMap<QString, QSet<QString>> m_heardGraphOutgoing; // callsign -> [stations who've this callsign has heard]
QMap<QString, QSet<QString>> m_heardGraphIncoming; // callsign -> [stations who've heard this callsign]
QMap<QString, int> m_rxInboxCountCache; // call -> count
QMap<QString, QMap<QString, CallDetail>> m_callActivityCache; // band -> call activity