mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-07-27 03:02:28 -04:00
------------------------------------------------------------------------ r8016 | k9an | 2017-08-09 16:22:54 +0100 (Wed, 09 Aug 2017) | 1 line Remove call to jtmsg. ------------------------------------------------------------------------ r8017 | k9an | 2017-08-09 16:52:52 +0100 (Wed, 09 Aug 2017) | 1 line Bring a simulation tool up to date. ------------------------------------------------------------------------ r8022 | k9an | 2017-08-13 02:35:13 +0100 (Sun, 13 Aug 2017) | 1 line Improve efficiency of OSD by a factor of 5 to 10 for norder=2 and 3. Use norder=2 for wideband multi-decoding, norder=3 near nfqso and nftx. ------------------------------------------------------------------------ r8026 | k9an | 2017-08-14 16:00:48 +0100 (Mon, 14 Aug 2017) | 1 line Make default MSK144 amplitude polynomial flat. ------------------------------------------------------------------------ r8029 | k1jt | 2017-08-19 14:07:27 +0100 (Sat, 19 Aug 2017) | 1 line Edit the advice displayed by F5. ------------------------------------------------------------------------ r8030 | k1jt | 2017-08-19 23:34:26 +0100 (Sat, 19 Aug 2017) | 1 line Fix a typo. ------------------------------------------------------------------------ r8031 | k9an | 2017-08-22 01:14:51 +0100 (Tue, 22 Aug 2017) | 1 line 1. Improvements to the OSD to allow deeper wideband decoding. 2. Add a third decoding pass. 3. Change symbol metric from max-log to max-amplitude. ------------------------------------------------------------------------ r8032 | k9an | 2017-08-22 01:17:23 +0100 (Tue, 22 Aug 2017) | 1 line Delete unused array. ------------------------------------------------------------------------ r8033 | k9an | 2017-08-22 01:21:59 +0100 (Tue, 22 Aug 2017) | 1 line More cleanup. ------------------------------------------------------------------------ r8034 | k1jt | 2017-08-24 14:38:47 +0100 (Thu, 24 Aug 2017) | 1 line Possible pseudo-code for DXpedition auto-sequencing. ------------------------------------------------------------------------ r8035 | k1jt | 2017-08-25 17:59:58 +0100 (Fri, 25 Aug 2017) | 4 lines Use the most recently edited "CQ xx: message in Tx6 as a template for subsequent regenerations. This means that "CQ DX", "CQ VT", etc., will be presistent until changed back. ------------------------------------------------------------------------ r8036 | k1jt | 2017-08-26 17:30:47 +0100 (Sat, 26 Aug 2017) | 1 line Use a baseline-fitting procedure to improve S/N estimates for FT8. ------------------------------------------------------------------------ r8037 | k1jt | 2017-08-27 13:26:37 +0100 (Sun, 27 Aug 2017) | 1 line Fix the 'Start=0 ==> S/N = -24 dB' problem. ------------------------------------------------------------------------ r8038 | k1jt | 2017-08-27 14:11:56 +0100 (Sun, 27 Aug 2017) | 1 line Change magic 36 back to 37; does this break something else? ------------------------------------------------------------------------ r8039 | k1jt | 2017-08-28 15:32:14 +0100 (Mon, 28 Aug 2017) | 2 lines Correct the behavior of FT8 in "NA VHF Contest mode". ------------------------------------------------------------------------ r8040 | k9an | 2017-08-28 22:09:44 +0100 (Mon, 28 Aug 2017) | 1 line Fix a potential array bounds issue in osd174.f90. ------------------------------------------------------------------------ r8043 | bsomervi | 2017-08-29 04:20:37 +0100 (Tue, 29 Aug 2017) | 1 line Update AD1C cty.dat database to 14th Aug 2017 big CTY.DAT ------------------------------------------------------------------------ r8044 | bsomervi | 2017-08-29 04:20:51 +0100 (Tue, 29 Aug 2017) | 1 line Basic fix of auto sequencing with free text 73 messages, more to come ------------------------------------------------------------------------ r8045 | bsomervi | 2017-08-29 04:46:32 +0100 (Tue, 29 Aug 2017) | 1 line Ensure that auto Tx is disabled when stop Tx on 73 isn't enabled and DX call is cleared ------------------------------------------------------------------------ r8046 | k1jt | 2017-08-29 15:01:55 +0100 (Tue, 29 Aug 2017) | 2 lines Update text in User Guide related to *NA VHF Contest Mode*. ------------------------------------------------------------------------ r8047 | bsomervi | 2017-08-30 03:27:57 +0100 (Wed, 30 Aug 2017) | 7 lines Fix some signoff issues with auto-sequencing 73 messages from other QSOs on frequency should now be ignored rather than being processed. Also some long overdue refactoring and tidying of non-idiomatic C++ code in the logbook directory. ------------------------------------------------------------------------ r8048 | bsomervi | 2017-08-30 14:20:39 +0100 (Wed, 30 Aug 2017) | 1 line Make 73 and RR73 matching of incoming messages for exact while words ------------------------------------------------------------------------ r8049 | k1jt | 2017-08-30 18:06:49 +0100 (Wed, 30 Aug 2017) | 1 line Updates to User Guide. ------------------------------------------------------------------------ git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx-1.8@8050 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
198 lines
5.4 KiB
C++
198 lines
5.4 KiB
C++
#include "decodedtext.h"
|
|
|
|
#include <QStringList>
|
|
#include <QRegularExpression>
|
|
|
|
extern "C" {
|
|
bool stdmsg_(const char* msg, int len);
|
|
}
|
|
|
|
DecodedText::DecodedText (QString const& the_string)
|
|
: string_ {the_string}
|
|
, padding_ {the_string.indexOf (" ") > 4 ? 2 : 0} // allow for
|
|
// seconds
|
|
, message_ {string_.mid (column_qsoText + padding_).trimmed ()}
|
|
, is_standard_ {false}
|
|
{
|
|
if (message_.length() >= 1)
|
|
{
|
|
message_ = message_.left (22).remove (QRegularExpression {"[<>]"});
|
|
int i1 = message_.indexOf ('\r');
|
|
if (i1 > 0)
|
|
{
|
|
message_ = message_.left (i1 - 1);
|
|
}
|
|
// stdmsg is a fortran routine that packs the text, unpacks it and compares the result
|
|
is_standard_ = stdmsg_ ((message_ + " ").toLatin1 ().constData (),22);
|
|
}
|
|
};
|
|
|
|
void DecodedText::removeAddedInfo ()
|
|
{
|
|
if (string_.indexOf (" CQ ") > 0) {
|
|
// TODO this magic 37 characters is also referenced in DisplayText::_appendDXCCWorkedB4()
|
|
auto eom_pos = string_.indexOf (' ', 37);
|
|
if (eom_pos < 37) eom_pos = string_.size () - 1; // we always want at least the characters
|
|
// to position 37
|
|
string_ = string_.left (eom_pos + 1); // remove DXCC entity and worked B4 status. TODO need a better way to do this
|
|
}
|
|
}
|
|
|
|
QString DecodedText::CQersCall() const
|
|
{
|
|
QRegularExpression callsign_re {R"(^(CQ|DE|QRZ)(\s?DX|\s([A-Z]{2}|\d{3}))?\s(?<callsign>[A-Z0-9/]{2,})(\s[A-R]{2}[0-9]{2})?)"};
|
|
return callsign_re.match (message_).captured ("callsign");
|
|
}
|
|
|
|
|
|
bool DecodedText::isJT65() const
|
|
{
|
|
return string_.indexOf("#") == column_mode + padding_;
|
|
}
|
|
|
|
bool DecodedText::isJT9() const
|
|
{
|
|
return string_.indexOf("@") == column_mode + padding_;
|
|
}
|
|
|
|
bool DecodedText::isTX() const
|
|
{
|
|
int i = string_.indexOf("Tx");
|
|
return (i >= 0 && i < 15); // TODO guessing those numbers. Does Tx ever move?
|
|
}
|
|
|
|
bool DecodedText::isLowConfidence () const
|
|
{
|
|
return QChar {'?'} == string_.mid (padding_ + column_qsoText + 21, 1);
|
|
}
|
|
|
|
int DecodedText::frequencyOffset() const
|
|
{
|
|
return string_.mid(column_freq + padding_,4).toInt();
|
|
}
|
|
|
|
int DecodedText::snr() const
|
|
{
|
|
int i1=string_.indexOf(" ")+1;
|
|
return string_.mid(i1,3).toInt();
|
|
}
|
|
|
|
float DecodedText::dt() const
|
|
{
|
|
return string_.mid(column_dt + padding_,5).toFloat();
|
|
}
|
|
|
|
/*
|
|
2343 -11 0.8 1259 # YV6BFE F6GUU R-08
|
|
2343 -19 0.3 718 # VE6WQ SQ2NIJ -14
|
|
2343 -7 0.3 815 # KK4DSD W7VP -16
|
|
2343 -13 0.1 3627 @ CT1FBK IK5YZT R+02
|
|
|
|
0605 Tx 1259 # CQ VK3ACF QF22
|
|
*/
|
|
|
|
// find and extract any report. Returns true if this is a standard message
|
|
bool DecodedText::report(QString const& myBaseCall, QString const& dxBaseCall, /*mod*/QString& report) const
|
|
{
|
|
if (message_.size () < 1) return false;
|
|
|
|
QStringList const& w = message_.split(" ",QString::SkipEmptyParts);
|
|
if (w.size ()
|
|
&& is_standard_ && (w[0] == myBaseCall
|
|
|| w[0].endsWith ("/" + myBaseCall)
|
|
|| w[0].startsWith (myBaseCall + "/")
|
|
|| (w.size () > 1 && !dxBaseCall.isEmpty ()
|
|
&& (w[1] == dxBaseCall
|
|
|| w[1].endsWith ("/" + dxBaseCall)
|
|
|| w[1].startsWith (dxBaseCall + "/")))))
|
|
{
|
|
QString tt="";
|
|
if(w.size() > 2) tt=w[2];
|
|
bool ok;
|
|
auto i1=tt.toInt(&ok);
|
|
if (ok and i1>=-50 and i1<50)
|
|
{
|
|
report = tt;
|
|
}
|
|
else
|
|
{
|
|
if (tt.mid(0,1)=="R")
|
|
{
|
|
i1=tt.mid(1).toInt(&ok);
|
|
if(ok and i1>=-50 and i1<50)
|
|
{
|
|
report = tt.mid(1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return is_standard_;
|
|
}
|
|
|
|
// get the first text word, usually the call
|
|
QString DecodedText::call() const
|
|
{
|
|
auto call = string_;
|
|
call = call.replace (QRegularExpression {" CQ ([A-Z]{2,2}|[0-9]{3,3}) "}, " CQ_\\1 ").mid (column_qsoText + padding_);
|
|
int i = call.indexOf(" ");
|
|
return call.mid(0,i);
|
|
}
|
|
|
|
// get the second word, most likely the de call and the third word, most likely grid
|
|
void DecodedText::deCallAndGrid(/*out*/QString& call, QString& grid) const
|
|
{
|
|
auto msg = string_;
|
|
if(msg.mid(4,1)!=" ") msg=msg.mid(0,4)+msg.mid(6,-1); //Remove seconds from UTC
|
|
msg = msg.replace (QRegularExpression {" CQ ([A-Z]{2,2}|[0-9]{3,3}) "}, " CQ_\\1 ").mid (column_qsoText + padding_);
|
|
int i1 = msg.indexOf (" ");
|
|
call = msg.mid (i1 + 1);
|
|
int i2 = call.indexOf (" ");
|
|
if (" R " == call.mid (i2, 3)) // MSK144 contest mode report
|
|
{
|
|
grid = call.mid (i2 + 3, 4);
|
|
}
|
|
else
|
|
{
|
|
grid = call.mid (i2 + 1, 4);
|
|
}
|
|
call = call.left (i2).replace (">", "");
|
|
}
|
|
|
|
int DecodedText::timeInSeconds() const
|
|
{
|
|
return 60*string_.mid(column_time,2).toInt() + string_.mid(2,2).toInt();
|
|
}
|
|
|
|
/*
|
|
2343 -11 0.8 1259 # YV6BFE F6GUU R-08
|
|
2343 -19 0.3 718 # VE6WQ SQ2NIJ -14
|
|
2343 -7 0.3 815 # KK4DSD W7VP -16
|
|
2343 -13 0.1 3627 @ CT1FBK IK5YZT R+02
|
|
|
|
0605 Tx 1259 # CQ VK3ACF QF22
|
|
*/
|
|
|
|
QString DecodedText::report() const // returns a string of the SNR field with a leading + or - followed by two digits
|
|
{
|
|
int sr = snr();
|
|
if (sr<-50)
|
|
sr = -50;
|
|
else
|
|
if (sr > 49)
|
|
sr = 49;
|
|
|
|
QString rpt;
|
|
rpt.sprintf("%d",abs(sr));
|
|
if (sr > 9)
|
|
rpt = "+" + rpt;
|
|
else
|
|
if (sr >= 0)
|
|
rpt = "+0" + rpt;
|
|
else
|
|
if (sr >= -9)
|
|
rpt = "-0" + rpt;
|
|
else
|
|
rpt = "-" + rpt;
|
|
return rpt;
|
|
}
|