Add decoding is busy flag to UDP Status message

Updated  message_aggregator reference  application  to  show the  mode
label in the status bar with a cyan background colour when decoding is
busy.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6089 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2015-11-13 15:44:11 +00:00
parent 192cebb1a3
commit 6bf8361850
8 changed files with 156 additions and 178 deletions

View File

@ -260,7 +260,8 @@ public:
} }
Q_SLOT void update_status (QString const& id, Frequency f, QString const& mode, QString const& dx_call Q_SLOT void update_status (QString const& id, Frequency f, QString const& mode, QString const& dx_call
, QString const& report, QString const& tx_mode, bool tx_enabled, bool transmitting) , QString const& report, QString const& tx_mode, bool tx_enabled
, bool transmitting, bool decoding)
{ {
if (id == id_) if (id == id_)
{ {
@ -271,6 +272,7 @@ public:
update_dynamic_property (frequency_label_, "transmitting", transmitting); update_dynamic_property (frequency_label_, "transmitting", transmitting);
auto_off_button_->setEnabled (tx_enabled); auto_off_button_->setEnabled (tx_enabled);
halt_tx_button_->setEnabled (transmitting); halt_tx_button_->setEnabled (transmitting);
update_dynamic_property (mode_label_, "decoding", decoding);
} }
} }

View File

@ -50,6 +50,17 @@ public:
void closedown (); void closedown ();
StreamStatus check_status (QDataStream const&) const; StreamStatus check_status (QDataStream const&) const;
void send_message (QByteArray const&); void send_message (QByteArray const&);
void send_message (QDataStream const& out, QByteArray const& message)
{
if (OK == check_status (out))
{
send_message (message);
}
else
{
Q_EMIT self_->error ("Error creating UDP message");
}
}
Q_SLOT void host_info_results (QHostInfo); Q_SLOT void host_info_results (QHostInfo);
@ -305,22 +316,15 @@ void MessageClient::send_raw_datagram (QByteArray const& message, QHostAddress c
void MessageClient::status_update (Frequency f, QString const& mode, QString const& dx_call void MessageClient::status_update (Frequency f, QString const& mode, QString const& dx_call
, QString const& report, QString const& tx_mode , QString const& report, QString const& tx_mode
, bool tx_enabled, bool transmitting) , bool tx_enabled, bool transmitting, bool decoding)
{ {
if (m_->server_port_ && !m_->server_string_.isEmpty ()) if (m_->server_port_ && !m_->server_string_.isEmpty ())
{ {
QByteArray message; QByteArray message;
NetworkMessage::Builder out {&message, NetworkMessage::Status, m_->id_, m_->schema_}; NetworkMessage::Builder out {&message, NetworkMessage::Status, m_->id_, m_->schema_};
out << f << mode.toUtf8 () << dx_call.toUtf8 () << report.toUtf8 () << tx_mode.toUtf8 () out << f << mode.toUtf8 () << dx_call.toUtf8 () << report.toUtf8 () << tx_mode.toUtf8 ()
<< tx_enabled << transmitting; << tx_enabled << transmitting << decoding;
if (impl::OK == m_->check_status (out)) m_->send_message (out, message);
{
m_->send_message (message);
}
else
{
Q_EMIT error ("Error creating UDP message");
}
} }
} }
@ -332,14 +336,7 @@ void MessageClient::decode (bool is_new, QTime time, qint32 snr, float delta_tim
QByteArray message; QByteArray message;
NetworkMessage::Builder out {&message, NetworkMessage::Decode, m_->id_, m_->schema_}; NetworkMessage::Builder out {&message, NetworkMessage::Decode, m_->id_, m_->schema_};
out << is_new << time << snr << delta_time << delta_frequency << mode.toUtf8 () << message_text.toUtf8 (); out << is_new << time << snr << delta_time << delta_frequency << mode.toUtf8 () << message_text.toUtf8 ();
if (impl::OK == m_->check_status (out)) m_->send_message (out, message);
{
m_->send_message (message);
}
else
{
Q_EMIT error ("Error creating UDP message");
}
} }
} }
@ -349,14 +346,7 @@ void MessageClient::clear_decodes ()
{ {
QByteArray message; QByteArray message;
NetworkMessage::Builder out {&message, NetworkMessage::Clear, m_->id_, m_->schema_}; NetworkMessage::Builder out {&message, NetworkMessage::Clear, m_->id_, m_->schema_};
if (impl::OK == m_->check_status (out)) m_->send_message (out, message);
{
m_->send_message (message);
}
else
{
Q_EMIT error ("Error creating UDP message");
}
} }
} }
@ -371,13 +361,6 @@ void MessageClient::qso_logged (QDateTime time, QString const& dx_call, QString
NetworkMessage::Builder out {&message, NetworkMessage::QSOLogged, m_->id_, m_->schema_}; NetworkMessage::Builder out {&message, NetworkMessage::QSOLogged, m_->id_, m_->schema_};
out << time << dx_call.toUtf8 () << dx_grid.toUtf8 () << dial_frequency << mode.toUtf8 () out << time << dx_call.toUtf8 () << dx_grid.toUtf8 () << dial_frequency << mode.toUtf8 ()
<< report_sent.toUtf8 () << report_received.toUtf8 () << tx_power.toUtf8 () << comments.toUtf8 () << name.toUtf8 (); << report_sent.toUtf8 () << report_received.toUtf8 () << tx_power.toUtf8 () << comments.toUtf8 () << name.toUtf8 ();
if (impl::OK == m_->check_status (out)) m_->send_message (out, message);
{
m_->send_message (message);
}
else
{
Q_EMIT error ("Error creating UDP message");
}
} }
} }

