summaryrefslogtreecommitdiff
path: root/lib/map65_mmdec.f90
blob: 797e6ab56a43f26c05cb17bd523e500ad9b1a93f (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
91
92
93
94
95
96
97
98
99
100
101
102
module map65_mmdec_mod
  use q65_decode
  implicit none

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

contains

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
    use iso_fortran_env, only: int16

  include 'jt9com.f90'

  logical single_decode,bVHF,lnewdat,lagain,lclearave,lapcqonly
    integer(int16) id2(300*12000)
  integer nqf(20)
    integer nutc,nqd,ntrperiod,nsubmode,nfa,nfb,nfqso,ntol
    integer newdat,nagain,max_drift,ndepth,navg0,ncontest
    integer nqsoprogress,ntr0
    real emedelay
!  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,.false.,      &
       lapcqonly,navg0,nqf)
  call timer('dec_q65 ',1)

  return

  
end subroutine map65_mmdec

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

  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
  integer, intent(in) :: iflagdec  !Not used by MAP65's q65b path; see WSJT-X's q65_decoded

  if(nutc+snr1+nsnr+dt+freq+idec+nused+ntrperiod+iflagdec.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 module map65_mmdec_mod