diff --git a/decodedtext.cpp b/decodedtext.cpp index 9723ce1..8a1da46 100644 --- a/decodedtext.cpp +++ b/decodedtext.cpp @@ -224,8 +224,6 @@ bool DecodedText::tryUnpackDirected(){ message_ = QString(parts.join("")); } - message_ = message_.replace("APRS: ", "APRS:"); - directed_ = parts; frameType_ = type; return true; diff --git a/mainwindow.cpp b/mainwindow.cpp index 54037fc..6e7710d 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -4713,6 +4713,37 @@ 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){ + 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; + qDebug() << "enqueueing third party text" << d.from << d.text; + m_aprsClient->enqueueThirdParty(Radio::base_callsign(d.from), d.text); +} + void MainWindow::pskLogReport(QString mode, int offset, int snr, QString callsign, QString grid){ if(!m_config.spot_to_reporting_networks()) return; @@ -6185,8 +6216,8 @@ bool MainWindow::ensureCreateMessageReady(const QString &text){ return false; } - if(text.contains("APRS:") && !m_aprsClient->isPasscodeValid()){ - MessageBox::warning_message(this, tr ("Please ensure a valid APRS passcode is set in the settings when sending an APRS packet.")); + if(text.contains("@APRSIS") && !m_aprsClient->isPasscodeValid()){ + MessageBox::warning_message(this, tr ("Please ensure a valid APRS passcode is set in the settings when sending to the @APRSIS group.")); return false; } @@ -10310,32 +10341,6 @@ void MainWindow::processCommandActivity() { logCallActivity(cd, true); logHeardGraph(d.from, d.to); - // PROCESS BUFFERED GRID FOR EVERYONE - if (d.cmd == " GRID"){ - // 1. parse grids - // 2. log it to reporting networks - 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); - } - - // make sure this is explicit - continue; - } - // PROCESS BUFFERED HEARING FOR EVERYONE if (d.cmd == " HEARING"){ // 1. parse callsigns @@ -10354,6 +10359,11 @@ void MainWindow::processCommandActivity() { spotCmd(d); } + // PROCESS @APRSIS SPOTS FOR EVERYONE + if (d.to == "@APRSIS"){ + spotAPRSCmd(d); + } + // PREPARE CMD TEXT STRING QStringList textList = { QString("%1: %2%3").arg(d.from).arg(d.to).arg(d.cmd) @@ -10930,14 +10940,6 @@ void MainWindow::processCommandActivity() { } } - // PROCESS BUFFERED APRS: - else if(d.cmd == " APRS:" && m_config.spot_to_reporting_networks() && m_aprsClient->isPasscodeValid()){ - m_aprsClient->enqueueThirdParty(Radio::base_callsign(d.from), d.text); - - // make sure this is explicit - continue; - } - #if 0 // PROCESS ALERT else if (d.cmd == "!" && !isAllCall) { diff --git a/mainwindow.h b/mainwindow.h index f2f040b..93f93c6 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -945,6 +945,7 @@ private: void aprsSetLocal (); void spotReport(int offset, int snr, QString callsign, QString grid); void spotCmd(CommandDetail cmd); + void spotAPRSCmd(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 2e76048..330c7ef 100644 --- a/varicode.cpp +++ b/varicode.cpp @@ -77,7 +77,7 @@ QMap directed_cmds = { {" QUERY CALL", 13 }, // can you transmit a ping to callsign? - {" APRS:", 14 }, // send an aprs packet + // {" ", 14 }, // reserved {" GRID", 15 }, // this is my current grid locator @@ -105,13 +105,13 @@ QMap directed_cmds = { }; // 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}; +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 (which can be relayed) QSet autoreply_cmds = {0, 3, 4, 6, 9, 10, 11, 12, 13, 16, 30}; // commands that should be buffered -QSet buffered_cmds = {5, 9, 10, 11, 12, 13, 14, 15, 24}; +QSet buffered_cmds = {5, 9, 10, 11, 12, 13, 15, 24}; // commands that may include an SNR value QSet snr_cmds = {25, 29}; @@ -124,13 +124,12 @@ QMap checksum_cmds = { { 11, 16 }, { 12, 16 }, { 13, 16 }, - { 14, 16 }, { 15, 0 }, { 24, 16 } }; QString callsign_pattern = QString("(?[@]?[A-Z0-9/]+)"); -QString optional_cmd_pattern = QString("(?\\s?(?:AGN[?]|QSL[?]|HW CPY[?]|APRS[:]|MSG TO[:]|SNR[?]|INFO[?]|GRID[?]|STATUS[?]|QUERY MSGS[?]|HEARING[?]|(?:(?:STATUS|HEARING|QUERY CALL|QUERY MSGS|QUERY|CMD|MSG|NACK|ACK|73|YES|NO|SNR|QSL|RR|SK|FB|INFO|GRID|DIT DIT)(?=[ ]|$))|[?> ]))?"); +QString optional_cmd_pattern = QString("(?\\s?(?:AGN[?]|QSL[?]|HW CPY[?]|MSG TO[:]|SNR[?]|INFO[?]|GRID[?]|STATUS[?]|QUERY MSGS[?]|HEARING[?]|(?:(?:STATUS|HEARING|QUERY CALL|QUERY MSGS|QUERY|CMD|MSG|NACK|ACK|73|YES|NO|SNR|QSL|RR|SK|FB|INFO|GRID|DIT DIT)(?=[ ]|$))|[?> ]))?"); QString optional_grid_pattern = QString("(?\\s?[A-R]{2}[0-9]{2})?"); QString optional_extended_grid_pattern = QString("^(?\\s?(?:[A-R]{2}[0-9]{2}(?:[A-X]{2}(?:[0-9]{2})?)*))?"); QString optional_num_pattern = QString("(?(?<=SNR|\\bACK)\\s?[-+]?(?:3[01]|[0-2]?[0-9]))?"); @@ -242,6 +241,16 @@ QMap basecalls = { { "@CONTROL", nbasecall + 25 }, // Control group { "@NET", nbasecall + 26 }, // Net group { "@NTS", nbasecall + 27 }, // NTS group + + // reserved groups + { "@RESERVE/0", nbasecall + 28 }, // Reserved + { "@RESERVE/1", nbasecall + 29 }, // Reserved + { "@RESERVE/2", nbasecall + 30 }, // Reserved + { "@RESERVE/3", nbasecall + 31 }, // Reserved + { "@RESERVE/4", nbasecall + 32 }, // Reserved + + // special groups + { "@APRSIS", nbasecall + 33 }, // APRS GROUP }; QMap cqs = { @@ -1036,7 +1045,7 @@ QPair Varicode::grid2deg(QString const &grid){ // pack a 4-digit maidenhead grid locator into a 15-bit value quint16 Varicode::packGrid(QString const& value){ QString grid = QString(value).trimmed(); - if(grid.length() < 4){ + if(grid.length() < 4){ return (1<<15)-1; }