Add contest exchange send and received fields to UDP logged QSO message

Updated  message_aggregator and  udp_daemon reference  applications to
exercise this change.
This commit is contained in:
Bill Somerville 2018-12-02 10:09:37 -05:00
parent fdb59cf6e9
commit 59fc83455d
14 changed files with 67 additions and 43 deletions

View File

@ -462,7 +462,8 @@ void MessageClient::qso_logged (QDateTime time_off, QString const& dx_call, QStr
, QString const& report_received, QString const& tx_power , QString const& report_received, QString const& tx_power
, QString const& comments, QString const& name, QDateTime time_on , QString const& comments, QString const& name, QDateTime time_on
, QString const& operator_call, QString const& my_call , QString const& operator_call, QString const& my_call
, QString const& my_grid) , QString const& my_grid, QString const& exchange_sent
, QString const& exchange_rcvd)
{ {
if (m_->server_port_ && !m_->server_string_.isEmpty ()) if (m_->server_port_ && !m_->server_string_.isEmpty ())
{ {
@ -470,7 +471,8 @@ void MessageClient::qso_logged (QDateTime time_off, QString const& dx_call, QStr
NetworkMessage::Builder out {&message, NetworkMessage::QSOLogged, m_->id_, m_->schema_}; NetworkMessage::Builder out {&message, NetworkMessage::QSOLogged, m_->id_, m_->schema_};
out << time_off << dx_call.toUtf8 () << dx_grid.toUtf8 () << dial_frequency << mode.toUtf8 () out << time_off << dx_call.toUtf8 () << dx_grid.toUtf8 () << dial_frequency << mode.toUtf8 ()
<< report_sent.toUtf8 () << report_received.toUtf8 () << tx_power.toUtf8 () << comments.toUtf8 () << report_sent.toUtf8 () << report_received.toUtf8 () << tx_power.toUtf8 () << comments.toUtf8 ()
<< name.toUtf8 () << time_on << operator_call.toUtf8 () << my_call.toUtf8 () << my_grid.toUtf8 (); << name.toUtf8 () << time_on << operator_call.toUtf8 () << my_call.toUtf8 () << my_grid.toUtf8 ()
<< exchange_sent.toUtf8 () << exchange_rcvd.toUtf8 ();
m_->send_message (out, message); m_->send_message (out, message);
} }
} }

View File

@ -64,7 +64,8 @@ public:
, Frequency dial_frequency, QString const& mode, QString const& report_sent , Frequency dial_frequency, QString const& mode, QString const& report_sent
, QString const& report_received, QString const& tx_power, QString const& comments , QString const& report_received, QString const& tx_power, QString const& comments
, QString const& name, QDateTime time_on, QString const& operator_call , QString const& name, QDateTime time_on, QString const& operator_call
, QString const& my_call, QString const& my_grid); , QString const& my_call, QString const& my_grid
, QString const& exchange_sent, QString const& exchange_rcvd);
// ADIF_record argument should be valid ADIF excluding any <EOR> end // ADIF_record argument should be valid ADIF excluding any <EOR> end
// of record marker // of record marker

View File

@ -294,8 +294,11 @@ void MessageServer::impl::parse_message (QHostAddress const& sender, port_type s
QByteArray operator_call; QByteArray operator_call;
QByteArray my_call; QByteArray my_call;
QByteArray my_grid; QByteArray my_grid;
QByteArray exchange_sent;
QByteArray exchange_rcvd;
in >> time_off >> dx_call >> dx_grid >> dial_frequency >> mode >> report_sent >> report_received in >> time_off >> dx_call >> dx_grid >> dial_frequency >> mode >> report_sent >> report_received
>> tx_power >> comments >> name >> time_on >> operator_call >> my_call >> my_grid; >> tx_power >> comments >> name >> time_on >> operator_call >> my_call >> my_grid
>> exchange_sent >> exchange_rcvd;
if (check_status (in) != Fail) if (check_status (in) != Fail)
{ {
Q_EMIT self_->qso_logged (id, time_off, QString::fromUtf8 (dx_call), QString::fromUtf8 (dx_grid) Q_EMIT self_->qso_logged (id, time_off, QString::fromUtf8 (dx_call), QString::fromUtf8 (dx_grid)
@ -303,7 +306,8 @@ void MessageServer::impl::parse_message (QHostAddress const& sender, port_type s
, QString::fromUtf8 (report_received), QString::fromUtf8 (tx_power) , QString::fromUtf8 (report_received), QString::fromUtf8 (tx_power)
, QString::fromUtf8 (comments), QString::fromUtf8 (name), time_on , QString::fromUtf8 (comments), QString::fromUtf8 (name), time_on
, QString::fromUtf8 (operator_call), QString::fromUtf8 (my_call) , QString::fromUtf8 (operator_call), QString::fromUtf8 (my_call)
, QString::fromUtf8 (my_grid)); , QString::fromUtf8 (my_grid), QString::fromUtf8 (exchange_sent)
, QString::fromUtf8 (exchange_rcvd));
} }
} }
break; break;

