Added APRS payload sends to APRS-IS

This commit is contained in:
Jordan Sherer 2018-08-28 15:13:38 -04:00
parent 541bd8bca3
commit 83b05df312
6 changed files with 44 additions and 16 deletions

View File

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

View File

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

View File

@ -2030,6 +2030,9 @@ for assessing propagation and system performance.</string>
<property name="text">
<string>Enable spotting to reporting networks (PSKReporter, APRS-IS, etc)</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>

11
aprs.py
View File

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

View File

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

View File

@ -45,16 +45,19 @@ QMap<QString, int> 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<QString, int> directed_cmds = {
{" ", 31 }, // send freetext
};
QSet<int> 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<int> 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<int> buffered_cmds = {6, 7, 8, 15};
QSet<int> buffered_cmds = {6, 7, 8, 14, 15};
QMap<int, int> checksum_cmds = {
{6, 16},
{7, 16},
{8, 32},
{15, 0}
{ 6, 16 },
{ 7, 16 },
{ 8, 32 },
{ 14, 16 },
{ 15, 0 }
};
QString callsign_pattern = QString("(?<callsign>[A-Z0-9/]+)");
QString optional_cmd_pattern = QString("(?<cmd>\\s?(?:AGN[?]|ACK|73|YES|NO|SNR|PWR|QSL[?]?|RR|HEARING|HW CPY[?]|FB|QTH|QTC|GRID|[?@&$%|!#^ ]))?");
QString optional_cmd_pattern = QString("(?<cmd>\\s?(?:AGN[?]|ACK|73|YES|NO|SNR|PWR|QSL[?]?|RR|HEARING|HW CPY[?]|FB|QTH|QTC|GRID|APRS[:]|[?@&$%|!#^ ]))?");
QString optional_grid_pattern = QString("(?<grid>\\s?[A-R]{2}[0-9]{2})?");
QString optional_extended_grid_pattern = QString("^(?<grid>\\s?(?:[A-R]{2}[0-9]{2}(?:[A-X]{2}(?:[0-9]{2})?)*))?");
QString optional_pwr_pattern = QString("(?<pwr>(?<=PWR)\\s?\\d+\\s?[KM]?W)?");