Rationalize NA contest mode

Generic message packing and unpacking routines now understand antipode
grid contest messages.  These messages  are now recognized as standard
messages in  message response processing and  dealt with appropriately
when contest mode is selected and applicable (currently FT8 and MSK144
only).

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8062 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2017-09-01 20:10:35 +00:00
parent 6c5809876a
commit dd1362b69a
26 changed files with 87 additions and 161 deletions

View File

@ -556,6 +556,7 @@ set (wsjt_FSRCS
lib/sync9w.f90 lib/sync9w.f90
lib/synciscat.f90 lib/synciscat.f90
lib/timf2.f90 lib/timf2.f90
lib/to_contest_msg.f90
lib/tweak1.f90 lib/tweak1.f90
lib/twkfreq.f90 lib/twkfreq.f90
lib/fsk4hf/twkfreq1.f90 lib/fsk4hf/twkfreq1.f90

View File

@ -4,18 +4,19 @@
#include <QRegularExpression> #include <QRegularExpression>
extern "C" { extern "C" {
bool stdmsg_(const char* msg, int len); bool stdmsg_(char const * msg, bool contest_mode, char const * mygrid, int len_msg, int len_grid);
} }
namespace 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/]+)(?:\sR\s)?(?:\s(?<word3>[-+A-Z0-9]+)(?:\s(?<word4>OOO))?)?)?)"}; 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) DecodedText::DecodedText (QString const& the_string, bool contest_mode, QString const& my_grid)
: string_ {the_string} : string_ {the_string}
, padding_ {the_string.indexOf (" ") > 4 ? 2 : 0} // allow for , padding_ {the_string.indexOf (" ") > 4 ? 2 : 0} // allow for
// seconds // seconds
, contest_mode_ {contest_mode}
, message_ {string_.mid (column_qsoText + padding_).trimmed ()} , message_ {string_.mid (column_qsoText + padding_).trimmed ()}
, is_standard_ {false} , is_standard_ {false}
{ {
@ -39,8 +40,16 @@ DecodedText::DecodedText (QString const& the_string)
// remove DXCC entity and worked B4 status. TODO need a better way to do this // remove DXCC entity and worked B4 status. TODO need a better way to do this
message_ = message_.left (eom_pos + 1); message_ = message_.left (eom_pos + 1);
} }
// stdmsg is a fortran routine that packs the text, unpacks it and compares the result // stdmsg is a fortran routine that packs the text, unpacks it
is_standard_ = stdmsg_ ((message_ + " ").toLatin1 ().constData (),22); // and compares the result
auto message_c_string = message_.toLocal8Bit ();
message_c_string.append (22 - message_c_string.size (), ' ');
auto grid_c_string = my_grid.toLocal8Bit ();
grid_c_string.append (6 - grid_c_string.size (), ' ');
is_standard_ = stdmsg_ (message_c_string.constData ()
, contest_mode_
, grid_c_string.constData ()
, 22, 6);
} }
}; };
@ -157,22 +166,10 @@ void DecodedText::deCallAndGrid(/*out*/QString& call, QString& grid) const
auto const& match = words_re.match (message_); auto const& match = words_re.match (message_);
call = match.captured ("word2"); call = match.captured ("word2");
grid = match.captured ("word3"); grid = match.captured ("word3");
if (contest_mode_ && "R" == grid)
// auto msg = string_; {
// if(msg.mid(4,1)!=" ") msg=msg.mid(0,4)+msg.mid(6,-1); //Remove seconds from UTC grid = match.captured ("word4");
// 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 (">", "");
} }
unsigned DecodedText::timeInSeconds() const unsigned DecodedText::timeInSeconds() const

View File

@ -29,7 +29,7 @@
class DecodedText class DecodedText
{ {
public: public:
explicit DecodedText (QString const&); explicit DecodedText (QString const& message, bool, QString const& my_grid);
QString string() const { return string_; }; QString string() const { return string_; };
QStringList messageWords () const; QStringList messageWords () const;
@ -77,6 +77,7 @@ private:
QString string_; QString string_;
int padding_; int padding_;
bool contest_mode_;
QString message_; QString message_;
bool is_standard_; bool is_standard_;
}; };

View File

