Repair a defect in reporting low confidence decodes & assoc issues

This commit is contained in:
Bill Somerville 2021-11-10 10:55:22 +00:00
parent f68a4bb1a1
commit d541286ba2
No known key found for this signature in database
GPG Key ID: D864B06D1E81618F
2 changed files with 29 additions and 18 deletions

View File

@ -13,25 +13,32 @@ namespace
{
QRegularExpression tokens_re {R"(
^
(?:(?<dual>[A-Z0-9/]+)\sRR73;\s)?
(?:(?<dual>[A-Z0-9/]+)\sRR73;\s)? # dual reply DXpedition message
(?:
(?<word1>
(?:CQ|DE|QRZ)
(?:\s?DX|\s
(?:[A-Z]{1,4}|\d{3})
(?:[A-Z]{1,4}|\d{3}) # directional CQ
)
| [A-Z0-9/]+
|\.{3}
| [A-Z0-9/]+ # DX call
|\.{3} # unknown hash code
)\s
)
(?:
(?<word2>[A-Z0-9/]+)
(?<word2>[A-Z0-9/]+) # DE call
(?:\s
(?<word3>[-+A-Z0-9]+)
(?<word3>[-+A-Z0-9]+) # report
(?:\s
(?<word4>
(?:OOO | (?!RR73)[A-R]{2}[0-9]{2})
(?:
OOO # EME
| (?!RR73)[A-R]{2}[0-9]{2} # grid square (not RR73)
| 5[0-9]{5} # EU VHF Contest report & serial
)
)
(?:\s
(?<word5>[A-R]{2}[0-9]{2}[A-X]{2}) # EU VHF Contest grid locator
)?
)?
)?
)?
@ -48,13 +55,13 @@ DecodedText::DecodedText (QString const& the_string)
, is_standard_ {false}
{
// discard appended AP info
clean_string_.replace (QRegularExpression {R"(^(.*?)(?:\?\s)?(?:a|q)[0-9].*$)"}, "\\1");
clean_string_.replace (QRegularExpression {R"(^(.*?)(?:\?\s)?[aq][0-9].*$)"}, "\\1");
// qDebug () << "DecodedText: the_string:" << the_string << "Nbsp pos:" << the_string.indexOf (QChar::Nbsp);
if (message_.length() >= 1)
{
message0_ = message_.left(36);
message_ = message_.left(36).remove (QRegularExpression {"[<>]"});
message0_ = message_.left(37);
message_ = message_.left(37).remove (QRegularExpression {"[<>]"});
int i1 = message_.indexOf ('\r');
if (i1 > 0)
{
@ -89,7 +96,9 @@ QStringList DecodedText::messageWords () const
}
// simple word split for free text messages
auto words = message_.split (' ', SkipEmptyParts);
// add whole message as item 0 to mimic RE capture list
// add whole message and two empty strings as item 0 & 1 to mimic RE
// capture list
words.prepend (QString {});
words.prepend (message_);
return words;
}
@ -119,7 +128,7 @@ bool DecodedText::isTX() const
bool DecodedText::isLowConfidence () const
{
return QChar {'?'} == string_.mid (padding_ + column_qsoText + 21, 1);
return QChar {'?'} == string_.mid (padding_ + column_qsoText + 36, 1);
}
int DecodedText::frequencyOffset() const

View File

@ -3641,8 +3641,9 @@ void MainWindow::auto_sequence (DecodedText const& message, unsigned start_toler
{
auto const& message_words = message.messageWords ();
auto is_73 = message_words.filter (QRegularExpression {"^(73|RR73)$"}).size();
auto const& msg_no_hash = message.clean_string ().mid(22).remove("<").remove(">");
bool is_OK=false;
if(m_mode=="MSK144" and message.clean_string ().indexOf(ui->dxCallEntry->text()+" R ")>0) is_OK=true;
if(m_mode=="MSK144" && msg_no_hash.indexOf(ui->dxCallEntry->text()+" R ")>0) is_OK=true;
if (message_words.size () > 3 && (message.isStandardMessage() || (is_73 or is_OK))) {
auto df = message.frequencyOffset ();
auto within_tolerance = (qAbs (ui->RxFreqSpinBox->value () - df) <= int (start_tolerance)
@ -3657,7 +3658,7 @@ void MainWindow::auto_sequence (DecodedText const& message, unsigned start_toler
|| message_words.contains ("DE")))
|| !message.isStandardMessage ()); // free text 73/RR73
QStringList w=message.clean_string ().mid(22).remove("<").remove(">").split(" ",SkipEmptyParts);
auto const& w = msg_no_hash.split(" ",SkipEmptyParts);
QString w2;
int nrpt=0;
if (w.size () > 2)
@ -7757,10 +7758,11 @@ void MainWindow::replyToCQ (QTime time, qint32 snr, float delta_time, quint32 de
, bool /*low_confidence*/, quint8 modifiers)
{
QString format_string {"%1 %2 %3 %4 %5 %6"};
auto const& time_string = time.toString ("~" == mode || "&" == mode
|| "+" == mode ? "hhmmss" : "hhmm");
auto const& time_string = time.toString ("~" == mode || "&" == mode || "+" == mode
|| (m_TRperiod < 60. && ("`" == mode || ":" == mode))
? "hhmmss" : "hhmm");
auto text = message_text;
auto ap_pos = text.lastIndexOf (QRegularExpression {R"((?:\?\s)?a[0-9]$)"});
auto ap_pos = text.lastIndexOf (QRegularExpression {R"((?:\?\s)?(?:a[0-9]|q[0-9][0-9]?)$)"});
if (ap_pos >= 0)
{
// beware of decodes ending on shorter version of wanted call so
@ -7881,7 +7883,7 @@ void MainWindow::postDecode (bool is_new, QString const& message)
, parts[1].toInt ()
, parts[2].toFloat (), parts[3].toUInt (), parts[4]
, decode.mid (has_seconds ? 24 : 22)
, QChar {'?'} == decode.mid (has_seconds ? 24 + 21 : 22 + 21, 1)
, QChar {'?'} == decode.mid (has_seconds ? 24 + 36 : 22 + 36, 1)
, m_diskData);
}
}