summaryrefslogtreecommitdiff
path: root/lib/map65_mmdec.f90
blob: 148718573120578b0a184b490748924e1f6c33e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
subroutine map65_mmdec(nutc,id2,nqd,ntrperiod, nsubmode,nfa,nfb,nfqso,   &
     ntol,newdat,nagain,max_drift,ndepth,mycall,hiscall,hisgrid)

  use prog_args
  use timer_module, only: timer
  use q65_decode

  include 'jt9com.f90'
  include 'timer_common.inc'

  type, extends(q65_decoder) :: counting_q65_decoder
     integer :: decoded
  end type counting_q65_decoder

  logical single_decode,bVHF,lnewdat,lagain,lclearave,lapcqonly
  integer*2 id2(300*12000)
  integer nqf(20)
!  type(params_block) :: params
  character(len=12) :: mycall, hiscall
  character(len=6) :: hisgrid
  data ntr0/-1/
  save
  type(counting_q65_decoder) :: my_q65

! Cast C character arrays to Fortran character strings
!  datetime=transfer(params%datetime, datetime)
!  mycall=transfer(params%mycall,mycall)
!  hiscall=transfer(params%hiscall,hiscall)
!  mygrid=transfer(params%mygrid,mygrid)
!  hisgrid=transfer(params%hisgrid,hisgrid)

  my_q65%decoded = 0
  ncontest=0
  nQSOprogress=0
  lclearave=.false.
  single_decode=.false.
  lapcqonly=.false.
  lnewdat=(newdat.ne.0)
  lagain=(nagain.ne.0)
  bVHF=.true.
  emedelay=2.5
!  ntrperiod=60

  call timer('dec_q65 ',0)
  call my_q65%decode(q65_decoded,id2,nqd,nutc,ntrperiod,nsubmode,nfqso,       &
       ntol,ndepth,nfa,nfb,lclearave,single_decode,lagain,max_drift,lnewdat,  &
       emedelay,mycall,hiscall,hisgrid,nQSOProgress,ncontest,lapcqonly,navg0,nqf)
  call timer('dec_q65 ',1)

  return

contains

  subroutine q65_decoded (this,nutc,snr1,nsnr,dt,freq,decoded,idec,   &
       nused,ntrperiod)

    use q65_decode
    implicit none

    class(q65_decoder), intent(inout) :: this
    integer, intent(in) :: nutc
    real, intent(in) :: snr1
    integer, intent(in) :: nsnr
    real, intent(in) :: dt
    real, intent(in) :: freq
    character(len=37), intent(in) :: decoded
    integer, intent(in) :: idec
    integer, intent(in) :: nused
    integer, intent(in) :: ntrperiod

    if(nutc+snr1+nsnr+dt+freq+idec+nused+ntrperiod.eq.-999) stop
    if(decoded.eq.'-999') stop

    cq0='q  '
    write(cq0(2:2),'(i1)') idec
    if(nused.ge.2) write(cq0(3:3),'(i1)') nused
    nsnr0=nsnr
    xdt0=dt
    nfreq0=nint(freq)
    msg0=decoded

    select type(this)
    type is (counting_q65_decoder)
       if(idec.ge.0) this%decoded = this%decoded + 1
    end select

   return
 end subroutine q65_decoded
  
end subroutine map65_mmdec