@ -36,10 +36,8 @@ program contest72
1001 format(a22) 1001 format(a22)
endif endif
msg=msg0 msg=msg0
if(bcontest) call to_contest_msg(msg0,msg) call packmsg(msg,dat,itype,bcontest)
call packmsg(msg,dat,itype) call unpackmsg(dat,msg1,bcontest,mygrid)
call unpackmsg(dat,msg1)
call fix_contest_msg(mygrid,msg1)
ok=msg1.eq.msg0 ok=msg1.eq.msg0
if(msg0.eq.' ') then if(msg0.eq.' ') then
write(*,1002) write(*,1002)
@ -78,9 +76,9 @@ program contest72
cycle cycle
endif endif
call packmsg(msg,dat,itype) call packmsg(msg,dat,itype,.false.)
write(ct1,1010) dat write(ct1,1010) dat
call packtext(msg,nc1,nc2,ng) call packtext(msg,nc1,nc2,ng,.false.,'')
! write(ct2,1012) nc1,nc2,ng+32768 ! write(ct2,1012) nc1,nc2,ng+32768
!1012 format(2b28.28,b16.16) !1012 format(2b28.28,b16.16)
! write(*,1014) ct1 ! write(*,1014) ct1

View File

@ -9,7 +9,7 @@ subroutine encode4(message,ncode)
integer*1 data0(13),symbol(216) integer*1 data0(13),symbol(216)
call chkmsg(message,cok,nspecial,flip) call chkmsg(message,cok,nspecial,flip)
call packmsg(message,dgen,itype) !Pack 72-bit message into 12 six-bit symbols call packmsg(message,dgen,itype,.false.) !Pack 72-bit message into 12 six-bit symbols
call entail(dgen,data0) call entail(dgen,data0)
call encode232(data0,206,symbol) !Convolutional encoding call encode232(data0,206,symbol) !Convolutional encoding
call interleave4(symbol,1) !Apply JT4 interleaving call interleave4(symbol,1) !Apply JT4 interleaving

View File

