PSK Reporter connection opened & closed at the correct times

This commit is contained in:
Bill Somerville
2020-08-16 00:38:19 +01:00
parent 491a7b9a05
commit 50da40413f
3 changed files with 29 additions and 6 deletions
+20 -2
View File
@@ -165,6 +165,16 @@ public:
}
}
void stop ()
{
if (socket_)
{
socket_->disconnectFromHost ();
}
descriptor_timer_.stop ();
report_timer_.stop ();
}
void send_report (bool send_residue = false);
void build_preamble (QDataStream&);
@@ -484,6 +494,7 @@ void PSKReporter::reconnect ()
void PSKReporter::setLocalStation (QString const& call, QString const& gridSquare, QString const& antenna)
{
m_->check_connection ();
if (call != m_->rx_call_ || gridSquare != m_->rx_grid_ || antenna != m_->rx_ant_)
{
m_->send_receiver_data_ = m_->socket_
@@ -510,7 +521,14 @@ bool PSKReporter::addRemoteStation (QString const& call, QString const& grid, Ra
return false;
}
void PSKReporter::sendReport ()
void PSKReporter::sendReport (bool last)
{
m_->send_report (true);
if (m_->socket_ && QAbstractSocket::ConnectedState == m_->socket_->state ())
{
m_->send_report (true);
}
if (last)
{
m_->stop ();
}
}