View File

@ -88,7 +88,8 @@ public:
, Frequency dial_frequency, QString const& mode, QString const& report_sent , Frequency dial_frequency, QString const& mode, QString const& report_sent
, QString const& report_received, QString const& tx_power, QString const& comments , QString const& report_received, QString const& tx_power, QString const& comments
, QString const& name, QDateTime time_on, QString const& operator_call , QString const& name, QDateTime time_on, QString const& operator_call
, QString const& my_call, QString const& my_grid); , QString const& my_call, QString const& my_grid
, QString const& exchange_sent, QString const& exchange_rcvd);
Q_SIGNAL void clear_decodes (QString const& id); Q_SIGNAL void clear_decodes (QString const& id);
Q_SIGNAL void logged_ADIF (QString const& id, QByteArray const& ADIF); Q_SIGNAL void logged_ADIF (QString const& id, QByteArray const& ADIF);

View File

@ -240,6 +240,8 @@
* Operator call utf8 * Operator call utf8
* My call utf8 * My call utf8
* My grid utf8 * My grid utf8
* Exchange sent utf8
* Exchange received utf8
* *
* The QSO logged message is sent to the server(s) when the * The QSO logged message is sent to the server(s) when the
* WSJT-X user accepts the "Log QSO" dialog by clicking the "OK" * WSJT-X user accepts the "Log QSO" dialog by clicking the "OK"

View File

