From 59fc83455d2c039d97ae1eb9992e6d7140d5b08a Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Sun, 2 Dec 2018 10:09:37 -0500 Subject: [PATCH] Add contest exchange send and received fields to UDP logged QSO message Updated message_aggregator and udp_daemon reference applications to exercise this change. --- MessageClient.cpp | 6 ++- MessageClient.hpp | 3 +- MessageServer.cpp | 8 +++- MessageServer.hpp | 3 +- NetworkMessage.hpp | 2 + UDPExamples/BeaconsModel.cpp | 2 +- UDPExamples/DecodesModel.cpp | 2 +- UDPExamples/MessageAggregatorMainWindow.cpp | 9 +++- UDPExamples/MessageAggregatorMainWindow.hpp | 3 +- UDPExamples/UDPDaemon.cpp | 6 ++- widgets/logqso.cpp | 51 ++++++++++----------- widgets/logqso.h | 4 +- widgets/mainwindow.cpp | 7 ++- widgets/mainwindow.h | 4 +- 14 files changed, 67 insertions(+), 43 deletions(-) diff --git a/MessageClient.cpp b/MessageClient.cpp index 80ceb04e6..853c917a7 100644 --- a/MessageClient.cpp +++ b/MessageClient.cpp @@ -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& comments, QString const& name, QDateTime time_on , 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 ()) { @@ -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_}; out << time_off << dx_call.toUtf8 () << dx_grid.toUtf8 () << dial_frequency << mode.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); } } diff --git a/MessageClient.hpp b/MessageClient.hpp index e1208f9c8..ec36a3357 100644 --- a/MessageClient.hpp +++ b/MessageClient.hpp @@ -64,7 +64,8 @@ public: , Frequency dial_frequency, QString const& mode, QString const& report_sent , QString const& report_received, QString const& tx_power, QString const& comments , 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 end // of record marker diff --git a/MessageServer.cpp b/MessageServer.cpp index b5a719e74..65394358f 100644 --- a/MessageServer.cpp +++ b/MessageServer.cpp @@ -294,8 +294,11 @@ void MessageServer::impl::parse_message (QHostAddress const& sender, port_type s QByteArray operator_call; QByteArray my_call; QByteArray my_grid; + QByteArray exchange_sent; + QByteArray exchange_rcvd; 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) { 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 (comments), QString::fromUtf8 (name), time_on , 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; diff --git a/MessageServer.hpp b/MessageServer.hpp index bb7501529..f308f7332 100644 --- a/MessageServer.hpp +++ b/MessageServer.hpp @@ -88,7 +88,8 @@ public: , Frequency dial_frequency, QString const& mode, QString const& report_sent , QString const& report_received, QString const& tx_power, QString const& comments , 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 logged_ADIF (QString const& id, QByteArray const& ADIF); diff --git a/NetworkMessage.hpp b/NetworkMessage.hpp index ffd0ff288..e5a3f5c08 100644 --- a/NetworkMessage.hpp +++ b/NetworkMessage.hpp @@ -240,6 +240,8 @@ * Operator call utf8 * My call utf8 * My grid utf8 + * Exchange sent utf8 + * Exchange received utf8 * * The QSO logged message is sent to the server(s) when the * WSJT-X user accepts the "Log QSO" dialog by clicking the "OK" diff --git a/UDPExamples/BeaconsModel.cpp b/UDPExamples/BeaconsModel.cpp index 1302dc05e..8955ea26a 100644 --- a/UDPExamples/BeaconsModel.cpp +++ b/UDPExamples/BeaconsModel.cpp @@ -72,7 +72,7 @@ namespace } BeaconsModel::BeaconsModel (QObject * parent) - : QStandardItemModel {0, sizeof (headings) / sizeof (headings[0]), parent} + : QStandardItemModel {0, sizeof headings / sizeof headings[0], parent} { int column {0}; for (auto const& heading : headings) diff --git a/UDPExamples/DecodesModel.cpp b/UDPExamples/DecodesModel.cpp index 5847e49ff..88b071c11 100644 --- a/UDPExamples/DecodesModel.cpp +++ b/UDPExamples/DecodesModel.cpp @@ -75,7 +75,7 @@ namespace } DecodesModel::DecodesModel (QObject * parent) - : QStandardItemModel {0, sizeof (headings) / sizeof (headings[0]), parent} + : QStandardItemModel {0, sizeof headings / sizeof headings[0], parent} { int column {0}; for (auto const& heading : headings) diff --git a/UDPExamples/MessageAggregatorMainWindow.cpp b/UDPExamples/MessageAggregatorMainWindow.cpp index 1d1dce5d6..0c2c51c30 100644 --- a/UDPExamples/MessageAggregatorMainWindow.cpp +++ b/UDPExamples/MessageAggregatorMainWindow.cpp @@ -25,12 +25,14 @@ namespace QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "Operator"), QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "My Call"), QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "My Grid"), + QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "Exchange Sent"), + QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "Exchange Rcvd"), QT_TRANSLATE_NOOP ("MessageAggregatorMainWindow", "Comments"), }; } MessageAggregatorMainWindow::MessageAggregatorMainWindow () - : log_ {new QStandardItemModel {0, 14, this}} + : log_ {new QStandardItemModel {0, sizeof headings / sizeof headings[0], this}} , decodes_model_ {new DecodesModel {this}} , beacons_model_ {new BeaconsModel {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& tx_power, QString const& comments , 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 row; 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 {my_call} << new QStandardItem {my_grid} + << new QStandardItem {exchange_sent} + << new QStandardItem {exchange_rcvd} << new QStandardItem {comments}; log_->appendRow (row); log_table_view_->resizeColumnsToContents (); diff --git a/UDPExamples/MessageAggregatorMainWindow.hpp b/UDPExamples/MessageAggregatorMainWindow.hpp index b699bee93..29f762d3d 100644 --- a/UDPExamples/MessageAggregatorMainWindow.hpp +++ b/UDPExamples/MessageAggregatorMainWindow.hpp @@ -32,7 +32,8 @@ public: , Frequency dial_frequency, QString const& mode, QString const& report_sent , QString const& report_received, QString const& tx_power, QString const& comments , 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: void add_client (QString const& id, QString const& version, QString const& revision); diff --git a/UDPExamples/UDPDaemon.cpp b/UDPExamples/UDPDaemon.cpp index b75a8adec..c075cfe83 100644 --- a/UDPExamples/UDPDaemon.cpp +++ b/UDPExamples/UDPDaemon.cpp @@ -99,7 +99,8 @@ public: , Frequency dial_frequency, QString const& mode, QString const& report_sent , QString const& report_received, QString const& tx_power , 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_) { @@ -107,7 +108,8 @@ public: << "freq:" << dial_frequency << "mode:" << mode << "rpt_sent:" << report_sent << "rpt_rcvd:" << report_received << "Tx_pwr:" << tx_power << "comments:" << comments << "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 << 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) diff --git a/widgets/logqso.cpp b/widgets/logqso.cpp index 64f589d20..da8d00819 100644 --- a/widgets/logqso.cpp +++ b/widgets/logqso.cpp @@ -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->cbComments->isChecked ()) ui->comments->setText(m_comments); if (m_config->report_in_comments()) { - QString t=mode; + auto t=mode; if(rptSent!="") t+=" Sent: " + rptSent; if(rptRcvd!="") t+=" Rcvd: " + rptRcvd; ui->comments->setText(t); @@ -107,30 +107,28 @@ void LogQSO::initLogQSO(QString const& hisCall, QString const& hisGrid, QString void LogQSO::accept() { - QString hisCall,hisGrid,mode,rptSent,rptRcvd,dateOn,dateOff,timeOn,timeOff,band,operator_call; - QString comments,name; - - hisCall=ui->call->text(); - hisGrid=ui->grid->text(); - mode=ui->mode->text(); - rptSent=ui->sent->text(); - rptRcvd=ui->rcvd->text(); - m_dateTimeOn = ui->start_date_time->dateTime (); - m_dateTimeOff = ui->end_date_time->dateTime (); - band=ui->band->text(); - name=ui->name->text(); - m_txPower=ui->txPower->text(); - comments=ui->comments->text(); - m_comments=comments; - QString strDialFreq(QString::number(m_dialFreq / 1.e6,'f',6)); - operator_call = ui->loggedOperator->text(); + auto hisCall = ui->call->text (); + auto hisGrid = ui->grid->text (); + auto mode = ui->mode->text (); + auto rptSent = ui->sent->text (); + auto rptRcvd = ui->rcvd->text (); + auto m_dateTimeOn = ui->start_date_time->dateTime (); + auto m_dateTimeOff = ui->end_date_time->dateTime (); + auto band = ui->band->text (); + auto name = ui->name->text (); + auto m_txPower = ui->txPower->text (); + auto m_comments = ui->comments->text (); + auto strDialFreq = QString::number (m_dialFreq / 1.e6,'f',6); + auto operator_call = ui->loggedOperator->text (); + auto xsent = ui->exchSent->text (); + auto xrcvd = ui->exchRcvd->text (); // validate using SpOp = Configuration::SpecialOperatingActivity; auto special_op = m_config->special_op_id (); if (SpOp::NONE < special_op && special_op < SpOp::FOX) { - if (ui->exchSent->text ().isEmpty () || ui->exchRcvd->text ().isEmpty ()) + if (xsent.isEmpty () || xrcvd.isEmpty ()) { show (); MessageBox::warning_message (this, tr ("Invalid QSO Data"), @@ -138,8 +136,7 @@ void LogQSO::accept() return; // without accepting } - if (!m_cabrilloLog->add_QSO (m_dialFreq, m_dateTimeOff, hisCall, - ui->exchSent->text (), ui->exchRcvd->text ())) + if (!m_cabrilloLog->add_QSO (m_dialFreq, m_dateTimeOff, hisCall, xsent, xrcvd)) { show (); MessageBox::warning_message (this, tr ("Invalid QSO Data"), @@ -161,7 +158,7 @@ void LogQSO::accept() m_dateTimeOff.time().toString("hh:mm:ss,") + hisCall + "," + hisGrid + "," + strDialFreq + "," + mode + "," + rptSent + "," + rptRcvd + "," + m_txPower + - "," + comments + "," + name; + "," + m_comments + "," + name; QTextStream out(&f); out << logEntry << endl; f.close(); @@ -176,12 +173,14 @@ void LogQSO::accept() , rptSent , rptRcvd , m_txPower - , comments + , m_comments , name , m_dateTimeOn , operator_call , m_myCall , m_myGrid + , xsent + , xrcvd , LogBook::QSOToADIF (hisCall , hisGrid , mode @@ -190,15 +189,15 @@ void LogQSO::accept() , m_dateTimeOn , m_dateTimeOff , band - , comments + , m_comments , name , strDialFreq , m_myCall , m_myGrid , m_txPower , operator_call - , ui->exchSent->text () - , ui->exchRcvd->text ())); + , xsent + , xrcvd)); QDialog::accept(); } diff --git a/widgets/logqso.h b/widgets/logqso.h index b0e703a93..346e3e5a2 100644 --- a/widgets/logqso.h +++ b/widgets/logqso.h @@ -40,7 +40,9 @@ signals: , QString const& rpt_sent, QString const& rpt_received , QString const& tx_power, QString const& comments , 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: void hideEvent (QHideEvent *); diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 8faf33fbd..2393f01db 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -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& tx_power, QString const& comments , 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"); 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 - , 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); // Log to N1MM Logger diff --git a/widgets/mainwindow.h b/widgets/mainwindow.h index e8f593c3f..6a2527440 100644 --- a/widgets/mainwindow.h +++ b/widgets/mainwindow.h @@ -230,7 +230,9 @@ private slots: , QString const& rpt_sent, QString const& rpt_received , QString const& tx_power, QString const& comments , 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_activated (int index); void on_readFreq_clicked();