Closed #45: A subset of directed commands will be autoreplied when relayed. This includes: SNR, GRID, QTC, QTH, etc

This commit is contained in:
Jordan Sherer 2019-01-20 23:08:57 -05:00
parent f13a6c37e8
commit ef6bde8cb0
3 changed files with 45 additions and 0 deletions

View File

@ -4258,10 +4258,16 @@ bool MainWindow::hasExistingMessageBuffer(int offset, bool drift, int *pPrevOffs
} }
void MainWindow::logCallActivity(CallDetail d, bool spot){ void MainWindow::logCallActivity(CallDetail d, bool spot){
// don't log empty calls
if(d.call.trimmed().isEmpty()){ if(d.call.trimmed().isEmpty()){
return; return;
} }
// don't log relay calls
if(d.call.contains(">")){
return;
}
if(m_callActivity.contains(d.call)){ if(m_callActivity.contains(d.call)){
// update (keep grid) // update (keep grid)
CallDetail old = m_callActivity[d.call]; CallDetail old = m_callActivity[d.call];
@ -9769,6 +9775,33 @@ void MainWindow::processCommandActivity() {
reply = QString("%1 ACK").arg(d.relayPath); 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); addCommandToInbox(d);
QTimer::singleShot(500, this, [this, d](){ QTimer::singleShot(500, this, [this, d](){

View File

@ -98,12 +98,19 @@ QMap<QString, int> directed_cmds = {
{" ", 31 }, // send freetext {" ", 31 }, // send freetext
}; };
// commands allowed to be processed
QSet<int> 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}; QSet<int> 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<int> autoreply_cmds = {0, 1, 2, 3, 4, 6, 12, 13, 30};
// commands that should be buffered
QSet<int> buffered_cmds = {3, 5, /*6,*/ /*7,*/ 12, 13, 14, 15}; QSet<int> buffered_cmds = {3, 5, /*6,*/ /*7,*/ 12, 13, 14, 15};
// commands that may include an SNR value
QSet<int> snr_cmds = {25, 29}; QSet<int> snr_cmds = {25, 29};
// commands that are checksummed and their crc size
QMap<int, int> checksum_cmds = { QMap<int, int> checksum_cmds = {
{ 5, 16 }, { 5, 16 },
{ 12, 16 }, { 12, 16 },
@ -1067,6 +1074,10 @@ int Varicode::isCommandChecksumed(const QString &cmd){
return checksum_cmds[directed_cmds[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){ bool isValidCompoundCallsign(QStringRef callsign){
// compound calls cannot be > 9 characters after removing the / // compound calls cannot be > 9 characters after removing the /
if(callsign.toString().replace("/", "").length() > 9){ if(callsign.toString().replace("/", "").length() > 9){

View File

@ -137,6 +137,7 @@ public:
static bool isCommandAllowed(const QString &cmd); static bool isCommandAllowed(const QString &cmd);
static bool isCommandBuffered(const QString &cmd); static bool isCommandBuffered(const QString &cmd);
static int isCommandChecksumed(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 isValidCallsign(const QString &callsign, bool *pIsCompound);
static bool isCompoundCallsign(const QString &callsign); static bool isCompoundCallsign(const QString &callsign);