Added new command HEARTBEAT SNR for sending heartbeat ACKs
This commit is contained in:
		
							parent
							
								
									7e9a9968e0
								
							
						
					
					
						commit
						76dfd50e74
					
				@ -6691,7 +6691,7 @@ int MainWindow::writeMessageTextToUI(QDateTime date, QString text, int freq, boo
 | 
			
		||||
 | 
			
		||||
    // fixup duplicate acks
 | 
			
		||||
    auto tc = c.document()->find(text);
 | 
			
		||||
    if(!tc.isNull() && tc.selectedText() == text && text.contains(" ACK ")){
 | 
			
		||||
    if(!tc.isNull() && tc.selectedText() == text && (text.contains(" ACK ") || text.contains(" HEARTBEAT SNR "))){
 | 
			
		||||
        tc.select(QTextCursor::BlockUnderCursor);
 | 
			
		||||
 | 
			
		||||
        if(tc.selectedText().trimmed().startsWith(date.time().toString())){
 | 
			
		||||
@ -8378,7 +8378,7 @@ void MainWindow::sendHeartbeatAck(QString to, int snr, QString extra){
 | 
			
		||||
        QString("%1 SNR %2 %3").arg(to).arg(Varicode::formatSNR(snr)).arg(extra).trimmed() :
 | 
			
		||||
        QString("%1 ACK %2").arg(to).arg(extra).trimmed();
 | 
			
		||||
#else
 | 
			
		||||
    auto message = QString("%1 SNR %2 %3").arg(to).arg(Varicode::formatSNR(snr)).arg(extra).trimmed();
 | 
			
		||||
    auto message = QString("%1 HEARTBEAT SNR %2 %3").arg(to).arg(Varicode::formatSNR(snr)).arg(extra).trimmed();
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    auto f = m_config.heartbeat_anywhere() ? -1 : findFreeFreqOffset(500, 1000, 50);
 | 
			
		||||
@ -11504,6 +11504,12 @@ void MainWindow::processCommandActivity() {
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // PROCESS HEARTBEAT SNR
 | 
			
		||||
        else if (d.cmd == " HEARTBEAT SNR"){
 | 
			
		||||
            qDebug() << "skipping incoming hb snr" << d.text;
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // PROCESS CQ
 | 
			
		||||
        else if (d.cmd == " CQ"){
 | 
			
		||||
            qDebug() << "skipping incoming cq" << d.text;
 | 
			
		||||
@ -12174,7 +12180,7 @@ void MainWindow::displayBandActivity() {
 | 
			
		||||
                    // hide heartbeat items
 | 
			
		||||
                    if (!ui->actionShow_Band_Heartbeats_and_ACKs->isChecked()){
 | 
			
		||||
                        // hide heartbeats and acks if we have heartbeating hidden
 | 
			
		||||
                        if(item.text.contains(" @HB ") || item.text.contains(" HEARTBEAT ") || item.text.contains(" ACK ")){
 | 
			
		||||
                        if(item.text.contains(" @HB ") || item.text.contains(" HEARTBEAT ")){
 | 
			
		||||
                            shouldDisplay = false;
 | 
			
		||||
 | 
			
		||||
                            // hide the previous item if this it shouldn't be displayed either...
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										21
									
								
								varicode.cpp
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								varicode.cpp
									
									
									
									
									
								
							@ -100,7 +100,9 @@ QMap<QString, int> directed_cmds = {
 | 
			
		||||
    {" 73",            28  }, // best regards, end of contact
 | 
			
		||||
 | 
			
		||||
    {" NACK",           2  }, // negative acknowledge
 | 
			
		||||
    {" ACK",          29  }, // acknowledge (digits deprecated in 2.2)
 | 
			
		||||
    {" ACK",           14  }, // acknowledge (was reserved in 2.1)
 | 
			
		||||
 | 
			
		||||
    {" HEARTBEAT SNR", 29  }, // (was ACK in 2.1, now deprecated)
 | 
			
		||||
 | 
			
		||||
    {" AGN?",          30  }, // repeat message
 | 
			
		||||
    {"  ",             31  }, // send freetext (weird artifact)
 | 
			
		||||
@ -117,7 +119,7 @@ QSet<int> autoreply_cmds = {0, 3, 4, 6, 9, 10, 11, 12, 13, 16, 30};
 | 
			
		||||
QSet<int> buffered_cmds = {5, 9, 10, 11, 12, 13, 15, 24};
 | 
			
		||||
 | 
			
		||||
// commands that may include an SNR value
 | 
			
		||||
QSet<int> snr_cmds = {25};
 | 
			
		||||
QSet<int> snr_cmds = {25, 29};
 | 
			
		||||
 | 
			
		||||
// commands that are checksummed and their crc size
 | 
			
		||||
QMap<int, int> checksum_cmds = {
 | 
			
		||||
@ -132,7 +134,7 @@ QMap<int, int> checksum_cmds = {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
QString callsign_pattern = QString("(?<callsign>[@]?[A-Z0-9/]+)");
 | 
			
		||||
QString optional_cmd_pattern = QString("(?<cmd>\\s?(?:AGN[?]|QSL[?]|HW CPY[?]|MSG TO[:]|SNR[?]|INFO[?]|GRID[?]|STATUS[?]|QUERY MSGS[?]|HEARING[?]|(?:(?:STATUS|HEARING|QUERY CALL|QUERY MSGS|QUERY|CMD|MSG|NACK|ACK|73|YES|NO|SNR|QSL|RR|SK|FB|INFO|GRID|DIT DIT)(?=[ ]|$))|[?> ]))?");
 | 
			
		||||
QString optional_cmd_pattern = QString("(?<cmd>\\s?(?:AGN[?]|QSL[?]|HW CPY[?]|MSG TO[:]|SNR[?]|INFO[?]|GRID[?]|STATUS[?]|QUERY MSGS[?]|HEARING[?]|(?:(?:STATUS|HEARING|QUERY CALL|QUERY MSGS|QUERY|CMD|MSG|NACK|ACK|73|YES|NO|HEARTBEAT SNR|SNR|QSL|RR|SK|FB|INFO|GRID|DIT DIT)(?=[ ]|$))|[?> ]))?");
 | 
			
		||||
QString optional_grid_pattern = QString("(?<grid>\\s?[A-R]{2}[0-9]{2})?");
 | 
			
		||||
QString optional_extended_grid_pattern = QString("^(?<grid>\\s?(?:[A-R]{2}[0-9]{2}(?:[A-X]{2}(?:[0-9]{2})?)*))?");
 | 
			
		||||
QString optional_num_pattern = QString("(?<num>(?<=SNR)\\s?[-+]?(?:3[01]|[0-2]?[0-9]))?");
 | 
			
		||||
@ -142,7 +144,7 @@ QRegularExpression directed_re("^"                    +
 | 
			
		||||
                               optional_cmd_pattern   +
 | 
			
		||||
                               optional_num_pattern);
 | 
			
		||||
 | 
			
		||||
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 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+SNR))(?:\s(?<grid>[A-R]{2}[0-9]{2}))?\b)");
 | 
			
		||||
 | 
			
		||||
QRegularExpression compound_re("^\\s*[`]"              +
 | 
			
		||||
                               callsign_pattern        +
 | 
			
		||||
@ -1168,7 +1170,7 @@ quint8 Varicode::packCmd(quint8 cmd, quint8 num, bool *pPackedNum){
 | 
			
		||||
        // [1][X][6]
 | 
			
		||||
        // X = 0 == SNR
 | 
			
		||||
        // X = 1 == DEADBEEF
 | 
			
		||||
        value = ((1 << 1) | (int)(cmdStr == " DEADBEEF")) << 6;
 | 
			
		||||
        value = ((1 << 1) | (int)(cmdStr == " HEARTBEAT SNR")) << 6;
 | 
			
		||||
        value = value + (num & ((1<<6)-1));
 | 
			
		||||
        if(pPackedNum) *pPackedNum = true;
 | 
			
		||||
    } else {
 | 
			
		||||
@ -1190,8 +1192,7 @@ quint8 Varicode::unpackCmd(quint8 value, quint8 *pNum){
 | 
			
		||||
        // so we zero them out when unpacking so we don't display them even if
 | 
			
		||||
        // they were encoded that way.
 | 
			
		||||
        if(value & (1<<6)){
 | 
			
		||||
            if(pNum) *pNum = 0;
 | 
			
		||||
            cmd = directed_cmds[" ACK"];
 | 
			
		||||
            cmd = directed_cmds[" HEARTBEAT SNR"];
 | 
			
		||||
        }
 | 
			
		||||
        return cmd;
 | 
			
		||||
    } else {
 | 
			
		||||
@ -1658,12 +1659,6 @@ QStringList Varicode::unpackDirectedMessage(const QString &text, quint8 *pType){
 | 
			
		||||
    unpacked.append(to);
 | 
			
		||||
    unpacked.append(cmd);
 | 
			
		||||
 | 
			
		||||
    // this is a temporary HACK for ACKs - ack digits were deprecated in 2.2 (for reasons)
 | 
			
		||||
    // this will prevent displaying the digits even when transmitted by a pre 2.2 station
 | 
			
		||||
    if(cmd == " ACK"){
 | 
			
		||||
        extra = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if(extra != 0){
 | 
			
		||||
        if(Varicode::isSNRCommand(cmd)){
 | 
			
		||||
            unpacked.append(Varicode::formatSNR((int)extra-31));
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user