mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-08-04 23:22:26 -04:00
Final adjustments for moving from test to live PSKReporter spotting
This commit is contained in:
parent
1f524026f9
commit
8b0b2c15b2
@ -32,9 +32,8 @@
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
// constexpr QLatin1String HOST {"report.pskreporter.info"};
|
constexpr QLatin1String HOST {"report.pskreporter.info"};
|
||||||
// constexpr QLatin1String HOST {"127.0.0.1"};
|
// constexpr QLatin1String HOST {"127.0.0.1"};
|
||||||
constexpr QLatin1String HOST {"192.168.1.195"};
|
|
||||||
constexpr quint16 SERVICE_PORT {4739};
|
constexpr quint16 SERVICE_PORT {4739};
|
||||||
// constexpr quint16 SERVICE_PORT {14739};
|
// constexpr quint16 SERVICE_PORT {14739};
|
||||||
constexpr int MIN_SEND_INTERVAL {15}; // in seconds
|
constexpr int MIN_SEND_INTERVAL {15}; // in seconds
|
||||||
@ -254,7 +253,7 @@ void PSKReporter::impl::build_preamble (QDataStream& message)
|
|||||||
<< ++sequence_number_ // Sequence Number
|
<< ++sequence_number_ // Sequence Number
|
||||||
<< observation_id_; // Observation Domain ID
|
<< observation_id_; // Observation Domain ID
|
||||||
|
|
||||||
qDebug () << "PSKReporter::impl::build_preamble: send_descriptors_:" << send_descriptors_;
|
// qDebug () << "PSKReporter::impl::build_preamble: send_descriptors_:" << send_descriptors_;
|
||||||
if (send_descriptors_)
|
if (send_descriptors_)
|
||||||
{
|
{
|
||||||
--send_descriptors_;
|
--send_descriptors_;
|
||||||
@ -319,7 +318,7 @@ void PSKReporter::impl::build_preamble (QDataStream& message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug () << "PSKReporter::impl::build_preamble: send_receiver_data_:" << send_receiver_data_;
|
// qDebug () << "PSKReporter::impl::build_preamble: send_receiver_data_:" << send_receiver_data_;
|
||||||
// if (send_receiver_data_)
|
// if (send_receiver_data_)
|
||||||
{
|
{
|
||||||
// --send_receiver_data_;
|
// --send_receiver_data_;
|
||||||
@ -348,7 +347,7 @@ void PSKReporter::impl::build_preamble (QDataStream& message)
|
|||||||
void PSKReporter::impl::send_report (bool send_residue)
|
void PSKReporter::impl::send_report (bool send_residue)
|
||||||
{
|
{
|
||||||
check_connection ();
|
check_connection ();
|
||||||
qDebug () << "PSKReporter::impl::send_report: send_residue:" << send_residue;
|
// qDebug () << "PSKReporter::impl::send_report: send_residue:" << send_residue;
|
||||||
if (QAbstractSocket::ConnectedState != socket_->state ()) return;
|
if (QAbstractSocket::ConnectedState != socket_->state ()) return;
|
||||||
|
|
||||||
QDataStream message {&payload_, QIODevice::WriteOnly | QIODevice::Append};
|
QDataStream message {&payload_, QIODevice::WriteOnly | QIODevice::Append};
|
||||||
@ -356,13 +355,13 @@ void PSKReporter::impl::send_report (bool send_residue)
|
|||||||
|
|
||||||
if (!payload_.size ())
|
if (!payload_.size ())
|
||||||
{
|
{
|
||||||
qDebug () << "PSKReporter::impl::send_report: building header";
|
// qDebug () << "PSKReporter::impl::send_report: building header";
|
||||||
// Build header, optional descriptors, and receiver information
|
// Build header, optional descriptors, and receiver information
|
||||||
build_preamble (message);
|
build_preamble (message);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto flush = flushing () || send_residue;
|
auto flush = flushing () || send_residue;
|
||||||
qDebug () << "PSKReporter::impl::send_report: flush:" << flush;
|
// qDebug () << "PSKReporter::impl::send_report: flush:" << flush;
|
||||||
while (spots_.size () || flush)
|
while (spots_.size () || flush)
|
||||||
{
|
{
|
||||||
if (!payload_.size ())
|
if (!payload_.size ())
|
||||||
@ -377,7 +376,7 @@ void PSKReporter::impl::send_report (bool send_residue)
|
|||||||
tx_out
|
tx_out
|
||||||
<< quint16 (0x50e3) // Template ID
|
<< quint16 (0x50e3) // Template ID
|
||||||
<< quint16 (0u); // Length (place-holder)
|
<< quint16 (0u); // Length (place-holder)
|
||||||
qDebug () << "PSKReporter::impl::send_report: set data set header";
|
// qDebug () << "PSKReporter::impl::send_report: set data set header";
|
||||||
}
|
}
|
||||||
|
|
||||||
// insert any residue
|
// insert any residue
|
||||||
@ -385,7 +384,7 @@ void PSKReporter::impl::send_report (bool send_residue)
|
|||||||
{
|
{
|
||||||
tx_out.writeRawData (tx_residue_.constData (), tx_residue_.size ());
|
tx_out.writeRawData (tx_residue_.constData (), tx_residue_.size ());
|
||||||
tx_residue_.clear ();
|
tx_residue_.clear ();
|
||||||
qDebug () << "PSKReporter::impl::send_report: inserted data residue";
|
// qDebug () << "PSKReporter::impl::send_report: inserted data residue";
|
||||||
}
|
}
|
||||||
|
|
||||||
while (spots_.size () || flush)
|
while (spots_.size () || flush)
|
||||||
@ -394,7 +393,7 @@ void PSKReporter::impl::send_report (bool send_residue)
|
|||||||
if (spots_.size ())
|
if (spots_.size ())
|
||||||
{
|
{
|
||||||
auto const& spot = spots_.dequeue ();
|
auto const& spot = spots_.dequeue ();
|
||||||
qDebug () << "PSKReporter::impl::send_report: processing spotted call:" << spot.call_;
|
// qDebug () << "PSKReporter::impl::send_report: processing spotted call:" << spot.call_;
|
||||||
|
|
||||||
// Sender information
|
// Sender information
|
||||||
writeUtfString (tx_out, spot.call_);
|
writeUtfString (tx_out, spot.call_);
|
||||||
@ -420,7 +419,7 @@ void PSKReporter::impl::send_report (bool send_residue)
|
|||||||
if (len <= MAX_PAYLOAD_LENGTH)
|
if (len <= MAX_PAYLOAD_LENGTH)
|
||||||
{
|
{
|
||||||
tx_data_size = tx_data_.size ();
|
tx_data_size = tx_data_.size ();
|
||||||
qDebug () << "PSKReporter::impl::send_report: sending short payload:" << tx_data_size;
|
// qDebug () << "PSKReporter::impl::send_report: sending short payload:" << tx_data_size;
|
||||||
}
|
}
|
||||||
QByteArray tx {tx_data_.left (tx_data_size)};
|
QByteArray tx {tx_data_.left (tx_data_size)};
|
||||||
QDataStream out {&tx, QIODevice::WriteOnly | QIODevice::Append};
|
QDataStream out {&tx, QIODevice::WriteOnly | QIODevice::Append};
|
||||||
@ -436,7 +435,7 @@ void PSKReporter::impl::send_report (bool send_residue)
|
|||||||
|
|
||||||
// Send data to PSK Reporter site
|
// Send data to PSK Reporter site
|
||||||
socket_->write (payload_); // TODO: handle errors
|
socket_->write (payload_); // TODO: handle errors
|
||||||
qDebug () << "PSKReporter::impl::send_report: sent payload:" << payload_.size () << "observation id:" << observation_id_;
|
// qDebug () << "PSKReporter::impl::send_report: sent payload:" << payload_.size () << "observation id:" << observation_id_;
|
||||||
flush = false; // break loop
|
flush = false; // break loop
|
||||||
message.device ()->seek (0u);
|
message.device ()->seek (0u);
|
||||||
payload_.clear (); // Fresh message
|
payload_.clear (); // Fresh message
|
||||||
@ -444,7 +443,7 @@ void PSKReporter::impl::send_report (bool send_residue)
|
|||||||
tx_residue_ = tx_data_.right (tx_data_.size () - tx_data_size);
|
tx_residue_ = tx_data_.right (tx_data_.size () - tx_data_size);
|
||||||
tx_out.device ()->seek (0u);
|
tx_out.device ()->seek (0u);
|
||||||
tx_data_.clear ();
|
tx_data_.clear ();
|
||||||
qDebug () << "PSKReporter::impl::send_report: payload sent residue length:" << tx_residue_.size ();
|
// qDebug () << "PSKReporter::impl::send_report: payload sent residue length:" << tx_residue_.size ();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user