Added user configurable APRS server option

This commit is contained in:
Jordan Sherer 2018-09-02 00:05:15 -04:00
parent 9bbaba3f72
commit 24e9b15e42
6 changed files with 107 additions and 73 deletions

View File

@ -4,15 +4,13 @@
#include "varicode.h" #include "varicode.h"
APRSISClient::APRSISClient(QString host, quint16 port, QObject *parent): APRSISClient::APRSISClient(QString host, quint16 port, QObject *parent):
QTcpSocket(parent), QTcpSocket(parent),
m_host(host), m_host(host),
m_port(port) m_port(port)
{ {
connect(&m_timer, &QTimer::timeout, this, &APRSISClient::sendReports); 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(); m_timer.start();
} }

View File

@ -16,6 +16,19 @@ public:
static QPair<float, float> grid2deg(QString grid); static QPair<float, float> grid2deg(QString grid);
static QPair<QString, QString> grid2aprs(QString grid); static QPair<QString, QString> 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){ void setLocalStation(QString mycall, QString mygrid){
m_localCall = mycall; m_localCall = mycall;
m_localGrid = mygrid; m_localGrid = mygrid;
@ -29,7 +42,11 @@ public:
void processQueue(bool disconnect=true); void processQueue(bool disconnect=true);
public slots: public slots:
void sendReports(){ processQueue(true); } void sendReports(){
if(m_paused) return;
processQueue(true);
}
private: private:
QString m_localCall; QString m_localCall;
@ -39,6 +56,7 @@ private:
QString m_host; QString m_host;
quint16 m_port; quint16 m_port;
QTimer m_timer; QTimer m_timer;
bool m_paused;
}; };
#endif // APRSISCLIENT_H #endif // APRSISCLIENT_H

View File

