diff options
author | jcorgan | 2006-10-07 01:22:00 +0000 |
---|---|---|
committer | jcorgan | 2006-10-07 01:22:00 +0000 |
commit | 2dbacda7b6ca783cccb687ab98429a539f82900d (patch) | |
tree | 6b36ebb6383c7ca728c6fa079668cc87b13069be | |
parent | baab0003d7c2464b61e29bbce615402bca7682c5 (diff) | |
download | gnuradio-2dbacda7b6ca783cccb687ab98429a539f82900d.tar.gz gnuradio-2dbacda7b6ca783cccb687ab98429a539f82900d.tar.bz2 gnuradio-2dbacda7b6ca783cccb687ab98429a539f82900d.zip |
Merged -r3690:3730 from jcorgan/pager branch into trunk.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@3731 221aa14e-8319-0410-a670-987f0aec2ac5
-rw-r--r-- | gr-pager/README | 14 | ||||
-rw-r--r-- | gr-pager/src/Makefile.am | 14 | ||||
-rwxr-xr-x | gr-pager/src/aypabtu.py | 117 | ||||
-rw-r--r-- | gr-pager/src/flex_demod.py | 36 | ||||
-rw-r--r-- | gr-pager/src/pager.i | 7 | ||||
-rw-r--r-- | gr-pager/src/pager_flex_frame.cc | 38 | ||||
-rw-r--r-- | gr-pager/src/pager_flex_frame.h | 46 | ||||
-rw-r--r-- | gr-pager/src/pager_flex_frame.i | 37 | ||||
-rw-r--r-- | gr-pager/src/pager_flex_parse.cc | 56 | ||||
-rw-r--r-- | gr-pager/src/pager_flex_parse.h | 13 | ||||
-rwxr-xr-x | gr-pager/src/usrp_flex.py | 24 |
11 files changed, 339 insertions, 63 deletions
diff --git a/gr-pager/README b/gr-pager/README index 9c0701d9f..4327f258e 100644 --- a/gr-pager/README +++ b/gr-pager/README @@ -1,13 +1,12 @@ This GNU Radio component implements (will implement) common radiopager signaling protocols such as POCSAG and FLEX. -Current status (9/28/06): +Current status (10/6/06): -FLEX receiving is nearing completion. +FLEX receiving is completed except for addition of BCH error correction. pager.slicer_fb() Accepts a complex baseband downconverted channel and outputs 4-level FSK symbols [0-3] as bytes. - This may migrate into gnuradio-core at some point. pager.flex_sync() Accepts 4FSK symbol stream at channel rate and outputs four phases of FLEX data bits as bytes. @@ -20,10 +19,8 @@ pager.flex_deinterleave() Accepts a single phase of FLEX data bits and performs and converted into FLEX data words for output. pager.flex_parse() Sink block that accepts a single phase of FLEX data - words and unpacks and parses individual pages. - Currently, this block decodes the capcodes of each - receive page and displays the page type, but not yet - the contents. + words and unpacks and parses individual pages. These are + passed outside the data plane via gr_message's. pager.flex_decode() Combines the above blocks correctly to convert from downconverted baseband to pager messages @@ -33,5 +30,8 @@ usrp_flex.py Instantiates USRP receive chain to receive FLEX Right now this installs into $PREFIX/bin but will probably make it into gnuradio-examples. +aypabtu.py Decodes FLEX pages from multiple rx channels in a range. + Incomplete. + Johnathan Corgan jcorgan@aeinet.com diff --git a/gr-pager/src/Makefile.am b/gr-pager/src/Makefile.am index c4a8c938e..e8dce780c 100644 --- a/gr-pager/src/Makefile.am +++ b/gr-pager/src/Makefile.am @@ -28,8 +28,9 @@ TESTS = \ run_tests bin_SCRIPTS = \ - usrp_flex.py - + usrp_flex.py \ + aypabtu.py + noinst_PYTHON = \ qa_pager.py @@ -46,7 +47,8 @@ SWIGPYTHONARGS = $(SWIGPYTHONFLAGS) $(STD_DEFINES_AND_INCLUDES) ALL_IFILES = \ $(LOCAL_IFILES) \ - $(NON_LOCAL_IFILES) + $(NON_LOCAL_IFILES) \ + pager_flex_frame.i NON_LOCAL_IFILES = \ $(GNURADIO_I) @@ -67,13 +69,15 @@ ourpython_PYTHON = \ __init__.py \ pager_swig.py \ flex_demod.py \ - usrp_flex.py - + usrp_flex.py \ + aypabtu.py + ourlib_LTLIBRARIES = _pager_swig.la # These are the source files that go into the shared library _pager_swig_la_SOURCES = \ pager_swig.cc \ + pager_flex_frame.cc \ pager_slicer_fb.cc \ pager_flex_sync.cc \ pager_flex_deinterleave.cc \ diff --git a/gr-pager/src/aypabtu.py b/gr-pager/src/aypabtu.py new file mode 100755 index 000000000..c742744c3 --- /dev/null +++ b/gr-pager/src/aypabtu.py @@ -0,0 +1,117 @@ +#!/usr/bin/env python + +from math import pi +from gnuradio import gr, gru, usrp, optfir, audio, eng_notation, blks, pager +from gnuradio.eng_option import eng_option +from optparse import OptionParser +from string import split, join, printable + +class usrp_source_c(gr.hier_block): + """ + Create a USRP source object supplying complex floats. + + Selects user supplied subdevice or chooses first available one. + + Calibration value is the offset from the tuned frequency to + the actual frequency. + """ + def __init__(self, fg, subdev_spec, decim, gain=None, calibration=0.0): + self._decim = decim + self._src = usrp.source_c() + if subdev_spec is None: + subdev_spec = usrp.pick_rx_subdevice(self._src) + self._subdev = usrp.selected_subdev(self._src, subdev_spec) + self._src.set_mux(usrp.determine_rx_mux_value(self._src, subdev_spec)) + self._src.set_decim_rate(self._decim) + + # If no gain specified, set to midrange + if gain is None: + g = self._subdev.gain_range() + gain = (g[0]+g[1])/2.0 + + self._subdev.set_gain(gain) + self._cal = calibration + + gr.hier_block.__init__(self, fg, self._src, self._src) + + def tune(self, freq): + result = usrp.tune(self._src, 0, self._subdev, freq+self._cal) + # TODO: deal with residual + + def rate(self): + return self._src.adc_rate()/self._decim + +class channelizer(blks.analysis_filterbank): + def __init__(self, + fg, # Flow graph + if_rate, # IF input sample rate (complex) + channel_rate, # Final channel sample rate (complex) + channel_pass, # Occupied spectrum for narrowband channel + channel_stop): # Total channel + guard band + + num_channels = int(if_rate/channel_rate) + taps = optfir.low_pass(1.0, if_rate, channel_pass, channel_stop, 0.1, 60) + blks.analysis_filterbank.__init__(self, fg, num_channels, taps) + +class app_flow_graph(gr.flow_graph): + def __init__(self, options, args, queue): + gr.flow_graph.__init__(self) + self.options = options + self.args = args + + # FIXME: Parameterize + # + # Difference between upper and lower must evenly divide into USRP sample rate + # and also must be divisible by 25000 + options.channel_rate = 25000 + options.channel_pass = 8000 + options.channel_stop = 10000 + + if_rate = options.upper_freq - options.lower_freq + center_freq = options.lower_freq + if_rate/2 + num_channels = int(if_rate/options.channel_rate) + decim = int(64000000/if_rate) + + self.SRC = usrp_source_c(self, options.rx_board, decim, options.gain, options.calibration) + self.CHAN = channelizer(self, if_rate, options.channel_rate, options.channel_pass, options.channel_stop) + + self.connect(self.SRC, self.CHAN) + for i in range(num_channels): + freq = options.lower_freq + i*options.channel_rate + if freq > center_freq: + freq -= if_rate/2 + else: + freq += if_rate/2 + FLEX = pager.flex_demod(self, options.channel_rate, queue) + self.connect((self.CHAN, i), FLEX.INPUT) + + self.SRC.tune(center_freq) + +def make_printable(data): + return "".join(char for char in data if char in printable) + +def main(): + parser = OptionParser(option_class=eng_option) + parser.add_option("", "--upper-freq", type="eng_float", help="lower Rx frequency", metavar="LOWER") + parser.add_option("", "--lower-freq", type="eng_float", help="upper Rx frequency", metavar="UPPER") + parser.add_option("-R", "--rx-board", type="subdev", help="select USRP Rx side A or B (default=first daughterboard found)", metavar="SIDE") + parser.add_option("-c", "--calibration", type="eng_float", default=0.0, help="set frequency offset to Hz", metavar="Hz") + parser.add_option("-g", "--gain", type="int", help="set RF gain", metavar="dB") + (options, args) = parser.parse_args() + + # FIXME: parameter sanity checks + + queue = gr.msg_queue() + fg = app_flow_graph(options, args, queue) + try: + fg.start() + while 1: + msg = queue.delete_head() # Blocking read + fields = split(msg.to_string(), chr(128)) + print join([make_printable(field) for field in fields], '|') + + except KeyboardInterrupt: + fg.stop() + +if __name__ == "__main__": + main() diff --git a/gr-pager/src/flex_demod.py b/gr-pager/src/flex_demod.py index 95a6517a1..a8c6f09b1 100644 --- a/gr-pager/src/flex_demod.py +++ b/gr-pager/src/flex_demod.py @@ -19,10 +19,12 @@ # Boston, MA 02110-1301, USA. # -from gnuradio import gr, optfir +from gnuradio import gr, gru, optfir, blks from math import pi import pager_swig +chan_rate = 16000 + class flex_demod: """ FLEX pager protocol demodulation block. @@ -32,6 +34,7 @@ class flex_demod: Flow graph (so far): + RSAMP - Resample incoming stream to 16000 sps QUAD - Quadrature demodulator converts FSK to baseband amplitudes LPF - Low pass filter to remove noise prior to slicer SLICER - Converts input to one of four symbols (0, 1, 2, 3) @@ -45,28 +48,39 @@ class flex_demod: @type sample_rate: integer """ - def __init__(self, fg, channel_rate): - k = channel_rate/(2*pi*4800) # 4800 Hz max deviation + + def __init__(self, fg, channel_rate, queue): + k = chan_rate/(2*pi*4800) # 4800 Hz max deviation QUAD = gr.quadrature_demod_cf(k) self.INPUT = QUAD - - taps = optfir.low_pass(1.0, channel_rate, 3200, 6400, 0.1, 60) + + if channel_rate != chan_rate: + interp = gru.lcm(channel_rate, chan_rate)/channel_rate + decim = gru.lcm(channel_rate, chan_rate)/chan_rate + RESAMP = blks.rational_resampler_ccf(fg, interp, decim) + self.INPUT = RESAMP + + taps = optfir.low_pass(1.0, chan_rate, 3200, 6400, 0.1, 60) LPF = gr.fir_filter_fff(1, taps) SLICER = pager_swig.slicer_fb(.001, .00001) # Attack, decay - SYNC = pager_swig.flex_sync(channel_rate) - fg.connect(QUAD, LPF, SLICER, SYNC) + SYNC = pager_swig.flex_sync(chan_rate) + + if channel_rate != chan_rate: + fg.connect(RESAMP, QUAD, LPF, SLICER, SYNC) + else: + fg.connect(QUAD, LPF, SLICER, SYNC) DEINTA = pager_swig.flex_deinterleave() - PARSEA = pager_swig.flex_parse() + PARSEA = pager_swig.flex_parse(queue) DEINTB = pager_swig.flex_deinterleave() - PARSEB = pager_swig.flex_parse() + PARSEB = pager_swig.flex_parse(queue) DEINTC = pager_swig.flex_deinterleave() - PARSEC = pager_swig.flex_parse() + PARSEC = pager_swig.flex_parse(queue) DEINTD = pager_swig.flex_deinterleave() - PARSED = pager_swig.flex_parse() + PARSED = pager_swig.flex_parse(queue) fg.connect((SYNC, 0), DEINTA, PARSEA) fg.connect((SYNC, 1), DEINTB, PARSEB) diff --git a/gr-pager/src/pager.i b/gr-pager/src/pager.i index aaa02feea..cc73a5473 100644 --- a/gr-pager/src/pager.i +++ b/gr-pager/src/pager.i @@ -25,6 +25,7 @@ %{ #include "gnuradio_swig_bug_workaround.h" // mandatory bug fix +#include "pager_flex_frame.h" #include "pager_slicer_fb.h" #include "pager_flex_sync.h" #include "pager_flex_deinterleave.h" @@ -32,6 +33,8 @@ #include <stdexcept> %} +%include "pager_flex_frame.i" + // ---------------------------------------------------------------- GR_SWIG_BLOCK_MAGIC(pager,slicer_fb); @@ -78,12 +81,12 @@ public: GR_SWIG_BLOCK_MAGIC(pager,flex_parse); -pager_flex_parse_sptr pager_make_flex_parse(); +pager_flex_parse_sptr pager_make_flex_parse(gr_msg_queue_sptr queue); class pager_flex_parse : public gr_block { private: - pager_flex_parse(); + pager_flex_parse(gr_msg_queue_sptr queue); public: }; diff --git a/gr-pager/src/pager_flex_frame.cc b/gr-pager/src/pager_flex_frame.cc new file mode 100644 index 000000000..3934c7692 --- /dev/null +++ b/gr-pager/src/pager_flex_frame.cc @@ -0,0 +1,38 @@ +/* + * Copyright 2006 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <pager_flex_frame.h> + +pager_flex_frame_sptr pager_make_flex_frame() +{ + return pager_flex_frame_sptr(new pager_flex_frame()); +} + +pager_flex_frame::pager_flex_frame() +{ +} + +pager_flex_frame::~pager_flex_frame() +{ +} diff --git a/gr-pager/src/pager_flex_frame.h b/gr-pager/src/pager_flex_frame.h new file mode 100644 index 000000000..300de9096 --- /dev/null +++ b/gr-pager/src/pager_flex_frame.h @@ -0,0 +1,46 @@ +/* + * Copyright 2006 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ +#ifndef INCLUDED_PAGER_FLEX_FRAME_H +#define INCLUDED_PAGER_FLEX_FRAME_H + +#include <boost/shared_ptr.hpp> + +class pager_flex_frame; +typedef boost::shared_ptr<pager_flex_frame> pager_flex_frame_sptr; + +/*! + * \brief public constructor for pager_flex_frame + */ +pager_flex_frame_sptr pager_make_flex_frame(); + +/*! + * \brief flex_frame. + */ +class pager_flex_frame { + // Constructor is private to force use of shared_ptr + pager_flex_frame(); + friend pager_flex_frame_sptr pager_make_flex_frame(); + +public: + ~pager_flex_frame(); +}; + +#endif /* INCLUDED_PAGER_FLEX_FRAME_H */ diff --git a/gr-pager/src/pager_flex_frame.i b/gr-pager/src/pager_flex_frame.i new file mode 100644 index 000000000..d3fa1b6b7 --- /dev/null +++ b/gr-pager/src/pager_flex_frame.i @@ -0,0 +1,37 @@ +/* + * Copyright 2006 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +class pager_flex_frame; +typedef boost::shared_ptr<pager_flex_frame> pager_flex_frame_sptr; +%template(pager_flex_frame_sptr) boost::shared_ptr<pager_flex_frame>; + +%rename(flex_frame) pager_make_flex_frame; +pager_flex_frame_sptr pager_make_flex_frame(); + +/*! + * \brief flex_frame. + */ +class pager_flex_frame { + pager_flex_frame(); + +public: +}; + diff --git a/gr-pager/src/pager_flex_parse.cc b/gr-pager/src/pager_flex_parse.cc index 22ee9eeca..7178ba516 100644 --- a/gr-pager/src/pager_flex_parse.cc +++ b/gr-pager/src/pager_flex_parse.cc @@ -27,16 +27,18 @@ #include <pageri_bch3221.h> #include <gr_io_signature.h> #include <ctype.h> +#include <iostream> -pager_flex_parse_sptr pager_make_flex_parse() +pager_flex_parse_sptr pager_make_flex_parse(gr_msg_queue_sptr queue) { - return pager_flex_parse_sptr(new pager_flex_parse()); + return pager_flex_parse_sptr(new pager_flex_parse(queue)); } -pager_flex_parse::pager_flex_parse() : +pager_flex_parse::pager_flex_parse(gr_msg_queue_sptr queue) : gr_sync_block("flex_parse", - gr_make_io_signature(1, 1, sizeof(gr_int32)), - gr_make_io_signature(0, 0, 0)) + gr_make_io_signature(1, 1, sizeof(gr_int32)), + gr_make_io_signature(0, 0, 0)), + d_queue(queue) { d_count = 0; } @@ -128,7 +130,8 @@ void pager_flex_parse::parse_data() if (mw1 > 87 || mw2 > 87) continue; // Invalid offsets - printf("%010i: ", d_capcode); + d_payload.str(""); + d_payload << d_capcode << FIELD_DELIM << d_type << FIELD_DELIM; if (is_alphanumeric_page(d_type)) parse_alphanumeric(mw1, mw2-1, j); @@ -139,17 +142,19 @@ void pager_flex_parse::parse_data() else parse_unknown(mw1, mw2); - printf("\n"); - fflush(stdout); + //std::cout << d_payload.str() << std::endl; + //fflush(stdout); + + gr_message_sptr msg = gr_make_message_from_string(std::string(d_payload.str())); + d_queue->handle(msg); } } void pager_flex_parse::parse_alphanumeric(int mw1, int mw2, int j) { - int frag; bool cont; - + if (!d_laddr) { frag = (d_datawords[mw1] >> 11) & 0x03; cont = (d_datawords[mw1] >> 10) & 0x01; @@ -161,32 +166,31 @@ void pager_flex_parse::parse_alphanumeric(int mw1, int mw2, int j) mw2--; } - printf("%c F:%i C:%i|", d_type == FLEX_SECURE ? 'S' : 'A', - frag, cont); + d_payload << frag << FIELD_DELIM; + d_payload << cont << FIELD_DELIM; for (int i = mw1; i <= mw2; i++) { gr_int32 dw = d_datawords[i]; + unsigned char ch; if (i > mw1 || frag != 0x03) { - unsigned char ch0 = dw & 0x7F; - if (ch0 != 0x03) // Fill - putchar(isprint(ch0) ? ch0 : '.'); + ch = dw & 0x7F; + if (ch != 0x03) + d_payload << ch; } - unsigned char ch1 = (dw >> 7) & 0x7F; - if (ch1 != 0x03) // Fill - putchar(isprint(ch1) ? ch1 : '.'); - - unsigned char ch2 = (dw >> 14) & 0x7F; - if (ch2 != 0x03) // Fill - putchar(isprint(ch2) ? ch2: '.'); + ch = (dw >> 7) & 0x7F; + if (ch != 0x03) // Fill + d_payload << ch; + + ch = (dw >> 14) & 0x7F; + if (ch != 0x03) // Fill + d_payload << ch; } } void pager_flex_parse::parse_numeric(int mw1, int mw2, int j) { - printf("N |"); - // Get first dataword from message field or from second // vector word if long address gr_int32 dw; @@ -215,7 +219,7 @@ void pager_flex_parse::parse_numeric(int mw1, int mw2, int j) dw >>= 1; if (--count == 0) { if (digit != 0x0C) // Fill - putchar(flex_bcd[digit]); + d_payload << flex_bcd[digit]; count = 4; } } @@ -226,10 +230,8 @@ void pager_flex_parse::parse_numeric(int mw1, int mw2, int j) void pager_flex_parse::parse_tone_only() { - printf("T |"); } void pager_flex_parse::parse_unknown(int mw1, int mw2) { - printf("U |(unparsed)"); } diff --git a/gr-pager/src/pager_flex_parse.h b/gr-pager/src/pager_flex_parse.h index 696eedc92..e5a225b28 100644 --- a/gr-pager/src/pager_flex_parse.h +++ b/gr-pager/src/pager_flex_parse.h @@ -23,24 +23,31 @@ #define INCLUDED_PAGER_FLEX_PARSE_H #include <gr_sync_block.h> +#include <gr_msg_queue.h> #include <pageri_flex_modes.h> +#include <sstream> class pager_flex_parse; typedef boost::shared_ptr<pager_flex_parse> pager_flex_parse_sptr; -pager_flex_parse_sptr pager_make_flex_parse(); +pager_flex_parse_sptr pager_make_flex_parse(gr_msg_queue_sptr queue); /*! * \brief flex parse description * \ingroup block */ +#define FIELD_DELIM ((unsigned char)128) + class pager_flex_parse : public gr_sync_block { private: // Constructors - friend pager_flex_parse_sptr pager_make_flex_parse(); - pager_flex_parse(); + friend pager_flex_parse_sptr pager_make_flex_parse(gr_msg_queue_sptr queue); + pager_flex_parse(gr_msg_queue_sptr queue); + + std::ostringstream d_payload; + gr_msg_queue_sptr d_queue; // Destination for decoded pages int d_count; // Count of received codewords gr_int32 d_datawords[88]; // 11 blocks of 8 32-bit words diff --git a/gr-pager/src/usrp_flex.py b/gr-pager/src/usrp_flex.py index 636efc7e3..055583c99 100755 --- a/gr-pager/src/usrp_flex.py +++ b/gr-pager/src/usrp_flex.py @@ -4,6 +4,7 @@ from gnuradio import gr, gru, usrp, optfir, eng_notation, blks, pager from gnuradio.eng_option import eng_option from optparse import OptionParser import time, os, sys +from string import split, join """ This example application demonstrates receiving and demodulating the @@ -68,21 +69,21 @@ class usrp_source_c(gr.hier_block): return self._src.adc_rate()/self._decim class app_flow_graph(gr.flow_graph): - def __init__(self, options, args): + def __init__(self, options, args, queue): gr.flow_graph.__init__(self) self.options = options self.args = args USRP = usrp_source_c(self, # Flow graph options.rx_subdev_spec, # Daugherboard spec - 250, # IF decimation ratio gets 256K if_rate + 256, # IF decimation ratio gets 250K if_rate options.gain, # Receiver gain options.calibration) # Frequency offset USRP.tune(options.frequency) if_rate = USRP.rate() - channel_rate = 32000 # Oversampled by 10 or 20 - channel_decim = if_rate // channel_rate + channel_rate = 25000 + channel_decim = int(if_rate / channel_rate) CHAN_taps = optfir.low_pass(1.0, # Filter gain if_rate, # Sample rate @@ -101,7 +102,7 @@ class app_flow_graph(gr.flow_graph): 1.0, # Initial gain 1.0) # Maximum gain - FLEX = pager.flex_demod(self, 32000) + FLEX = pager.flex_demod(self, 25000, queue) self.connect(USRP, CHAN, AGC, FLEX.INPUT) @@ -120,11 +121,18 @@ def main(): if options.frequency < 1e6: options.frequency *= 1e6 - fg = app_flow_graph(options, args) + queue = gr.msg_queue() + + fg = app_flow_graph(options, args, queue) try: - fg.run() + fg.start() + while 1: + msg = queue.delete_head() # Blocking read + fields = split(msg.to_string(), chr(128)) + print join(fields, '|') + except KeyboardInterrupt: - pass + fg.stop() if __name__ == "__main__": main() |