From 025a0161f87527856e79192fc92515866b1c824c Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Sun, 2 Dec 2018 23:19:08 +0000 Subject: [PATCH] Add special operation mode enumeration to UDP status message Also updated the message_aggregator UDP reference application to exercise this field. --- MessageClient.cpp | 4 ++-- MessageClient.hpp | 2 +- MessageServer.cpp | 6 ++++-- MessageServer.hpp | 3 ++- NetworkMessage.hpp | 15 ++++++++++++++- UDPExamples/ClientWidget.cpp | 20 +++++++++++++++++--- UDPExamples/ClientWidget.hpp | 3 ++- UDPExamples/UDPDaemon.cpp | 3 ++- widgets/mainwindow.cpp | 3 ++- 9 files changed, 46 insertions(+), 13 deletions(-) diff --git a/MessageClient.cpp b/MessageClient.cpp index 853c917a7..6ceca2dce 100644 --- a/MessageClient.cpp +++ b/MessageClient.cpp @@ -405,7 +405,7 @@ void MessageClient::status_update (Frequency f, QString const& mode, QString con , qint32 rx_df, qint32 tx_df, QString const& de_call , QString const& de_grid, QString const& dx_grid , bool watchdog_timeout, QString const& sub_mode - , bool fast_mode) + , bool fast_mode, quint8 special_op_mode) { if (m_->server_port_ && !m_->server_string_.isEmpty ()) { @@ -414,7 +414,7 @@ void MessageClient::status_update (Frequency f, QString const& mode, QString con out << f << mode.toUtf8 () << dx_call.toUtf8 () << report.toUtf8 () << tx_mode.toUtf8 () << tx_enabled << transmitting << decoding << rx_df << tx_df << de_call.toUtf8 () << de_grid.toUtf8 () << dx_grid.toUtf8 () << watchdog_timeout << sub_mode.toUtf8 () - << fast_mode; + << fast_mode << special_op_mode; m_->send_message (out, message); } } diff --git a/MessageClient.hpp b/MessageClient.hpp index ec36a3357..0deb1a49d 100644 --- a/MessageClient.hpp +++ b/MessageClient.hpp @@ -52,7 +52,7 @@ public: , QString const& tx_mode, bool tx_enabled, bool transmitting, bool decoding , qint32 rx_df, qint32 tx_df, QString const& de_call, QString const& de_grid , QString const& dx_grid, bool watchdog_timeout, QString const& sub_mode - , bool fast_mode); + , bool fast_mode, quint8 special_op_mode); Q_SLOT void decode (bool is_new, QTime time, qint32 snr, float delta_time, quint32 delta_frequency , QString const& mode, QString const& message, bool low_confidence , bool off_air); diff --git a/MessageServer.cpp b/MessageServer.cpp index 65394358f..609d24a9a 100644 --- a/MessageServer.cpp +++ b/MessageServer.cpp @@ -216,9 +216,10 @@ void MessageServer::impl::parse_message (QHostAddress const& sender, port_type s bool watchdog_timeout {false}; QByteArray sub_mode; bool fast_mode {false}; + quint8 special_op_mode {0}; in >> f >> mode >> dx_call >> report >> tx_mode >> tx_enabled >> transmitting >> decoding >> rx_df >> tx_df >> de_call >> de_grid >> dx_grid >> watchdog_timeout >> sub_mode - >> fast_mode; + >> fast_mode >> special_op_mode; if (check_status (in) != Fail) { Q_EMIT self_->status_update (id, f, QString::fromUtf8 (mode), QString::fromUtf8 (dx_call) @@ -226,7 +227,8 @@ void MessageServer::impl::parse_message (QHostAddress const& sender, port_type s , tx_enabled, transmitting, decoding, rx_df, tx_df , QString::fromUtf8 (de_call), QString::fromUtf8 (de_grid) , QString::fromUtf8 (dx_grid), watchdog_timeout - , QString::fromUtf8 (sub_mode), fast_mode); + , QString::fromUtf8 (sub_mode), fast_mode + , special_op_mode); } } break; diff --git a/MessageServer.hpp b/MessageServer.hpp index f308f7332..4a6022bfd 100644 --- a/MessageServer.hpp +++ b/MessageServer.hpp @@ -76,7 +76,8 @@ public: , QString const& report, QString const& tx_mode, bool tx_enabled , bool transmitting, bool decoding, qint32 rx_df, qint32 tx_df , QString const& de_call, QString const& de_grid, QString const& dx_grid - , bool watchdog_timeout, QString const& sub_mode, bool fast_mode); + , bool watchdog_timeout, QString const& sub_mode, bool fast_mode + , quint8 special_op_mode); Q_SIGNAL void client_closed (QString const& id); Q_SIGNAL void decode (bool is_new, QString const& id, QTime time, qint32 snr, float delta_time , quint32 delta_frequency, QString const& mode, QString const& message diff --git a/NetworkMessage.hpp b/NetworkMessage.hpp index e5a3f5c08..a4d9ba0d5 100644 --- a/NetworkMessage.hpp +++ b/NetworkMessage.hpp @@ -124,6 +124,7 @@ * Tx Watchdog bool * Sub-mode utf8 * Fast mode bool + * Special operation mode quint8 * * WSJT-X sends this status message when various internal state * changes to allow the server to track the relevant state of each @@ -142,10 +143,22 @@ * At the start and end of decoding, * When the Rx DF changes, * When the Tx DF changes, - * When the DE call or grid changes (currently when settings are exited), + * When settings are exited, * When the DX call or grid changes, * When the Tx watchdog is set or reset. * + * The Special operation mode is an enumeration that indicates the + * setting selected in the WSJT-X "Settings->Advanced->Special + * operating activity" panel. The values are as follows: + * + * 0 -> NONE + * 1 -> NA VHF + * 2 -> EU VHF + * 3 -> FIELD DAY + * 4 -> RTTY RU + * 5 -> FOX + * 6 -> HOUND + * * * Decode Out 2 quint32 * Id (unique key) utf8 diff --git a/UDPExamples/ClientWidget.cpp b/UDPExamples/ClientWidget.cpp index 10361d55d..7423f6d81 100644 --- a/UDPExamples/ClientWidget.cpp +++ b/UDPExamples/ClientWidget.cpp @@ -244,15 +244,29 @@ void ClientWidget::update_status (QString const& id, Frequency f, QString const& , QString const& report, QString const& tx_mode, bool tx_enabled , bool transmitting, bool decoding, qint32 rx_df, qint32 tx_df , QString const& de_call, QString const& de_grid, QString const& dx_grid - , bool watchdog_timeout, QString const& sub_mode, bool fast_mode) + , bool watchdog_timeout, QString const& sub_mode, bool fast_mode + , quint8 special_op_mode) { if (id == id_) { fast_mode_ = fast_mode; decodes_proxy_model_.de_call (de_call); decodes_proxy_model_.rx_df (rx_df); - de_label_->setText (de_call.size () >= 0 ? QString {"DE: %1%2"}.arg (de_call) - .arg (de_grid.size () ? '(' + de_grid + ')' : QString {}) : QString {}); + QString special; + switch (special_op_mode) + { + case 1: special = "[NA VHF]"; break; + case 2: special = "[EU VHF]"; break; + case 3: special = "[FD]"; break; + case 4: special = "[RTTY RU]"; break; + case 5: special = "[Fox]"; break; + case 6: special = "[Hound]"; break; + default: break; + } + de_label_->setText (de_call.size () >= 0 ? QString {"DE: %1%2%3"}.arg (de_call) + .arg (de_grid.size () ? '(' + de_grid + ')' : QString {}) + .arg (special) + : QString {}); mode_label_->setText (QString {"Mode: %1%2%3%4"} .arg (mode) .arg (sub_mode) diff --git a/UDPExamples/ClientWidget.hpp b/UDPExamples/ClientWidget.hpp index 29059bfa5..0459ad036 100644 --- a/UDPExamples/ClientWidget.hpp +++ b/UDPExamples/ClientWidget.hpp @@ -32,7 +32,8 @@ public: , QString const& report, QString const& tx_mode, bool tx_enabled , bool transmitting, bool decoding, qint32 rx_df, qint32 tx_df , QString const& de_call, QString const& de_grid, QString const& dx_grid - , bool watchdog_timeout, QString const& sub_mode, bool fast_mode); + , bool watchdog_timeout, QString const& sub_mode, bool fast_mode + , quint8 special_op_mode); Q_SLOT void decode_added (bool is_new, QString const& client_id, QTime, qint32 snr , float delta_time, quint32 delta_frequency, QString const& mode , QString const& message, bool low_confidence, bool off_air); diff --git a/UDPExamples/UDPDaemon.cpp b/UDPExamples/UDPDaemon.cpp index c075cfe83..0ee202dc7 100644 --- a/UDPExamples/UDPDaemon.cpp +++ b/UDPExamples/UDPDaemon.cpp @@ -50,7 +50,8 @@ public: , QString const& /*report*/, QString const& /*tx_mode*/, bool /*tx_enabled*/ , bool /*transmitting*/, bool /*decoding*/, qint32 /*rx_df*/, qint32 /*tx_df*/ , QString const& /*de_call*/, QString const& /*de_grid*/, QString const& /*dx_grid*/ - , bool /* watchdog_timeout */, QString const& sub_mode, bool /*fast_mode*/) + , bool /* watchdog_timeout */, QString const& sub_mode, bool /*fast_mode*/ + , quint8 /*special_op_mode*/) { if (id == id_) { diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 2393f01db..b265ad7ba 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -7684,7 +7684,8 @@ void MainWindow::statusUpdate () const ui->RxFreqSpinBox->value (), ui->TxFreqSpinBox->value (), m_config.my_callsign (), m_config.my_grid (), m_hisGrid, m_tx_watchdog, - submode != QChar::Null ? QString {submode} : QString {}, m_bFastMode); + submode != QChar::Null ? QString {submode} : QString {}, m_bFastMode, + static_cast (m_config.special_op_id ())); } void MainWindow::childEvent (QChildEvent * e)