From f2bbf98cbbee79405a5673e45b5ed4587e858ab6 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Tue, 20 Oct 2020 12:43:45 +0100 Subject: [PATCH] Update WSPRnet.org posts to allow mode to be determined The sent/received 'mode' parameter posted to WSPRnet.org has been amended as follows: WSPR-2: "2" FST4W-120: "3" FST4W-300: "5" FST4W-900: "16" FST4W-1800: "30" this change is designed to maintain backwards compatibility with older versions of WSJT-X and other software like WSPR-X which already post these values: WSPR-2: "2" WSPR-15: "15" It is expected that the WSPRnet.org server side will be updated in sync with a WSJT-X v2.3.0 RC2 (or GA) release to account for this change. --- Network/wsprnet.cpp | 38 ++++++++++++++++++++++---------------- Network/wsprnet.h | 7 ++++--- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/Network/wsprnet.cpp b/Network/wsprnet.cpp index ba1e36c18..e01be1b5e 100644 --- a/Network/wsprnet.cpp +++ b/Network/wsprnet.cpp @@ -211,7 +211,7 @@ void WSPRNet::networkReply (QNetworkReply * reply) } } -bool WSPRNet::decodeLine (QString const& line, SpotQueue::value_type& query) +bool WSPRNet::decodeLine (QString const& line, SpotQueue::value_type& query) const { auto const& rx_match = wspr_re.match (line); if (rx_match.hasMatch ()) { @@ -271,7 +271,23 @@ bool WSPRNet::decodeLine (QString const& line, SpotQueue::value_type& query) return true; } -auto WSPRNet::urlEncodeNoSpot () -> SpotQueue::value_type +QString WSPRNet::encode_mode () const +{ + if (m_mode == "WSPR") return "2"; + if (m_mode == "WSPR-15") return "15"; + if (m_mode == "FST4W") + { + auto tr = static_cast ((TR_period_ / 60.)+.5); + if (2 == tr || 15 == tr) + { + tr += 1; // distinguish from WSPR-2 and WSPR-15 + } + return QString::number (tr); + } + return ""; +} + +auto WSPRNet::urlEncodeNoSpot () const -> SpotQueue::value_type { SpotQueue::value_type query; query.addQueryItem ("function", "wsprstat"); @@ -282,28 +298,18 @@ auto WSPRNet::urlEncodeNoSpot () -> SpotQueue::value_type query.addQueryItem ("tqrg", m_tfreq); query.addQueryItem ("dbm", m_dbm); query.addQueryItem ("version", m_vers); - if (m_mode == "WSPR") query.addQueryItem ("mode", "2"); - if (m_mode == "WSPR-15") query.addQueryItem ("mode", "15"); - if (m_mode == "FST4W") - { - query.addQueryItem ("mode", QString::number (static_cast ((TR_period_ / 60.)+.5))); - } + query.addQueryItem ("mode", encode_mode ()); return query;; } -auto WSPRNet::urlEncodeSpot (SpotQueue::value_type& query) -> SpotQueue::value_type +auto WSPRNet::urlEncodeSpot (SpotQueue::value_type& query) const -> SpotQueue::value_type { query.addQueryItem ("version", m_vers); query.addQueryItem ("rcall", m_call); query.addQueryItem ("rgrid", m_grid); query.addQueryItem ("rqrg", m_rfreq); - if (m_mode == "WSPR") query.addQueryItem ("mode", "2"); - if (m_mode == "WSPR-15") query.addQueryItem ("mode", "15"); - if (m_mode == "FST4W") - { - query.addQueryItem ("mode", QString::number (static_cast ((TR_period_ / 60.)+.5))); - } - return query; + query.addQueryItem ("mode", encode_mode ()); + return query; } void WSPRNet::work() diff --git a/Network/wsprnet.h b/Network/wsprnet.h index 29e5e58f8..a450d5827 100644 --- a/Network/wsprnet.h +++ b/Network/wsprnet.h @@ -34,9 +34,10 @@ public slots: void abortOutstandingRequests (); private: - bool decodeLine (QString const& line, SpotQueue::value_type& query); - SpotQueue::value_type urlEncodeNoSpot (); - SpotQueue::value_type urlEncodeSpot (SpotQueue::value_type& spot); + bool decodeLine (QString const& line, SpotQueue::value_type& query) const; + SpotQueue::value_type urlEncodeNoSpot () const; + SpotQueue::value_type urlEncodeSpot (SpotQueue::value_type& spot) const; + QString encode_mode () const; QNetworkAccessManager * network_manager_; QList m_outstandingRequests;