From 531370681854b91618641e5678772aea69754df5 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Mon, 21 Oct 2019 14:01:56 -0400 Subject: [PATCH] Refactor decoder output to include which submode is decoded so we could eventually run three --- decodedtext.cpp | 4 ++-- decodedtext.h | 3 ++- lib/decoder.f90 | 32 +++++++++++++++++++++----------- mainwindow.cpp | 6 +++--- 4 files changed, 28 insertions(+), 17 deletions(-) diff --git a/decodedtext.cpp b/decodedtext.cpp index 8a1da46..e46ab11 100644 --- a/decodedtext.cpp +++ b/decodedtext.cpp @@ -15,7 +15,7 @@ namespace QRegularExpression words_re {R"(^(?:(?(?:CQ|DE|QRZ)(?:\s?DX|\s(?:[A-Z]{2}|\d{3}))|[A-Z0-9/]+)\s)(?:(?[A-Z0-9/]+)(?:\s(?[-+A-Z0-9]+)(?:\s(?(?: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 {"[<>]"}); diff --git a/decodedtext.h b/decodedtext.h index 7872ccb..1eb51af 100644 --- a/decodedtext.h +++ b/decodedtext.h @@ -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; diff --git a/lib/decoder.f90 b/lib/decoder.f90 index 204fa1d..87aa7ce 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -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('',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) diff --git a/mainwindow.cpp b/mainwindow.cpp index c0af6a2..f55a6cd 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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) {