View File

@ -47,7 +47,7 @@ public:
// outgoing messages // outgoing messages
Q_SLOT void status_update (Frequency, QString const& mode, QString const& dx_call, QString const& report Q_SLOT void status_update (Frequency, QString const& mode, QString const& dx_call, QString const& report
, QString const& tx_mode, bool tx_enabled, bool transmitting); , QString const& tx_mode, bool tx_enabled, bool transmitting, bool decoding);
Q_SLOT void decode (bool is_new, QTime time, qint32 snr, float delta_time, quint32 delta_frequency Q_SLOT void decode (bool is_new, QTime time, qint32 snr, float delta_time, quint32 delta_frequency
, QString const& mode, QString const& message); , QString const& mode, QString const& message);
Q_SLOT void clear_decodes (); Q_SLOT void clear_decodes ();

View File

@ -43,6 +43,17 @@ public:
void tick (); void tick ();
void pending_datagrams (); void pending_datagrams ();
StreamStatus check_status (QDataStream const&) const; StreamStatus check_status (QDataStream const&) const;
void send_message (QDataStream const& out, QByteArray const& message, QHostAddress const& address, port_type port)
{
if (OK == check_status (out))
{
writeDatagram (message, address, port);
}
else
{
Q_EMIT self_->error ("Error creating UDP message");
}
}
MessageServer * self_; MessageServer * self_;
port_type port_; port_type port_;
@ -182,12 +193,13 @@ void MessageServer::impl::parse_message (QHostAddress const& sender, port_type s
QByteArray tx_mode; QByteArray tx_mode;
bool tx_enabled {false}; bool tx_enabled {false};
bool transmitting {false}; bool transmitting {false};
in >> f >> mode >> dx_call >> report >> tx_mode >> tx_enabled >> transmitting; bool decoding {false};
in >> f >> mode >> dx_call >> report >> tx_mode >> tx_enabled >> transmitting >> decoding;
if (check_status (in) != Fail) if (check_status (in) != Fail)
{ {
Q_EMIT self_->status_update (id, f, QString::fromUtf8 (mode), QString::fromUtf8 (dx_call) Q_EMIT self_->status_update (id, f, QString::fromUtf8 (mode), QString::fromUtf8 (dx_call)
, QString::fromUtf8 (report), QString::fromUtf8 (tx_mode) , QString::fromUtf8 (report), QString::fromUtf8 (tx_mode)
, tx_enabled, transmitting); , tx_enabled, transmitting, decoding);
} }
} }
break; break;
@ -236,11 +248,8 @@ void MessageServer::impl::parse_message (QHostAddress const& sender, port_type s
break; break;
case NetworkMessage::Close: case NetworkMessage::Close:
if (check_status (in) != Fail)
{
Q_EMIT self_->client_closed (id); Q_EMIT self_->client_closed (id);
clients_.remove (id); clients_.remove (id);
}
break; break;
default: default:
@ -346,14 +355,7 @@ void MessageServer::reply (QString const& id, QTime time, qint32 snr, float delt
QByteArray message; QByteArray message;
NetworkMessage::Builder out {&message, NetworkMessage::Reply, id, (*iter).negotiated_schema_number_}; NetworkMessage::Builder out {&message, NetworkMessage::Reply, id, (*iter).negotiated_schema_number_};
out << time << snr << delta_time << delta_frequency << mode.toUtf8 () << message_text.toUtf8 (); out << time << snr << delta_time << delta_frequency << mode.toUtf8 () << message_text.toUtf8 ();
if (impl::OK == m_->check_status (out)) m_->send_message (out, message, iter.value ().sender_address_, (*iter).sender_port_);
{
m_->writeDatagram (message, iter.value ().sender_address_, (*iter).sender_port_);
}
else
{
Q_EMIT error ("Error creating UDP message");
}
} }
} }
@ -364,14 +366,7 @@ void MessageServer::replay (QString const& id)
{ {
QByteArray message; QByteArray message;
NetworkMessage::Builder out {&message, NetworkMessage::Replay, id, (*iter).negotiated_schema_number_}; NetworkMessage::Builder out {&message, NetworkMessage::Replay, id, (*iter).negotiated_schema_number_};
if (impl::OK == m_->check_status (out)) m_->send_message (out, message, iter.value ().sender_address_, (*iter).sender_port_);
{
m_->writeDatagram (message, iter.value ().sender_address_, (*iter).sender_port_);
}
else
{
Q_EMIT error ("Error creating UDP message");
}
} }
} }
@ -383,14 +378,7 @@ void MessageServer::halt_tx (QString const& id, bool auto_only)
QByteArray message; QByteArray message;
NetworkMessage::Builder out {&message, NetworkMessage::HaltTx, id, (*iter).negotiated_schema_number_}; NetworkMessage::Builder out {&message, NetworkMessage::HaltTx, id, (*iter).negotiated_schema_number_};
out << auto_only; out << auto_only;
if (impl::OK == m_->check_status (out)) m_->send_message (out, message, iter.value ().sender_address_, (*iter).sender_port_);
{
m_->writeDatagram (message, iter.value ().sender_address_, (*iter).sender_port_);
}
else
{
Q_EMIT error ("Error creating UDP message");
}
} }
} }
@ -402,13 +390,6 @@ void MessageServer::free_text (QString const& id, QString const& text, bool send
QByteArray message; QByteArray message;
NetworkMessage::Builder out {&message, NetworkMessage::FreeText, id, (*iter).negotiated_schema_number_}; NetworkMessage::Builder out {&message, NetworkMessage::FreeText, id, (*iter).negotiated_schema_number_};
out << text.toUtf8 () << send; out << text.toUtf8 () << send;
if (impl::OK == m_->check_status (out)) m_->send_message (out, message, iter.value ().sender_address_, (*iter).sender_port_);
{
m_->writeDatagram (message, iter.value ().sender_address_, (*iter).sender_port_);
}
else
{
Q_EMIT error ("Error creating UDP message");
}
} }
} }

