Refactor decoder output to include which submode is decoded so we could eventually run three

This commit is contained in:
Jordan Sherer 2019-10-21 14:01:56 -04:00
parent 0426b3a6ce
commit 5313706818
4 changed files with 28 additions and 17 deletions

View File

@ -15,7 +15,7 @@ namespace
QRegularExpression words_re {R"(^(?:(?<word1>(?:CQ|DE|QRZ)(?:\s?DX|\s(?:[A-Z]{2}|\d{3}))|[A-Z0-9/]+)\s)(?:(?<word2>[A-Z0-9/]+)(?:\s(?<word3>[-+A-Z0-9]+)(?:\s(?<word4>(?:OOO|(?!RR73)[A-R]{2}[0-9]{2})))?)?)?)"};
}
DecodedText::DecodedText (QString const& the_string, bool contest_mode, QString const& my_grid, int submode)
DecodedText::DecodedText (QString const& the_string, bool contest_mode, QString const& my_grid)
: string_ {the_string.left (the_string.indexOf (QChar::Nbsp))} // discard appended info
, padding_ {string_.indexOf (" ") > 4 ? 2 : 0} // allow for seconds
, contest_mode_ {contest_mode}
@ -25,7 +25,7 @@ DecodedText::DecodedText (QString const& the_string, bool contest_mode, QString
, isHeartbeat_(false)
, isAlt_(false)
, bits_{0}
, submode_{submode}
, submode_{ string_.mid(column_mode, 3).trimmed().at(0).cell() - 'A' }
{
if(message_.length() >= 1) {
message_ = message_.left (21).remove (QRegularExpression {"[<>]"});

View File

@ -30,7 +30,7 @@
class DecodedText
{
public:
explicit DecodedText (QString const& message, bool, QString const& my_grid, int submode);
explicit DecodedText (QString const& message, bool, QString const& my_grid);
explicit DecodedText (QString const& js8callmessage, int bits, int submode);
bool tryUnpack();
@ -74,6 +74,7 @@ public:
bool hasBits() const { return !string_.right(5).trimmed().isEmpty(); }
int bits() const { return string_.right(5).trimmed().toShort(); }
float dt() const;
int submode() const { return submode_; }
// find and extract any report. Returns true if this is a standard message
bool report(QString const& myBaseCall, QString const& dxBaseCall, /*mod*/QString& report) const;

View File

@ -79,7 +79,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
endif
if(params%nmode.eq.8 .and. params%nsubmode.eq.3) then
! We're in JS8 mode C
! We're in JS8 mode D
call timer('decjs8d ',0)
newdat=params%newdat
call my_js8d%decode(js8d_decoded,id2,params%nQSOProgress,params%nfqso, &
@ -169,7 +169,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
!$call omp_set_dynamic(.true.)
800 ndecoded = my_js8a%decoded + my_js8b%decoded + my_js8c%decoded
800 ndecoded = my_js8a%decoded + my_js8b%decoded + my_js8c%decoded + my_js8d%decoded
write(*,1010) nsynced,ndecoded
1010 format('<DecodeFinished>',2i4)
call flush(6)
@ -177,7 +177,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
contains
subroutine js8_decoded (sync,snr,dt,freq,decoded,nap,qual)
subroutine js8_decoded (sync,snr,dt,freq,decoded,nap,qual,submode)
implicit none
real, intent(in) :: sync
@ -189,6 +189,8 @@ contains
integer i0,i1,i2,i3,i4,i5,n30,nwrap
integer, intent(in) :: nap
real, intent(in) :: qual
integer, intent(in) :: submode
character*3 m
character*2 annot
character*37 decoded0
logical isgrid4,first,b0,b1,b2
@ -220,11 +222,19 @@ contains
if(qual.lt.0.17) decoded0(22:22)='?'
endif
m = ' ~ '
if(submode.eq.0) m=' A '
if(submode.eq.1) m=' B '
if(submode.eq.2) m=' C '
if(submode.eq.3) m=' D '
i0=index(decoded0,';')
if(i0.le.0) write(*,1000) params%nutc,snr,dt,nint(freq),decoded0(1:22),annot
1000 format(i6.6,i4,f5.1,i5,' ~ ',1x,a22,1x,a2)
if(i0.gt.0) write(*,1001) params%nutc,snr,dt,nint(freq),decoded0
1001 format(i6.6,i4,f5.1,i5,' ~ ',1x,a37)
if(i0.le.0) write(*,1000) params%nutc,snr,dt,nint(freq),m,decoded0(1:22),annot
1000 format(i6.6,i4,f5.1,i5,a3,1x,a22,1x,a2)
if(i0.gt.0) write(*,1001) params%nutc,snr,dt,nint(freq),m,decoded0
1001 format(i6.6,i4,f5.1,i5,a3,1x,a37)
i1=index(decoded0,' ')
i2=i1 + index(decoded0(i1+1:),' ')
@ -276,7 +286,7 @@ contains
real, intent(in) :: qual
save
call js8_decoded(sync, snr, dt, freq, decoded, nap, qual)
call js8_decoded(sync, snr, dt, freq, decoded, nap, qual, 0)
select type(this)
type is (counting_ft8_decoder)
@ -300,7 +310,7 @@ contains
real, intent(in) :: qual
save
call js8_decoded(sync, snr, dt, freq, decoded, nap, qual)
call js8_decoded(sync, snr, dt, freq, decoded, nap, qual, 1)
select type(this)
type is (counting_js8b_decoder)
@ -324,7 +334,7 @@ contains
real, intent(in) :: qual
save
call js8_decoded(sync, snr, dt, freq, decoded, nap, qual)
call js8_decoded(sync, snr, dt, freq, decoded, nap, qual, 2)
select type(this)
type is (counting_js8c_decoder)
@ -348,7 +358,7 @@ contains
real, intent(in) :: qual
save
call js8_decoded(sync, snr, dt, freq, decoded, nap, qual)
call js8_decoded(sync, snr, dt, freq, decoded, nap, qual, 3)
select type(this)
type is (counting_js8d_decoder)

View File

@ -4205,7 +4205,7 @@ void MainWindow::readFromStdout() //readFromStdout
}
int n=t.length();
auto logText = t.mid(0, n-2);
auto dt = DecodedText(logText, false, m_config.my_grid(), m_nSubMode);
auto dt = DecodedText(logText, false, m_config.my_grid());
out << logText << " " << dt.message() << endl;
f.close();
} else {
@ -4215,7 +4215,7 @@ void MainWindow::readFromStdout() //readFromStdout
}
DecodedText decodedtext {QString::fromUtf8 (t.constData ()).remove (QRegularExpression {"\r|\n"}), "FT8" == m_mode &&
ui->cbVHFcontest->isChecked(), m_config.my_grid (), m_nSubMode};
ui->cbVHFcontest->isChecked(), m_config.my_grid ()};
bool bValidFrame = decodedtext.snr() > -24;
@ -4234,7 +4234,7 @@ void MainWindow::readFromStdout() //readFromStdout
m_messageDupeCache[frame] = frameOffset;
}
qDebug() << "valid" << bValidFrame << "decoded text" << decodedtext.message();
qDebug() << "valid" << bValidFrame << decodedtext.submode() << "decoded text" << decodedtext.message();
// skip if invalid
if(!bValidFrame) {