@ -122,7 +122,7 @@ subroutine extract(s3,nadd,mode65,ntrials,naggressive,ndepth,nflip, &
correct(1:63)=tmp(1:63) correct(1:63)=tmp(1:63)
call interleave63(correct,63,1) call interleave63(correct,63,1)
call graycode65(correct,63,1) call graycode65(correct,63,1)
call unpackmsg(dat4,decoded) !Unpack the user message call unpackmsg(dat4,decoded,.false.,' ') !Unpack the user message
ncount=0 ncount=0
if(iand(dat4(10),8).ne.0) ltext=.true. if(iand(dat4(10),8).ne.0) ltext=.true.
endif endif

View File

@ -57,7 +57,7 @@ subroutine extract4(sym0,ncount,decoded)
read(c72,1102) data4 read(c72,1102) data4
1102 format(12b6) 1102 format(12b6)
call unpackmsg(data4,decoded) call unpackmsg(data4,decoded,.false.,' ')
if(decoded(1:6).eq.'000AAA') then if(decoded(1:6).eq.'000AAA') then
! decoded='***WRONG MODE?***' ! decoded='***WRONG MODE?***'
decoded=' ' decoded=' '

View File

@ -6,10 +6,9 @@ subroutine genft8(msg,mygrid,bcontest,msgsent,msgbits,itone)
use packjt use packjt
include 'ft8_params.f90' include 'ft8_params.f90'
character*22 msg,msgsent character*22 msg,msgsent
character*6 mygrid,g1,g2,g3,g4 character*6 mygrid
character*87 cbits character*87 cbits
logical*1 bcontest logical bcontest
logical isgrid
integer*4 i4Msg6BitWords(12) !72-bit message as 6-bit words integer*4 i4Msg6BitWords(12) !72-bit message as 6-bit words
integer*1 msgbits(KK),codeword(3*ND) integer*1 msgbits(KK),codeword(3*ND)
integer*1, target:: i1Msg8BitBytes(11) integer*1, target:: i1Msg8BitBytes(11)
@ -17,41 +16,8 @@ subroutine genft8(msg,mygrid,bcontest,msgsent,msgbits,itone)
integer icos7(0:6) integer icos7(0:6)
data icos7/2,5,6,0,4,1,3/ !Costas 7x7 tone pattern data icos7/2,5,6,0,4,1,3/ !Costas 7x7 tone pattern
isgrid(g1)=g1(1:1).ge.'A' .and. g1(1:1).le.'R' .and. g1(2:2).ge.'A' .and. & call packmsg(msg,i4Msg6BitWords,itype,bcontest) !Pack into 12 6-bit bytes
g1(2:2).le.'R' .and. g1(3:3).ge.'0' .and. g1(3:3).le.'9' .and. & call unpackmsg(i4Msg6BitWords,msgsent,bcontest,mygrid) !Unpack to get msgsent
g1(4:4).ge.'0' .and. g1(4:4).le.'9' .and. g1(1:4).ne.'RR73'
if(bcontest) then
i0=index(msg,' R ') + 3 !Check for ' R ' in message
g1=msg(i0:i0+3)//' '
if(isgrid(g1)) then !Check for ' R grid'
call grid2deg(g1,dlong,dlat)
dlong=dlong+180.0
if(dlong.gt.180.0) dlong=dlong-360.0
dlat=-dlat
call deg2grid(dlong,dlat,g2) !g2=antipodes grid
msg=msg(1:i0-3)//g2(1:4) !Send message with g2
endif
endif
call packmsg(msg,i4Msg6BitWords,itype) !Pack into 12 6-bit bytes
call unpackmsg(i4Msg6BitWords,msgsent) !Unpack to get msgsent
if(bcontest) then
i1=index(msgsent(8:22),' ') + 8
g3=msgsent(i1:i1+3)//' '
if(isgrid(g3)) then
call azdist(mygrid,g3,0.d0,nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter)
if(ndkm.gt.10000) then
call grid2deg(g3,dlong,dlat)
dlong=dlong+180.0
if(dlong.gt.180.0) dlong=dlong-360.0
dlat=-dlat
call deg2grid(dlong,dlat,g4)
msgsent=msgsent(1:i1-1)//'R '//g4(1:4)
endif
endif
endif
i3bit=0 !### temporary ### i3bit=0 !### temporary ###
write(cbits,1000) i4Msg6BitWords,32*i3bit write(cbits,1000) i4Msg6BitWords,32*i3bit

View File

@ -66,8 +66,8 @@ allocate ( rxdata(N), llr(N) )
! msg="K1JT K9AN EN50" ! msg="K1JT K9AN EN50"
msg="G4WJS K9AN EN50" msg="G4WJS K9AN EN50"
call packmsg(msg,i4Msg6BitWords,itype) !Pack into 12 6-bit bytes call packmsg(msg,i4Msg6BitWords,itype,.false.) !Pack into 12 6-bit bytes
call unpackmsg(i4Msg6BitWords,msgsent) !Unpack to get msgsent call unpackmsg(i4Msg6BitWords,msgsent,.false.,'') !Unpack to get msgsent
write(*,*) "message sent ",msgsent write(*,*) "message sent ",msgsent
i4=0 i4=0

View File

@ -71,8 +71,8 @@ allocate ( rxdata(N), llr(N) )
msg="K1JT K9AN EN50" msg="K1JT K9AN EN50"
! msg="G4WJS K9AN EN50" ! msg="G4WJS K9AN EN50"
call packmsg(msg,i4Msg6BitWords,itype) !Pack into 12 6-bit bytes call packmsg(msg,i4Msg6BitWords,itype,.false.) !Pack into 12 6-bit bytes
call unpackmsg(i4Msg6BitWords,msgsent) !Unpack to get msgsent call unpackmsg(i4Msg6BitWords,msgsent,.false.,'') !Unpack to get msgsent
write(*,*) "message sent ",msgsent write(*,*) "message sent ",msgsent
i4=0 i4=0

View File

@ -26,8 +26,8 @@ subroutine gen4(msg0,ichk,msgsent,itone,itype)
message=msg0 message=msg0
call fmtmsg(message,iz) call fmtmsg(message,iz)
call packmsg(message,i4Msg6BitWords,itype) !Pack into 12 6-bit bytes call packmsg(message,i4Msg6BitWords,itype,.false.) !Pack into 12 6-bit bytes
call unpackmsg(i4Msg6BitWords,msgsent) !Unpack to get msgsent call unpackmsg(i4Msg6BitWords,msgsent,.false.,' ') !Unpack to get msgsent
if(ichk.ne.0) go to 999 if(ichk.ne.0) go to 999
call encode4(message,itone) !Encode the information bits call encode4(message,itone) !Encode the information bits
i1=index(message,'-') i1=index(message,'-')

View File

@ -44,8 +44,8 @@ subroutine gen65(msg0,ichk,msgsent,itone,itype)
ntest=0 ntest=0
if(flip.lt.0.0) ntest=1 if(flip.lt.0.0) ntest=1
if(nspecial.eq.0) then if(nspecial.eq.0) then
call packmsg(message,dgen,itype) !Pack message into 72 bits call packmsg(message,dgen,itype,.false.) !Pack message into 72 bits
call unpackmsg(dgen,msgsent) !Unpack to get message sent call unpackmsg(dgen,msgsent,.false.,' ') !Unpack to get message sent
msgsent(20:22)=cok msgsent(20:22)=cok
call fmtmsg(msgsent,iz) call fmtmsg(msgsent,iz)
if(ichk.ne.0) go to 999 !Return if checking only if(ichk.ne.0) go to 999 !Return if checking only

View File

@ -37,8 +37,8 @@ subroutine gen9(msg0,ichk,msgsent,i4tone,itype)
message=message(i+1:) message=message(i+1:)
enddo enddo
call packmsg(message,i4Msg6BitWords,itype) !Pack into 12 6-bit bytes call packmsg(message,i4Msg6BitWords,itype,.false.) !Pack into 12 6-bit bytes
call unpackmsg(i4Msg6BitWords,msgsent) !Unpack to get msgsent call unpackmsg(i4Msg6BitWords,msgsent,.false.,' ') !Unpack to get msgsent
if(ichk.ne.0) go to 999 if(ichk.ne.0) go to 999
call entail(i4Msg6BitWords,i1Msg8BitBytes) !Add tail, make 8-bit bytes call entail(i4Msg6BitWords,i1Msg8BitBytes) !Add tail, make 8-bit bytes
nsym2=206 nsym2=206

View File

@ -23,7 +23,7 @@ subroutine genmsk144(msg0,mygrid,ichk,bcontest,msgsent,i4tone,itype)
character*22 msg0 character*22 msg0
character*22 message !Message to be generated character*22 message !Message to be generated
character*22 msgsent !Message as it will be received character*22 msgsent !Message as it will be received
character*6 mygrid,g1,g2,g3,g4 character*6 mygrid
integer*4 i4Msg6BitWords(13) !72-bit message as 6-bit words integer*4 i4Msg6BitWords(13) !72-bit message as 6-bit words
integer*4 i4tone(144) ! integer*4 i4tone(144) !
integer*1, target:: i1Msg8BitBytes(10) !80 bits represented in 10 bytes integer*1, target:: i1Msg8BitBytes(10) !80 bits represented in 10 bytes
@ -32,19 +32,15 @@ subroutine genmsk144(msg0,mygrid,ichk,bcontest,msgsent,i4tone,itype)
integer*1 bitseq(144) !Tone #s, data and sync (values 0-1) integer*1 bitseq(144) !Tone #s, data and sync (values 0-1)
integer*1 i1hash(4) integer*1 i1hash(4)
integer*1 s8(8) integer*1 s8(8)
logical*1 bcontest logical bcontest
real*8 pp(12) real*8 pp(12)
real*8 xi(864),xq(864),pi,twopi real*8 xi(864),xq(864),pi,twopi
data s8/0,1,1,1,0,0,1,0/ data s8/0,1,1,1,0,0,1,0/
equivalence (ihash,i1hash) equivalence (ihash,i1hash)
logical first,isgrid logical first
data first/.true./ data first/.true./
save save
isgrid(g1)=g1(1:1).ge.'A' .and. g1(1:1).le.'R' .and. g1(2:2).ge.'A' .and. &
g1(2:2).le.'R' .and. g1(3:3).ge.'0' .and. g1(3:3).le.'9' .and. &
g1(4:4).ge.'0' .and. g1(4:4).le.'9' .and. g1(1:4).ne.'RR73'
if(first) then if(first) then
first=.false. first=.false.
nsym=128 nsym=128
@ -81,37 +77,8 @@ subroutine genmsk144(msg0,mygrid,ichk,bcontest,msgsent,i4tone,itype)
go to 999 go to 999
endif endif
if(bcontest) then call packmsg(message,i4Msg6BitWords,itype,bcontest) !Pack into 12 6-bit bytes
i0=index(message,' R ') + 3 !Check for ' R ' in message call unpackmsg(i4Msg6BitWords,msgsent,bcontest,mygrid) !Unpack to get msgsent
g1=message(i0:i0+3)//' '
if(isgrid(g1)) then !Check for ' R grid'
call grid2deg(g1,dlong,dlat)
dlong=dlong+180.0
if(dlong.gt.180.0) dlong=dlong-360.0
dlat=-dlat
call deg2grid(dlong,dlat,g2) !g2=antipodes grid
message=message(1:i0-3)//g2(1:4) !Send message with g2
endif
endif
call packmsg(message,i4Msg6BitWords,itype) !Pack into 12 6-bit bytes
call unpackmsg(i4Msg6BitWords,msgsent) !Unpack to get msgsent
if(bcontest) then
i1=index(msgsent(8:22),' ') + 8
g3=msgsent(i1:i1+3)//' '
if(isgrid(g3)) then
call azdist(mygrid,g3,0.d0,nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter)
if(ndkm.gt.10000) then
call grid2deg(g3,dlong,dlat)
dlong=dlong+180.0
if(dlong.gt.180.0) dlong=dlong-360.0
dlat=-dlat
call deg2grid(dlong,dlat,g4)
msgsent=msgsent(1:i1-1)//'R '//g4(1:4)
endif
endif
endif
if(ichk.eq.1) go to 999 if(ichk.eq.1) go to 999
i4=0 i4=0

View File

@ -37,8 +37,8 @@ subroutine genqra64(msg0,ichk,msgsent,itone,itype)
enddo enddo
call chkmsg(message,cok,nspecial,flip) call chkmsg(message,cok,nspecial,flip)
call packmsg(message,dgen,itype) !Pack message into 72 bits call packmsg(message,dgen,itype,.false.) !Pack message into 72 bits
call unpackmsg(dgen,msgsent) !Unpack to get message sent call unpackmsg(dgen,msgsent,.false.,' ') !Unpack to get message sent
if(ichk.ne.0) go to 999 !Return if checking only if(ichk.ne.0) go to 999 !Return if checking only
call qra64_enc(dgen,sent) !Encode using QRA64 call qra64_enc(dgen,sent) !Encode using QRA64

View File

@ -88,7 +88,7 @@ subroutine hint65(s3,mrs,mrs2,nadd,nflip,mycall,hiscall,hisgrid,qual,decoded)
if(m.eq.2) msg='CQ '//call2(i)//' '//grid2(i) if(m.eq.2) msg='CQ '//call2(i)//' '//grid2(i)
endif endif
call fmtmsg(msg,iz) call fmtmsg(msg,iz)
call packmsg(msg,dgen,itype) !Pack message into 72 bits call packmsg(msg,dgen,itype,.false.) !Pack message into 72 bits
call rs_encode(dgen,sym_rev) !RS encode call rs_encode(dgen,sym_rev) !RS encode
sym(0:62)=sym_rev(62:0:-1) sym(0:62)=sym_rev(62:0:-1)
sym1(0:62,j)=sym sym1(0:62,j)=sym

View File

@ -61,7 +61,7 @@ program JT65code
go to 10 go to 10
endif endif
call packmsg(msg1,dgen,itype) !Pack message into 12 six-bit bytes call packmsg(msg1,dgen,itype,.false.) !Pack message into 12 six-bit bytes
msgtype="" msgtype=""
if(itype.eq.1) msgtype="Std Msg" if(itype.eq.1) msgtype="Std Msg"
if(itype.eq.2) msgtype="Type 1 pfx" if(itype.eq.2) msgtype="Type 1 pfx"
@ -77,7 +77,7 @@ program JT65code
call graycode(sent,63,-1,tmp) !Remove Gray code call graycode(sent,63,-1,tmp) !Remove Gray code
call interleave63(tmp,-1) !Remove interleaving call interleave63(tmp,-1) !Remove interleaving
call rs_decode(tmp,era,0,recd,nerr) !Decode the message call rs_decode(tmp,era,0,recd,nerr) !Decode the message
call unpackmsg(recd,decoded) !Unpack the user message call unpackmsg(recd,decoded,.false.,' ') !Unpack the user message
if(cok.eq."OOO") decoded(20:22)=cok if(cok.eq."OOO") decoded(20:22)=cok
call fmtmsg(decoded,iz) call fmtmsg(decoded,iz)

View File

@ -153,7 +153,7 @@ program jt65sim
msg="K1ABC W9XYZ EN37" msg="K1ABC W9XYZ EN37"
!### !###
call packmsg(msg,dgen,itype) !Pack message into 12 six-bit bytes call packmsg(msg,dgen,itype,.false.) !Pack message into 12 six-bit bytes
call rs_encode(dgen,sent) !Encode using RS(63,12) call rs_encode(dgen,sent) !Encode using RS(63,12)
call interleave63(sent,1) !Interleave channel symbols call interleave63(sent,1) !Interleave channel symbols
call graycode65(sent,63,1) !Apply Gray code call graycode65(sent,63,1) !Apply Gray code

View File

@ -84,7 +84,7 @@ subroutine jt9fano(i1SoftSymbols,limit,nlim,msg)
enddo enddo
call unpackbits(i4DecodedBytes,nbytes,8,i1DecodedBits) call unpackbits(i4DecodedBytes,nbytes,8,i1DecodedBits)
call packbits(i1DecodedBits,12,6,i4Decoded6BitWords) call packbits(i1DecodedBits,12,6,i4Decoded6BitWords)
call unpackmsg(i4Decoded6BitWords,msg) !Unpack decoded msg call unpackmsg(i4Decoded6BitWords,msg,.false.,' ') !Unpack decoded msg
if(index(msg,'000AAA ').gt.0) msg=' ' if(index(msg,'000AAA ').gt.0) msg=' '
endif endif

View File

@ -53,8 +53,8 @@ allocate ( codeword(N), decoded(K), message(K) )
allocate ( lratio(N), rxdata(N), rxavgd(N), yy(N), llr(N) ) allocate ( lratio(N), rxdata(N), rxavgd(N), yy(N), llr(N) )
msg="K9AN K1JT EN50" msg="K9AN K1JT EN50"
call packmsg(msg,i4Msg6BitWords,itype) !Pack into 12 6-bit bytes call packmsg(msg,i4Msg6BitWords,itype,.false.) !Pack into 12 6-bit bytes
call unpackmsg(i4Msg6BitWords,msgsent) !Unpack to get msgsent call unpackmsg(i4Msg6BitWords,msgsent,.false.,' ') !Unpack to get msgsent
write(*,*) "message sent ",msgsent write(*,*) "message sent ",msgsent
i4=0 i4=0

View File

@ -392,7 +392,7 @@ subroutine packbits(dbits,nsymd,m0,sym)
900 return 900 return
end subroutine unpackgrid end subroutine unpackgrid
subroutine packmsg(msg0,dat,itype) subroutine packmsg(msg0,dat,itype,bcontest)
! Packs a JT4/JT9/JT65 message into twelve 6-bit symbols ! Packs a JT4/JT9/JT65 message into twelve 6-bit symbols
@ -413,10 +413,15 @@ subroutine packbits(dbits,nsymd,m0,sym)
character*12 c1,c2 character*12 c1,c2
character*4 c3 character*4 c3
character*6 grid6 character*6 grid6
logical text1,text2,text3 logical text1,text2,text3,bcontest
msg=msg0
itype=1 itype=1
if(bcontest) then
call to_contest_msg(msg0,msg)
else
msg=msg0
end if
call fmtmsg(msg,iz) call fmtmsg(msg,iz)
if(msg(1:6).eq.'CQ DX ') msg(3:3)='9' if(msg(1:6).eq.'CQ DX ') msg(3:3)='9'
@ -525,13 +530,13 @@ subroutine packbits(dbits,nsymd,m0,sym)
return return
end subroutine packmsg end subroutine packmsg
subroutine unpackmsg(dat,msg) subroutine unpackmsg(dat,msg,bcontest,mygrid)
parameter (NBASE=37*36*10*27*27*27) parameter (NBASE=37*36*10*27*27*27)
parameter (NGBASE=180*180) parameter (NGBASE=180*180)
integer dat(:) integer dat(:)
character c1*12,c2*12,grid*4,msg*22,grid6*6,psfx*4,junk2*4 character c1*12,c2*12,grid*4,msg*22,grid6*6,psfx*4,junk2*4,mygrid*6
logical cqnnn logical cqnnn,bcontest
cqnnn=.false. cqnnn=.false.
nc1=ishft(dat(1),22) + ishft(dat(2),16) + ishft(dat(3),10)+ & nc1=ishft(dat(1),22) + ishft(dat(2),16) + ishft(dat(3),10)+ &
@ -645,6 +650,8 @@ subroutine packbits(dbits,nsymd,m0,sym)
msg(4:4).ge.'A' .and. msg(4:4).le.'Z' .and. & msg(4:4).ge.'A' .and. msg(4:4).le.'Z' .and. &
msg(5:5).eq.' ') msg='CQ '//msg(3:) msg(5:5).eq.' ') msg='CQ '//msg(3:)
if(bcontest) call fix_contest_msg(mygrid,msg)
return return
end subroutine unpackmsg end subroutine unpackmsg

