diff --git a/APRSISClient.cpp b/APRSISClient.cpp index 2b12b7d..c1a82e9 100644 --- a/APRSISClient.cpp +++ b/APRSISClient.cpp @@ -4,15 +4,13 @@ #include "varicode.h" - - APRSISClient::APRSISClient(QString host, quint16 port, QObject *parent): QTcpSocket(parent), m_host(host), m_port(port) { connect(&m_timer, &QTimer::timeout, this, &APRSISClient::sendReports); - m_timer.setInterval(30*1000); // every 30 seconds + m_timer.setInterval(60*1000); // every 60 seconds m_timer.start(); } diff --git a/APRSISClient.h b/APRSISClient.h index 1b6902f..158e0c9 100644 --- a/APRSISClient.h +++ b/APRSISClient.h @@ -16,6 +16,19 @@ public: static QPair grid2deg(QString grid); static QPair grid2aprs(QString grid); + void setServer(QString host, quint16 port){ + if(state() == QTcpSocket::ConnectedState){ + disconnectFromHost(); + } + + m_host = host; + m_port = port; + } + + void setPaused(bool paused){ + m_paused = paused; + } + void setLocalStation(QString mycall, QString mygrid){ m_localCall = mycall; m_localGrid = mygrid; @@ -29,7 +42,11 @@ public: void processQueue(bool disconnect=true); public slots: - void sendReports(){ processQueue(true); } + void sendReports(){ + if(m_paused) return; + + processQueue(true); + } private: QString m_localCall; @@ -39,6 +56,7 @@ private: QString m_host; quint16 m_port; QTimer m_timer; + bool m_paused; }; #endif // APRSISCLIENT_H diff --git a/Configuration.cpp b/Configuration.cpp index aaf7da4..e4b571b 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -555,7 +555,6 @@ private: QString my_callsign_; QString my_grid_; QString my_station_; - QString aprs_ssid_; QString my_qth_; QString reply_; int callsign_aging_; @@ -606,6 +605,10 @@ private: bool x4ToneSpacing_; bool use_dynamic_info_; QString opCall_; + + QString aprs_server_name_; + port_type aprs_server_port_; + QString udp_server_name_; port_type udp_server_port_; // QString n1mm_server_name () const; @@ -720,6 +723,8 @@ bool Configuration::x2ToneSpacing() const {return m_->x2ToneSpacing_;} bool Configuration::x4ToneSpacing() const {return m_->x4ToneSpacing_;} bool Configuration::split_mode () const {return m_->split_mode ();} QString Configuration::opCall() const {return m_->opCall_;} +QString Configuration::aprs_server_name () const {return m_->aprs_server_name_;} +auto Configuration::aprs_server_port () const -> port_type {return m_->aprs_server_port_;} QString Configuration::udp_server_name () const {return m_->udp_server_name_;} auto Configuration::udp_server_port () const -> port_type {return m_->udp_server_port_;} bool Configuration::accept_udp_requests () const {return m_->accept_udp_requests_;} @@ -865,10 +870,6 @@ QString Configuration::my_station() const return station; } -QString Configuration::aprs_ssid() const { - return m_->aprs_ssid_; -} - QString Configuration::my_qth() const { return m_->my_qth_; @@ -1304,6 +1305,8 @@ void Configuration::impl::initialize_models () ui_->TX_audio_source_button_group->button (rig_params_.audio_source)->setChecked (true); ui_->CAT_poll_interval_spin_box->setValue (rig_params_.poll_interval); ui_->opCallEntry->setText (opCall_); + ui_->aprs_server_line_edit->setText (aprs_server_name_); + ui_->aprs_server_port_spin_box->setValue (aprs_server_port_); ui_->udp_server_line_edit->setText (udp_server_name_); ui_->udp_server_port_spin_box->setValue (udp_server_port_); ui_->accept_udp_requests_check_box->setChecked (accept_udp_requests_); @@ -1356,7 +1359,6 @@ void Configuration::impl::read_settings () my_callsign_ = settings_->value ("MyCall", QString {}).toString (); my_grid_ = settings_->value ("MyGrid", QString {}).toString (); my_station_ = settings_->value("MyStation", QString {}).toString(); - aprs_ssid_ = settings_->value("APRSSSID", "-0").toString(); callsign_aging_ = settings_->value ("CallsignAging", 0).toInt (); activity_aging_ = settings_->value ("ActivityAging", 2).toInt (); my_qth_ = settings_->value("MyQTH", QString {}).toString(); @@ -1529,6 +1531,8 @@ void Configuration::impl::read_settings () rig_params_.poll_interval = settings_->value ("Polling", 0).toInt (); rig_params_.split_mode = settings_->value ("SplitMode", QVariant::fromValue (TransceiverFactory::split_mode_none)).value (); opCall_ = settings_->value ("OpCall", "").toString (); + aprs_server_name_ = settings_->value ("aprsServer", "rotate.aprs2.net").toString (); + aprs_server_port_ = settings_->value ("aprsServerPort", 14580).toUInt (); udp_server_name_ = settings_->value ("UDPServer", "127.0.0.1").toString (); udp_server_port_ = settings_->value ("UDPServerPort", 2237).toUInt (); n1mm_server_name_ = settings_->value ("N1MMServer", "127.0.0.1").toString (); @@ -1552,7 +1556,6 @@ void Configuration::impl::write_settings () settings_->setValue ("MyCall", my_callsign_); settings_->setValue ("MyGrid", my_grid_); settings_->setValue ("MyStation", my_station_); - settings_->setValue ("APRSSSID", aprs_ssid_); settings_->setValue ("MyQTH", my_qth_); settings_->setValue ("Reply", reply_); settings_->setValue ("CallsignAging", callsign_aging_); @@ -1643,6 +1646,8 @@ void Configuration::impl::write_settings () settings_->setValue ("x2ToneSpacing", x2ToneSpacing_); settings_->setValue ("x4ToneSpacing", x4ToneSpacing_); settings_->setValue ("OpCall", opCall_); + settings_->setValue ("aprsServer", aprs_server_name_); + settings_->setValue ("aprsServerPort", aprs_server_port_); settings_->setValue ("UDPServer", udp_server_name_); settings_->setValue ("UDPServerPort", udp_server_port_); settings_->setValue ("N1MMServer", n1mm_server_name_); @@ -2016,7 +2021,6 @@ void Configuration::impl::accept () my_grid_ = ui_->grid_line_edit->text (); my_station_ = ui_->station_message_line_edit->text().toUpper(); reply_ = ui_->reply_message_line_edit->text().toUpper(); - aprs_ssid_ = ui_->aprs_ssid_line_edit->text().toUpper(); my_qth_ = ui_->qth_message_line_edit->text().toUpper(); callsign_aging_ = ui_->callsign_aging_spin_box->value(); activity_aging_ = ui_->activity_aging_spin_box->value(); @@ -2064,6 +2068,9 @@ void Configuration::impl::accept () pwrBandTuneMemory_ = ui_->checkBoxPwrBandTuneMemory->isChecked (); opCall_=ui_->opCallEntry->text(); + aprs_server_name_ = ui_->aprs_server_line_edit->text(); + aprs_server_port_ = ui_->aprs_server_port_spin_box->value(); + auto newUdpEnabled = ui_->udpEnable->isChecked(); auto new_server = ui_->udp_server_line_edit->text (); if (new_server != udp_server_name_ || newUdpEnabled != udpEnabled_) diff --git a/Configuration.hpp b/Configuration.hpp index 0db5b51..33a1950 100644 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -98,7 +98,6 @@ public: QString my_callsign () const; QString my_grid () const; QString my_station () const; - QString aprs_ssid() const; int activity_aging() const; int callsign_aging() const; QString my_qth () const; @@ -149,6 +148,8 @@ public: bool EMEonly() const; bool post_decodes () const; QString opCall() const; + QString aprs_server_name () const; + port_type aprs_server_port () const; QString udp_server_name () const; port_type udp_server_port () const; QString n1mm_server_name () const; diff --git a/Configuration.ui b/Configuration.ui index f4e5ba0..ed71cf1 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -2027,73 +2027,80 @@ comments field. Network Services - - - - - 20 - - - - - The program can send your station details and all + + + + + The program can send your station details and all decoded signals as spots to the http://pskreporter.info web site. This is used for reverse beacon analysis which is very useful for assessing propagation and system performance. - + + + Enable spotting to reporting networks (PSKReporter && APRS-IS) + + + true + + + + + + + QFormLayout::AllNonFixedFieldsGrow + + + - Enable spotting to reporting networks (PSKReporter && APRS-IS) + APRS Server: - - true + + udp_server_line_edit - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - false - - - The SSID to be used for local APRS spots - - - APRS SSID: - - - - - - - false - + + 0 0 - - - 40 - 0 - + + <html><head/><body><p>Optional hostname of APRS server to send spots to.</p><p>Formats:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">hostname</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">IPv4 address</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">IPv6 address</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">IPv4 multicast group address</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">IPv6 multicast group address</li></ul><p>Clearing this field will disable the spotting to APRS.</p></body></html> + + + Qt::ImhDigitsOnly - -0 + rotate.aprs2.net + + + + + + + APRS Server Port: + + + udp_server_port_spin_box + + + + + + + <html><head/><body><p>Enter the service port number of the APRS server that should receive updates. If this is zero no updates will be broadcast.</p></body></html> + + + 0 + + + 65534 + + + 14580 @@ -2142,7 +2149,7 @@ for assessing propagation and system performance. - UDP Server port number: + UDP Server Port: udp_server_port_spin_box @@ -2152,7 +2159,7 @@ for assessing propagation and system performance. - <html><head/><body><p>Enter the service port number of the UDP server that WSJT-X should send updates to. If this is zero no updates will be broadcast.</p></body></html> + <html><head/><body><p>Enter the service port number of the UDP server that should receive updates. If this is zero no updates will be broadcast.</p></body></html> 0 @@ -2252,7 +2259,7 @@ for assessing propagation and system performance. - <html><head/><body><p>N1MM Server name or IP address:</p></body></html> + <html><head/><body><p>N1MM Server:</p></body></html> @@ -2266,14 +2273,14 @@ for assessing propagation and system performance. - <html><head/><body><p>N1MM Server port number:</p></body></html> + <html><head/><body><p>N1MM Server Port:</p></body></html> - <html><head/><body><p>Enter the port number that WSJT-X should use for UDP broadcasts of ADIF log information. For N1MM Logger+, this value should be 2333. If this is zero, no updates will be broadcast.</p></body></html> + <html><head/><body><p>Enter the port number that should be used for UDP broadcasts of ADIF log information. For N1MM Logger+, this value should be 2333. If this is zero, no updates will be broadcast.</p></body></html> @@ -3232,12 +3239,12 @@ soundcard changes - - - + + + diff --git a/mainwindow.cpp b/mainwindow.cpp index 3cd76f0..d06e183 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -2295,8 +2295,11 @@ void MainWindow::prepareSpotting(){ if(m_config.spot_to_reporting_networks ()){ pskSetLocal(); aprsSetLocal(); + m_aprsClient->setServer(m_config.aprs_server_name(), m_config.aprs_server_port()); + m_aprsClient->setPaused(false); ui->spotButton->setChecked(true); } else { + m_aprsClient->setPaused(true); ui->spotButton->setChecked(false); } } @@ -7120,7 +7123,7 @@ void MainWindow::band_changed (Frequency f) m_bandEdited = false; psk_Reporter->sendReport(); // Upload any queued spots before changing band - m_aprsClient->processQueue(true); + m_aprsClient->sendReports(); if (!m_transmitting) monitor (true); if ("FreqCal" == m_mode) {