Updated and fixed GRID spotting and APRSIS groups

This commit is contained in:
Jordan Sherer 2019-09-06 11:21:42 -04:00
parent 40eb00eff3
commit 6bbf7321ce
5 changed files with 45 additions and 30 deletions

View File

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

View File

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

View File

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

View File

@ -1217,6 +1217,13 @@ bool Varicode::isCompoundCallsign(const QString &callsign){
return isValid;
}
bool Varicode::isGroupAllowed(const QString &group){
const QSet<QString> disallowed = {
"@APRSIS"
};
return !disallowed.contains(group);
}
// CQCQCQ EM73
// CQ DX EM73
// CQ QRP EM73

View File

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