From 83b05df31200d19a8606d3d3dc8d1ede29ad4731 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Tue, 28 Aug 2018 15:13:38 -0400 Subject: [PATCH] Added APRS payload sends to APRS-IS --- APRSISClient.cpp | 12 ++++++++++-- APRSISClient.h | 2 +- Configuration.ui | 3 +++ aprs.py | 11 ++++++++--- mainwindow.cpp | 8 ++++++++ varicode.cpp | 24 ++++++++++++++---------- 6 files changed, 44 insertions(+), 16 deletions(-) diff --git a/APRSISClient.cpp b/APRSISClient.cpp index c2f92b0..7795854 100644 --- a/APRSISClient.cpp +++ b/APRSISClient.cpp @@ -188,11 +188,11 @@ void APRSISClient::enqueueSpot(QString theircall, QString grid, quint64 frequenc if(m_localCall.isEmpty()) return; auto geo = APRSISClient::grid2aprs(grid); - auto spotFrame = QString("%1>APRS,TCPIP*:=%2/%3nFT8CALL %4 %5 %6MHz %7dB\n"); + auto spotFrame = QString("%1>%2,APRS,TCPIP*:=%3/%4nFT8CALL %5 %6MHz %7dB\n"); spotFrame = spotFrame.arg(theircall); + spotFrame = spotFrame.arg(m_localCall); spotFrame = spotFrame.arg(geo.first); spotFrame = spotFrame.arg(geo.second); - spotFrame = spotFrame.arg(m_localCall); spotFrame = spotFrame.arg(m_localGrid.left(4)); spotFrame = spotFrame.arg(Radio::frequency_MHz_string(frequency)); spotFrame = spotFrame.arg(Varicode::formatSNR(snr)); @@ -209,6 +209,14 @@ void APRSISClient::enqueueMessage(QString tocall, QString message){ enqueueRaw(messageFrame); } +void APRSISClient::enqueueThirdParty(QString theircall, QString payload){ + auto frame = QString("%1>%2,APRS,TCPIP*:%3\n"); + frame = frame.arg(theircall); + frame = frame.arg(m_localCall); + frame = frame.arg(payload); + enqueueRaw(frame); +} + void APRSISClient::enqueueRaw(QString aprsFrame){ m_frameQueue.enqueue(aprsFrame); } diff --git a/APRSISClient.h b/APRSISClient.h index 4cc7bc1..0f067d2 100644 --- a/APRSISClient.h +++ b/APRSISClient.h @@ -23,7 +23,7 @@ public: void enqueueSpot(QString theircall, QString grid, quint64 frequency, int snr); void enqueueMessage(QString tocall, QString message); - void enqueueMail(QString email, QString message); + void enqueueThirdParty(QString theircall, QString payload); void enqueueRaw(QString aprsFrame); void processQueue(bool disconnect=false); diff --git a/Configuration.ui b/Configuration.ui index 87158ce..32cc254 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -2030,6 +2030,9 @@ for assessing propagation and system performance. Enable spotting to reporting networks (PSKReporter, APRS-IS, etc) + + true + diff --git a/aprs.py b/aprs.py index 7bf269a..d36e7d4 100644 --- a/aprs.py +++ b/aprs.py @@ -41,19 +41,24 @@ print "Login sent...", login data = s.recv(1024) print data -if 1: +if 0: + message = "KN4CRD>OH8STN,APRS,TCPIP*::EMAIL-2 :KN4CRD@GMAIL.COM TESTING!{04}\n" + s.send(message) + +if 0: message = "{}>APRS,TCPIP*::EMAIL-2 :kn4crd@gmail.com testing456{{01}}\n".format(call) + message = "KN4CRD>APRS,TCPIP*::EMAIL-2 :KN4CRD@GMAIL.COM TESTING!{02}\n" s.send(message) if 0: payload = ":This is a test message" message = "{}>APRS,TCPIP*::{} {}\n".format(call, call, payload) s.send(message) -if 0: +if 1: position = "=3352.45N/08422.71Wn" status = "FT8CALL VIA XX9XXX/XXXX 14.082500MHz -20dB" payload = "".join((position, status)) - message = "{}>APRS,TCPIP*:{}\n".format(call, payload) + message = "{}>OH8STN,APRS,TCPIP*:{}\n".format(call, payload) s.send(message) print "Spot sent...", message diff --git a/mainwindow.cpp b/mainwindow.cpp index ce63ef6..ff89f31 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -9160,6 +9160,11 @@ void MainWindow::processCommandActivity() { reply = QString("%1 ACK").arg(d.from); } + // PROCESS APRS + else if(d.cmd == " APRS:" && m_config.spot_to_reporting_networks()){ + m_aprsClient->enqueueThirdParty(Radio::base_callsign(d.from), d.text); + reply = QString("%1 ACK").arg(d.from); + } // PROCESS ALERT else if (d.cmd == "!" && !isAllCall) { QMessageBox * msgBox = new QMessageBox(this); @@ -9184,6 +9189,9 @@ void MainWindow::processCommandActivity() { }); msgBox->show(); + + // make sure this is explicit + continue; } if (reply.isEmpty()) { diff --git a/varicode.cpp b/varicode.cpp index 91e1ee1..cb96220 100644 --- a/varicode.cpp +++ b/varicode.cpp @@ -45,16 +45,19 @@ QMap directed_cmds = { {"&", 2 }, // query station message {"$", 3 }, // query station(s) heard {"^", 4 }, // query grid - {"%", 5 }, // query pwr {"|", 6 }, // retransmit message {"!", 7 }, // alert message {"#", 8 }, // all or nothing message - // {"=", 9 }, // unused? (can we even use equals?) - // {"/", 10 }, // unused? (can we even use stroke?) + // {"=", 9 }, // unused + // {"/", 10 }, // unused + // {"/", 11 }, // unused + // {"/", 12 }, // unused + // {"/", 13 }, // unused // directed responses + {" APRS:", 14 }, // send an aprs packet {" GRID", 15 }, // this is my current grid locator {" QTC", 16 }, // this is my qtc message {" QTH", 17 }, // this is my qth message @@ -74,19 +77,20 @@ QMap directed_cmds = { {" ", 31 }, // send freetext }; -QSet allowed_cmds = {0, 1, 2, 3, 4, 5, 6, 7, 8, /*...*/ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}; +QSet allowed_cmds = {0, 1, 2, 3, 4, 5, 6, 7, 8, /*...*/ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}; -QSet buffered_cmds = {6, 7, 8, 15}; +QSet buffered_cmds = {6, 7, 8, 14, 15}; QMap checksum_cmds = { - {6, 16}, - {7, 16}, - {8, 32}, - {15, 0} + { 6, 16 }, + { 7, 16 }, + { 8, 32 }, + { 14, 16 }, + { 15, 0 } }; QString callsign_pattern = QString("(?[A-Z0-9/]+)"); -QString optional_cmd_pattern = QString("(?\\s?(?:AGN[?]|ACK|73|YES|NO|SNR|PWR|QSL[?]?|RR|HEARING|HW CPY[?]|FB|QTH|QTC|GRID|[?@&$%|!#^ ]))?"); +QString optional_cmd_pattern = QString("(?\\s?(?:AGN[?]|ACK|73|YES|NO|SNR|PWR|QSL[?]?|RR|HEARING|HW CPY[?]|FB|QTH|QTC|GRID|APRS[:]|[?@&$%|!#^ ]))?"); 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_pwr_pattern = QString("(?(?<=PWR)\\s?\\d+\\s?[KM]?W)?");