View File

@ -128,7 +128,7 @@ subroutine qra64a(dd,npts,nutc,nf1,nf2,nfqso,ntol,mode64,minsync,ndepth, &
10 decoded=' ' 10 decoded=' '
if(irc.ge.0) then if(irc.ge.0) then
call unpackmsg(dat4,decoded) !Unpack the user message call unpackmsg(dat4,decoded,.false.,' ') !Unpack the user message
call fmtmsg(decoded,iz) call fmtmsg(decoded,iz)
if(index(decoded,"000AAA ").ge.1) then if(index(decoded,"000AAA ").ge.1) then
! Suppress a certain type of garbage decode. ! Suppress a certain type of garbage decode.

View File

@ -34,7 +34,7 @@ program QRA64code
msg0=msg !Input message msg0=msg !Input message
call chkmsg(msg,cok,nspecial,flip) !See if it includes "OOO" report call chkmsg(msg,cok,nspecial,flip) !See if it includes "OOO" report
msg1=msg !Message without "OOO" msg1=msg !Message without "OOO"
call packmsg(msg1,dgen,itype) !Pack message into 12 six-bit bytes call packmsg(msg1,dgen,itype,.false.) !Pack message into 12 six-bit bytes
msgtype="" msgtype=""
if(itype.eq.1) msgtype="Std Msg" if(itype.eq.1) msgtype="Std Msg"
if(itype.eq.2) msgtype="Type 1 pfx" if(itype.eq.2) msgtype="Type 1 pfx"
@ -45,7 +45,7 @@ program QRA64code
call qra64_enc(dgen,sent) !Encode using QRA64 call qra64_enc(dgen,sent) !Encode using QRA64
call unpackmsg(dgen,decoded) !Unpack the user message call unpackmsg(dgen,decoded,.false.,' ') !Unpack the user message
call fmtmsg(decoded,iz) call fmtmsg(decoded,iz)
ii=imsg ii=imsg
write(*,1020) ii,msg0,decoded,itype,msgtype write(*,1020) ii,msg0,decoded,itype,msgtype

View File

@ -1,11 +1,15 @@
logical*1 function stdmsg(msg0) function stdmsg(msg0,bcontest,mygrid)
use iso_c_binding, only: c_bool
use packjt use packjt
character*22 msg0,msg character*22 msg0,msg
character*6 mygrid
integer dat(12) integer dat(12)
logical(c_bool), value :: bcontest
logical(c_bool) :: stdmsg
call packmsg(msg0,dat,itype) call packmsg(msg0,dat,itype,logical(bcontest))
call unpackmsg(dat,msg) call unpackmsg(dat,msg,logical(bcontest),mygrid)
stdmsg=(msg.eq.msg0) .and. (itype.ge.0) .and. itype.ne.6 stdmsg=(msg.eq.msg0) .and. (itype.ge.0) .and. itype.ne.6
return return

View File

@ -294,7 +294,7 @@ subroutine syncmsk(cdat,npts,jpk,ipk,idf,rmax,snr,metric,decoded)
1012 format(9b8.8) 1012 format(9b8.8)
read(c72,1014) i4Msg6BitWords read(c72,1014) i4Msg6BitWords
1014 format(12b6.6) 1014 format(12b6.6)
call unpackmsg(i4Msg6BitWords,decoded) !Unpack to get msgsent call unpackmsg(i4Msg6BitWords,decoded,.false.,' ') !Unpack to get msgsent
endif endif
if(decoded.ne.' ') exit if(decoded.ne.' ') exit
enddo enddo

View File

@ -1189,7 +1189,7 @@ void MainWindow::dataSink(qint64 frames)
int ftol = ui->sbFtol->value (); int ftol = ui->sbFtol->value ();
freqcal_(&dec_data.d2[0],&k,&nkhz,&RxFreq,&ftol,&line[0],80); freqcal_(&dec_data.d2[0],&k,&nkhz,&RxFreq,&ftol,&line[0],80);
QString t=QString::fromLatin1(line); QString t=QString::fromLatin1(line);
DecodedText decodedtext {t}; DecodedText decodedtext {t, false, m_config.my_grid ()};
ui->decodedTextBrowser->displayDecodedText (decodedtext,m_baseCall,m_config.DXCC(), ui->decodedTextBrowser->displayDecodedText (decodedtext,m_baseCall,m_config.DXCC(),
m_logBook,m_config.color_CQ(),m_config.color_MyCall(),m_config.color_DXCC(), m_logBook,m_config.color_CQ(),m_config.color_MyCall(),m_config.color_DXCC(),
m_config.color_NewCall()); m_config.color_NewCall());
@ -1424,7 +1424,7 @@ void MainWindow::fastSink(qint64 frames)
if(bmsk144 and (line[0]!=0)) { if(bmsk144 and (line[0]!=0)) {
QString message {QString::fromLatin1 (line)}; QString message {QString::fromLatin1 (line)};
DecodedText decodedtext {message.replace (QChar::LineFeed, "")}; DecodedText decodedtext {message.replace (QChar::LineFeed, ""), bcontest, m_config.my_grid ()};
ui->decodedTextBrowser->displayDecodedText (decodedtext,m_baseCall,m_config.DXCC(), ui->decodedTextBrowser->displayDecodedText (decodedtext,m_baseCall,m_config.DXCC(),
m_logBook,m_config.color_CQ(),m_config.color_MyCall(),m_config.color_DXCC(), m_logBook,m_config.color_CQ(),m_config.color_MyCall(),m_config.color_DXCC(),
m_config.color_NewCall()); m_config.color_NewCall());
@ -2561,7 +2561,7 @@ void::MainWindow::fast_decode_done()
if(narg[13]/8==narg[12]) message=message.trimmed().replace("<...>",m_calls); if(narg[13]/8==narg[12]) message=message.trimmed().replace("<...>",m_calls);
//Left (Band activity) window //Left (Band activity) window
DecodedText decodedtext {message.replace (QChar::LineFeed, "")}; DecodedText decodedtext {message.replace (QChar::LineFeed, ""), "FT8" == m_mode && m_config.contestMode (), m_config.my_grid ()};
if(!m_bFastDone) { if(!m_bFastDone) {
ui->decodedTextBrowser->displayDecodedText (decodedtext,m_baseCall,m_config.DXCC(), ui->decodedTextBrowser->displayDecodedText (decodedtext,m_baseCall,m_config.DXCC(),
m_logBook,m_config.color_CQ(),m_config.color_MyCall(),m_config.color_DXCC(), m_logBook,m_config.color_CQ(),m_config.color_MyCall(),m_config.color_DXCC(),
@ -2706,7 +2706,7 @@ void MainWindow::readFromStdout() //readFromStdout
m_blankLine = false; m_blankLine = false;
} }
DecodedText decodedtext {QString::fromUtf8 (t.constData ()).remove (QRegularExpression {"\r|\n"})}; DecodedText decodedtext {QString::fromUtf8 (t.constData ()).remove (QRegularExpression {"\r|\n"}), "FT8" == m_mode && m_config.contestMode (), m_config.my_grid ()};
//Left (Band activity) window //Left (Band activity) window
if(!bAvgMsg) { if(!bAvgMsg) {
@ -3642,7 +3642,7 @@ void MainWindow::doubleClickOnCall(bool alt, bool ctrl)
cursor=ui->decodedTextBrowser2->textCursor(); cursor=ui->decodedTextBrowser2->textCursor();
} }
cursor.setPosition (cursor.selectionStart ()); cursor.setPosition (cursor.selectionStart ());
DecodedText message {cursor.block ().text ()}; DecodedText message {cursor.block ().text (), ("MSK144" == m_mode || "FT8" == m_mode) && m_config.contestMode (), m_config.my_grid ()};
m_bDoubleClicked = true; m_bDoubleClicked = true;
processMessage (message, ctrl, alt); processMessage (message, ctrl, alt);
} }
@ -3661,15 +3661,6 @@ void MainWindow::processMessage(DecodedText const& message, bool ctrl, bool alt)
return; return;
} }
// QString t2a;
// int ntsec=3600*t2.mid(0,2).toInt() + 60*t2.mid(2,2).toInt();
// if(m_bFastMode or m_mode=="FT8") {
// ntsec = ntsec + t2.mid(4,2).toInt();
// t2a = t2.left (4) + t2.mid (6); //Change hhmmss to hhmm for the message parser
// }
//t2a = t2.left (44); // strip any quality info trailing the
// decoded message
if(m_bFastMode or m_mode=="FT8") { if(m_bFastMode or m_mode=="FT8") {
auto i1=message.string ().indexOf(" CQ "); auto i1=message.string ().indexOf(" CQ ");
if(i1>10) { if(i1>10) {
@ -3706,12 +3697,6 @@ void MainWindow::processMessage(DecodedText const& message, bool ctrl, bool alt)
message.deCallAndGrid(/*out*/hiscall,hisgrid); message.deCallAndGrid(/*out*/hiscall,hisgrid);
auto is_73 = message_words.filter (QRegularExpression {"^(73|RR73)$"}).size (); auto is_73 = message_words.filter (QRegularExpression {"^(73|RR73)$"}).size ();
if (!is_73 && !message.isStandardMessage ()) if (!is_73 && !message.isStandardMessage ())
// && (!Radio::is_callsign (hiscall) // not interested if not from QSO partner
// && !(t4.size () == 7 // unless it is of the form
// && (t4.at (5) == m_baseCall // "<our-call> 73"
// || t4.at (5).startsWith (m_baseCall + '/')
// || t4.at (5).endsWith ('/' + m_baseCall))
// && t4.at (6) == "73")))
{ {
qDebug () << "Not processing message - hiscall:" << hiscall << "hisgrid:" << hisgrid; qDebug () << "Not processing message - hiscall:" << hiscall << "hisgrid:" << hisgrid;
return; return;
@ -3929,7 +3914,7 @@ void MainWindow::processMessage(DecodedText const& message, bool ctrl, bool alt)
ui->decodedTextBrowser2->displayDecodedText(message, m_baseCall, ui->decodedTextBrowser2->displayDecodedText(message, m_baseCall,
false, m_logBook,m_config.color_CQ(), m_config.color_MyCall(), false, m_logBook,m_config.color_CQ(), m_config.color_MyCall(),
m_config.color_DXCC(),m_config.color_NewCall()); m_config.color_DXCC(),m_config.color_NewCall());
m_QSOText = s1; m_QSOText = s2;
} }
if (hiscall != "73" if (hiscall != "73"
@ -6110,7 +6095,7 @@ void MainWindow::replyToCQ (QTime time, qint32 snr, float delta_time, quint32 de
position = ui->decodedTextBrowser->toPlainText().indexOf(QChar::LineFeed,position); position = ui->decodedTextBrowser->toPlainText().indexOf(QChar::LineFeed,position);
m_bDoubleClicked = true; m_bDoubleClicked = true;
auto start = messages.left (position).lastIndexOf (QChar::LineFeed) + 1; auto start = messages.left (position).lastIndexOf (QChar::LineFeed) + 1;
DecodedText message {messages.mid (start, position - start)}; DecodedText message {messages.mid (start, position - start), ("MSK144" == m_mode || "FT8" == m_mode) && m_config.contestMode (), m_config.my_grid ()};
processMessage (message); processMessage (message);
tx_watchdog (false); tx_watchdog (false);
QApplication::alert (this); QApplication::alert (this);