2 # Copyright 2006 Free Software Foundation, Inc.
4 # This file is part of GNU Radio
6 # GNU Radio is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
11 # GNU Radio is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with GNU Radio; see the file COPYING. If not, write to
18 # the Free Software Foundation, Inc., 51 Franklin Street,
19 # Boston, MA 02110-1301, USA.
22 from gnuradio import gr, optfir
26 class flex_demod(gr.hier_block):
28 FLEX protocol demodulation block.
30 This block demodulates a band-limited, complex down-converted baseband
31 channel into FLEX protocol frames.
35 QUAD - Quadrature demodulator converts FSK to baseband amplitudes
36 LPF - Low pass filter to remove noise prior to slicer
37 SLICER - Converts input to one of four symbols (0, 1, 2, 3)
38 DEFRAMER - Syncronizes symbol stream and outputs FLEX codewords
42 @param channel_rate: incoming sample rate of the baseband channel
43 @type sample_rate: integer
46 def __init__(self, fg, channel_rate):
47 k = channel_rate/(2*pi*4800) # 4800 Hz max deviation
48 QUAD = gr.quadrature_demod_cf(k)
50 taps = optfir.low_pass(1.0, channel_rate, 3200, 6400, 0.1, 60)
51 LPF = gr.fir_filter_fff(1, taps)
52 SLICER = pager_swig.slicer_fb(.001, .00001) # Attack, decay
53 DEFRAMER = pager_swig.flex_deframer(channel_rate)
55 fg.connect(QUAD, LPF, SLICER, DEFRAMER)
57 gr.hier_block.__init__(self, fg, QUAD, DEFRAMER)