diff options
| author | Christoph Berg <myon@debian.org> | 2026-10-09 14:12:35 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-10-09 14:12:35 +0200 |
| commit | ffc62c792c9a5196cb4ce7a353287dfe20db6524 (patch) | |
| tree | 1269efa852935b183daae4bb33a58d1b4d2ffb53 /lib/superfox | |
| parent | 059831534c7e884f0a607ed86b582fd00d821731 (diff) | |
New upstream version 3.3.0~beta1+dfsgupstream/3.3.0_beta1+dfsg
Diffstat (limited to 'lib/superfox')
| -rw-r--r-- | lib/superfox/qpc_sync.f90 | 6 | ||||
| -rw-r--r-- | lib/superfox/sfox_gen_gfsk.f90 | 4 | ||||
| -rw-r--r-- | lib/superfox/sfox_pack.f90 | 38 | ||||
| -rw-r--r-- | lib/superfox/sfox_remove_ft8.f90 | 26 | ||||
| -rw-r--r-- | lib/superfox/sfox_unpack.f90 | 96 | ||||
| -rw-r--r-- | lib/superfox/sfrx_sub.f90 | 34 |
6 files changed, 177 insertions, 27 deletions
diff --git a/lib/superfox/qpc_sync.f90 b/lib/superfox/qpc_sync.f90 index 9c80b390..d24b7be1 100644 --- a/lib/superfox/qpc_sync.f90 +++ b/lib/superfox/qpc_sync.f90 @@ -2,15 +2,17 @@ subroutine qpc_sync(crcvd0,fsample,isync,fsync,ftol,f2,t2,snrsync) parameter(N9SEC=9*12000,NMAX=15*12000,NDOWN=16,NZ=N9SEC/NDOWN) complex crcvd0(NMAX) !Signal as received - complex c0(0:N9SEC-1) !For long FFT + complex, allocatable :: c0(:) !For long FFT complex c1(0:NZ-1) complex c1sum(0:NZ-1) complex z - real s(N9SEC/4) + real, allocatable :: s(:) real p(-1125:1125) integer ipk(1) integer isync(24) + allocate(c0(0:N9SEC-1),s(N9SEC/4)) + baud=12000.0/1024.0 df2=fsample/N9SEC fac=1.0/N9SEC diff --git a/lib/superfox/sfox_gen_gfsk.f90 b/lib/superfox/sfox_gen_gfsk.f90 index 3f682b9a..bd3d8c4c 100644 --- a/lib/superfox/sfox_gen_gfsk.f90 +++ b/lib/superfox/sfox_gen_gfsk.f90 @@ -13,12 +13,14 @@ subroutine sfox_gen_gfsk(idat,f0,isync,itone,cdat) integer isync(NS) integer itone(NDS) real*8 dt,twopi,phi,dphi_peak - real*8 dphi(0:NPTS-1) + real*8, allocatable :: dphi(:) real pulse(3*NSPS) logical first/.true./ save first,twopi,dt,hmod,dphi_peak,pulse + allocate(dphi(0:NPTS-1)) + if(first) then twopi=8.d0*atan(1.0) fsample=12000.0 diff --git a/lib/superfox/sfox_pack.f90 b/lib/superfox/sfox_pack.f90 index 1a482422..0b9a6457 100644 --- a/lib/superfox/sfox_pack.f90 +++ b/lib/superfox/sfox_pack.f90 @@ -1,8 +1,16 @@ -subroutine sfox_pack(line,ckey,bMoreCQs,bSendMsg,freeTextMsg,xin,pack_error) +module sfox_pack_module + implicit none + private + public :: sfox_pack_for_state +contains +subroutine sfox_pack_for_state(knowledge,line,ckey,bMoreCQs,bSendMsg,freeTextMsg,xin,pack_error) use qpc_mod use packjt use packjt77 + implicit real(a-h,o-z) + implicit integer(i-n) + type(pack77_state), intent(inout) :: knowledge parameter (NQU1RKS=203514677) integer*8 n47,n58 integer*1 xin(0:49) !Packed message as 7-bit symbols @@ -86,7 +94,7 @@ subroutine sfox_pack(line,ckey,bMoreCQs,bSendMsg,freeTextMsg,xin,pack_error) pack_error=SFOX_PACK_BAD_CALL return endif - call pack28(w1,n28) !Fox call + call pack28_for_state(knowledge,w1,n28) !Fox call write(msgbits(1:28),'(b28.28)') n28 nrr73_total=0 @@ -141,7 +149,7 @@ subroutine sfox_pack(line,ckey,bMoreCQs,bSendMsg,freeTextMsg,xin,pack_error) pack_error=SFOX_PACK_BAD_CALL return endif - call pack28(w(i),n28) + call pack28_for_state(knowledge,w(i),n28) write(msgbits(j:j+27),1002) n28 !Insert this call for RR73 message 1002 format(b28.28) j=j+28 @@ -165,7 +173,7 @@ subroutine sfox_pack(line,ckey,bMoreCQs,bSendMsg,freeTextMsg,xin,pack_error) pack_error=SFOX_PACK_BAD_CALL return endif - call pack28(w(i),n28) + call pack28_for_state(knowledge,w(i),n28) write(msgbits(j:j+27),1002) n28 !Insert this call if(.not.valid_sfox_report(w(i1),n)) then pack_error=SFOX_PACK_BAD_REPORT @@ -292,8 +300,8 @@ contains integer n28 valid_sfox_call=.false. - call pack28(call,n28) - call unpack28(n28,decoded,success) + call pack28_for_state(knowledge,call,n28) + call unpack28_for_state(knowledge,n28,decoded,success) if(.not.success) return valid_sfox_call=trim(decoded).eq.trim(call) return @@ -352,4 +360,22 @@ contains enddo return end function valid_sfox_free_text +end subroutine sfox_pack_for_state +end module sfox_pack_module + +subroutine sfox_pack(line,ckey,bMoreCQs,bSendMsg,freeTextMsg,xin,pack_error) + use sfox_pack_module, only: sfox_pack_for_state + use ft8_codec_context, only: get_ft8_codec_state + use packjt77, only: pack77_state + implicit none + character*120 line + character*10 ckey + character*26 freeTextMsg + logical*1 bMoreCQs,bSendMsg + integer*1 xin(0:49) + integer pack_error + type(pack77_state), pointer :: knowledge + + knowledge => get_ft8_codec_state() + call sfox_pack_for_state(knowledge,line,ckey,bMoreCQs,bSendMsg,freeTextMsg,xin,pack_error) end subroutine sfox_pack diff --git a/lib/superfox/sfox_remove_ft8.f90 b/lib/superfox/sfox_remove_ft8.f90 index 75687659..ef3c9fe1 100644 --- a/lib/superfox/sfox_remove_ft8.f90 +++ b/lib/superfox/sfox_remove_ft8.f90 @@ -1,5 +1,13 @@ -subroutine sfox_remove_ft8(dd,npts) +module sfox_remove_ft8_module + implicit none + private + public :: sfox_remove_ft8_for_state +contains +subroutine sfox_remove_ft8_for_state(knowledge,dd,npts) use packjt77 + implicit real(a-h,o-z) + implicit integer(i-n) + type(pack77_state), optional, intent(inout) :: knowledge include 'ft8_params.f90' parameter (MAXCAND=100) parameter (NP2=2812) @@ -194,7 +202,11 @@ subroutine sfox_remove_ft8(dd,npts) if(i3.gt.5 .or. (i3.eq.0.and.n3.gt.6)) cycle if(i3.eq.0 .and. n3.eq.2) cycle - call unpack77(c77,1,msg37,unpk77_success) + if(present(knowledge)) then + call unpack77_for_state(knowledge,c77,1,msg37,unpk77_success) + else + call unpack77(c77,1,msg37,unpk77_success) + endif ! write(77,*) 'FT8 interference: ',msg37 if(.not.unpk77_success) cycle ! Message structure: S7 D29 S7 D29 S7 @@ -213,4 +225,14 @@ subroutine sfox_remove_ft8(dd,npts) ! return enddo return +end subroutine sfox_remove_ft8_for_state +end module sfox_remove_ft8_module + +subroutine sfox_remove_ft8(dd,npts) + use sfox_remove_ft8_module, only: sfox_remove_ft8_for_state + implicit none + integer npts + real dd(npts) + + call sfox_remove_ft8_for_state(dd=dd,npts=npts) end subroutine sfox_remove_ft8 diff --git a/lib/superfox/sfox_unpack.f90 b/lib/superfox/sfox_unpack.f90 index fd940347..b86f6bb2 100644 --- a/lib/superfox/sfox_unpack.f90 +++ b/lib/superfox/sfox_unpack.f90 @@ -1,12 +1,34 @@ -subroutine sfox_unpack(nutc,x,nsnr,f0,dt0,foxcall,notp) +module sfox_unpack_module + use iso_c_binding, only: c_ptr, c_null_ptr + use decoder_engine_types, only: superfox_observation, sf_kind_cq, sf_kind_exchange, & + sf_kind_free_text, sf_kind_verification + use packjt77, only: pack77_state + implicit none + private + public :: sfox_unpack_for_state, superfox_callback, sfox_render_legacy + abstract interface + subroutine superfox_callback(user_context,record) + import superfox_observation, c_ptr + type(c_ptr), intent(in) :: user_context + type(superfox_observation), intent(in) :: record + end subroutine superfox_callback + end interface +contains +subroutine sfox_unpack_for_state(knowledge,callback,user_context,nutc,x,nsnr,f0,dt0,foxcall,notp) use packjt77 + implicit real(a-h,o-z) + implicit integer(i-n) + type(pack77_state), optional, intent(inout) :: knowledge + procedure(superfox_callback) :: callback + type(c_ptr), intent(in) :: user_context + integer child_index parameter (NQU1RKS=203514677) integer*1 x(0:49) integer*8 n58 logical success character*336 msgbits - character*22 msg(10) !### only msg(1) is used ??? ### + character*22 msg(10) character*13 foxcall,c13 character*10 ssignature character*4 crpt(5),grid4 @@ -15,6 +37,7 @@ subroutine sfox_unpack(nutc,x,nsnr,f0,dt0,foxcall,notp) logical use_otp data c/' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ/'/ + child_index=0 ncq=0 if (notp.eq.0) then use_otp = .FALSE. @@ -25,7 +48,11 @@ subroutine sfox_unpack(nutc,x,nsnr,f0,dt0,foxcall,notp) 1000 format(47b7.7) read(msgbits(327:329),'(b3)') i3 !Message type read(msgbits(1:28),'(b28)') n28 !Standard Fox call - call unpack28(n28,foxcall,success) + if(present(knowledge)) then + call unpack28_for_state(knowledge,n28,foxcall,success) + else + call unpack28(n28,foxcall,success) + endif if(i3.eq.1) then ! Type i3=1 is documented for a compound-Fox c58 layout, but the @@ -40,8 +67,7 @@ subroutine sfox_unpack(nutc,x,nsnr,f0,dt0,foxcall,notp) if(freeTextMsg(i:i).ne.'.') exit freeTextMsg(i:i)=' ' enddo - write(*,1100) nutc,nsnr,dt0,nint(f0),freeTextMsg -1100 format(i6.6,i4,f5.1,i5,1x,"~",2x,a) + call emit(sf_kind_free_text,freeTextMsg) else if(i3.eq.3) then !CQ FoxCall Grid read(msgbits(1:58),'(b58)') n58 !FoxCall do i=11,1,-1 @@ -53,7 +79,7 @@ subroutine sfox_unpack(nutc,x,nsnr,f0,dt0,foxcall,notp) read(msgbits(59:73),'(b15)') n15 call unpackgrid(n15,grid4) msg(1)='CQ '//trim(foxcall)//' '//grid4 - write(*,1100) nutc,nsnr,dt0,nint(f0),trim(msg(1)) + call emit(sf_kind_cq,trim(msg(1))) allz=1 do i=0,6 read(msgbits(74+32*i:105+32*i),'(b32)') n32 @@ -66,8 +92,7 @@ subroutine sfox_unpack(nutc,x,nsnr,f0,dt0,foxcall,notp) if(freeTextMsg(i:i).ne.'.') exit freeTextMsg(i:i)=' ' enddo - if(len(trim(freeTextMsg)).gt.0) write(*,1100) nutc,nsnr,dt0,& - nint(f0),freeTextMsg + if(len(trim(freeTextMsg)).gt.0) call emit(sf_kind_free_text,freeTextMsg) go to 100 endif @@ -92,7 +117,11 @@ subroutine sfox_unpack(nutc,x,nsnr,f0,dt0,foxcall,notp) do i=1,iz j=28*i + 1 read(msgbits(j:j+27),'(b28)') n28 - call unpack28(n28,c13,success) + if(present(knowledge)) then + call unpack28_for_state(knowledge,n28,c13,success) + else + call unpack28(n28,c13,success) + endif if(n28.eq.0 .or. n28.eq.NQU1RKS) cycle msg(i)=trim(c13)//' '//trim(foxcall) if(msg(i)(1:3).eq.'CQ ') then @@ -106,19 +135,60 @@ subroutine sfox_unpack(nutc,x,nsnr,f0,dt0,foxcall,notp) endif endif if(ncq.le.1 .or. msg(i)(1:3).ne.'CQ ') then - write(*,1100) nutc,nsnr,dt0,nint(f0),trim(msg(i)) + if(msg(i)(1:3).eq.'CQ ') then + call emit(sf_kind_cq,trim(msg(i))) + else + call emit(sf_kind_exchange,trim(msg(i))) + endif endif enddo if(msgbits(306:306).eq.'1' .and. ncq.lt.1) then - write(*,1100) nutc,nsnr,dt0,nint(f0),'CQ '//foxcall + call emit(sf_kind_cq,'CQ '//foxcall) endif 100 read(msgbits(307:326),'(b20)') notp if (use_otp) then write(ssignature,'(I6.6)') notp - write(*,1100) nutc,nsnr,dt0,nint(f0),'$VERIFY$ '//trim(foxcall)// & - ' '//trim(ssignature) + call emit(sf_kind_verification,'$VERIFY$ '//trim(foxcall)//' '//trim(ssignature)) endif 900 return +contains + subroutine emit(kind,text) + integer, intent(in) :: kind + character(len=*), intent(in) :: text + type(superfox_observation) :: record + + child_index=child_index+1 + record%symbols=x + record%kind=kind + record%child_index=child_index + record%frequency_hz=f0 + record%dt_seconds=dt0 + record%snr_db=nsnr + record%message=text + write(record%legacy_line,'(i6.6,i4,f5.1,i5,1x,"~",2x,a)') nutc,nsnr,dt0,nint(f0),text + record%legacy_line_length=24+len(text) + call callback(user_context,record) + end subroutine emit +end subroutine sfox_unpack_for_state + +subroutine sfox_render_legacy(user_context,record) + type(c_ptr), intent(in) :: user_context + type(superfox_observation), intent(in) :: record + write(*,'(a)') record%legacy_line(:record%legacy_line_length) +end subroutine sfox_render_legacy +end module sfox_unpack_module + +subroutine sfox_unpack(nutc,x,nsnr,f0,dt0,foxcall,notp) + use iso_c_binding, only: c_null_ptr + use sfox_unpack_module, only: sfox_unpack_for_state, sfox_render_legacy + implicit none + integer nutc,nsnr,notp + integer*1 x(0:49) + real f0,dt0 + character*13 foxcall + + call sfox_unpack_for_state(callback=sfox_render_legacy,user_context=c_null_ptr,nutc=nutc,x=x,nsnr=nsnr, & + f0=f0,dt0=dt0,foxcall=foxcall,notp=notp) end subroutine sfox_unpack diff --git a/lib/superfox/sfrx_sub.f90 b/lib/superfox/sfrx_sub.f90 index fed03461..3031ce56 100644 --- a/lib/superfox/sfrx_sub.f90 +++ b/lib/superfox/sfrx_sub.f90 @@ -1,7 +1,21 @@ -subroutine sfrx_sub(nyymmdd,nutc,nfqso,ntol,iwave) +module sfrx_engine + use iso_c_binding, only: c_ptr + use packjt77, only: pack77_state + use sfox_unpack_module, only: superfox_callback, sfox_unpack_for_state, sfox_render_legacy + use sfox_remove_ft8_module, only: sfox_remove_ft8_for_state + implicit none + private + public :: sfrx_decode, superfox_callback +contains +subroutine sfrx_decode(knowledge,callback,user_context,nyymmdd,nutc,nfqso,ntol,iwave) use sfox_mod use julian + implicit real(a-h,o-z) + implicit integer(i-n) + type(pack77_state), optional, intent(inout) :: knowledge + procedure(superfox_callback) :: callback + type(c_ptr), intent(in) :: user_context integer*2 iwave(NMAX) integer*8 secday,ntime8 @@ -33,7 +47,7 @@ subroutine sfrx_sub(nyymmdd,nutc,nfqso,ntol,iwave) allocate(c0(NMAX),dd(NMAX)) dd=iwave - call sfox_remove_ft8(dd,npts) + call sfox_remove_ft8_for_state(knowledge,dd,npts) call sfox_ana(dd,npts,c0,npts) @@ -48,8 +62,22 @@ subroutine sfrx_sub(nyymmdd,nutc,nfqso,ntol,iwave) if(crc_ok) then nsnr=nint(snr) nsignature = 1 - call sfox_unpack(nutc,xdec,nsnr,fbest-750.0,tbest,foxcall,nsignature) + call sfox_unpack_for_state(knowledge,callback,user_context,nutc,xdec,nsnr,fbest-750.0,tbest,foxcall,nsignature) endif return +end subroutine sfrx_decode +end module sfrx_engine + +subroutine sfrx_sub(nyymmdd,nutc,nfqso,ntol,iwave) + use iso_c_binding, only: c_null_ptr + use sfrx_engine, only: sfrx_decode + use sfox_unpack_module, only: sfox_render_legacy + use sfox_mod, only: NMAX + implicit none + integer nyymmdd,nutc,nfqso,ntol + integer*2 iwave(NMAX) + + call sfrx_decode(callback=sfox_render_legacy,user_context=c_null_ptr,nyymmdd=nyymmdd,nutc=nutc, & + nfqso=nfqso,ntol=ntol,iwave=iwave) end subroutine sfrx_sub |
