Added tcp server configuration options
This commit is contained in:
parent
2ff74626ba
commit
1d6670f2f9
@ -685,6 +685,8 @@ private:
|
||||
|
||||
QString udp_server_name_;
|
||||
port_type udp_server_port_;
|
||||
QString tcp_server_name_;
|
||||
port_type tcp_server_port_;
|
||||
QString n3fjp_server_name_;
|
||||
port_type n3fjp_server_port_;
|
||||
bool broadcast_to_n3fjp_;
|
||||
@ -692,9 +694,10 @@ private:
|
||||
port_type n1mm_server_port_;
|
||||
bool broadcast_to_n1mm_;
|
||||
bool accept_udp_requests_;
|
||||
bool udpWindowToFront_;
|
||||
bool udpWindowRestore_;
|
||||
bool accept_tcp_requests_;
|
||||
bool udpEnabled_;
|
||||
bool tcpEnabled_;
|
||||
int tcpMaxConnections_;
|
||||
DataMode data_mode_;
|
||||
bool pwrBandTxMemory_;
|
||||
bool pwrBandTuneMemory_;
|
||||
@ -868,16 +871,19 @@ 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_;}
|
||||
QString Configuration::tcp_server_name () const {return m_->tcp_server_name_;}
|
||||
auto Configuration::tcp_server_port () const -> port_type {return m_->tcp_server_port_;}
|
||||
bool Configuration::accept_udp_requests () const {return m_->accept_udp_requests_;}
|
||||
bool Configuration::accept_tcp_requests () const {return m_->accept_tcp_requests_;}
|
||||
QString Configuration::n3fjp_server_name () const {return m_->n3fjp_server_name_;}
|
||||
auto Configuration::n3fjp_server_port () const -> port_type {return m_->n3fjp_server_port_;}
|
||||
bool Configuration::broadcast_to_n3fjp () const {return m_->broadcast_to_n3fjp_;}
|
||||
QString Configuration::n1mm_server_name () const {return m_->n1mm_server_name_;}
|
||||
auto Configuration::n1mm_server_port () const -> port_type {return m_->n1mm_server_port_;}
|
||||
bool Configuration::broadcast_to_n1mm () const {return m_->broadcast_to_n1mm_;}
|
||||
bool Configuration::udpWindowToFront () const {return m_->udpWindowToFront_;}
|
||||
bool Configuration::udpWindowRestore () const {return m_->udpWindowRestore_;}
|
||||
bool Configuration::udpEnabled () const {return m_->udpEnabled_;}
|
||||
bool Configuration::tcpEnabled () const {return m_->tcpEnabled_;}
|
||||
int Configuration::tcp_max_connections() const { return m_->tcpMaxConnections_; }
|
||||
Bands * Configuration::bands () {return &m_->bands_;}
|
||||
Bands const * Configuration::bands () const {return &m_->bands_;}
|
||||
StationList * Configuration::stations () {return &m_->stations_;}
|
||||
@ -1618,16 +1624,19 @@ void Configuration::impl::initialize_models ()
|
||||
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_->tcp_server_line_edit->setText (tcp_server_name_);
|
||||
ui_->tcp_server_port_spin_box->setValue (tcp_server_port_);
|
||||
ui_->accept_udp_requests_check_box->setChecked (accept_udp_requests_);
|
||||
ui_->accept_tcp_requests_check_box->setChecked (accept_tcp_requests_);
|
||||
ui_->n3fjp_server_name_line_edit->setText (n3fjp_server_name_);
|
||||
ui_->n3fjp_server_port_spin_box->setValue (n3fjp_server_port_);
|
||||
ui_->enable_n3fjp_broadcast_check_box->setChecked (broadcast_to_n3fjp_);
|
||||
ui_->n1mm_server_name_line_edit->setText (n1mm_server_name_);
|
||||
ui_->n1mm_server_port_spin_box->setValue (n1mm_server_port_);
|
||||
ui_->enable_n1mm_broadcast_check_box->setChecked (broadcast_to_n1mm_);
|
||||
ui_->udpWindowToFront->setChecked(udpWindowToFront_);
|
||||
ui_->tcpEnable->setChecked(tcpEnabled_);
|
||||
ui_->udpEnable->setChecked(udpEnabled_);
|
||||
ui_->udpWindowRestore->setChecked(udpWindowRestore_);
|
||||
ui_->tcp_max_connections_spin_box->setValue(tcpMaxConnections_);
|
||||
ui_->calibration_intercept_spin_box->setValue (calibration_.intercept);
|
||||
ui_->calibration_slope_ppm_spin_box->setValue (calibration_.slope_ppm);
|
||||
|
||||
@ -2069,6 +2078,8 @@ void Configuration::impl::read_settings ()
|
||||
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", 2242).toUInt ();
|
||||
tcp_server_name_ = settings_->value ("TCPServer", "127.0.0.1").toString ();
|
||||
tcp_server_port_ = settings_->value ("TCPServerPort", 2442).toUInt ();
|
||||
n3fjp_server_name_ = settings_->value ("N3FJPServer", "127.0.0.1").toString ();
|
||||
n3fjp_server_port_ = settings_->value ("N3FJPServerPort", 1100).toUInt ();
|
||||
broadcast_to_n3fjp_ = settings_->value ("BroadcastToN3FJP", false).toBool ();
|
||||
@ -2076,9 +2087,10 @@ void Configuration::impl::read_settings ()
|
||||
n1mm_server_port_ = settings_->value ("N1MMServerPort", 2333).toUInt ();
|
||||
broadcast_to_n1mm_ = settings_->value ("BroadcastToN1MM", false).toBool ();
|
||||
accept_udp_requests_ = settings_->value ("AcceptUDPRequests", false).toBool ();
|
||||
accept_tcp_requests_ = settings_->value ("AcceptTCPRequests", false).toBool ();
|
||||
udpEnabled_ = settings_->value("UDPEnabled", false).toBool();
|
||||
udpWindowToFront_ = settings_->value ("udpWindowToFront",false).toBool ();
|
||||
udpWindowRestore_ = settings_->value ("udpWindowRestore",false).toBool ();
|
||||
tcpEnabled_ = settings_->value("TCPEnabled", false).toBool();
|
||||
tcpMaxConnections_ = settings_->value("TCPMaxConnections", 1).toInt();
|
||||
calibration_.intercept = settings_->value ("CalibrationIntercept", 0.).toDouble ();
|
||||
calibration_.slope_ppm = settings_->value ("CalibrationSlopePPM", 0.).toDouble ();
|
||||
pwrBandTxMemory_ = settings_->value("pwrBandTxMemory",false).toBool ();
|
||||
@ -2255,6 +2267,8 @@ void Configuration::impl::write_settings ()
|
||||
settings_->setValue ("aprsServerPort", aprs_server_port_);
|
||||
settings_->setValue ("UDPServer", udp_server_name_);
|
||||
settings_->setValue ("UDPServerPort", udp_server_port_);
|
||||
settings_->setValue ("TCPServer", tcp_server_name_);
|
||||
settings_->setValue ("TCPServerPort", tcp_server_port_);
|
||||
settings_->setValue ("N3FJPServer", n3fjp_server_name_);
|
||||
settings_->setValue ("N3FJPServerPort", n3fjp_server_port_);
|
||||
settings_->setValue ("BroadcastToN3FJP", broadcast_to_n3fjp_);
|
||||
@ -2262,9 +2276,10 @@ void Configuration::impl::write_settings ()
|
||||
settings_->setValue ("N1MMServerPort", n1mm_server_port_);
|
||||
settings_->setValue ("BroadcastToN1MM", broadcast_to_n1mm_);
|
||||
settings_->setValue ("AcceptUDPRequests", accept_udp_requests_);
|
||||
settings_->setValue ("AcceptTCPRequests", accept_tcp_requests_);
|
||||
settings_->setValue ("UDPEnabled", udpEnabled_);
|
||||
settings_->setValue ("udpWindowToFront", udpWindowToFront_);
|
||||
settings_->setValue ("udpWindowRestore", udpWindowRestore_);
|
||||
settings_->setValue ("TCPEnabled", tcpEnabled_);
|
||||
settings_->setValue ("TCPMaxConnections", tcpMaxConnections_);
|
||||
settings_->setValue ("CalibrationIntercept", calibration_.intercept);
|
||||
settings_->setValue ("CalibrationSlopePPM", calibration_.slope_ppm);
|
||||
settings_->setValue ("pwrBandTxMemory", pwrBandTxMemory_);
|
||||
@ -2870,23 +2885,48 @@ void Configuration::impl::accept ()
|
||||
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_)
|
||||
auto newUdpServer = ui_->udp_server_line_edit->text ();
|
||||
if (newUdpServer != udp_server_name_ || newUdpEnabled != udpEnabled_)
|
||||
{
|
||||
udp_server_name_ = new_server;
|
||||
udp_server_name_ = newUdpServer;
|
||||
udpEnabled_ = newUdpEnabled;
|
||||
|
||||
Q_EMIT self_->udp_server_changed (udpEnabled_ ? new_server : "");
|
||||
Q_EMIT self_->udp_server_changed (udpEnabled_ ? newUdpServer : "");
|
||||
}
|
||||
|
||||
auto new_port = ui_->udp_server_port_spin_box->value ();
|
||||
if (new_port != udp_server_port_)
|
||||
auto newUdpPort = ui_->udp_server_port_spin_box->value ();
|
||||
if (newUdpPort != udp_server_port_)
|
||||
{
|
||||
udp_server_port_ = new_port;
|
||||
Q_EMIT self_->udp_server_port_changed (new_port);
|
||||
udp_server_port_ = newUdpPort;
|
||||
Q_EMIT self_->udp_server_port_changed (newUdpPort);
|
||||
}
|
||||
|
||||
auto newTcpEnabled = ui_->tcpEnable->isChecked();
|
||||
auto newTcpServer = ui_->tcp_server_line_edit->text ();
|
||||
if (newTcpServer != tcp_server_name_ || newTcpEnabled != tcpEnabled_)
|
||||
{
|
||||
tcp_server_name_ = newTcpServer;
|
||||
tcpEnabled_ = newTcpEnabled;
|
||||
|
||||
Q_EMIT self_->tcp_server_changed (tcpEnabled_ ? newTcpServer : "");
|
||||
}
|
||||
|
||||
auto newTcpPort = ui_->tcp_server_port_spin_box->value ();
|
||||
if (newTcpPort != tcp_server_port_)
|
||||
{
|
||||
tcp_server_port_ = newTcpPort;
|
||||
Q_EMIT self_->tcp_server_port_changed (newTcpPort);
|
||||
}
|
||||
|
||||
auto newTcpMaxConnections = ui_->tcp_max_connections_spin_box->value();
|
||||
if(newTcpMaxConnections != tcpMaxConnections_){
|
||||
tcpMaxConnections_ = newTcpMaxConnections;
|
||||
Q_EMIT self_->tcp_max_connections_changed (newTcpMaxConnections);
|
||||
}
|
||||
|
||||
accept_udp_requests_ = ui_->accept_udp_requests_check_box->isChecked ();
|
||||
accept_tcp_requests_ = ui_->accept_tcp_requests_check_box->isChecked ();
|
||||
|
||||
auto new_n3fjp_server = ui_->n3fjp_server_name_line_edit->text ();
|
||||
n3fjp_server_name_ = new_n3fjp_server;
|
||||
auto new_n3fjp_port = ui_->n3fjp_server_port_spin_box->value ();
|
||||
@ -2899,10 +2939,6 @@ void Configuration::impl::accept ()
|
||||
n1mm_server_port_ = new_n1mm_port;
|
||||
broadcast_to_n1mm_ = ui_->enable_n1mm_broadcast_check_box->isChecked ();
|
||||
|
||||
udpWindowToFront_ = ui_->udpWindowToFront->isChecked ();
|
||||
udpWindowRestore_ = ui_->udpWindowRestore->isChecked ();
|
||||
|
||||
|
||||
if (macros_.stringList () != next_macros_.stringList ())
|
||||
{
|
||||
macros_.setStringList (next_macros_.stringList ());
|
||||
|
@ -188,6 +188,8 @@ public:
|
||||
port_type aprs_server_port () const;
|
||||
QString udp_server_name () const;
|
||||
port_type udp_server_port () const;
|
||||
QString tcp_server_name () const;
|
||||
port_type tcp_server_port () const;
|
||||
QString n1mm_server_name () const;
|
||||
port_type n1mm_server_port () const;
|
||||
bool valid_n1mm_info () const;
|
||||
@ -197,9 +199,10 @@ public:
|
||||
bool valid_n3fjp_info () const;
|
||||
bool broadcast_to_n3fjp() const;
|
||||
bool accept_udp_requests () const;
|
||||
bool udpWindowToFront () const;
|
||||
bool udpWindowRestore () const;
|
||||
bool accept_tcp_requests () const;
|
||||
bool udpEnabled () const;
|
||||
bool tcpEnabled () const;
|
||||
int tcp_max_connections () const;
|
||||
Bands * bands ();
|
||||
Bands const * bands () const;
|
||||
IARURegions::Region region () const;
|
||||
@ -334,6 +337,7 @@ public:
|
||||
Q_SIGNAL void udp_server_port_changed (port_type port);
|
||||
Q_SIGNAL void tcp_server_changed (QString const& host);
|
||||
Q_SIGNAL void tcp_server_port_changed (port_type port);
|
||||
Q_SIGNAL void tcp_max_connections_changed (int n);
|
||||
|
||||
// This signal is emitted when the band schedule changes
|
||||
Q_SIGNAL void band_schedule_changed (StationList &stations);
|
||||
|
536
Configuration.ui
536
Configuration.ui
@ -2350,6 +2350,97 @@ both here.</string>
|
||||
<string>Reporting and logging settings</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="logging_group_box">
|
||||
<property name="title">
|
||||
<string>Logging</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_14">
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="report_in_comments_check_box">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Some logging programs will not accept the type of reports
|
||||
saved by this program.
|
||||
Check this option to save the sent and received reports in the
|
||||
comments field.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>d&B reports to comments</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="clear_callsign_check_box">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Check this option to force deselect callsign after logging.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Deselect callsign after logging</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Operator Callsign (if different than Station Callsign):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="prompt_to_log_check_box">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The program will pop up a partially completed Log QSO dialog when you send a 73 or free text message.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Promp&t me to log QSO</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLineEdit" name="opCallEntry">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>The callsign of the operator, if different from the station callsign.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="log_as_RTTY_check_box">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Some logging programs will not accept JT-65 or JT9 as a recognized mode.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Con&vert mode to DATA</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea_6">
|
||||
<property name="frameShape">
|
||||
@ -2370,7 +2461,7 @@ both here.</string>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>746</width>
|
||||
<height>667</height>
|
||||
<height>722</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_30">
|
||||
@ -2386,223 +2477,6 @@ both here.</string>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="logging_group_box">
|
||||
<property name="title">
|
||||
<string>Logging</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_14">
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="report_in_comments_check_box">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Some logging programs will not accept the type of reports
|
||||
saved by this program.
|
||||
Check this option to save the sent and received reports in the
|
||||
comments field.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>d&B reports to comments</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="clear_callsign_check_box">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Check this option to force deselect callsign after logging.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Deselect callsign after logging</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="text">
|
||||
<string>Operator Callsign (if different than Station Callsign):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="prompt_to_log_check_box">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The program will pop up a partially completed Log QSO dialog when you send a 73 or free text message.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Promp&t me to log QSO</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLineEdit" name="opCallEntry">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>The callsign of the operator, if different from the station callsign.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="log_as_RTTY_check_box">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Some logging programs will not accept JT-65 or JT9 as a recognized mode.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Con&vert mode to DATA</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>UDP API</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_16">
|
||||
<item row="0" column="0">
|
||||
<layout class="QFormLayout" name="formLayout_6">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="udp_server_label">
|
||||
<property name="text">
|
||||
<string>UDP Server:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>udp_server_line_edit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="udp_server_line_edit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Optional hostname of network service to receive decodes.</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 broadcasting of UDP status updates.</p></body></html></string>
|
||||
</property>
|
||||
<property name="inputMethodHints">
|
||||
<set>Qt::ImhDigitsOnly</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>UDP 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="udp_server_port_spin_box">
|
||||
<property name="toolTip">
|
||||
<string><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></string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65534</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="udpEnable">
|
||||
<property name="text">
|
||||
<string>Enable UDP Server API</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="accept_udp_requests_check_box">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>With this enabled the app will accept certain requests back from a UDP server that receives decode messages.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Accept UDP requests</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_21">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="use_dynamic_grid">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Check to allow changes to grid, qtc, etc from external programs</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Accept Dynamic Station Information (Grid, Info, Status, etc)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="udpWindowToFront">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Indicate acceptance of an incoming UDP request. The effect of this option varies depending on the operating system and window manager, its intent is to notify the acceptance of an incoming UDP request even if this application is minimized or hidden.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Notify on accepted UDP request</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="udpWindowRestore">
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Restore the window from minimized if an UDP request is accepted.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Accepted UDP request restores window</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="network_group_box">
|
||||
<property name="title">
|
||||
@ -2700,6 +2574,225 @@ for assessing propagation and system performance.</string>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>API</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_16">
|
||||
<item row="2" column="1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="udpEnable">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Enable the application to send API information to UDP Servers</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable UDP Server API</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="accept_udp_requests_check_box">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>With this enabled the app will accept certain requests back from a UDP server that receives decode messages.</p></body></html>ch</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Accept UDP Requests</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer_20">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_38">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="tcpEnable">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Enable the application to send API information over a TCP Server</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable TCP Server API</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="accept_tcp_requests_check_box">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>With this enabled the app will accept certain requests back from a TCP client that receives decode messages.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Accept TCP Requests</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_19">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<layout class="QFormLayout" name="formLayout_18">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="tcp_server_line_edit"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>TCP Server Hostname: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_29">
|
||||
<property name="text">
|
||||
<string>TCP Server Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="tcp_server_port_spin_box">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Enter the service port number of the TCP server. If this is zero then TCP server will not be started.</p></body></html></string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65534</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="tcp_max_connections_spin_box">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Enter the maximum number of API connections allowed to the TCP server</p></body></html></string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_30">
|
||||
<property name="text">
|
||||
<string>TCP Max Connections:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QFormLayout" name="formLayout_6">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="udp_server_label">
|
||||
<property name="text">
|
||||
<string>UDP Server Hostname:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>udp_server_line_edit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="udp_server_line_edit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Optional hostname of network service to receive decodes.</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 broadcasting of UDP status updates.</p></body></html></string>
|
||||
</property>
|
||||
<property name="inputMethodHints">
|
||||
<set>Qt::ImhDigitsOnly</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>UDP 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="udp_server_port_spin_box">
|
||||
<property name="toolTip">
|
||||
<string><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></string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65534</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="use_dynamic_grid">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Check to allow changes to grid, qtc, etc from external programs</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Allow setting station information (Grid, Info, Status, etc) from the APIs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="verticalSpacer_21">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_11">
|
||||
<property name="title">
|
||||
@ -4508,7 +4601,6 @@ soundcard changes</string>
|
||||
<tabstop>udp_server_port_spin_box</tabstop>
|
||||
<tabstop>udpEnable</tabstop>
|
||||
<tabstop>accept_udp_requests_check_box</tabstop>
|
||||
<tabstop>use_dynamic_grid</tabstop>
|
||||
<tabstop>psk_reporter_check_box</tabstop>
|
||||
<tabstop>aprs_server_line_edit</tabstop>
|
||||
<tabstop>aprs_server_port_spin_box</tabstop>
|
||||
@ -4646,11 +4738,11 @@ soundcard changes</string>
|
||||
</connections>
|
||||
<buttongroups>
|
||||
<buttongroup name="split_mode_button_group"/>
|
||||
<buttongroup name="CAT_stop_bits_button_group"/>
|
||||
<buttongroup name="TX_mode_button_group"/>
|
||||
<buttongroup name="PTT_method_button_group"/>
|
||||
<buttongroup name="CAT_handshake_button_group"/>
|
||||
<buttongroup name="CAT_data_bits_button_group"/>
|
||||
<buttongroup name="TX_audio_source_button_group"/>
|
||||
<buttongroup name="PTT_method_button_group"/>
|
||||
<buttongroup name="CAT_stop_bits_button_group"/>
|
||||
<buttongroup name="TX_mode_button_group"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
@ -20,11 +20,16 @@ bool MessageServer::start()
|
||||
}
|
||||
|
||||
auto address = QHostAddress();
|
||||
if(!address.setAddress(m_host)){
|
||||
if(m_host.isEmpty() || !address.setAddress(m_host)){
|
||||
qDebug() << "MessageServer address invalid:" << m_host << m_port;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(m_port <= 0){
|
||||
qDebug() << "MessageServer port invalid:" << m_host << m_port;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool listening = listen(address, m_port);
|
||||
qDebug() << "MessageServer listening:" << listening << m_host << m_port;
|
||||
|
||||
@ -67,6 +72,33 @@ void MessageServer::setPause(bool paused)
|
||||
}
|
||||
}
|
||||
|
||||
void MessageServer::setMaxConnections(int n){
|
||||
// set the maximum number of connections allowed
|
||||
m_maxConnections = n;
|
||||
|
||||
// then, prune old ones greater than the max (fifo)
|
||||
pruneConnections();
|
||||
}
|
||||
|
||||
int MessageServer::activeConnections(){
|
||||
int i = 0;
|
||||
foreach(auto client, m_clients){
|
||||
if(client->isConnected()) i++;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
void MessageServer::pruneConnections(){
|
||||
// keep only the n most recent connections (fifo)
|
||||
if(m_maxConnections && m_maxConnections < activeConnections()){
|
||||
for(int i = m_maxConnections; i < activeConnections(); i++){
|
||||
auto client = m_clients.first();
|
||||
client->close();
|
||||
m_clients.removeFirst();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MessageServer::send(const Message &message){
|
||||
foreach(auto client, m_clients){
|
||||
if(!client->awaitingResponse(message.id())){
|
||||
@ -91,6 +123,13 @@ void MessageServer::incomingConnection(qintptr handle)
|
||||
}
|
||||
#endif
|
||||
|
||||
if(m_maxConnections && m_maxConnections <= activeConnections()){
|
||||
qDebug() << "MessageServer connections full, dropping incoming connection";
|
||||
client->send(Message("API.ERROR", "Connections Full"));
|
||||
client->close();
|
||||
return;
|
||||
}
|
||||
|
||||
m_clients.append(client);
|
||||
}
|
||||
|
||||
@ -167,12 +206,12 @@ void Client::readyRead(){
|
||||
QJsonParseError e;
|
||||
QJsonDocument d = QJsonDocument::fromJson(msg, &e);
|
||||
if(e.error != QJsonParseError::NoError){
|
||||
//Q_EMIT self_->error(QString {"MessageClient json parse error: %1"}.arg(e.errorString()));
|
||||
send({"API.ERROR", "Invalid JSON (unparsable)"});
|
||||
return;
|
||||
}
|
||||
|
||||
if(!d.isObject()){
|
||||
//Q_EMIT self_->error(QString {"MessageClient json parse error: json is not an object"});
|
||||
send({"API.ERROR", "Invalid JSON (not an object)"});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,8 @@ public:
|
||||
virtual ~MessageServer();
|
||||
|
||||
protected:
|
||||
int activeConnections();
|
||||
void pruneConnections();
|
||||
void incomingConnection(qintptr handle);
|
||||
|
||||
signals:
|
||||
@ -30,6 +32,7 @@ public slots:
|
||||
void setPause(bool paused);
|
||||
bool start();
|
||||
void stop();
|
||||
void setMaxConnections(int n);
|
||||
void setServerHost(const QString &host){ setServer(host, m_port); }
|
||||
void setServerPort(quint16 port){ setServer(m_host, port); }
|
||||
void send(Message const &message);
|
||||
@ -38,6 +41,7 @@ private:
|
||||
bool m_paused;
|
||||
QString m_host;
|
||||
quint16 m_port;
|
||||
int m_maxConnections;
|
||||
|
||||
QList<Client*> m_clients;
|
||||
};
|
||||
|
@ -488,11 +488,13 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
||||
// hook up the message server slots and signals and disposal
|
||||
connect (m_messageServer, &MessageServer::error, this, &MainWindow::udpNetworkError);
|
||||
connect (m_messageServer, &MessageServer::message, this, &MainWindow::networkMessage);
|
||||
connect (this, &MainWindow::apiSetMaxConnections, m_messageServer, &MessageServer::setMaxConnections);
|
||||
connect (this, &MainWindow::apiSetServer, m_messageServer, &MessageServer::setServer);
|
||||
connect (this, &MainWindow::apiStartServer, m_messageServer, &MessageServer::start);
|
||||
connect (this, &MainWindow::apiStopServer, m_messageServer, &MessageServer::stop);
|
||||
connect (&m_config, &Configuration::tcp_server_changed, m_messageServer, &MessageServer::setServerHost);
|
||||
connect (&m_config, &Configuration::tcp_server_port_changed, m_messageServer, &MessageServer::setServerPort);
|
||||
connect (&m_config, &Configuration::tcp_max_connections_changed, m_messageServer, &MessageServer::setMaxConnections);
|
||||
connect (&m_networkThread, &QThread::finished, m_messageServer, &QObject::deleteLater);
|
||||
|
||||
// hook up the aprs client slots and signals and disposal
|
||||
@ -3180,9 +3182,13 @@ void MainWindow::openSettings(int tab){
|
||||
}
|
||||
|
||||
void MainWindow::prepareApi(){
|
||||
bool enabled = true;
|
||||
// the udp api is prepared by default (always listening)
|
||||
|
||||
// so, we just need to prepare the tcp api
|
||||
bool enabled = m_config.tcpEnabled();
|
||||
if(enabled){
|
||||
emit apiSetServer("0.0.0.0", 2442);
|
||||
emit apiSetMaxConnections(m_config.tcp_max_connections());
|
||||
emit apiSetServer(m_config.tcp_server_name(), m_config.tcp_server_port());
|
||||
emit apiStartServer();
|
||||
} else {
|
||||
emit apiStopServer();
|
||||
@ -12624,13 +12630,13 @@ void MainWindow::udpNetworkMessage(Message const &message)
|
||||
|
||||
void MainWindow::tcpNetworkMessage(Message const &message)
|
||||
{
|
||||
// if(!m_config.tcpEnabled()){
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if(!m_config.accept_tcp_requests()){
|
||||
// return;
|
||||
// }
|
||||
if(!m_config.tcpEnabled()){
|
||||
return;
|
||||
}
|
||||
|
||||
if(!m_config.accept_tcp_requests()){
|
||||
return;
|
||||
}
|
||||
|
||||
networkMessage(message);
|
||||
}
|
||||
@ -12888,7 +12894,7 @@ void MainWindow::networkMessage(Message const &message)
|
||||
}
|
||||
|
||||
bool MainWindow::canSendNetworkMessage(){
|
||||
return m_config.udpEnabled();
|
||||
return m_config.udpEnabled() || m_config.tcpEnabled();
|
||||
}
|
||||
|
||||
void MainWindow::sendNetworkMessage(QString const &type, QString const &message){
|
||||
@ -12897,8 +12903,14 @@ void MainWindow::sendNetworkMessage(QString const &type, QString const &message)
|
||||
}
|
||||
|
||||
auto m = Message(type, message);
|
||||
m_messageClient->send(m);
|
||||
m_messageServer->send(m);
|
||||
|
||||
if(m_config.udpEnabled()){
|
||||
m_messageClient->send(m);
|
||||
}
|
||||
|
||||
if(m_config.tcpEnabled()){
|
||||
m_messageServer->send(m);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::sendNetworkMessage(QString const &type, QString const &message, QMap<QString, QVariant> const ¶ms)
|
||||
@ -12908,12 +12920,19 @@ void MainWindow::sendNetworkMessage(QString const &type, QString const &message,
|
||||
}
|
||||
|
||||
auto m = Message(type, message, params);
|
||||
m_messageClient->send(m);
|
||||
m_messageServer->send(m);
|
||||
|
||||
if(m_config.udpEnabled()){
|
||||
m_messageClient->send(m);
|
||||
}
|
||||
|
||||
if(m_config.tcpEnabled()){
|
||||
m_messageServer->send(m);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::udpNetworkError (QString const& e)
|
||||
{
|
||||
/*
|
||||
if(!m_config.udpEnabled()){
|
||||
return;
|
||||
}
|
||||
@ -12934,6 +12953,7 @@ void MainWindow::udpNetworkError (QString const& e)
|
||||
// retry server lookup
|
||||
m_messageClient->set_server (m_config.udp_server_name ());
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void MainWindow::tcpNetworkError (QString const& e)
|
||||
|
@ -441,6 +441,7 @@ private slots:
|
||||
void refreshTextDisplay();
|
||||
|
||||
private:
|
||||
Q_SIGNAL void apiSetMaxConnections(int n);
|
||||
Q_SIGNAL void apiSetServer(QString host, quint16 port);
|
||||
Q_SIGNAL void apiStartServer();
|
||||
Q_SIGNAL void apiStopServer();
|
||||
|
Loading…
Reference in New Issue
Block a user