diff --git a/mainwindow.cpp b/mainwindow.cpp index 8152d55..6ad95ec 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -4258,10 +4258,16 @@ bool MainWindow::hasExistingMessageBuffer(int offset, bool drift, int *pPrevOffs } void MainWindow::logCallActivity(CallDetail d, bool spot){ + // don't log empty calls if(d.call.trimmed().isEmpty()){ return; } + // don't log relay calls + if(d.call.contains(">")){ + return; + } + if(m_callActivity.contains(d.call)){ // update (keep grid) CallDetail old = m_callActivity[d.call]; @@ -9769,6 +9775,33 @@ void MainWindow::processCommandActivity() { reply = QString("%1 ACK").arg(d.relayPath); + // check to see if the relay text contains a command that should be replied to instead of an ack. + auto relayedCmds = d.text.split(" "); + if(!relayedCmds.isEmpty()){ + auto first = relayedCmds.first(); + + auto valid = Varicode::isCommandAllowed(first); + if(!valid){ + first = " " + first; + valid = Varicode::isCommandAllowed(first); + } + + if(valid && Varicode::isCommandAutoreply(first)){ + CommandDetail rd = {}; + rd.bits = d.bits; + rd.cmd = first; + rd.freq = d.freq; + rd.from = d.relayPath; + rd.text = d.text; + rd.to = d.to; + rd.utcTimestamp = d.utcTimestamp; + + m_rxCommandQueue.insert(0, rd); + continue; + } + } + + // if we make it here, this is a message addCommandToInbox(d); QTimer::singleShot(500, this, [this, d](){ diff --git a/varicode.cpp b/varicode.cpp index a962723..2a04176 100644 --- a/varicode.cpp +++ b/varicode.cpp @@ -98,12 +98,19 @@ QMap directed_cmds = { {" ", 31 }, // send freetext }; +// commands allowed to be processed QSet allowed_cmds = {-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /*10,*/ /*11,*/ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, /*24,*/ 25, 26, 27, 28, 29, 30, 31}; +// commands that result in an autoreply +QSet autoreply_cmds = {0, 1, 2, 3, 4, 6, 12, 13, 30}; + +// commands that should be buffered QSet buffered_cmds = {3, 5, /*6,*/ /*7,*/ 12, 13, 14, 15}; +// commands that may include an SNR value QSet snr_cmds = {25, 29}; +// commands that are checksummed and their crc size QMap checksum_cmds = { { 5, 16 }, { 12, 16 }, @@ -1067,6 +1074,10 @@ int Varicode::isCommandChecksumed(const QString &cmd){ return checksum_cmds[directed_cmds[cmd]]; } +bool Varicode::isCommandAutoreply(const QString &cmd){ + return directed_cmds.contains(cmd) && (autoreply_cmds.contains(directed_cmds[cmd])); +} + bool isValidCompoundCallsign(QStringRef callsign){ // compound calls cannot be > 9 characters after removing the / if(callsign.toString().replace("/", "").length() > 9){ diff --git a/varicode.h b/varicode.h index 6437355..9e952a8 100644 --- a/varicode.h +++ b/varicode.h @@ -137,6 +137,7 @@ public: static bool isCommandAllowed(const QString &cmd); static bool isCommandBuffered(const QString &cmd); static int isCommandChecksumed(const QString &cmd); + static bool isCommandAutoreply(const QString &cmd); static bool isValidCallsign(const QString &callsign, bool *pIsCompound); static bool isCompoundCallsign(const QString &callsign);