View File

@ -60,7 +60,8 @@ public:
// matching message // matching message
Q_SIGNAL void client_opened (QString const& id); Q_SIGNAL void client_opened (QString const& id);
Q_SIGNAL void status_update (QString const& id, Frequency, QString const& mode, QString const& dx_call Q_SIGNAL void status_update (QString const& id, Frequency, QString const& mode, QString const& dx_call
, QString const& report, QString const& tx_mode, bool tx_enabled, bool transmitting); , QString const& report, QString const& tx_mode, bool tx_enabled
, bool transmitting, bool decoding);
Q_SIGNAL void client_closed (QString const& id); 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 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); , quint32 delta_frequency, QString const& mode, QString const& message);

View File

@ -108,6 +108,7 @@
* Tx Mode utf8 * Tx Mode utf8
* Tx Enabled bool * Tx Enabled bool
* Transmitting bool * Transmitting bool
* Decoding bool
* *
* WSJT-X sends this status message when various internal state * WSJT-X sends this status message when various internal state
* changes to allow the server to track the relevant state of each * changes to allow the server to track the relevant state of each
@ -122,7 +123,8 @@
* Transmit mode changed (in dual JT9+JT65 mode), * Transmit mode changed (in dual JT9+JT65 mode),
* Changes to the "Rpt" spinner, * Changes to the "Rpt" spinner,
* After an old decodes replay sequence (see Replay below), * After an old decodes replay sequence (see Replay below),
* When switching between Tx and Rx mode. * When switching between Tx and Rx mode,
* At the start and end of decoding.
* *
* *
* Decode Out 2 quint32 * Decode Out 2 quint32