@ -555,7 +555,6 @@ private:
QString my_callsign_; QString my_callsign_;
QString my_grid_; QString my_grid_;
QString my_station_; QString my_station_;
QString aprs_ssid_;
QString my_qth_; QString my_qth_;
QString reply_; QString reply_;
int callsign_aging_; int callsign_aging_;
@ -606,6 +605,10 @@ private:
bool x4ToneSpacing_; bool x4ToneSpacing_;
bool use_dynamic_info_; bool use_dynamic_info_;
QString opCall_; QString opCall_;
QString aprs_server_name_;
port_type aprs_server_port_;
QString udp_server_name_; QString udp_server_name_;
port_type udp_server_port_; port_type udp_server_port_;
// QString n1mm_server_name () const; // 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::x4ToneSpacing() const {return m_->x4ToneSpacing_;}
bool Configuration::split_mode () const {return m_->split_mode ();} bool Configuration::split_mode () const {return m_->split_mode ();}
QString Configuration::opCall() const {return m_->opCall_;} 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_;} QString Configuration::udp_server_name () const {return m_->udp_server_name_;}
auto Configuration::udp_server_port () const -> port_type {return m_->udp_server_port_;} auto Configuration::udp_server_port () const -> port_type {return m_->udp_server_port_;}
bool Configuration::accept_udp_requests () const {return m_->accept_udp_requests_;} bool Configuration::accept_udp_requests () const {return m_->accept_udp_requests_;}
@ -865,10 +870,6 @@ QString Configuration::my_station() const
return station; return station;
} }
QString Configuration::aprs_ssid() const {
return m_->aprs_ssid_;
}
QString Configuration::my_qth() const QString Configuration::my_qth() const
{ {
return m_->my_qth_; 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_->TX_audio_source_button_group->button (rig_params_.audio_source)->setChecked (true);
ui_->CAT_poll_interval_spin_box->setValue (rig_params_.poll_interval); ui_->CAT_poll_interval_spin_box->setValue (rig_params_.poll_interval);
ui_->opCallEntry->setText (opCall_); 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_line_edit->setText (udp_server_name_);
ui_->udp_server_port_spin_box->setValue (udp_server_port_); ui_->udp_server_port_spin_box->setValue (udp_server_port_);
ui_->accept_udp_requests_check_box->setChecked (accept_udp_requests_); 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_callsign_ = settings_->value ("MyCall", QString {}).toString ();
my_grid_ = settings_->value ("MyGrid", QString {}).toString (); my_grid_ = settings_->value ("MyGrid", QString {}).toString ();
my_station_ = settings_->value("MyStation", QString {}).toString(); my_station_ = settings_->value("MyStation", QString {}).toString();
aprs_ssid_ = settings_->value("APRSSSID", "-0").toString();
callsign_aging_ = settings_->value ("CallsignAging", 0).toInt (); callsign_aging_ = settings_->value ("CallsignAging", 0).toInt ();
activity_aging_ = settings_->value ("ActivityAging", 2).toInt (); activity_aging_ = settings_->value ("ActivityAging", 2).toInt ();
my_qth_ = settings_->value("MyQTH", QString {}).toString(); 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_.poll_interval = settings_->value ("Polling", 0).toInt ();
rig_params_.split_mode = settings_->value ("SplitMode", QVariant::fromValue (TransceiverFactory::split_mode_none)).value<TransceiverFactory::SplitMode> (); rig_params_.split_mode = settings_->value ("SplitMode", QVariant::fromValue (TransceiverFactory::split_mode_none)).value<TransceiverFactory::SplitMode> ();
opCall_ = settings_->value ("OpCall", "").toString (); 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_name_ = settings_->value ("UDPServer", "127.0.0.1").toString ();
udp_server_port_ = settings_->value ("UDPServerPort", 2237).toUInt (); udp_server_port_ = settings_->value ("UDPServerPort", 2237).toUInt ();
n1mm_server_name_ = settings_->value ("N1MMServer", "127.0.0.1").toString (); 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 ("MyCall", my_callsign_);
settings_->setValue ("MyGrid", my_grid_); settings_->setValue ("MyGrid", my_grid_);
settings_->setValue ("MyStation", my_station_); settings_->setValue ("MyStation", my_station_);
settings_->setValue ("APRSSSID", aprs_ssid_);
settings_->setValue ("MyQTH", my_qth_); settings_->setValue ("MyQTH", my_qth_);
settings_->setValue ("Reply", reply_); settings_->setValue ("Reply", reply_);
settings_->setValue ("CallsignAging", callsign_aging_); settings_->setValue ("CallsignAging", callsign_aging_);
@ -1643,6 +1646,8 @@ void Configuration::impl::write_settings ()
settings_->setValue ("x2ToneSpacing", x2ToneSpacing_); settings_->setValue ("x2ToneSpacing", x2ToneSpacing_);
settings_->setValue ("x4ToneSpacing", x4ToneSpacing_); settings_->setValue ("x4ToneSpacing", x4ToneSpacing_);
settings_->setValue ("OpCall", opCall_); settings_->setValue ("OpCall", opCall_);
settings_->setValue ("aprsServer", aprs_server_name_);
settings_->setValue ("aprsServerPort", aprs_server_port_);
settings_->setValue ("UDPServer", udp_server_name_); settings_->setValue ("UDPServer", udp_server_name_);
settings_->setValue ("UDPServerPort", udp_server_port_); settings_->setValue ("UDPServerPort", udp_server_port_);
settings_->setValue ("N1MMServer", n1mm_server_name_); settings_->setValue ("N1MMServer", n1mm_server_name_);
@ -2016,7 +2021,6 @@ void Configuration::impl::accept ()
my_grid_ = ui_->grid_line_edit->text (); my_grid_ = ui_->grid_line_edit->text ();
my_station_ = ui_->station_message_line_edit->text().toUpper(); my_station_ = ui_->station_message_line_edit->text().toUpper();
reply_ = ui_->reply_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(); my_qth_ = ui_->qth_message_line_edit->text().toUpper();
callsign_aging_ = ui_->callsign_aging_spin_box->value(); callsign_aging_ = ui_->callsign_aging_spin_box->value();
activity_aging_ = ui_->activity_aging_spin_box->value(); activity_aging_ = ui_->activity_aging_spin_box->value();
@ -2064,6 +2068,9 @@ void Configuration::impl::accept ()
pwrBandTuneMemory_ = ui_->checkBoxPwrBandTuneMemory->isChecked (); pwrBandTuneMemory_ = ui_->checkBoxPwrBandTuneMemory->isChecked ();
opCall_=ui_->opCallEntry->text(); 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 newUdpEnabled = ui_->udpEnable->isChecked();
auto new_server = ui_->udp_server_line_edit->text (); auto new_server = ui_->udp_server_line_edit->text ();
if (new_server != udp_server_name_ || newUdpEnabled != udpEnabled_) if (new_server != udp_server_name_ || newUdpEnabled != udpEnabled_)

View File

@ -98,7 +98,6 @@ public:
QString my_callsign () const; QString my_callsign () const;
QString my_grid () const; QString my_grid () const;
QString my_station () const; QString my_station () const;
QString aprs_ssid() const;
int activity_aging() const; int activity_aging() const;
int callsign_aging() const; int callsign_aging() const;
QString my_qth () const; QString my_qth () const;
@ -149,6 +148,8 @@ public:
bool EMEonly() const; bool EMEonly() const;
bool post_decodes () const; bool post_decodes () const;
QString opCall() const; QString opCall() const;
QString aprs_server_name () const;
port_type aprs_server_port () const;
QString udp_server_name () const; QString udp_server_name () const;
port_type udp_server_port () const; port_type udp_server_port () const;
QString n1mm_server_name () const; QString n1mm_server_name () const;

View File

@ -2027,73 +2027,80 @@ comments field.</string>
<property name="title"> <property name="title">
<string>Network Services</string> <string>Network Services</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_17"> <layout class="QVBoxLayout" name="verticalLayout_14">
<item row="1" column="0"> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <widget class="QCheckBox" name="psk_reporter_check_box">
<property name="bottomMargin"> <property name="toolTip">
<number>20</number> <string>The program can send your station details and all
</property>
<item>
<widget class="QCheckBox" name="psk_reporter_check_box">
<property name="toolTip">
<string>The program can send your station details and all
decoded signals as spots to the http://pskreporter.info web site. decoded signals as spots to the http://pskreporter.info web site.
This is used for reverse beacon analysis which is very useful This is used for reverse beacon analysis which is very useful
for assessing propagation and system performance.</string> for assessing propagation and system performance.</string>
</property> </property>
<property name="text">
<string>Enable spotting to reporting networks (PSKReporter &amp;&amp; APRS-IS)</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout_17">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="udp_server_label_2">
<property name="text"> <property name="text">
<string>Enable spotting to reporting networks (PSKReporter &amp;&amp; APRS-IS)</string> <string>APRS Server:</string>
</property> </property>
<property name="checked"> <property name="buddy">
<bool>true</bool> <cstring>udp_server_line_edit</cstring>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="1">
<spacer name="horizontalSpacer_2"> <widget class="QLineEdit" name="aprs_server_line_edit">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_16">
<property name="visible">
<bool>false</bool>
</property>
<property name="toolTip">
<string>The SSID to be used for local APRS spots</string>
</property>
<property name="text">
<string>APRS SSID:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="aprs_ssid_line_edit">
<property name="visible">
<bool>false</bool>
</property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="toolTip">
<size> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Optional hostname of APRS server to send spots to.&lt;/p&gt;&lt;p&gt;Formats:&lt;/p&gt;&lt;ul style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;hostname&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;IPv4 address&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;IPv6 address&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;IPv4 multicast group address&lt;/li&gt;&lt;li style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;IPv6 multicast group address&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Clearing this field will disable the spotting to APRS.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<width>40</width> </property>
<height>0</height> <property name="inputMethodHints">
</size> <set>Qt::ImhDigitsOnly</set>
</property> </property>
<property name="text"> <property name="text">
<string>-0</string> <string>rotate.aprs2.net</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_18">
<property name="text">
<string>APRS Server Port:</string>
</property>
<property name="buddy">
<cstring>udp_server_port_spin_box</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="aprs_server_port_spin_box">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter the service port number of the APRS server that should receive updates. If this is zero no updates will be broadcast.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>65534</number>
</property>
<property name="value">
<number>14580</number>
</property> </property>
</widget> </widget>
</item> </item>
@ -2142,7 +2149,7 @@ for assessing propagation and system performance.</string>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="text"> <property name="text">
<string>UDP Server port number:</string> <string>UDP Server Port:</string>
</property> </property>
<property name="buddy"> <property name="buddy">
<cstring>udp_server_port_spin_box</cstring> <cstring>udp_server_port_spin_box</cstring>
@ -2152,7 +2159,7 @@ for assessing propagation and system performance.</string>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QSpinBox" name="udp_server_port_spin_box"> <widget class="QSpinBox" name="udp_server_port_spin_box">
<property name="toolTip"> <property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter the service port number of the UDP server that should receive updates. If this is zero no updates will be broadcast.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="minimum"> <property name="minimum">
<number>0</number> <number>0</number>
@ -2252,7 +2259,7 @@ for assessing propagation and system performance.</string>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="n1mm_server_name_label"> <widget class="QLabel" name="n1mm_server_name_label">
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;N1MM Server name or IP address:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;N1MM Server:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -2266,14 +2273,14 @@ for assessing propagation and system performance.</string>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="n1mm_server_port_label"> <widget class="QLabel" name="n1mm_server_port_label">
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;N1MM Server port number:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;N1MM Server Port:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QSpinBox" name="n1mm_server_port_spin_box"> <widget class="QSpinBox" name="n1mm_server_port_spin_box">
<property name="toolTip"> <property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -3232,12 +3239,12 @@ soundcard changes</string>
</connection> </connection>
</connections> </connections>
<buttongroups> <buttongroups>
<buttongroup name="TX_audio_source_button_group"/>
<buttongroup name="CAT_stop_bits_button_group"/> <buttongroup name="CAT_stop_bits_button_group"/>
<buttongroup name="PTT_method_button_group"/> <buttongroup name="PTT_method_button_group"/>
<buttongroup name="CAT_handshake_button_group"/>
<buttongroup name="CAT_data_bits_button_group"/>
<buttongroup name="TX_mode_button_group"/> <buttongroup name="TX_mode_button_group"/>
<buttongroup name="CAT_handshake_button_group"/>
<buttongroup name="TX_audio_source_button_group"/>
<buttongroup name="CAT_data_bits_button_group"/>
<buttongroup name="split_mode_button_group"/> <buttongroup name="split_mode_button_group"/>
</buttongroups> </buttongroups>
</ui> </ui>

View File

@ -2295,8 +2295,11 @@ void MainWindow::prepareSpotting(){
if(m_config.spot_to_reporting_networks ()){ if(m_config.spot_to_reporting_networks ()){
pskSetLocal(); pskSetLocal();
aprsSetLocal(); aprsSetLocal();
m_aprsClient->setServer(m_config.aprs_server_name(), m_config.aprs_server_port());
m_aprsClient->setPaused(false);
ui->spotButton->setChecked(true); ui->spotButton->setChecked(true);
} else { } else {
m_aprsClient->setPaused(true);
ui->spotButton->setChecked(false); ui->spotButton->setChecked(false);
} }
} }
@ -7120,7 +7123,7 @@ void MainWindow::band_changed (Frequency f)
m_bandEdited = false; m_bandEdited = false;
psk_Reporter->sendReport(); // Upload any queued spots before changing band psk_Reporter->sendReport(); // Upload any queued spots before changing band
m_aprsClient->processQueue(true); m_aprsClient->sendReports();
if (!m_transmitting) monitor (true); if (!m_transmitting) monitor (true);
if ("FreqCal" == m_mode) if ("FreqCal" == m_mode)
{ {