[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r3731 - in gnuradio/trunk/gr-pager: . src
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r3731 - in gnuradio/trunk/gr-pager: . src |
Date: |
Fri, 6 Oct 2006 19:22:00 -0600 (MDT) |
Author: jcorgan
Date: 2006-10-06 19:22:00 -0600 (Fri, 06 Oct 2006)
New Revision: 3731
Added:
gnuradio/trunk/gr-pager/src/aypabtu.py
gnuradio/trunk/gr-pager/src/pager_flex_frame.cc
gnuradio/trunk/gr-pager/src/pager_flex_frame.h
gnuradio/trunk/gr-pager/src/pager_flex_frame.i
Modified:
gnuradio/trunk/gr-pager/README
gnuradio/trunk/gr-pager/src/Makefile.am
gnuradio/trunk/gr-pager/src/flex_demod.py
gnuradio/trunk/gr-pager/src/pager.i
gnuradio/trunk/gr-pager/src/pager_flex_parse.cc
gnuradio/trunk/gr-pager/src/pager_flex_parse.h
gnuradio/trunk/gr-pager/src/usrp_flex.py
Log:
Merged -r3690:3730 from jcorgan/pager branch into trunk.
Modified: gnuradio/trunk/gr-pager/README
===================================================================
--- gnuradio/trunk/gr-pager/README 2006-10-07 01:15:13 UTC (rev 3730)
+++ gnuradio/trunk/gr-pager/README 2006-10-07 01:22:00 UTC (rev 3731)
@@ -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 @@
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 @@
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
address@hidden
Modified: gnuradio/trunk/gr-pager/src/Makefile.am
===================================================================
--- gnuradio/trunk/gr-pager/src/Makefile.am 2006-10-07 01:15:13 UTC (rev
3730)
+++ gnuradio/trunk/gr-pager/src/Makefile.am 2006-10-07 01:22:00 UTC (rev
3731)
@@ -28,8 +28,9 @@
run_tests
bin_SCRIPTS = \
- usrp_flex.py
-
+ usrp_flex.py \
+ aypabtu.py
+
noinst_PYTHON = \
qa_pager.py
@@ -46,7 +47,8 @@
ALL_IFILES = \
$(LOCAL_IFILES) \
- $(NON_LOCAL_IFILES)
+ $(NON_LOCAL_IFILES) \
+ pager_flex_frame.i
NON_LOCAL_IFILES = \
$(GNURADIO_I)
@@ -67,13 +69,15 @@
__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 \
Copied: gnuradio/trunk/gr-pager/src/aypabtu.py (from rev 3730,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/aypabtu.py)
===================================================================
--- gnuradio/trunk/gr-pager/src/aypabtu.py (rev 0)
+++ gnuradio/trunk/gr-pager/src/aypabtu.py 2006-10-07 01:22:00 UTC (rev
3731)
@@ -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()
Modified: gnuradio/trunk/gr-pager/src/flex_demod.py
===================================================================
--- gnuradio/trunk/gr-pager/src/flex_demod.py 2006-10-07 01:15:13 UTC (rev
3730)
+++ gnuradio/trunk/gr-pager/src/flex_demod.py 2006-10-07 01:22:00 UTC (rev
3731)
@@ -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 @@
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 @@
@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)
Modified: gnuradio/trunk/gr-pager/src/pager.i
===================================================================
--- gnuradio/trunk/gr-pager/src/pager.i 2006-10-07 01:15:13 UTC (rev 3730)
+++ gnuradio/trunk/gr-pager/src/pager.i 2006-10-07 01:22:00 UTC (rev 3731)
@@ -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 @@
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:
};
Copied: gnuradio/trunk/gr-pager/src/pager_flex_frame.cc (from rev 3730,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_frame.cc)
===================================================================
--- gnuradio/trunk/gr-pager/src/pager_flex_frame.cc
(rev 0)
+++ gnuradio/trunk/gr-pager/src/pager_flex_frame.cc 2006-10-07 01:22:00 UTC
(rev 3731)
@@ -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()
+{
+}
Copied: gnuradio/trunk/gr-pager/src/pager_flex_frame.h (from rev 3730,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_frame.h)
===================================================================
--- gnuradio/trunk/gr-pager/src/pager_flex_frame.h
(rev 0)
+++ gnuradio/trunk/gr-pager/src/pager_flex_frame.h 2006-10-07 01:22:00 UTC
(rev 3731)
@@ -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 */
Copied: gnuradio/trunk/gr-pager/src/pager_flex_frame.i (from rev 3730,
gnuradio/branches/developers/jcorgan/pager/gr-pager/src/pager_flex_frame.i)
===================================================================
--- gnuradio/trunk/gr-pager/src/pager_flex_frame.i
(rev 0)
+++ gnuradio/trunk/gr-pager/src/pager_flex_frame.i 2006-10-07 01:22:00 UTC
(rev 3731)
@@ -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:
+};
+
Modified: gnuradio/trunk/gr-pager/src/pager_flex_parse.cc
===================================================================
--- gnuradio/trunk/gr-pager/src/pager_flex_parse.cc 2006-10-07 01:15:13 UTC
(rev 3730)
+++ gnuradio/trunk/gr-pager/src/pager_flex_parse.cc 2006-10-07 01:22:00 UTC
(rev 3731)
@@ -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 @@
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 @@
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 @@
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 @@
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_tone_only()
{
- printf("T |");
}
void pager_flex_parse::parse_unknown(int mw1, int mw2)
{
- printf("U |(unparsed)");
}
Modified: gnuradio/trunk/gr-pager/src/pager_flex_parse.h
===================================================================
--- gnuradio/trunk/gr-pager/src/pager_flex_parse.h 2006-10-07 01:15:13 UTC
(rev 3730)
+++ gnuradio/trunk/gr-pager/src/pager_flex_parse.h 2006-10-07 01:22:00 UTC
(rev 3731)
@@ -23,25 +23,32 @@
#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
Modified: gnuradio/trunk/gr-pager/src/usrp_flex.py
===================================================================
--- gnuradio/trunk/gr-pager/src/usrp_flex.py 2006-10-07 01:15:13 UTC (rev
3730)
+++ gnuradio/trunk/gr-pager/src/usrp_flex.py 2006-10-07 01:22:00 UTC (rev
3731)
@@ -4,6 +4,7 @@
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 @@
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 @@
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 @@
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()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r3731 - in gnuradio/trunk/gr-pager: . src,
jcorgan <=