mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-09-02 21:27:52 -04:00
Merge changes from revisions 4533, 4534, 4535, 4536, 4537, 4540, and
4544 into wsjtx-1.4. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx-1.4@4550 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
945eb8c267
commit
d4879ac0e0
@ -236,6 +236,7 @@ set (wsjt_FSRCS
|
|||||||
lib/flat3.f90
|
lib/flat3.f90
|
||||||
lib/flat65.f90
|
lib/flat65.f90
|
||||||
lib/four2a.f90
|
lib/four2a.f90
|
||||||
|
lib/fmtmsg.f90
|
||||||
lib/gen65.f90
|
lib/gen65.f90
|
||||||
lib/genjt9.f90
|
lib/genjt9.f90
|
||||||
lib/geodist.f90
|
lib/geodist.f90
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
subroutine encode4(message,ncode)
|
|
||||||
|
|
||||||
parameter (MAXCALLS=7000,MAXRPT=63)
|
|
||||||
integer ncode(206)
|
|
||||||
character*22 message !Message to be generated
|
|
||||||
character*3 cok !' ' or 'OOO'
|
|
||||||
integer dgen(13)
|
|
||||||
integer*1 data0(13),symbol(216)
|
|
||||||
logical text
|
|
||||||
|
|
||||||
call chkmsg(message,cok,nspecial,flip)
|
|
||||||
call packmsg(message,dgen,text) !Pack 72-bit message into 12 six-bit symbols
|
|
||||||
call entail(dgen,data0)
|
|
||||||
call encode232(data0,206,symbol) !Convolutional encoding
|
|
||||||
call interleave24(symbol,1) !Apply JT4 interleaving
|
|
||||||
do i=1,206
|
|
||||||
ncode(i)=symbol(i)
|
|
||||||
enddo
|
|
||||||
|
|
||||||
end subroutine encode4
|
|
21
lib/fmtmsg.f90
Normal file
21
lib/fmtmsg.f90
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
subroutine fmtmsg(msg,iz)
|
||||||
|
|
||||||
|
character*22 msg
|
||||||
|
|
||||||
|
! Convert all letters to upper case
|
||||||
|
iz=22
|
||||||
|
do i=1,22
|
||||||
|
if(msg(i:i).ge.'a' .and. msg(i:i).le.'z') &
|
||||||
|
msg(i:i)= char(ichar(msg(i:i))+ichar('A')-ichar('a'))
|
||||||
|
if(msg(i:i).ne.' ') iz=i
|
||||||
|
enddo
|
||||||
|
|
||||||
|
do iter=1,5 !Collapse multiple blanks into one
|
||||||
|
ib2=index(msg(1:iz),' ')
|
||||||
|
if(ib2.lt.1) go to 100
|
||||||
|
msg=msg(1:ib2)//msg(ib2+2:)
|
||||||
|
iz=iz-1
|
||||||
|
enddo
|
||||||
|
|
||||||
|
100 return
|
||||||
|
end subroutine fmtmsg
|
@ -1,86 +0,0 @@
|
|||||||
subroutine gen24(message,mode4,samfac,ntxdf,iwave,nwave,sendingsh,msgsent,nmsg)
|
|
||||||
|
|
||||||
! Encode a JT4 message into a wavefile.
|
|
||||||
|
|
||||||
parameter (NMAX=60*11025) !Max length of wave file
|
|
||||||
character*22 message !Message to be generated
|
|
||||||
character*22 msgsent !Message as it will be received
|
|
||||||
character*3 cok !' ' or 'OOO'
|
|
||||||
real*8 t,dt,phi,f,f0,dfgen,dphi,pi,twopi,samfac,tsymbol
|
|
||||||
integer*2 iwave(NMAX) !Generated wave file
|
|
||||||
integer sendingsh
|
|
||||||
integer dgen(13)
|
|
||||||
integer*1 data0(13),symbol(216)
|
|
||||||
logical first
|
|
||||||
include 'prcom2.f'
|
|
||||||
data first/.true./
|
|
||||||
save
|
|
||||||
|
|
||||||
nsym=207 !Symbols per transmission
|
|
||||||
if(first) then
|
|
||||||
do i=1,nsym
|
|
||||||
pr2(i)=2*npr2(i)-1
|
|
||||||
enddo
|
|
||||||
pi=4.d0*atan(1.d0)
|
|
||||||
twopi=2.d0*pi
|
|
||||||
first=.false.
|
|
||||||
endif
|
|
||||||
|
|
||||||
call chkmsg(message,cok,nspecial,flip)
|
|
||||||
call packmsg(message,dgen) !Pack 72-bit message into 12 six-bit symbols
|
|
||||||
call entail(dgen,data0)
|
|
||||||
call unpackmsg(dgen,msgsent)
|
|
||||||
|
|
||||||
nbytes=(72+31+7)/8
|
|
||||||
call encode(data0,nbytes,symbol(2)) !Convolutional encoding
|
|
||||||
symbol(1)=0 !Reference phase
|
|
||||||
sendingsh=0
|
|
||||||
if(iand(dgen(10),8).ne.0) sendingsh=-1 !Plain text flag
|
|
||||||
call interleave24(symbol(2),1) !Apply JT4 interleaving
|
|
||||||
|
|
||||||
! Set up necessary constants
|
|
||||||
tsymbol=2520.d0/11025.d0
|
|
||||||
dt=1.d0/(samfac*11025.d0)
|
|
||||||
f0=118*11025.d0/1024 + ntxdf
|
|
||||||
dfgen=11025.d0/2520 !4.375 Hz
|
|
||||||
t=0.d0
|
|
||||||
phi=0.d0
|
|
||||||
j0=0
|
|
||||||
ndata=(nsym*11025.d0*samfac*tsymbol)/2
|
|
||||||
ndata=2*ndata
|
|
||||||
do i=1,ndata
|
|
||||||
t=t+dt
|
|
||||||
j=int(t/tsymbol) + 1 !Symbol number, 1-207
|
|
||||||
if(j.ne.j0) then
|
|
||||||
f=f0 + (npr2(j)+2*symbol(j)-1.5) * dfgen * mode4
|
|
||||||
if(flip.lt.0.0) f=f0+((1-npr2(j))+2*symbol(j)-1.5)*dfgen*mode4
|
|
||||||
dphi=twopi*dt*f
|
|
||||||
j0=j
|
|
||||||
endif
|
|
||||||
phi=phi+dphi
|
|
||||||
iwave(i)=32767.0*sin(phi)
|
|
||||||
enddo
|
|
||||||
|
|
||||||
do j=1,5512 !Put another 0.5 sec of silence at end
|
|
||||||
i=i+1
|
|
||||||
iwave(i)=0
|
|
||||||
enddo
|
|
||||||
nwave=i
|
|
||||||
|
|
||||||
if(flip.lt.0.0) then
|
|
||||||
do i=22,1,-1
|
|
||||||
if(msgsent(i:i).ne.' ') goto 10
|
|
||||||
enddo
|
|
||||||
10 msgsent=msgsent(1:i)//' OOO'
|
|
||||||
endif
|
|
||||||
do i=22,1,-1
|
|
||||||
if(msgsent(i:i).ne.' ') goto 20
|
|
||||||
enddo
|
|
||||||
20 nmsg=i
|
|
||||||
|
|
||||||
! write(*,3002) (symbol(i),i=1,207)
|
|
||||||
! 3002 format(70i1)
|
|
||||||
|
|
||||||
return
|
|
||||||
end subroutine gen24
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
subroutine gen65(msg0,ichk,msgsent,itone,itext)
|
subroutine gen65(msg0,ichk,msgsent,itone,itype)
|
||||||
|
|
||||||
! Encodes a JT65 message to yieild itone(1:126)
|
! Encodes a JT65 message to yieild itone(1:126)
|
||||||
! Temporarily, does not implement EME shorthands
|
! Temporarily, does not implement EME shorthands
|
||||||
@ -10,7 +10,6 @@ subroutine gen65(msg0,ichk,msgsent,itone,itext)
|
|||||||
! character*3 cok !' ' or 'OOO'
|
! character*3 cok !' ' or 'OOO'
|
||||||
integer dgen(13)
|
integer dgen(13)
|
||||||
integer sent(63)
|
integer sent(63)
|
||||||
logical text
|
|
||||||
integer nprc(126)
|
integer nprc(126)
|
||||||
data nprc/1,0,0,1,1,0,0,0,1,1,1,1,1,1,0,1,0,1,0,0, &
|
data nprc/1,0,0,1,1,0,0,0,1,1,1,1,1,1,0,1,0,1,0,0, &
|
||||||
0,1,0,1,1,0,0,1,0,0,0,1,1,1,0,0,1,1,1,1, &
|
0,1,0,1,1,0,0,1,0,0,0,1,1,1,0,0,1,1,1,1, &
|
||||||
@ -37,9 +36,7 @@ subroutine gen65(msg0,ichk,msgsent,itone,itext)
|
|||||||
nspecial=0
|
nspecial=0
|
||||||
! call chkmsg(message,cok,nspecial,flip)
|
! call chkmsg(message,cok,nspecial,flip)
|
||||||
if(nspecial.eq.0) then
|
if(nspecial.eq.0) then
|
||||||
call packmsg(message,dgen,text) !Pack message into 72 bits
|
call packmsg(message,dgen,itype) !Pack message into 72 bits
|
||||||
itext=0
|
|
||||||
if(text) itext=1
|
|
||||||
call unpackmsg(dgen,msgsent) !Unpack to get message sent
|
call unpackmsg(dgen,msgsent) !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
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
subroutine genjt9(msg0,ichk,msgsent,i4tone,itext)
|
subroutine genjt9(msg0,ichk,msgsent,i4tone,itype)
|
||||||
|
|
||||||
! Encodes a JT9 message and returns msgsent, the message as it will
|
! Encodes a JT9 message and returns msgsent, the message as it will
|
||||||
! be decoded, and an integer array i4tone(85) of 9-FSK tone values
|
! be decoded, and an integer array i4tone(85) of 9-FSK tone values
|
||||||
@ -14,7 +14,6 @@ subroutine genjt9(msg0,ichk,msgsent,i4tone,itext)
|
|||||||
integer*4 i4DataSymbols(69) !Data symbols (values 0-7)
|
integer*4 i4DataSymbols(69) !Data symbols (values 0-7)
|
||||||
integer*4 i4GrayCodedSymbols(69) !Gray-coded symbols (values 0-7)
|
integer*4 i4GrayCodedSymbols(69) !Gray-coded symbols (values 0-7)
|
||||||
integer*4 i4tone(85) !Tone #s, data and sync (values 0-8)
|
integer*4 i4tone(85) !Tone #s, data and sync (values 0-8)
|
||||||
logical text
|
|
||||||
include 'jt9sync.f90'
|
include 'jt9sync.f90'
|
||||||
save
|
save
|
||||||
|
|
||||||
@ -31,9 +30,7 @@ subroutine genjt9(msg0,ichk,msgsent,i4tone,itext)
|
|||||||
message=message(i+1:)
|
message=message(i+1:)
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
call packmsg(message,i4Msg6BitWords,text) !Pack message into 12 6-bit bytes
|
call packmsg(message,i4Msg6BitWords,itype) !Pack into 12 6-bit bytes
|
||||||
itext=0
|
|
||||||
if(text) itext=1
|
|
||||||
call unpackmsg(i4Msg6BitWords,msgsent) !Unpack to get msgsent
|
call unpackmsg(i4Msg6BitWords,msgsent) !Unpack to get msgsent
|
||||||
if(ichk.ne.0) go to 999
|
if(ichk.ne.0) go to 999
|
||||||
call entail(i4Msg6BitWords,i1Msg8BitBytes) !Add tail, convert to 8-bit bytes
|
call entail(i4Msg6BitWords,i1Msg8BitBytes) !Add tail, convert to 8-bit bytes
|
||||||
|
@ -8,7 +8,7 @@ subroutine getpfx1(callsign,k,nv2)
|
|||||||
include 'pfx.f90'
|
include 'pfx.f90'
|
||||||
|
|
||||||
callsign0=callsign
|
callsign0=callsign
|
||||||
nv2=0
|
nv2=1
|
||||||
iz=index(callsign,' ') - 1
|
iz=index(callsign,' ') - 1
|
||||||
if(iz.lt.0) iz=12
|
if(iz.lt.0) iz=12
|
||||||
islash=index(callsign(1:iz),'/')
|
islash=index(callsign(1:iz),'/')
|
||||||
@ -22,11 +22,13 @@ subroutine getpfx1(callsign,k,nv2)
|
|||||||
do i=1,NZ
|
do i=1,NZ
|
||||||
if(pfx(i)(1:4).eq.c) then
|
if(pfx(i)(1:4).eq.c) then
|
||||||
k=i
|
k=i
|
||||||
|
nv2=2
|
||||||
go to 10
|
go to 10
|
||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
if(addpfx.eq.c) then
|
if(addpfx.eq.c) then
|
||||||
k=449
|
k=449
|
||||||
|
nv2=2
|
||||||
go to 10
|
go to 10
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -37,6 +39,7 @@ subroutine getpfx1(callsign,k,nv2)
|
|||||||
do i=1,NZ2
|
do i=1,NZ2
|
||||||
if(sfx(i).eq.c(1:1)) then
|
if(sfx(i).eq.c(1:1)) then
|
||||||
k=400+i
|
k=400+i
|
||||||
|
nv2=3
|
||||||
go to 10
|
go to 10
|
||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
@ -75,7 +78,7 @@ subroutine getpfx1(callsign,k,nv2)
|
|||||||
k=37*k + nchar(tpfx(2:2))
|
k=37*k + nchar(tpfx(2:2))
|
||||||
k=37*k + nchar(tpfx(3:3))
|
k=37*k + nchar(tpfx(3:3))
|
||||||
k=37*k + nchar(tpfx(4:4))
|
k=37*k + nchar(tpfx(4:4))
|
||||||
nv2=1
|
nv2=4
|
||||||
i=index(callsign0,'/')
|
i=index(callsign0,'/')
|
||||||
callsign=callsign0(:i-1)
|
callsign=callsign0(:i-1)
|
||||||
callsign=callsign0(i+1:)
|
callsign=callsign0(i+1:)
|
||||||
@ -85,7 +88,7 @@ subroutine getpfx1(callsign,k,nv2)
|
|||||||
k=nchar(tsfx(1:1))
|
k=nchar(tsfx(1:1))
|
||||||
k=37*k + nchar(tsfx(2:2))
|
k=37*k + nchar(tsfx(2:2))
|
||||||
k=37*k + nchar(tsfx(3:3))
|
k=37*k + nchar(tsfx(3:3))
|
||||||
nv2=2
|
nv2=5
|
||||||
i=index(callsign0,'/')
|
i=index(callsign0,'/')
|
||||||
callsign=callsign0(:i-1)
|
callsign=callsign0(:i-1)
|
||||||
endif
|
endif
|
||||||
|
115
lib/jt65code.f90
115
lib/jt65code.f90
@ -4,46 +4,101 @@ program JT65code
|
|||||||
! Reed Solomon encoding, and other necessary details of the JT65
|
! Reed Solomon encoding, and other necessary details of the JT65
|
||||||
! protocol.
|
! protocol.
|
||||||
|
|
||||||
character*22 msg0,msg,decoded,cok*3
|
character*22 testmsg(26)
|
||||||
|
character*22 msg,msg0,msg1,decoded,cok*3,bad*1,msgtype*10
|
||||||
integer dgen(12),sent(63),recd(12),era(51)
|
integer dgen(12),sent(63),recd(12),era(51)
|
||||||
logical text
|
|
||||||
|
|
||||||
nargs=iargc()
|
nargs=iargc()
|
||||||
if(nargs.ne.1) then
|
if(nargs.ne.1) then
|
||||||
print*,'Usage: JT65code "message"'
|
print*,'Usage: jt65code "message"'
|
||||||
|
print*,' jt65code -t'
|
||||||
go to 999
|
go to 999
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call getarg(1,msg0) !Get message from command line
|
call getarg(1,msg) !Get message from command line
|
||||||
msg=msg0
|
nmsg=1
|
||||||
|
if(msg(1:2).eq."-t") then
|
||||||
call chkmsg(msg,cok,nspecial,flip) !See if it includes "OOO" report
|
testmsg(1)="KA1ABC WB9XYZ EN34"
|
||||||
|
testmsg(2)="KA1ABC WB9XYZ EN34 OOO"
|
||||||
if(nspecial.gt.0) then !or is a shorthand message
|
testmsg(3)="KA1ABC WB9XYZ RO"
|
||||||
write(*,1010)
|
testmsg(4)="KA1ABC WB9XYZ -21"
|
||||||
1010 format('Shorthand message.')
|
testmsg(5)="KA1ABC WB9XYZ R-19"
|
||||||
go to 999
|
testmsg(6)="KA1ABC WB9XYZ RRR"
|
||||||
|
testmsg(7)="KA1ABC WB9XYZ 73"
|
||||||
|
testmsg(8)="KA1ABC WB9XYZ"
|
||||||
|
testmsg(9)="KA1ABC WB9XYZ OOO"
|
||||||
|
testmsg(10)="KA1ABC WB9XYZ RO"
|
||||||
|
testmsg(11)="ZL/KA1ABC WB9XYZ"
|
||||||
|
testmsg(12)="KA1ABC ZL/WB9XYZ"
|
||||||
|
testmsg(13)="KA1ABC/4 WB9XYZ"
|
||||||
|
testmsg(14)="KA1ABC WB9XYZ/4"
|
||||||
|
testmsg(15)="CQ ZL4/KA1ABC"
|
||||||
|
testmsg(16)="DE ZL4/KA1ABC"
|
||||||
|
testmsg(17)="QRZ ZL4/KA1ABC"
|
||||||
|
testmsg(18)="CQ WB9XYZ/VE4"
|
||||||
|
testmsg(19)="HELLO WORLD"
|
||||||
|
testmsg(20)="ZL4/KA1ABC 73"
|
||||||
|
testmsg(21)="RO"
|
||||||
|
testmsg(22)="RRR"
|
||||||
|
testmsg(23)="73"
|
||||||
|
testmsg(24)="KA1ABC XL/WB9XYZ"
|
||||||
|
testmsg(25)="KA1ABC WB9XYZ/W4"
|
||||||
|
testmsg(26)="123456789ABCDEFGH"
|
||||||
|
nmsg=26
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call packmsg(msg,dgen,text) !Pack message into 12 six-bit bytes
|
write(*,1010)
|
||||||
write(*,1020) msg0
|
1010 format("Message Decoded Err?"/ &
|
||||||
1020 format('Message: ',a22) !Echo input message
|
"-----------------------------------------------------------------")
|
||||||
if(iand(dgen(10),8).ne.0) write(*,1030) !Is plain text bit set?
|
|
||||||
1030 format('Plain text.')
|
|
||||||
write(*,1040) dgen
|
|
||||||
1040 format('Packed message, 6-bit symbols: ',12i3) !Display packed symbols
|
|
||||||
|
|
||||||
call rs_encode(dgen,sent) !RS encode
|
do imsg=1,nmsg
|
||||||
call interleave63(sent,1) !Interleave channel symbols
|
if(nmsg.gt.1) msg=testmsg(imsg)
|
||||||
call graycode(sent,63,1,sent) !Apply Gray code
|
|
||||||
write(*,1050) sent
|
|
||||||
1050 format('Information-carrying channel symbols:'/(i5,20i3))
|
|
||||||
|
|
||||||
call graycode(sent,63,-1,sent)
|
call fmtmsg(msg,iz) !To upper, collapse mult blanks
|
||||||
call interleave63(sent,-1)
|
msg0=msg !Input message
|
||||||
call rs_decode(sent,era,0,recd,nerr)
|
call chkmsg(msg,cok,nspecial,flip) !See if it includes "OOO" report
|
||||||
call unpackmsg(recd,decoded) !Unpack the user message
|
msg1=msg !Message without "OOO"
|
||||||
write(*,1060) decoded,cok
|
|
||||||
1060 format('Decoded message: ',a22,2x,a3)
|
if(nspecial.gt.0) then !or is a shorthand message
|
||||||
|
if(nspecial.eq.2) decoded="RO"
|
||||||
|
if(nspecial.eq.3) decoded="RRR"
|
||||||
|
if(nspecial.eq.4) decoded="73"
|
||||||
|
itype=-1
|
||||||
|
msgtype="Shorthand"
|
||||||
|
go to 10
|
||||||
|
endif
|
||||||
|
|
||||||
|
call packmsg(msg1,dgen,itype) !Pack message into 12 six-bit bytes
|
||||||
|
msgtype=""
|
||||||
|
if(itype.eq.1) msgtype="Std Msg"
|
||||||
|
if(itype.eq.2) msgtype="Type 1 pfx"
|
||||||
|
if(itype.eq.3) msgtype="Type 1 sfx"
|
||||||
|
if(itype.eq.4) msgtype="Type 2 pfx"
|
||||||
|
if(itype.eq.5) msgtype="Type 2 sfx"
|
||||||
|
if(itype.eq.6) msgtype="Free text"
|
||||||
|
|
||||||
|
call rs_encode(dgen,sent) !RS encode
|
||||||
|
call interleave63(sent,1) !Interleave channel symbols
|
||||||
|
call graycode(sent,63,1,sent) !Apply Gray code
|
||||||
|
call graycode(sent,63,-1,sent)
|
||||||
|
call interleave63(sent,-1)
|
||||||
|
call rs_decode(sent,era,0,recd,nerr)
|
||||||
|
call unpackmsg(recd,decoded) !Unpack the user message
|
||||||
|
if(cok.eq."OOO") decoded(20:22)=cok
|
||||||
|
call fmtmsg(decoded,iz)
|
||||||
|
|
||||||
|
10 bad=" "
|
||||||
|
if(decoded.ne.msg0) bad="*"
|
||||||
|
write(*,1020) msg0,decoded,bad,itype,msgtype
|
||||||
|
1020 format(a22,2x,a22,3x,a1,i3,": ",a10)
|
||||||
|
enddo
|
||||||
|
|
||||||
|
if(nmsg.eq.1 .and. nspecial.eq.0) then
|
||||||
|
write(*,1030) dgen
|
||||||
|
1030 format(/'Packed message, 6-bit symbols ',12i3) !Display packed symbols
|
||||||
|
|
||||||
|
write(*,1040) sent
|
||||||
|
1040 format(/'Information-carrying channel symbols'/(i5,20i3))
|
||||||
|
endif
|
||||||
|
|
||||||
999 end program JT65code
|
999 end program JT65code
|
||||||
|
@ -2,28 +2,70 @@ program jt9code
|
|||||||
|
|
||||||
! Generate simulated data for testing of WSJT-X
|
! Generate simulated data for testing of WSJT-X
|
||||||
|
|
||||||
character msg*22,msg0*22,decoded*22
|
character*22 testmsg(20)
|
||||||
|
character msg*22,msg0*22,decoded*22,bad*1,msgtype*10
|
||||||
integer*4 i4tone(85) !Channel symbols (values 0-8)
|
integer*4 i4tone(85) !Channel symbols (values 0-8)
|
||||||
include 'jt9sync.f90'
|
include 'jt9sync.f90'
|
||||||
|
|
||||||
nargs=iargc()
|
nargs=iargc()
|
||||||
if(nargs.ne.1) then
|
if(nargs.ne.1) then
|
||||||
print*,'Usage: jt9code "message"'
|
print*,'Usage: jt9code "message"'
|
||||||
|
print*,' jt9code -t'
|
||||||
go to 999
|
go to 999
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call getarg(1,msg0)
|
call getarg(1,msg)
|
||||||
write(*,1000) msg0
|
nmsg=1
|
||||||
1000 format('Message:',3x,a22)
|
if(msg(1:2).eq."-t") then
|
||||||
msg=msg0
|
testmsg(1)="KA1ABC WB9XYZ EN34"
|
||||||
ichk=0
|
testmsg(2)="KA1ABC WB9XYZ RO"
|
||||||
itext=0
|
testmsg(3)="KA1ABC WB9XYZ -21"
|
||||||
call genjt9(msg,ichk,decoded,i4tone,itext) !Encode message into tone #s
|
testmsg(4)="KA1ABC WB9XYZ R-19"
|
||||||
write(*,1002) i4tone
|
testmsg(5)="KA1ABC WB9XYZ RRR"
|
||||||
1002 format('Channel symbols:'/(30i2))
|
testmsg(6)="KA1ABC WB9XYZ 73"
|
||||||
if(itext.eq.0) write(*,1004) decoded
|
testmsg(7)="KA1ABC WB9XYZ"
|
||||||
1004 format('Decoded message:',1x,a22)
|
testmsg(8)="ZL/KA1ABC WB9XYZ"
|
||||||
if(itext.ne.0) write(*,1005) decoded
|
testmsg(9)="KA1ABC ZL/WB9XYZ"
|
||||||
1005 format('Decoded message:',1x,a22,3x,'(free text)')
|
testmsg(10)="KA1ABC/4 WB9XYZ"
|
||||||
|
testmsg(11)="KA1ABC WB9XYZ/4"
|
||||||
|
testmsg(12)="CQ ZL4/KA1ABC"
|
||||||
|
testmsg(13)="DE ZL4/KA1ABC"
|
||||||
|
testmsg(14)="QRZ ZL4/KA1ABC"
|
||||||
|
testmsg(15)="CQ WB9XYZ/VE4"
|
||||||
|
testmsg(16)="HELLO WORLD"
|
||||||
|
testmsg(17)="ZL4/KA1ABC 73"
|
||||||
|
testmsg(18)="KA1ABC XL/WB9XYZ"
|
||||||
|
testmsg(19)="KA1ABC WB9XYZ/W4"
|
||||||
|
testmsg(20)="123456789ABCDEFGH"
|
||||||
|
nmsg=20
|
||||||
|
endif
|
||||||
|
|
||||||
|
write(*,1010)
|
||||||
|
1010 format("Message Decoded Err?"/ &
|
||||||
|
"-----------------------------------------------------------------")
|
||||||
|
do imsg=1,nmsg
|
||||||
|
if(nmsg.gt.1) msg=testmsg(imsg)
|
||||||
|
call fmtmsg(msg,iz) !To upper, collapse mult blanks
|
||||||
|
msg0=msg !Input message
|
||||||
|
|
||||||
|
ichk=0
|
||||||
|
call genjt9(msg,ichk,decoded,i4tone,itype) !Encode message into tone #s
|
||||||
|
|
||||||
|
msgtype=""
|
||||||
|
if(itype.eq.1) msgtype="Std Msg"
|
||||||
|
if(itype.eq.2) msgtype="Type 1 pfx"
|
||||||
|
if(itype.eq.3) msgtype="Type 1 sfx"
|
||||||
|
if(itype.eq.4) msgtype="Type 2 pfx"
|
||||||
|
if(itype.eq.5) msgtype="Type 2 sfx"
|
||||||
|
if(itype.eq.6) msgtype="Free text"
|
||||||
|
|
||||||
|
bad=" "
|
||||||
|
if(decoded.ne.msg0) bad="*"
|
||||||
|
write(*,1020) msg0,decoded,bad,itype,msgtype
|
||||||
|
1020 format(a22,2x,a22,3x,a1,i3,": ",a10)
|
||||||
|
enddo
|
||||||
|
|
||||||
|
if(nmsg.eq.1) write(*,1030) i4tone
|
||||||
|
1030 format(/'Channel symbols'/(30i2))
|
||||||
|
|
||||||
999 end program jt9code
|
999 end program jt9code
|
||||||
|
@ -1,4 +1,16 @@
|
|||||||
subroutine packmsg(msg,dat,text)
|
subroutine packmsg(msg,dat,itype)
|
||||||
|
|
||||||
|
! Packs a JT4/JT9/JT65 message into twelve 6-bit symbols
|
||||||
|
|
||||||
|
! itype Message Type
|
||||||
|
!--------------------
|
||||||
|
! 1 Standardd message
|
||||||
|
! 2 Type 1 prefix
|
||||||
|
! 3 Type 1 suffix
|
||||||
|
! 4 Type 2 prefix
|
||||||
|
! 5 Type 2 suffix
|
||||||
|
! 6 Free text
|
||||||
|
! -1 Does not decode correctly
|
||||||
|
|
||||||
parameter (NBASE=37*36*10*27*27*27)
|
parameter (NBASE=37*36*10*27*27*27)
|
||||||
parameter (NBASE2=262178562)
|
parameter (NBASE2=262178562)
|
||||||
@ -7,24 +19,12 @@ subroutine packmsg(msg,dat,text)
|
|||||||
character*12 c1,c2
|
character*12 c1,c2
|
||||||
character*4 c3
|
character*4 c3
|
||||||
character*6 grid6
|
character*6 grid6
|
||||||
logical text1,text2,text3,text
|
logical text1,text2,text3
|
||||||
|
|
||||||
text=.false.
|
itype=1
|
||||||
! Convert all letters to upper case
|
call fmtmsg(msg,iz)
|
||||||
iz=22
|
|
||||||
do i=1,22
|
|
||||||
if(msg(i:i).ge.'a' .and. msg(i:i).le.'z') &
|
|
||||||
msg(i:i)= char(ichar(msg(i:i))+ichar('A')-ichar('a'))
|
|
||||||
if(msg(i:i).ne.' ') iz=i
|
|
||||||
enddo
|
|
||||||
do iter=1,5 !Collapse multiple blanks into one
|
|
||||||
ib2=index(msg(1:iz),' ')
|
|
||||||
if(ib2.lt.1) go to 5
|
|
||||||
msg=msg(1:ib2)//msg(ib2+2:)
|
|
||||||
iz=iz-1
|
|
||||||
enddo
|
|
||||||
|
|
||||||
5 if(msg(1:6).eq.'CQ DX ') msg(3:3)='9'
|
if(msg(1:6).eq.'CQ DX ') msg(3:3)='9'
|
||||||
|
|
||||||
! See if it's a CQ message
|
! See if it's a CQ message
|
||||||
if(msg(1:3).eq.'CQ ') then
|
if(msg(1:3).eq.'CQ ') then
|
||||||
@ -60,12 +60,14 @@ subroutine packmsg(msg,dat,text)
|
|||||||
c3=' '
|
c3=' '
|
||||||
if(ic.ge.ib+1) c3=msg(ib+1:ic)
|
if(ic.ge.ib+1) c3=msg(ib+1:ic)
|
||||||
if(c3.eq.'OOO ') c3=' ' !Strip out the OOO flag
|
if(c3.eq.'OOO ') c3=' ' !Strip out the OOO flag
|
||||||
call getpfx1(c1,k1,kk)
|
call getpfx1(c1,k1,nv2a)
|
||||||
if(kk.ne.0) go to 10 !Tnx to DL9RDZ for reminding me!
|
if(nv2a.ge.4) go to 10
|
||||||
call packcall(c1,nc1,text1)
|
call packcall(c1,nc1,text1)
|
||||||
call getpfx1(c2,k2,nv2)
|
if(text1) go to 10
|
||||||
|
call getpfx1(c2,k2,nv2b)
|
||||||
call packcall(c2,nc2,text2)
|
call packcall(c2,nc2,text2)
|
||||||
if(nv2.eq.0) then
|
if(text2) go to 10
|
||||||
|
if(nv2a.eq.2 .or. nv2a.eq.3 .or. nv2b.eq.2 .or. nv2b.eq.3) then
|
||||||
if(k1.lt.0 .or. k2.lt.0 .or. k1*k2.ne.0) go to 10
|
if(k1.lt.0 .or. k2.lt.0 .or. k1*k2.ne.0) go to 10
|
||||||
if(k2.gt.0) k2=k2+450
|
if(k2.gt.0) k2=k2+450
|
||||||
k=max(k1,k2)
|
k=max(k1,k2)
|
||||||
@ -75,29 +77,31 @@ subroutine packmsg(msg,dat,text)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
call packgrid(c3,ng,text3)
|
call packgrid(c3,ng,text3)
|
||||||
if(nv2.eq.0 .and. (.not.text1) .and. (.not.text2) .and. &
|
|
||||||
|
if(nv2a.lt.4 .and. nv2b.lt.4 .and. (.not.text1) .and. (.not.text2) .and. &
|
||||||
(.not.text3)) go to 20
|
(.not.text3)) go to 20
|
||||||
if(nv2.gt.0) then
|
|
||||||
if(nv2.eq.1) then
|
nc1=0
|
||||||
if(c1(1:3).eq.'CQ ') nc1=262178563 + k2
|
if(nv2b.eq.4) then
|
||||||
if(c1(1:4).eq.'QRZ ') nc1=264002072 + k2
|
if(c1(1:3).eq.'CQ ') nc1=262178563 + k2
|
||||||
if(c1(1:3).eq.'DE ') nc1=265825581 + k2
|
if(c1(1:4).eq.'QRZ ') nc1=264002072 + k2
|
||||||
endif
|
if(c1(1:3).eq.'DE ') nc1=265825581 + k2
|
||||||
if(nv2.eq.2) then
|
else if(nv2b.eq.5) then
|
||||||
if(c1(1:3).eq.'CQ ') nc1=267649090 + k2
|
if(c1(1:3).eq.'CQ ') nc1=267649090 + k2
|
||||||
if(c1(1:4).eq.'QRZ ') nc1=267698375 + k2
|
if(c1(1:4).eq.'QRZ ') nc1=267698375 + k2
|
||||||
if(c1(1:3).eq.'DE ') nc1=267747660 + k2
|
if(c1(1:3).eq.'DE ') nc1=267747660 + k2
|
||||||
endif
|
|
||||||
go to 20
|
|
||||||
endif
|
endif
|
||||||
|
if(nc1.ne.0) go to 20
|
||||||
|
|
||||||
! The message will be treated as plain text.
|
! The message will be treated as plain text.
|
||||||
10 text=.true.
|
10 itype=6
|
||||||
call packtext(msg,nc1,nc2,ng)
|
call packtext(msg,nc1,nc2,ng)
|
||||||
ng=ng+32768
|
ng=ng+32768
|
||||||
|
|
||||||
! Encode data into 6-bit words
|
! Encode data into 6-bit words
|
||||||
20 dat(1)=iand(ishft(nc1,-22),63) !6 bits
|
20 continue
|
||||||
|
if(itype.ne.6) itype=max(nv2a,nv2b)
|
||||||
|
dat(1)=iand(ishft(nc1,-22),63) !6 bits
|
||||||
dat(2)=iand(ishft(nc1,-16),63) !6 bits
|
dat(2)=iand(ishft(nc1,-16),63) !6 bits
|
||||||
dat(3)=iand(ishft(nc1,-10),63) !6 bits
|
dat(3)=iand(ishft(nc1,-10),63) !6 bits
|
||||||
dat(4)=iand(ishft(nc1, -4),63) !6 bits
|
dat(4)=iand(ishft(nc1, -4),63) !6 bits
|
||||||
@ -112,3 +116,4 @@ subroutine packmsg(msg,dat,text)
|
|||||||
|
|
||||||
return
|
return
|
||||||
end subroutine packmsg
|
end subroutine packmsg
|
||||||
|
|
||||||
|
@ -2,11 +2,10 @@ logical*1 function stdmsg(msg0)
|
|||||||
|
|
||||||
character*22 msg0,msg
|
character*22 msg0,msg
|
||||||
integer dat(12)
|
integer dat(12)
|
||||||
logical text
|
|
||||||
|
|
||||||
call packmsg(msg0,dat,text)
|
call packmsg(msg0,dat,itype)
|
||||||
call unpackmsg(dat,msg)
|
call unpackmsg(dat,msg)
|
||||||
stdmsg=msg.eq.msg0 .and. (.not.text)
|
stdmsg=(msg.eq.msg0) .and. (itype.ge.0)
|
||||||
|
|
||||||
return
|
return
|
||||||
end function stdmsg
|
end function stdmsg
|
||||||
|
@ -1505,19 +1505,19 @@ void MainWindow::guiUpdate()
|
|||||||
ba2msg(ba,message);
|
ba2msg(ba,message);
|
||||||
// ba2msg(ba,msgsent);
|
// ba2msg(ba,msgsent);
|
||||||
int len1=22;
|
int len1=22;
|
||||||
int ichk=0,itext=0;
|
int ichk=0,itype=0;
|
||||||
if(m_modeTx=="JT9") genjt9_(message
|
if(m_modeTx=="JT9") genjt9_(message
|
||||||
, &ichk
|
, &ichk
|
||||||
, msgsent
|
, msgsent
|
||||||
, const_cast<int *> (itone)
|
, const_cast<int *> (itone)
|
||||||
, &itext
|
, &itype
|
||||||
, len1
|
, len1
|
||||||
, len1);
|
, len1);
|
||||||
if(m_modeTx=="JT65") gen65_(message
|
if(m_modeTx=="JT65") gen65_(message
|
||||||
, &ichk
|
, &ichk
|
||||||
, msgsent
|
, msgsent
|
||||||
, const_cast<int *> (itone)
|
, const_cast<int *> (itone)
|
||||||
, &itext
|
, &itype
|
||||||
, len1
|
, len1
|
||||||
, len1);
|
, len1);
|
||||||
msgsent[22]=0;
|
msgsent[22]=0;
|
||||||
@ -1542,7 +1542,7 @@ void MainWindow::guiUpdate()
|
|||||||
t="";
|
t="";
|
||||||
if(w.length()==3) t=w[2];
|
if(w.length()==3) t=w[2];
|
||||||
icw[0]=0;
|
icw[0]=0;
|
||||||
m_sent73=(t=="73" or itext!=0);
|
m_sent73=(t=="73" or itype==6);
|
||||||
if(m_sent73) {
|
if(m_sent73) {
|
||||||
if(m_config.id_after_73 ()) icw[0]=m_ncw;
|
if(m_config.id_after_73 ()) icw[0]=m_ncw;
|
||||||
if(m_config.prompt_to_log () && !m_tune) logQSOTimer->start(200);
|
if(m_config.prompt_to_log () && !m_tune) logQSOTimer->start(200);
|
||||||
@ -1557,7 +1557,7 @@ void MainWindow::guiUpdate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString t2=QDateTime::currentDateTimeUtc().toString("hhmm");
|
QString t2=QDateTime::currentDateTimeUtc().toString("hhmm");
|
||||||
if(itext==0 and w.length()>=3 and w[1]==m_config.my_callsign ()) {
|
if(itype<6 and w.length()>=3 and w[1]==m_config.my_callsign ()) {
|
||||||
int i1;
|
int i1;
|
||||||
bool ok;
|
bool ok;
|
||||||
i1=t.toInt(&ok);
|
i1=t.toInt(&ok);
|
||||||
@ -1574,7 +1574,7 @@ void MainWindow::guiUpdate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(itext==1 or (w.length()==3 and w[2]=="73")) m_qsoStop=t2;
|
if(itype==6 or (w.length()==3 and w[2]=="73")) m_qsoStop=t2;
|
||||||
m_restart=false;
|
m_restart=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2024,9 +2024,10 @@ void MainWindow::genStdMsgs(QString rpt) //genStdMsgs()
|
|||||||
|
|
||||||
t="CQ " + m_config.my_callsign () + " " + m_config.my_grid ().mid(0,4);
|
t="CQ " + m_config.my_callsign () + " " + m_config.my_grid ().mid(0,4);
|
||||||
msgtype(t, ui->tx6);
|
msgtype(t, ui->tx6);
|
||||||
|
|
||||||
if(m_config.my_callsign ()!=myBase) {
|
if(m_config.my_callsign ()!=myBase) {
|
||||||
if(shortList(m_config.my_callsign ())) {
|
if(shortList(m_config.my_callsign ())) {
|
||||||
|
t=hisCall + " " + m_config.my_callsign ();
|
||||||
|
msgtype(t, ui->tx1);
|
||||||
t="CQ " + m_config.my_callsign ();
|
t="CQ " + m_config.my_callsign ();
|
||||||
msgtype(t, ui->tx6);
|
msgtype(t, ui->tx6);
|
||||||
} else {
|
} else {
|
||||||
@ -2041,7 +2042,10 @@ void MainWindow::genStdMsgs(QString rpt) //genStdMsgs()
|
|||||||
if(hisCall!=hisBase) {
|
if(hisCall!=hisBase) {
|
||||||
if(shortList(hisCall)) {
|
if(shortList(hisCall)) {
|
||||||
t=hisCall + " " + m_config.my_callsign ();
|
t=hisCall + " " + m_config.my_callsign ();
|
||||||
msgtype(t, ui->tx2);
|
msgtype(t, ui->tx1);
|
||||||
|
} else {
|
||||||
|
t=hisCall + " 73";
|
||||||
|
msgtype(t, ui->tx5->lineEdit());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2193,17 +2197,17 @@ void MainWindow::msgtype(QString t, QLineEdit* tx) //msgtype()
|
|||||||
t=t.toUpper();
|
t=t.toUpper();
|
||||||
QByteArray s=t.toUpper().toLocal8Bit();
|
QByteArray s=t.toUpper().toLocal8Bit();
|
||||||
ba2msg(s,message);
|
ba2msg(s,message);
|
||||||
int ichk=1,itext=0;
|
int ichk=1,itype=0;
|
||||||
genjt9_(message
|
genjt9_(message
|
||||||
, &ichk
|
, &ichk
|
||||||
, msgsent
|
, msgsent
|
||||||
, const_cast<int *> (itone)
|
, const_cast<int *> (itone)
|
||||||
, &itext
|
, &itype
|
||||||
, len1
|
, len1
|
||||||
, len1);
|
, len1);
|
||||||
msgsent[22]=0;
|
msgsent[22]=0;
|
||||||
bool text=false;
|
bool text=false;
|
||||||
if(itext!=0) text=true;
|
if(itype==6) text=true;
|
||||||
QString t1;
|
QString t1;
|
||||||
t1.fromLatin1(msgsent);
|
t1.fromLatin1(msgsent);
|
||||||
if(text) t1=t1.mid(0,13);
|
if(text) t1=t1.mid(0,13);
|
||||||
|
18
mainwindow.h
18
mainwindow.h
@ -216,13 +216,19 @@ private:
|
|||||||
|
|
||||||
Frequency m_dialFreq;
|
Frequency m_dialFreq;
|
||||||
|
|
||||||
|
Detector m_detector;
|
||||||
|
SoundInput m_soundInput;
|
||||||
|
Modulator m_modulator;
|
||||||
|
SoundOutput m_soundOutput;
|
||||||
|
QThread * m_audioThread;
|
||||||
|
|
||||||
qint64 m_msErase;
|
qint64 m_msErase;
|
||||||
qint64 m_secBandChanged;
|
qint64 m_secBandChanged;
|
||||||
|
|
||||||
qint32 m_waterfallAvg;
|
qint32 m_waterfallAvg;
|
||||||
qint32 m_ntx;
|
qint32 m_ntx;
|
||||||
qint32 m_timeout;
|
qint32 m_timeout;
|
||||||
int m_XIT;
|
qint32 m_XIT;
|
||||||
qint32 m_setftx;
|
qint32 m_setftx;
|
||||||
qint32 m_ndepth;
|
qint32 m_ndepth;
|
||||||
qint32 m_sec0;
|
qint32 m_sec0;
|
||||||
@ -230,14 +236,6 @@ private:
|
|||||||
qint32 m_nutc0;
|
qint32 m_nutc0;
|
||||||
qint32 m_nrx;
|
qint32 m_nrx;
|
||||||
qint32 m_hsym;
|
qint32 m_hsym;
|
||||||
|
|
||||||
Detector m_detector;
|
|
||||||
SoundInput m_soundInput;
|
|
||||||
|
|
||||||
Modulator m_modulator;
|
|
||||||
SoundOutput m_soundOutput;
|
|
||||||
QThread * m_audioThread;
|
|
||||||
|
|
||||||
qint32 m_TRperiod;
|
qint32 m_TRperiod;
|
||||||
qint32 m_nsps;
|
qint32 m_nsps;
|
||||||
qint32 m_hsymStop;
|
qint32 m_hsymStop;
|
||||||
@ -246,7 +244,6 @@ private:
|
|||||||
qint32 m_nsave;
|
qint32 m_nsave;
|
||||||
qint32 m_ncw;
|
qint32 m_ncw;
|
||||||
qint32 m_secID;
|
qint32 m_secID;
|
||||||
QString m_band;
|
|
||||||
qint32 m_repeatMsg;
|
qint32 m_repeatMsg;
|
||||||
qint32 m_watchdogLimit;
|
qint32 m_watchdogLimit;
|
||||||
qint32 m_astroFont;
|
qint32 m_astroFont;
|
||||||
@ -339,6 +336,7 @@ private:
|
|||||||
QString m_cmnd;
|
QString m_cmnd;
|
||||||
QString m_msgSent0;
|
QString m_msgSent0;
|
||||||
QString m_fileToSave;
|
QString m_fileToSave;
|
||||||
|
QString m_band;
|
||||||
|
|
||||||
QStringList m_prefix;
|
QStringList m_prefix;
|
||||||
QStringList m_suffix;
|
QStringList m_suffix;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user