@ -72,7 +72,7 @@ namespace
} }
BeaconsModel::BeaconsModel (QObject * parent) BeaconsModel::BeaconsModel (QObject * parent)
: QStandardItemModel {0, sizeof (headings) / sizeof (headings[0]), parent} : QStandardItemModel {0, sizeof headings / sizeof headings[0], parent}
{ {
int column {0}; int column {0};
for (auto const& heading : headings) for (auto const& heading : headings)

View File

@ -75,7 +75,7 @@ namespace
} }
DecodesModel::DecodesModel (QObject * parent) DecodesModel::DecodesModel (QObject * parent)
: QStandardItemModel {0, sizeof (headings) / sizeof (headings[0]), parent} : QStandardItemModel {0, sizeof headings / sizeof headings[0], parent}
{ {
int column {0}; int column {0};
for (auto const& heading : headings) for (auto const& heading : headings)

View File

@ -25,12 +25,14 @@ namespace
QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "Operator"), QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "Operator"),
QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "My Call"), QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "My Call"),
QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "My Grid"), QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "My Grid"),
QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "Exchange Sent"),
QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "Exchange Rcvd"),
QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "Comments"), QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "Comments"),
}; };
} }
MessageAggregatorMainWindow::MessageAggregatorMainWindow () MessageAggregatorMainWindow::MessageAggregatorMainWindow ()
: log_ {new QStandardItemModel {0, 14, this}} : log_ {new QStandardItemModel {0, sizeof headings / sizeof headings[0], this}}
, decodes_model_ {new DecodesModel {this}} , decodes_model_ {new DecodesModel {this}}
, beacons_model_ {new BeaconsModel {this}} , beacons_model_ {new BeaconsModel {this}}
, server_ {new MessageServer {this}} , server_ {new MessageServer {this}}
@ -209,7 +211,8 @@ void MessageAggregatorMainWindow::log_qso (QString const& /*id*/, QDateTime time
, QString const& report_sent, QString const& report_received , QString const& report_sent, QString const& report_received
, QString const& tx_power, QString const& comments , QString const& tx_power, QString const& comments
, QString const& name, QDateTime time_on, QString const& operator_call , QString const& name, QDateTime time_on, QString const& operator_call
, QString const& my_call, QString const& my_grid) , QString const& my_call, QString const& my_grid
, QString const& exchange_sent, QString const& exchange_rcvd)
{ {
QList<QStandardItem *> row; QList<QStandardItem *> row;
row << new QStandardItem {time_on.toString ("dd-MMM-yyyy hh:mm:ss")} row << new QStandardItem {time_on.toString ("dd-MMM-yyyy hh:mm:ss")}
@ -225,6 +228,8 @@ void MessageAggregatorMainWindow::log_qso (QString const& /*id*/, QDateTime time
<< new QStandardItem {operator_call} << new QStandardItem {operator_call}
<< new QStandardItem {my_call} << new QStandardItem {my_call}
<< new QStandardItem {my_grid} << new QStandardItem {my_grid}
<< new QStandardItem {exchange_sent}
<< new QStandardItem {exchange_rcvd}
<< new QStandardItem {comments}; << new QStandardItem {comments};
log_->appendRow (row); log_->appendRow (row);
log_table_view_->resizeColumnsToContents (); log_table_view_->resizeColumnsToContents ();

View File

@ -32,7 +32,8 @@ public:
, Frequency dial_frequency, QString const& mode, QString const& report_sent , Frequency dial_frequency, QString const& mode, QString const& report_sent
, QString const& report_received, QString const& tx_power, QString const& comments , QString const& report_received, QString const& tx_power, QString const& comments
, QString const& name, QDateTime time_on, QString const& operator_call , QString const& name, QDateTime time_on, QString const& operator_call
, QString const& my_call, QString const& my_grid); , QString const& my_call, QString const& my_grid
, QString const& exchange_sent, QString const& exchange_rcvd);
private: private:
void add_client (QString const& id, QString const& version, QString const& revision); void add_client (QString const& id, QString const& version, QString const& revision);

View File

@ -99,7 +99,8 @@ public:
, Frequency dial_frequency, QString const& mode, QString const& report_sent , Frequency dial_frequency, QString const& mode, QString const& report_sent
, QString const& report_received, QString const& tx_power , QString const& report_received, QString const& tx_power
, QString const& comments, QString const& name, QDateTime time_on , QString const& comments, QString const& name, QDateTime time_on
, QString const& operator_call, QString const& my_call, QString const& my_grid) , QString const& operator_call, QString const& my_call, QString const& my_grid
, QString const& exchange_sent, QString const& exchange_rcvd)
{ {
if (client_id == id_) if (client_id == id_)
{ {
@ -107,7 +108,8 @@ public:
<< "freq:" << dial_frequency << "mode:" << mode << "rpt_sent:" << report_sent << "freq:" << dial_frequency << "mode:" << mode << "rpt_sent:" << report_sent
<< "rpt_rcvd:" << report_received << "Tx_pwr:" << tx_power << "comments:" << comments << "rpt_rcvd:" << report_received << "Tx_pwr:" << tx_power << "comments:" << comments
<< "name:" << name << "operator_call:" << operator_call << "my_call:" << my_call << "name:" << name << "operator_call:" << operator_call << "my_call:" << my_call
<< "my_grid:" << my_grid; << "my_grid:" << my_grid << "exchange_sent:" << exchange_sent
<< "exchange_rcvd:" << exchange_rcvd;
std::cout << QByteArray {80, '-'}.data () << '\n'; std::cout << QByteArray {80, '-'}.data () << '\n';
std::cout << tr ("%1: Logged %2 grid: %3 power: %4 sent: %5 recd: %6 freq: %7 time_off: %8 op: %9 my_call: %10 my_grid: %11") std::cout << tr ("%1: Logged %2 grid: %3 power: %4 sent: %5 recd: %6 freq: %7 time_off: %8 op: %9 my_call: %10 my_grid: %11")
.arg (id_).arg (dx_call).arg (dx_grid).arg (tx_power).arg (report_sent).arg (report_received) .arg (id_).arg (dx_call).arg (dx_grid).arg (tx_power).arg (report_sent).arg (report_received)

View File

@ -69,7 +69,7 @@ void LogQSO::initLogQSO(QString const& hisCall, QString const& hisGrid, QString
if (ui->cbTxPower->isChecked ()) ui->txPower->setText(m_txPower); if (ui->cbTxPower->isChecked ()) ui->txPower->setText(m_txPower);
if (ui->cbComments->isChecked ()) ui->comments->setText(m_comments); if (ui->cbComments->isChecked ()) ui->comments->setText(m_comments);
if (m_config->report_in_comments()) { if (m_config->report_in_comments()) {
QString t=mode; auto t=mode;
if(rptSent!="") t+=" Sent: " + rptSent; if(rptSent!="") t+=" Sent: " + rptSent;
if(rptRcvd!="") t+=" Rcvd: " + rptRcvd; if(rptRcvd!="") t+=" Rcvd: " + rptRcvd;
ui->comments->setText(t); ui->comments->setText(t);
@ -107,30 +107,28 @@ void LogQSO::initLogQSO(QString const& hisCall, QString const& hisGrid, QString
void LogQSO::accept() void LogQSO::accept()
{ {
QString hisCall,hisGrid,mode,rptSent,rptRcvd,dateOn,dateOff,timeOn,timeOff,band,operator_call; auto hisCall = ui->call->text ();
QString comments,name; auto hisGrid = ui->grid->text ();
auto mode = ui->mode->text ();
hisCall=ui->call->text(); auto rptSent = ui->sent->text ();
hisGrid=ui->grid->text(); auto rptRcvd = ui->rcvd->text ();
mode=ui->mode->text(); auto m_dateTimeOn = ui->start_date_time->dateTime ();
rptSent=ui->sent->text(); auto m_dateTimeOff = ui->end_date_time->dateTime ();
rptRcvd=ui->rcvd->text(); auto band = ui->band->text ();
m_dateTimeOn = ui->start_date_time->dateTime (); auto name = ui->name->text ();
m_dateTimeOff = ui->end_date_time->dateTime (); auto m_txPower = ui->txPower->text ();
band=ui->band->text(); auto m_comments = ui->comments->text ();
name=ui->name->text(); auto strDialFreq = QString::number (m_dialFreq / 1.e6,'f',6);
m_txPower=ui->txPower->text(); auto operator_call = ui->loggedOperator->text ();
comments=ui->comments->text(); auto xsent = ui->exchSent->text ();
m_comments=comments; auto xrcvd = ui->exchRcvd->text ();
QString strDialFreq(QString::number(m_dialFreq / 1.e6,'f',6));
operator_call = ui->loggedOperator->text();
// validate // validate
using SpOp = Configuration::SpecialOperatingActivity; using SpOp = Configuration::SpecialOperatingActivity;
auto special_op = m_config->special_op_id (); auto special_op = m_config->special_op_id ();
if (SpOp::NONE < special_op && special_op < SpOp::FOX) if (SpOp::NONE < special_op && special_op < SpOp::FOX)
{ {
if (ui->exchSent->text ().isEmpty () || ui->exchRcvd->text ().isEmpty ()) if (xsent.isEmpty () || xrcvd.isEmpty ())
{ {
show (); show ();
MessageBox::warning_message (this, tr ("Invalid QSO Data"), MessageBox::warning_message (this, tr ("Invalid QSO Data"),
@ -138,8 +136,7 @@ void LogQSO::accept()
return; // without accepting return; // without accepting
} }
if (!m_cabrilloLog->add_QSO (m_dialFreq, m_dateTimeOff, hisCall, if (!m_cabrilloLog->add_QSO (m_dialFreq, m_dateTimeOff, hisCall, xsent, xrcvd))
ui->exchSent->text (), ui->exchRcvd->text ()))
{ {
show (); show ();
MessageBox::warning_message (this, tr ("Invalid QSO Data"), MessageBox::warning_message (this, tr ("Invalid QSO Data"),
@ -161,7 +158,7 @@ void LogQSO::accept()
m_dateTimeOff.time().toString("hh:mm:ss,") + hisCall + "," + m_dateTimeOff.time().toString("hh:mm:ss,") + hisCall + "," +
hisGrid + "," + strDialFreq + "," + mode + hisGrid + "," + strDialFreq + "," + mode +
"," + rptSent + "," + rptRcvd + "," + m_txPower + "," + rptSent + "," + rptRcvd + "," + m_txPower +
"," + comments + "," + name; "," + m_comments + "," + name;
QTextStream out(&f); QTextStream out(&f);
out << logEntry << endl; out << logEntry << endl;
f.close(); f.close();
@ -176,12 +173,14 @@ void LogQSO::accept()
, rptSent , rptSent
, rptRcvd , rptRcvd
, m_txPower , m_txPower
, comments , m_comments
, name , name
, m_dateTimeOn , m_dateTimeOn
, operator_call , operator_call
, m_myCall , m_myCall
, m_myGrid , m_myGrid
, xsent
, xrcvd
, LogBook::QSOToADIF (hisCall , LogBook::QSOToADIF (hisCall
, hisGrid , hisGrid
, mode , mode
@ -190,15 +189,15 @@ void LogQSO::accept()
, m_dateTimeOn , m_dateTimeOn
, m_dateTimeOff , m_dateTimeOff
, band , band
, comments , m_comments
, name , name
, strDialFreq , strDialFreq
, m_myCall , m_myCall
, m_myGrid , m_myGrid
, m_txPower , m_txPower
, operator_call , operator_call
, ui->exchSent->text () , xsent
, ui->exchRcvd->text ())); , xrcvd));
QDialog::accept(); QDialog::accept();
} }

View File

@ -40,7 +40,9 @@ signals:
, QString const& rpt_sent, QString const& rpt_received , QString const& rpt_sent, QString const& rpt_received
, QString const& tx_power, QString const& comments , QString const& tx_power, QString const& comments
, QString const& name, QDateTime const& QSO_date_on, QString const& operator_call , QString const& name, QDateTime const& QSO_date_on, QString const& operator_call
, QString const& my_call, QString const& my_grid, QByteArray const& ADIF); , QString const& my_call, QString const& my_grid
, QString const& exchange_sent, QString const& exchange_rcvd
, QByteArray const& ADIF);
protected: protected:
void hideEvent (QHideEvent *); void hideEvent (QHideEvent *);

View File

@ -5376,7 +5376,9 @@ void MainWindow::acceptQSO (QDateTime const& QSO_date_off, QString const& call,
, QString const& rpt_sent, QString const& rpt_received , QString const& rpt_sent, QString const& rpt_received
, QString const& tx_power, QString const& comments , QString const& tx_power, QString const& comments
, QString const& name, QDateTime const& QSO_date_on, QString const& operator_call , QString const& name, QDateTime const& QSO_date_on, QString const& operator_call
, QString const& my_call, QString const& my_grid, QByteArray const& ADIF) , QString const& my_call, QString const& my_grid
, QString const& exchange_sent, QString const& exchange_rcvd
, QByteArray const& ADIF)
{ {
QString date = QSO_date_on.toString("yyyyMMdd"); QString date = QSO_date_on.toString("yyyyMMdd");
if (!m_logBook.add (m_hisCall, grid, m_config.bands()->find(m_freqNominal), m_modeTx, ADIF)) if (!m_logBook.add (m_hisCall, grid, m_config.bands()->find(m_freqNominal), m_modeTx, ADIF))
@ -5386,7 +5388,8 @@ void MainWindow::acceptQSO (QDateTime const& QSO_date_off, QString const& call,
} }
m_messageClient->qso_logged (QSO_date_off, call, grid, dial_freq, mode, rpt_sent, rpt_received m_messageClient->qso_logged (QSO_date_off, call, grid, dial_freq, mode, rpt_sent, rpt_received
, tx_power, comments, name, QSO_date_on, operator_call, my_call, my_grid); , tx_power, comments, name, QSO_date_on, operator_call, my_call, my_grid
, exchange_sent, exchange_rcvd);
m_messageClient->logged_ADIF (ADIF); m_messageClient->logged_ADIF (ADIF);
// Log to N1MM Logger // Log to N1MM Logger

View File

@ -230,7 +230,9 @@ private slots:
, QString const& rpt_sent, QString const& rpt_received , QString const& rpt_sent, QString const& rpt_received
, QString const& tx_power, QString const& comments , QString const& tx_power, QString const& comments
, QString const& name, QDateTime const& QSO_date_on, QString const& operator_call , QString const& name, QDateTime const& QSO_date_on, QString const& operator_call
, QString const& my_call, QString const& my_grid, QByteArray const& ADIF); , QString const& my_call, QString const& my_grid
, QString const& exchange_sent, QString const& exchange_rcvd
, QByteArray const& ADIF);
void on_bandComboBox_currentIndexChanged (int index); void on_bandComboBox_currentIndexChanged (int index);
void on_bandComboBox_activated (int index); void on_bandComboBox_activated (int index);
void on_readFreq_clicked(); void on_readFreq_clicked();