Moving heartbeats to an HB group that is added when you enable heartbeat networking

This commit is contained in:
Jordan Sherer 2020-03-31 20:49:03 -04:00
parent 01b1cb2edc
commit 38e2bfe83b
3 changed files with 33 additions and 9 deletions

View File

@ -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;
}

View File

@ -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 <del>and auto ack enabled and no callsign is selected</del> 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";

View File

@ -45,6 +45,7 @@ QString alphanumeric = {"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ /@"}; // callsign
QMap<QString, int> 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*(?<callsign>[@](?:ALLCALL)\s+)?(?<type>CQ CQ CQ|CQ DX|CQ QRP|CQ CONTEST|CQ FIELD|CQ FD|CQ CQ|CQ|HB)(?:\s(?<grid>[A-R]{2}[0-9]{2}))?\b)");
QRegularExpression heartbeat_re(R"(^\s*(?<callsign>[@](?:ALLCALL|HB)\s+)?(?<type>CQ CQ CQ|CQ DX|CQ QRP|CQ CONTEST|CQ FIELD|CQ FD|CQ CQ|CQ|HB|HEARTBEAT)(?:\s(?<grid>[A-R]{2}[0-9]{2}))?\b)");
QRegularExpression compound_re("^\\s*[`]" +
callsign_pattern +
@ -288,6 +289,8 @@ QMap<quint32, QString> 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<quint32, QString> hbs = {
{ 0, "HB" }, // HB
{ 1, "HB" }, // HB AUTO