From 1629415dc1eda8a947b902863d796234a17b6578 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Mon, 25 Mar 2019 15:05:13 -0400 Subject: [PATCH] Added spotting of messages directed to @JS8NET --- SpotClient.cpp | 21 ++++++++++++++++++++- SpotClient.h | 1 + mainwindow.cpp | 16 ++++++++++++++++ mainwindow.h | 1 + 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/SpotClient.cpp b/SpotClient.cpp index 7f0e66e..2ef2a68 100644 --- a/SpotClient.cpp +++ b/SpotClient.cpp @@ -81,7 +81,26 @@ void SpotClient::enqueueSpot(QString callsign, QString grid, int frequency, int {"SNR", QVariant(snr)}, }); - // queue these... + m_queue.enqueue(m.toJson()); +} + +void SpotClient::enqueueCmd(QString cmd, QString from, QString to, QString relayPath, QString text, QString grid, QString extra, int frequency, int snr){ + auto m = Message("RX.DIRECTED", "", { + {"BY", QVariant(QMap{ + {"CALLSIGN", QVariant(m_call)}, + {"GRID", QVariant(m_grid)}, + })}, + {"CMD", QVariant(cmd)}, + {"FROM", QVariant(from)}, + {"TO", QVariant(to)}, + {"PATH", QVariant(relayPath)}, + {"TEXT", QVariant(text)}, + {"GRID", QVariant(grid)}, + {"EXTRA", QVariant(extra)}, + {"FREQ", QVariant(frequency)}, + {"SNR", QVariant(snr)}, + }); + m_queue.enqueue(m.toJson()); } diff --git a/SpotClient.h b/SpotClient.h index 88b4b92..d6095ff 100644 --- a/SpotClient.h +++ b/SpotClient.h @@ -17,6 +17,7 @@ public: void prepare(); void setLocalStation(QString callsign, QString grid, QString info, QString version); void enqueueLocalSpot(QString callsign, QString grid, QString info, QString version); + void enqueueCmd(QString cmd, QString from, QString to, QString relayPath, QString text, QString grid, QString extra, int frequency, int snr); void enqueueSpot(QString callsign, QString grid, int frequency, int snr); void sendRawSpot(QByteArray payload); diff --git a/mainwindow.cpp b/mainwindow.cpp index 932c213..23c6d05 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -4543,6 +4543,17 @@ void MainWindow::spotReport(int offset, int snr, QString callsign, QString grid) m_spotClient->enqueueSpot(callsign, grid, frequency, snr); } +void MainWindow::spotCmd(CommandDetail cmd){ + if(!m_config.spot_to_reporting_networks()) return; + + QString cmdStr = cmd.cmd; + if(!cmdStr.trimmed().isEmpty()){ + cmdStr = Varicode::lstrip(cmd.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::pskLogReport(QString mode, int offset, int snr, QString callsign, QString grid){ if(!m_config.spot_to_reporting_networks()) return; @@ -9971,6 +9982,11 @@ void MainWindow::processCommandActivity() { continue; } + // PROCESS @JS8NET SPOTS FOR EVERYONE + if (d.to == "@JS8NET"){ + spotCmd(d); + } + // we're only responding to allcall, groupcalls, and our callsign at this point, so we'll end after logging the callsigns we've heard if (!isAllCall && !toMe && !isGroupCall) { continue; diff --git a/mainwindow.h b/mainwindow.h index b833447..bd8d14a 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -926,6 +926,7 @@ private: void pskSetLocal (); void aprsSetLocal (); void spotReport(int offset, int snr, QString callsign, QString grid); + void spotCmd(CommandDetail cmd); 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();