From 6bbf7321cef4a6e3000916e1130721c76d7a86ac Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Fri, 6 Sep 2019 11:21:42 -0400 Subject: [PATCH] Updated and fixed GRID spotting and APRSIS groups --- Configuration.cpp | 4 ++++ mainwindow.cpp | 61 +++++++++++++++++++++++++---------------------- mainwindow.h | 2 +- varicode.cpp | 7 ++++++ varicode.h | 1 + 5 files changed, 45 insertions(+), 30 deletions(-) diff --git a/Configuration.cpp b/Configuration.cpp index cf3bc65..8214ab6 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -2168,6 +2168,10 @@ bool Configuration::impl::validate () } foreach(auto group, splitGroups(ui_->groups_line_edit->text().toUpper().trimmed(), false)){ + if(!Varicode::isGroupAllowed(group)){ + MessageBox::critical_message (this, QString("%1 is not an available group").arg(group)); + return false; + } if(!Varicode::isCompoundCallsign(group)){ MessageBox::critical_message (this, QString("%1 is not a valid group").arg(group)); return false; diff --git a/mainwindow.cpp b/mainwindow.cpp index 6e7710d..d1b8ee0 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -4713,33 +4713,14 @@ void MainWindow::spotCmd(CommandDetail cmd){ m_spotClient->enqueueCmd(cmdStr, cmd.from, cmd.to, cmd.relayPath, cmd.text, cmd.grid, cmd.extra, m_freqNominal + cmd.freq, cmd.snr); } -void MainWindow::spotAPRSCmd(CommandDetail d){ +void MainWindow::spotAPRSMsg(CommandDetail d){ if(!m_config.spot_to_reporting_networks()) return; - - if(d.cmd == " GRID"){ - auto grids = Varicode::parseGrids(d.text); - foreach(auto grid, grids){ - CallDetail cd = {}; - cd.bits = d.bits; - cd.call = d.from; - cd.freq = d.freq; - cd.grid = grid; - cd.snr = d.snr; - cd.utcTimestamp = d.utcTimestamp; - cd.tdrift = d.tdrift; - cd.mode = currentMode(); - - m_aprsCallCache.remove(cd.call); - m_aprsCallCache.remove(APRSISClient::replaceCallsignSuffixWithSSID(cd.call, Radio::base_callsign(cd.call))); - - logCallActivity(cd, true); - } - - return; - } - - // for raw messages, ensure the passcode is valid first if(!m_aprsClient->isPasscodeValid()) return; + + // ONLY MSG IS APPROPRIATE HERE, e.g., + // KN4CRD: @APRSIS MSG :EMAIL-2 :email@domain.com booya{ + if(d.cmd != " MSG") return; + qDebug() << "enqueueing third party text" << d.from << d.text; m_aprsClient->enqueueThirdParty(Radio::base_callsign(d.from), d.text); } @@ -10349,9 +10330,31 @@ void MainWindow::processCommandActivity() { foreach(auto call, calls){ logHeardGraph(d.from, call); } + } - // make sure this is explicit - continue; + // PROCESS BUFFERED GRID FOR EVERYONE + if(d.cmd == " GRID"){ + // 1. parse grids + // 2. log it to our call activity + auto grids = Varicode::parseGrids(d.text); + foreach(auto grid, grids){ + CallDetail cd = {}; + cd.bits = d.bits; + cd.call = d.from; + cd.freq = d.freq; + cd.grid = grid; + cd.snr = d.snr; + cd.utcTimestamp = d.utcTimestamp; + cd.tdrift = d.tdrift; + cd.mode = currentMode(); + + if(d.to == "@APRSIS"){ + m_aprsCallCache.remove(cd.call); + m_aprsCallCache.remove(APRSISClient::replaceCallsignSuffixWithSSID(cd.call, Radio::base_callsign(cd.call))); + } + + logCallActivity(cd, true); + } } // PROCESS @JS8NET SPOTS FOR EVERYONE @@ -10359,9 +10362,9 @@ void MainWindow::processCommandActivity() { spotCmd(d); } - // PROCESS @APRSIS SPOTS FOR EVERYONE + // PROCESS @APRSIS MSG SPOTS FOR EVERYONE if (d.to == "@APRSIS"){ - spotAPRSCmd(d); + spotAPRSMsg(d); } // PREPARE CMD TEXT STRING diff --git a/mainwindow.h b/mainwindow.h index 93f93c6..8cd8994 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -945,7 +945,7 @@ private: void aprsSetLocal (); void spotReport(int offset, int snr, QString callsign, QString grid); void spotCmd(CommandDetail cmd); - void spotAPRSCmd(CommandDetail d); + void spotAPRSMsg(CommandDetail d); void pskLogReport(QString mode, int offset, int snr, QString callsign, QString grid); void aprsLogReport(int offset, int snr, QString callsign, QString grid); Radio::Frequency dialFrequency(); diff --git a/varicode.cpp b/varicode.cpp index 330c7ef..bcec224 100644 --- a/varicode.cpp +++ b/varicode.cpp @@ -1217,6 +1217,13 @@ bool Varicode::isCompoundCallsign(const QString &callsign){ return isValid; } +bool Varicode::isGroupAllowed(const QString &group){ + const QSet disallowed = { + "@APRSIS" + }; + return !disallowed.contains(group); +} + // CQCQCQ EM73 // CQ DX EM73 // CQ QRP EM73 diff --git a/varicode.h b/varicode.h index 238db99..40dd5b0 100644 --- a/varicode.h +++ b/varicode.h @@ -148,6 +148,7 @@ public: static bool isCommandAutoreply(const QString &cmd); static bool isValidCallsign(const QString &callsign, bool *pIsCompound); static bool isCompoundCallsign(const QString &callsign); + static bool isGroupAllowed(const QString &group); static QString packHeartbeatMessage(QString const &text, QString const&callsign, int *n); static QStringList unpackHeartbeatMessage(const QString &text, quint8 *pType, bool *isAlt, quint8 *pBits3);