From 38e2bfe83b9868fb61e523faa14bde2626016390 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Tue, 31 Mar 2020 20:49:03 -0400 Subject: [PATCH] Moving heartbeats to an HB group that is added when you enable heartbeat networking --- decodedtext.cpp | 19 +++++++++++++++---- mainwindow.cpp | 18 ++++++++++++++---- varicode.cpp | 5 ++++- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/decodedtext.cpp b/decodedtext.cpp index 60b795e..4ffb3d4 100644 --- a/decodedtext.cpp +++ b/decodedtext.cpp @@ -146,10 +146,21 @@ bool DecodedText::tryUnpackHeartbeat(){ } compound_ = cmp.join("/"); - auto to = "@ALLCALL"; - auto hborcq = isAlt ? Varicode::cqString(bits3) : Varicode::hbString(bits3); - message_ = QString("%1: %2 %3 %4 ").arg(compound_).arg(to).arg(hborcq).arg(extra_); - frameType_ = type; + if(isAlt){ + auto sbits3 = Varicode::cqString(bits3); + message_ = QString("%1: @ALLCALL %2 %3 ").arg(compound_).arg(sbits3).arg(extra_); + frameType_ = type; + } else { + auto sbits3 = Varicode::hbString(bits3); + if(sbits3 == "HB"){ + message_ = QString("%1: @HB HEARTBEAT %2 ").arg(compound_).arg(extra_); + frameType_ = type; + } else { + message_ = QString("%1: @HB %2 %3 ").arg(compound_).arg(sbits3).arg(extra_); + frameType_ = type; + } + } + return true; } diff --git a/mainwindow.cpp b/mainwindow.cpp index e49cb31..367b6de 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -4916,7 +4916,7 @@ void MainWindow::processDecodedLine(QByteArray t){ // convert HEARTBEAT to a directed command and process... cmd.from = cd.call; cmd.to = "@ALLCALL"; - cmd.cmd = " HB"; + cmd.cmd = " HEARTBEAT"; cmd.snr = cd.snr; cmd.bits = cd.bits; cmd.grid = cd.grid; @@ -7589,6 +7589,12 @@ void MainWindow::prepareHeartbeatMode(bool enabled){ ui->actionModeJS8HB->setEnabled(canCurrentModeSendHeartbeat()); ui->actionHeartbeatAcknowledgements->setEnabled(enabled && ui->actionModeAutoreply->isChecked()); + if(enabled){ + m_config.addGroup("@HB"); + } else { + m_config.removeGroup("@HB"); + } + #if 0 //ui->actionCQ->setEnabled(!enabled); //ui->actionFocus_Message_Reply_Area->setEnabled(!enabled); @@ -8204,9 +8210,13 @@ void MainWindow::sendHeartbeat(){ QStringList parts; parts.append(QString("%1:").arg(mycall)); +#if JS8_CUSTOMIZE_HB auto hb = m_config.hb_message(); +#else + auto hb = QString{}; +#endif if(hb.isEmpty()){ - parts.append("HB"); + parts.append("HEARTBEAT"); parts.append(mygrid); } else { parts.append(hb); @@ -10950,7 +10960,7 @@ void MainWindow::processCommandActivity() { // we're only responding to allcalls if we are participating in the allcall group // but, don't avoid for heartbeats...those are technically allcalls but are processed differently - if(isAllCall && m_config.avoid_allcall() && d.cmd != " HB"){ + if(isAllCall && m_config.avoid_allcall() && d.cmd != " HB" && d.cmd != " HEARTBEAT"){ continue; } @@ -11294,7 +11304,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" && canCurrentModeSendHeartbeat() && ui->actionModeJS8HB->isChecked() && ui->actionModeAutoreply->isChecked() && ui->actionHeartbeatAcknowledgements->isChecked()){ + else if ((d.cmd == " HB" || d.cmd == " HEARTBEAT") && 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/varicode.cpp b/varicode.cpp index 048c9ff..d90a99a 100644 --- a/varicode.cpp +++ b/varicode.cpp @@ -45,6 +45,7 @@ QString alphanumeric = {"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ /@"}; // callsign QMap directed_cmds = { // any changes here need to be made also in the directed regular xpression for parsing // ?*^&@ + {" HEARTBEAT", -1 }, // this is my heartbeat (unused except for faux processing of HBs as directed commands) {" HB", -1 }, // this is my heartbeat (unused except for faux processing of HBs as directed commands) {" SNR?", 0 }, // query snr @@ -143,7 +144,7 @@ QRegularExpression directed_re("^" + optional_cmd_pattern + optional_num_pattern); -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 heartbeat_re(R"(^\s*(?[@](?:ALLCALL|HB)\s+)?(?CQ CQ CQ|CQ DX|CQ QRP|CQ CONTEST|CQ FIELD|CQ FD|CQ CQ|CQ|HB|HEARTBEAT)(?:\s(?[A-R]{2}[0-9]{2}))?\b)"); QRegularExpression compound_re("^\\s*[`]" + callsign_pattern + @@ -288,6 +289,8 @@ QMap cqs = { }; // status flags in HB messages are deprecated as of 2.2, later versions will likely repurpose these flags +// keep in mind if you change any of these to not start with HB you'll have to address the packHeartbeatMessage +// and how the function computes the isAlt flag. QMap hbs = { { 0, "HB" }, // HB { 1, "HB" }, // HB AUTO