View File

@ -983,7 +983,7 @@ void MainWindow::on_autoButton_clicked (bool checked)
m_messageClient->status_update (m_dialFreq, m_mode, m_hisCall, m_messageClient->status_update (m_dialFreq, m_mode, m_hisCall,
QString::number (ui->rptSpinBox->value ()), QString::number (ui->rptSpinBox->value ()),
m_modeTx, ui->autoButton->isChecked (), m_modeTx, ui->autoButton->isChecked (),
m_transmitting); m_transmitting, m_decoderBusy);
m_bEchoTxOK=false; m_bEchoTxOK=false;
if(m_auto and (m_mode=="Echo")) { if(m_auto and (m_mode=="Echo")) {
m_nclearave=1; m_nclearave=1;
@ -1182,7 +1182,7 @@ void MainWindow::statusChanged()
m_messageClient->status_update (m_dialFreq, m_mode, m_hisCall, m_messageClient->status_update (m_dialFreq, m_mode, m_hisCall,
QString::number (ui->rptSpinBox->value ()), QString::number (ui->rptSpinBox->value ()),
m_modeTx, ui->autoButton->isChecked (), m_modeTx, ui->autoButton->isChecked (),
m_transmitting); m_transmitting, m_decoderBusy);
QFile f {m_config.temp_dir ().absoluteFilePath ("wsjtx_status.txt")}; QFile f {m_config.temp_dir ().absoluteFilePath ("wsjtx_status.txt")};
if(f.open(QFile::WriteOnly | QIODevice::Text)) { if(f.open(QFile::WriteOnly | QIODevice::Text)) {
@ -1755,6 +1755,11 @@ void MainWindow::decodeBusy(bool b) //decodeBusy()
ui->actionOpen->setEnabled(!b); ui->actionOpen->setEnabled(!b);
ui->actionOpen_next_in_directory->setEnabled(!b); ui->actionOpen_next_in_directory->setEnabled(!b);
ui->actionDecode_remaining_files_in_directory->setEnabled(!b); ui->actionDecode_remaining_files_in_directory->setEnabled(!b);
m_messageClient->status_update (m_dialFreq, m_mode, m_hisCall,
QString::number (ui->rptSpinBox->value ()),
m_modeTx, ui->autoButton->isChecked (),
m_transmitting, m_decoderBusy);
} }
//------------------------------------------------------------- //guiUpdate() //------------------------------------------------------------- //guiUpdate()
@ -2064,7 +2069,7 @@ void MainWindow::guiUpdate()
m_messageClient->status_update (m_dialFreq, m_mode, m_hisCall, m_messageClient->status_update (m_dialFreq, m_mode, m_hisCall,
QString::number (ui->rptSpinBox->value ()), QString::number (ui->rptSpinBox->value ()),
m_modeTx, ui->autoButton->isChecked (), m_modeTx, ui->autoButton->isChecked (),
m_transmitting); m_transmitting, m_decoderBusy);
} }
if(!m_btxok && btxok0 && g_iptt==1) stopTx(); if(!m_btxok && btxok0 && g_iptt==1) stopTx();
@ -2182,7 +2187,7 @@ void MainWindow::stopTx()
m_messageClient->status_update (m_dialFreq, m_mode, m_hisCall, m_messageClient->status_update (m_dialFreq, m_mode, m_hisCall,
QString::number (ui->rptSpinBox->value ()), QString::number (ui->rptSpinBox->value ()),
m_modeTx, ui->autoButton->isChecked (), m_modeTx, ui->autoButton->isChecked (),
m_transmitting); m_transmitting, m_decoderBusy);
} }
void MainWindow::stopTx2() void MainWindow::stopTx2()

View File

@ -3,3 +3,7 @@
[transmitting="true"] { [transmitting="true"] {
background-color: yellow background-color: yellow
} }
[decoding="true"] {
background-color: cyan
}