From 1a4efa81200f6f5648adea7582a4d2fa368aaded Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Sat, 28 Mar 2020 11:57:38 -0400 Subject: [PATCH] Added @ALLCALL to CQs and HBs to make them more clear and unify the message formatting across all directed message types --- decodedtext.cpp | 2 +- mainwindow.cpp | 44 +++++++++++++------------------------------- mainwindow.h | 2 +- varicode.cpp | 21 ++++++++++++--------- 4 files changed, 27 insertions(+), 42 deletions(-) diff --git a/decodedtext.cpp b/decodedtext.cpp index 5a2e5a8..6ac3dcc 100644 --- a/decodedtext.cpp +++ b/decodedtext.cpp @@ -145,7 +145,7 @@ bool DecodedText::tryUnpackHeartbeat(){ cmp.append(parts.at(1)); } compound_ = cmp.join("/"); - message_ = QString("%1: %2 %3 ").arg(compound_).arg(isAlt ? Varicode::cqString(bits3) : Varicode::hbString(bits3)).arg(extra_); + message_ = QString("%1: @ALLCALL %2 %3 ").arg(compound_).arg(isAlt ? Varicode::cqString(bits3) : Varicode::hbString(bits3)).arg(extra_); frameType_ = type; return true; } diff --git a/mainwindow.cpp b/mainwindow.cpp index b01dda5..e5c99fb 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -990,7 +990,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, } // prep - prepareHeartbeatMode(ui->actionModeJS8HB->isEnabled() && ui->actionModeJS8HB->isChecked()); + prepareHeartbeatMode(canCurrentModeSendHeartbeat() && ui->actionModeJS8HB->isChecked()); prepareSpotting(); auto enterFilter = new EnterKeyPressEater(); @@ -1241,10 +1241,6 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, ui->tableWidgetCalls->clearSelection(); }); - // savedMenu->setEnabled(savedMenu->isEnabled() && !ui->actionModeJS8HB->isChecked()); - // directedMenu->setEnabled(directedMenu->isEnabled() && !ui->actionModeJS8HB->isChecked()); - // relayAction->setEnabled(relayAction->isEnabled() && !ui->actionModeJS8HB->isChecked()); - menu->addSeparator(); removeActivity->setDisabled(selectedOffset == -1); @@ -1493,10 +1489,6 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, ui->tableWidgetCalls->clearSelection(); }); - // savedMenu->setEnabled(savedMenu->isEnabled() && !ui->actionModeJS8HB->isChecked()); - // directedMenu->setEnabled(directedMenu->isEnabled() && !ui->actionModeJS8HB->isChecked()); - // relayAction->setEnabled(relayAction->isEnabled() && !ui->actionModeJS8HB->isChecked()); - menu->addSeparator(); menu->addAction(addStation); @@ -2384,7 +2376,7 @@ void MainWindow::readSettings() setFreqOffsetForRestore(m_settings->value("RxFreq",1500).toInt(), false); setSubmode(m_settings->value("SubMode", Varicode::JS8CallFast).toInt()); - ui->actionModeJS8HB->setChecked(canEnableHeartbeat() && m_settings->value("SubModeHB", false).toBool()); + ui->actionModeJS8HB->setChecked(m_settings->value("SubModeHB", false).toBool()); ui->actionHeartbeatAcknowledgements->setChecked(m_settings->value("SubModeHBAck", false).toBool()); ui->actionModeMultiDecoder->setChecked(m_settings->value("SubModeMultiDecode", true).toBool()); @@ -4876,7 +4868,7 @@ void MainWindow::processDecodedLine(QByteArray t){ // Only respond to HEARTBEATS...remember that CQ messages are "Alt" pings if(decodedtext.isHeartbeat()){ if(decodedtext.isAlt()){ - // this is a cq with a standard or compound call, ala "KN4CRD/P: CQCQCQ" + // this is a cq with a standard or compound call, ala "KN4CRD/P: @ALLCALL CQ CQ CQ" cd.cqTimestamp = DriftingDateTime::currentDateTimeUtc(); // it is not processed elsewhere, so we need to just log it here. @@ -7447,7 +7439,7 @@ void MainWindow::displayWidgets(qint64 n) void MainWindow::on_actionModeJS8HB_toggled(bool checked){ // prep hb mode - prepareHeartbeatMode(ui->actionModeJS8HB->isEnabled() && ui->actionModeJS8HB->isChecked()); + prepareHeartbeatMode(canCurrentModeSendHeartbeat() && ui->actionModeJS8HB->isChecked()); displayActivity(true); on_actionJS8_triggered(); @@ -7456,7 +7448,7 @@ void MainWindow::on_actionModeJS8HB_toggled(bool checked){ void MainWindow::on_actionHeartbeatAcknowledgements_toggled(bool checked){ // prep hb ack mode - prepareHeartbeatMode(ui->actionModeJS8HB->isEnabled() && ui->actionModeJS8HB->isChecked()); + prepareHeartbeatMode(canCurrentModeSendHeartbeat() && ui->actionModeJS8HB->isChecked()); displayActivity(true); on_actionJS8_triggered(); @@ -7492,13 +7484,13 @@ void MainWindow::on_actionModeJS8Ultra_triggered(){ void MainWindow::on_actionModeAutoreply_toggled(bool checked){ // update the HB ack option (needs autoreply on) - prepareHeartbeatMode(ui->actionModeJS8HB->isEnabled() && ui->actionModeJS8HB->isChecked()); + prepareHeartbeatMode(canCurrentModeSendHeartbeat() && ui->actionModeJS8HB->isChecked()); // then update the js8 mode on_actionJS8_triggered(); } -bool MainWindow::canEnableHeartbeat(){ +bool MainWindow::canCurrentModeSendHeartbeat(){ if(m_nSubMode == Varicode::JS8CallFast){ return true; } @@ -7521,7 +7513,7 @@ void MainWindow::prepareHeartbeatMode(bool enabled){ ui->hbMacroButton->setChecked(false); } ui->actionHeartbeat->setEnabled(enabled); - ui->actionModeJS8HB->setEnabled(enabled && canEnableHeartbeat()); + ui->actionModeJS8HB->setEnabled(canCurrentModeSendHeartbeat()); ui->actionHeartbeatAcknowledgements->setEnabled(enabled && ui->actionModeAutoreply->isChecked()); #if 0 @@ -7571,13 +7563,8 @@ void MainWindow::on_actionJS8_triggered() m_nSubMode=Varicode::JS8CallUltra; } - // Only enable heartbeat for normal mode - ui->actionModeJS8HB->setEnabled(canEnableHeartbeat()); - prepareHeartbeatMode(ui->actionModeJS8HB->isEnabled() && ui->actionModeJS8HB->isChecked()); - - //if(m_nSubMode != Varicode::JS8CallNormal){ - // ui->actionModeJS8HB->setChecked(false); - //} + // Only enable heartbeat for modes that support it + prepareHeartbeatMode(canCurrentModeSendHeartbeat() && ui->actionModeJS8HB->isChecked()); updateModeButtonText(); @@ -8142,12 +8129,7 @@ void MainWindow::sendHeartbeat(){ QStringList parts; parts.append(QString("%1:").arg(mycall)); - - auto flags = generateStatusFlags(); - if(flags.isEmpty() || flags.first() != "HB"){ - parts.append("HB"); - } - parts.append(flags); + parts.append("HB"); parts.append(mygrid); QString message = parts.join(" ").trimmed(); @@ -8219,7 +8201,7 @@ void MainWindow::sendCQ(bool repeat){ auto message = m_config.cq_message(); if(message.isEmpty()){ QString mygrid = m_config.my_grid().left(4); - message = QString("CQCQCQ %1").arg(mygrid).trimmed(); + message = QString("CQ CQ CQ %1").arg(mygrid).trimmed(); } clearCallsignSelected(); @@ -11221,7 +11203,7 @@ void MainWindow::processCommandActivity() { // PROCESS ACTIVE HEARTBEAT // if we have hb mode enabled and auto reply enabled and auto ack enabled and no callsign is selected update: if we're in HB mode, doesn't matter if a callsign is selected. - else if (d.cmd == " HB" && ui->actionModeJS8HB->isEnabled() && ui->actionModeJS8HB->isChecked() && ui->actionModeAutoreply->isChecked() && ui->actionHeartbeatAcknowledgements->isChecked()){ + else if (d.cmd == " HB" && canCurrentModeSendHeartbeat() && ui->actionModeJS8HB->isChecked() && ui->actionModeAutoreply->isChecked() && ui->actionHeartbeatAcknowledgements->isChecked()){ // check to make sure we aren't pausing HB transmissions (ACKs) while a callsign is selected if(m_config.heartbeat_qso_pause() && !selectedCallsign.isEmpty()){ qDebug() << "hb paused during qso"; diff --git a/mainwindow.h b/mainwindow.h index b18f0e4..5d09a20 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -282,7 +282,7 @@ private slots: void on_actionHeartbeatAcknowledgements_toggled(bool checked); void on_actionModeMultiDecoder_toggled(bool checked); void on_actionModeAutoreply_toggled(bool checked); - bool canEnableHeartbeat(); + bool canCurrentModeSendHeartbeat(); void prepareHeartbeatMode(bool enabled); void on_actionJS8_triggered(); void on_TxFreqSpinBox_valueChanged(int arg1); diff --git a/varicode.cpp b/varicode.cpp index 69c17fd..db6e0a8 100644 --- a/varicode.cpp +++ b/varicode.cpp @@ -139,7 +139,7 @@ QRegularExpression directed_re("^" + optional_cmd_pattern + optional_num_pattern); -QRegularExpression heartbeat_re(R"(^\s*(?CQ CQ CQ|CQ DX|CQ QRP|CQ CONTEST|CQ FIELD|CQ FD|CQ CQ|CQ|HB( AUTO)?( RELAY)?( SPOT)?)(?:\s(?[A-R]{2}[0-9]{2}))?\b)"); +QRegularExpression heartbeat_re(R"(^\s*(?[@]ALLCALL\s+)?(?CQ CQ CQ|CQ DX|CQ QRP|CQ CONTEST|CQ FIELD|CQ FD|CQ CQ|CQ|HB)(?:\s(?[A-R]{2}[0-9]{2}))?\b)"); QRegularExpression compound_re("^\\s*[`]" + callsign_pattern + @@ -261,6 +261,8 @@ QMap basecalls = { { "@RAYNET", nbasecall + 41 }, // RAYNET GROUP { "@RADAR", nbasecall + 42 }, // RADAR GROUP { "@SKYWARN", nbasecall + 43 }, // SKYWARN GROUP + { "@CQ", nbasecall + 44 }, // CQ GROUP + { "@QSO", nbasecall + 45 }, // QSO GROUP }; QMap cqs = { @@ -274,15 +276,16 @@ QMap cqs = { { 7, "CQ"}, }; +/* status flags in HB messages are deprecated as of 2.2 */ QMap hbs = { - { 0, "HB" }, // HB - { 1, "HB AUTO" }, // HB AUTO - { 2, "HB AUTO RELAY" }, // HB AUTO RELAY - { 3, "HB AUTO RELAY SPOT" }, // HB AUTO RELAY SPOT - { 7, "HB AUTO SPOT"}, // HB AUTO SPOT - { 4, "HB RELAY" }, // HB RELAY - { 5, "HB RELAY SPOT" }, // HB RELAY SPOT - { 6, "HB SPOT" }, // HB SPOT + { 0, "HB" }, // HB + { 1, "HB" }, // HB AUTO + { 2, "HB" }, // HB AUTO RELAY + { 3, "HB" }, // HB AUTO RELAY SPOT + { 4, "HB" }, // HB RELAY + { 5, "HB" }, // HB RELAY SPOT + { 6, "HB" }, // HB SPOT + { 7, "HB" }, // HB AUTO SPOT };