Hello,

Recently I had to use the Wifi implementation of the BBN 80211b.
The project is based on Gnuradio-3.1.1, and does not compile with 3.7.1.

I made some changes to compile with the new version, and now the
bn_80211b_test.py program works at least. I did not tested the other
modules which requires an usrp, so this port is far from complete, but
perhaps can be used as a starting point if someone is interested.

Tomi
diff --git a/configure.ac b/configure.ac
index 18195b2..e105e8f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,7 +78,7 @@ AC_CHECK_FUNCS([])
 dnl Check for Mingw support
 GR_PWIN32
 
-PKG_CHECK_MODULES(GNURADIO_CORE, gnuradio-core >= 2)
+PKG_CHECK_MODULES(GNURADIO_CORE, gnuradio-blocks >= 2)
 LIBS="$LIBS $GNURADIO_CORE_LIBS"
 
 dnl Define where to find boost includes
diff --git a/src/bbn/Makefile.am b/src/bbn/Makefile.am
index 1f34241..5511c63 100644
--- a/src/bbn/Makefile.am
+++ b/src/bbn/Makefile.am
@@ -32,14 +32,14 @@ ourlibdir    = $(grpyexecdir)
 INCLUDES = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS)
 
 SWIGCPPPYTHONARGS = -fvirtual -python -modern $(PYTHON_CPPFLAGS) \
-       -I$(swigincludedir) -I$(grincludedir)
+       -I$(swigincludedir) -I$(includedir)
 
 ALL_IFILES =                           \
        $(LOCAL_IFILES)                 \
        $(NON_LOCAL_IFILES)             
 
 NON_LOCAL_IFILES =                     \
-       $(GNURADIO_CORE_INCLUDEDIR)/swig/gnuradio.i
+       $(GNURADIO_CORE_INCLUDEDIR)/gnuradio/swig/gnuradio.i
 
 
 LOCAL_IFILES =                                 \
diff --git a/src/bbn/bbn.i b/src/bbn/bbn.i
index ed3f6bf..88121d7 100644
--- a/src/bbn/bbn.i
+++ b/src/bbn/bbn.i
@@ -1,12 +1,26 @@
 /* -*- c++ -*- */
 
 %feature("autodoc", "1");              // generate python docstrings
+%{
+#include <cstddef>
+using namespace std;
+#include <boost/shared_ptr.hpp>
+#include <gnuradio/block.h>
+#include <gnuradio/sync_block.h>
+#include <gnuradio/sync_decimator.h>
+#include <gnuradio/sync_interpolator.h>
+#include <gnuradio/tagged_stream_block.h>
+#include <gnuradio/block_gateway.h>
+#include <gnuradio/feval.h>
+#include <gnuradio/py_feval.h>
+#include <gnuradio/high_res_timer.h>
+%}
 
 %include "exception.i"
 %import "gnuradio.i"                   // the common stuff
 
 %{
-#include "gnuradio_swig_bug_workaround.h"      // mandatory bug fix
+//#include "gnuradio_swig_bug_workaround.h"    // mandatory bug fix
 #include "bbn_tap.h"
 #include "bbn_dpsk_demod_cb.h"
 #include "bbn_crc16.h"
diff --git a/src/bbn/bbn_crc16.h b/src/bbn/bbn_crc16.h
index 318ef2c..6ed159e 100644
--- a/src/bbn/bbn_crc16.h
+++ b/src/bbn/bbn_crc16.h
@@ -29,7 +29,7 @@
 #define INCLUDED_BBN_CRC16_H
 
 #include <string>
-#include <gr_types.h>
+//#include <gr_types.h>
 
 /*!
  * \brief update running CRC-32
diff --git a/src/bbn/bbn_dpsk_demod_cb.cc b/src/bbn/bbn_dpsk_demod_cb.cc
index d877651..9e3428d 100644
--- a/src/bbn/bbn_dpsk_demod_cb.cc
+++ b/src/bbn/bbn_dpsk_demod_cb.cc
@@ -30,9 +30,9 @@
 #endif
 
 #include <bbn_dpsk_demod_cb.h>
-#include <gr_io_signature.h>
-#include <gr_expj.h>
-#include <gr_sincos.h>
+#include <gnuradio/io_signature.h>
+#include <gnuradio/expj.h>
+#include <gnuradio/sincos.h>
 #include <math.h>
 
 #define BBN_SLICER_DEBUG 1
@@ -45,9 +45,9 @@ bbn_dpsk_demod_cb::~bbn_dpsk_demod_cb () {
 }
 
 bbn_dpsk_demod_cb::bbn_dpsk_demod_cb ()
-  : gr_block ("bbn_dpsk_demod_cb",
-              gr_make_io_signature (1, 1, sizeof (gr_complex)),
-              gr_make_io_signature (1, 2, sizeof (unsigned short))),
+  : gr::block ("bbn_dpsk_demod_cb",
+               gr::io_signature::make (1, 1, sizeof (gr_complex)),
+               gr::io_signature::make (1, 2, sizeof (unsigned short))),
     d_e_squared(0),
     d_sample_count(0),
     d_rssi(0) {
diff --git a/src/bbn/bbn_dpsk_demod_cb.h b/src/bbn/bbn_dpsk_demod_cb.h
index cab078f..1c2ed73 100644
--- a/src/bbn/bbn_dpsk_demod_cb.h
+++ b/src/bbn/bbn_dpsk_demod_cb.h
@@ -29,7 +29,7 @@
 #ifndef INCLUDED_BBN_DPSK_DMOD_DB_H
 #define INCLUDED_BBN_DPSK_DMOD_DB_H
 
-#include <gr_block.h>
+#include <gnuradio/block.h>
 
 #define RSSI_AVE_COUNT 128
 #define RSSI_MAX 0
@@ -39,7 +39,7 @@ typedef boost::shared_ptr<bbn_dpsk_demod_cb> 
bbn_dpsk_demod_cb_sptr;
 bbn_dpsk_demod_cb_sptr bbn_make_dpsk_demod_cb();
 
 
-class bbn_dpsk_demod_cb : public gr_block {
+class bbn_dpsk_demod_cb : public gr::block {
   friend bbn_dpsk_demod_cb_sptr bbn_make_dpsk_demod_cb ();
 
   bbn_dpsk_demod_cb ();
diff --git a/src/bbn/bbn_dpsk_demod_cb.i b/src/bbn/bbn_dpsk_demod_cb.i
index e107388..ed693ea 100644
--- a/src/bbn/bbn_dpsk_demod_cb.i
+++ b/src/bbn/bbn_dpsk_demod_cb.i
@@ -30,7 +30,7 @@ GR_SWIG_BLOCK_MAGIC(bbn, dpsk_demod_cb)
   bbn_dpsk_demod_cb_sptr bbn_make_dpsk_demod_cb ();
                                               
 
-class bbn_dpsk_demod_cb : public gr_block
+class bbn_dpsk_demod_cb : public gr::block
 {
  private:
   bbn_dpsk_demod_cb ();
diff --git a/src/bbn/bbn_firdes_barker.cc b/src/bbn/bbn_firdes_barker.cc
index 8892538..ddfbaa9 100644
--- a/src/bbn/bbn_firdes_barker.cc
+++ b/src/bbn/bbn_firdes_barker.cc
@@ -34,7 +34,7 @@
 #include <config.h>
 #endif
 #include <bbn_firdes_barker.h>
-#include <gr_firdes.h>
+#include <gnuradio/filter/firdes.h>
 
 static int sinc(int numSamples, float period, float *result);
 
diff --git a/src/bbn/bbn_firdes_barker.h b/src/bbn/bbn_firdes_barker.h
index b496efe..20a833a 100644
--- a/src/bbn/bbn_firdes_barker.h
+++ b/src/bbn/bbn_firdes_barker.h
@@ -29,7 +29,7 @@
 #define INCLUDED_BBN_FIRDES_BARKER_H
 
 #include <string>
-#include <gr_types.h>
+#include <gnuradio/types.h>
 
 /*!
  * \brief Creates a barker correlator filter
diff --git a/src/bbn/bbn_plcp80211_bb.cc b/src/bbn/bbn_plcp80211_bb.cc
index 29a3157..9993f78 100644
--- a/src/bbn/bbn_plcp80211_bb.cc
+++ b/src/bbn/bbn_plcp80211_bb.cc
@@ -29,7 +29,7 @@
 #include "config.h"
 #endif
 
-#include <gr_io_signature.h>
+#include <gnuradio/io_signature.h>
 #include <bbn_plcp80211_bb.h>
 #include <bbn_crc16.h>
 #include <bbn_tap.h>
@@ -41,7 +41,7 @@ static inline unsigned char reverse_bits(unsigned char c);
 
 #define REVERSE_BITS(c) ( bit_reverse_table[(c) & 0xff])
 
-bbn_plcp80211_bb_sptr bbn_make_plcp80211_bb (gr_msg_queue_sptr target_queue,
+bbn_plcp80211_bb_sptr bbn_make_plcp80211_bb (gr::msg_queue::sptr target_queue,
                                              bool check_crc) {
   return bbn_plcp80211_bb_sptr (new bbn_plcp80211_bb (target_queue, check_crc)
                                 );
@@ -50,11 +50,11 @@ bbn_plcp80211_bb_sptr bbn_make_plcp80211_bb 
(gr_msg_queue_sptr target_queue,
 bbn_plcp80211_bb::~bbn_plcp80211_bb () {
 }
 
-bbn_plcp80211_bb::bbn_plcp80211_bb (gr_msg_queue_sptr target_queue,
+bbn_plcp80211_bb::bbn_plcp80211_bb (gr::msg_queue::sptr target_queue,
                                     bool check_crc)
-  : gr_block ("plcp80211_bb",
-              gr_make_io_signature (1, 2, sizeof (unsigned short)),
-              gr_make_io_signature (0,0,0)),
+  : gr::block ("plcp80211_bb",
+               gr::io_signature::make (1, 2, sizeof (unsigned short)),
+               gr::io_signature::make (0,0,0)),
     d_symbol_count(0),
     d_packet_rx_time(0),
     d_packet_rate(0),
@@ -411,7 +411,7 @@ bbn_plcp80211_bb::general_work (int noutput_items,
           }
           d_pdu_len -= 4; /* Strip the crc from the payload */
         }
-        gr_message_sptr msg = gr_make_message(0, 0, 0, 
+        gr::message::sptr msg = gr::message::make(0, 0, 0, 
                                               d_pdu_len + sizeof(*oob));
 
         memcpy(msg->msg() + sizeof(*oob), d_pkt_data, d_pdu_len);
diff --git a/src/bbn/bbn_plcp80211_bb.h b/src/bbn/bbn_plcp80211_bb.h
index 63ba4ab..37ecbc1 100644
--- a/src/bbn/bbn_plcp80211_bb.h
+++ b/src/bbn/bbn_plcp80211_bb.h
@@ -29,14 +29,14 @@
 #ifndef INCLUDED_BBN_PLCP80211_BB_H
 #define INCLUDED_BBN_PLCP80211_BB_H
 
-#include <gr_block.h>
-#include <gr_msg_queue.h>
+#include <gnuradio/block.h>
+#include <gnuradio/msg_queue.h>
 #include <bbn_scrambler_bb.h>
 
 class bbn_plcp80211_bb;
 typedef boost::shared_ptr<bbn_plcp80211_bb> bbn_plcp80211_bb_sptr;
 
-bbn_plcp80211_bb_sptr bbn_make_plcp80211_bb(gr_msg_queue_sptr target_queue,
+bbn_plcp80211_bb_sptr bbn_make_plcp80211_bb(gr::msg_queue::sptr target_queue,
                                             bool check_crc = 0);
 
 #define SFD (0x05cf)
@@ -65,12 +65,12 @@ typedef enum plcp_current_rate_enum {
  * \brief Carrier tracking PLL for QPSK
  * input: complex; output: complex
  */
-class bbn_plcp80211_bb : public gr_block {
-  friend bbn_plcp80211_bb_sptr bbn_make_plcp80211_bb(gr_msg_queue_sptr 
+class bbn_plcp80211_bb : public gr::block {
+  friend bbn_plcp80211_bb_sptr bbn_make_plcp80211_bb(gr::msg_queue::sptr 
                                                      target_queue,
                                                      bool check_crc);
 
-  bbn_plcp80211_bb (gr_msg_queue_sptr target_queue, bool check_crc);
+  bbn_plcp80211_bb (gr::msg_queue::sptr target_queue, bool check_crc);
 
 public:
   ~bbn_plcp80211_bb ();
@@ -85,7 +85,7 @@ private:
   long long d_symbol_count;
   long long d_packet_rx_time;
   long long d_packet_rate;
-  gr_msg_queue_sptr d_target_queue;
+  gr::msg_queue::sptr d_target_queue;
   bbn_scrambler_bb_sptr d_descrambler;
   plcp_state_t d_state;
   unsigned int d_data;
diff --git a/src/bbn/bbn_plcp80211_bb.i b/src/bbn/bbn_plcp80211_bb.i
index 0a16362..dd1fa6b 100644
--- a/src/bbn/bbn_plcp80211_bb.i
+++ b/src/bbn/bbn_plcp80211_bb.i
@@ -27,10 +27,10 @@
 
 GR_SWIG_BLOCK_MAGIC(bbn,plcp80211_bb)
 
-  bbn_plcp80211_bb_sptr bbn_make_plcp80211_bb (gr_msg_queue_sptr target_queue,
+bbn_plcp80211_bb_sptr bbn_make_plcp80211_bb (gr::msg_queue::sptr target_queue,
                                               bool check_crc = 0);
 
-class bbn_plcp80211_bb : public gr_block {
+class bbn_plcp80211_bb : public gr::block {
  private:
-  bbn_plcp80211_bb(gr_msg_queue_sptr target_queue, bool check_crc);
+  bbn_plcp80211_bb(gr::msg_queue::sptr target_queue, bool check_crc);
 };
diff --git a/src/bbn/bbn_scrambler_bb.cc b/src/bbn/bbn_scrambler_bb.cc
index 018722e..8372b38 100644
--- a/src/bbn/bbn_scrambler_bb.cc
+++ b/src/bbn/bbn_scrambler_bb.cc
@@ -30,7 +30,7 @@
 #endif
 
 #include <bbn_scrambler_bb.h>
-#include <gr_io_signature.h>
+#include <gnuradio/io_signature.h>
 
 #define SCRAMBLER_DEBUG 0
 #define DESCRAMBLER_DEBUG 0
@@ -45,9 +45,9 @@ bbn_make_scrambler_bb (bool transmit) {
 }
 
 bbn_scrambler_bb::bbn_scrambler_bb (const std::string &name, bool transmit)
-  : gr_sync_block (name,
-                   gr_make_io_signature (1, 1, sizeof (unsigned char)),
-                   gr_make_io_signature (1, 1, sizeof (unsigned char))) {
+  : gr::sync_block (name,
+                    gr::io_signature::make (1, 1, sizeof (unsigned char)),
+                    gr::io_signature::make (1, 1, sizeof (unsigned char))) {
   int i;
 
   d_table = new scramble_data_t[256 * 128];
diff --git a/src/bbn/bbn_scrambler_bb.h b/src/bbn/bbn_scrambler_bb.h
index 5fe9db1..e7b7743 100644
--- a/src/bbn/bbn_scrambler_bb.h
+++ b/src/bbn/bbn_scrambler_bb.h
@@ -29,7 +29,7 @@
 #ifndef INCLUDED_BBN_SCRAMBLER_BB_H
 #define INCLUDED_BBN_SCRAMBLER_BB_H
 
-#include <gr_sync_block.h>
+#include <gnuradio/sync_block.h>
 
 class bbn_scrambler_bb;
 typedef boost::shared_ptr<bbn_scrambler_bb> bbn_scrambler_bb_sptr;
@@ -45,7 +45,7 @@ typedef struct scramble_data_struct {
  * \brief 802.11 Scrambler
  * input: byte; output: byte
  */
-class bbn_scrambler_bb : public gr_sync_block {
+class bbn_scrambler_bb : public gr::sync_block {
   friend bbn_scrambler_bb_sptr bbn_make_scrambler_bb(bool transmit);
 
 protected:
diff --git a/src/bbn/bbn_scrambler_bb.i b/src/bbn/bbn_scrambler_bb.i
index 36deb95..ff8751b 100644
--- a/src/bbn/bbn_scrambler_bb.i
+++ b/src/bbn/bbn_scrambler_bb.i
@@ -29,7 +29,7 @@ GR_SWIG_BLOCK_MAGIC(bbn, scrambler_bb)
 
   bbn_scrambler_bb_sptr bbn_make_scrambler_bb (bool transmit);
 
-class bbn_scrambler_bb : public gr_sync_block {
+class bbn_scrambler_bb : public gr::sync_block {
  private:
   bbn_scrambler_bb (const std::string &name, bool transmit);
 };
diff --git a/src/bbn/bbn_slicer_cc.cc b/src/bbn/bbn_slicer_cc.cc
index 085014f..4f5bcc4 100644
--- a/src/bbn/bbn_slicer_cc.cc
+++ b/src/bbn/bbn_slicer_cc.cc
@@ -30,9 +30,9 @@
 #endif
 
 #include <bbn_slicer_cc.h>
-#include <gr_io_signature.h>
-#include <gr_expj.h>
-#include <gr_sincos.h>
+#include <gnuradio/io_signature.h>
+#include <gnuradio/expj.h>
+#include <gnuradio/sincos.h>
 #include <math.h>
 
 #define BBN_SLICER_DEBUG 0
@@ -52,9 +52,9 @@ bbn_slicer_cc::~bbn_slicer_cc () {
 }
 
 bbn_slicer_cc::bbn_slicer_cc (int samples_per_symbol, int num_symbols)
-  : gr_block ("bbn_slicer_cc",
-              gr_make_io_signature (1, 1, sizeof (gr_complex)),
-              gr_make_io_signature (1, 1, sizeof (gr_complex))),
+  : gr::block ("bbn_slicer_cc",
+               gr::io_signature::make (1, 1, sizeof (gr_complex)),
+               gr::io_signature::make (1, 1, sizeof (gr_complex))),
     d_samples_per_symbol(samples_per_symbol) {
   int i;
 
diff --git a/src/bbn/bbn_slicer_cc.h b/src/bbn/bbn_slicer_cc.h
index f39c05c..b89bba6 100644
--- a/src/bbn/bbn_slicer_cc.h
+++ b/src/bbn/bbn_slicer_cc.h
@@ -29,7 +29,7 @@
 #ifndef INCLUDED_BBN_SLICER_CC_H
 #define INCLUDED_BBN_SLICER_CC_H
 
-#include <gr_block.h>
+#include <gnuradio/block.h>
 
 class bbn_slicer_cc;
 typedef boost::shared_ptr<bbn_slicer_cc> bbn_slicer_cc_sptr;
@@ -42,7 +42,7 @@ bbn_slicer_cc_sptr bbn_make_slicer_cc (int samples_per_symbol,
  * \brief Carrier tracking PLL for QPSK
  * input: complex; output: complex
  */
-class bbn_slicer_cc : public gr_block {
+class bbn_slicer_cc : public gr::block {
   friend bbn_slicer_cc_sptr bbn_make_slicer_cc (int samples_per_symbol,
                                                int num_symbols);
 
diff --git a/src/bbn/bbn_slicer_cc.i b/src/bbn/bbn_slicer_cc.i
index aa9bf8e..cc1038f 100644
--- a/src/bbn/bbn_slicer_cc.i
+++ b/src/bbn/bbn_slicer_cc.i
@@ -31,7 +31,7 @@ GR_SWIG_BLOCK_MAGIC(bbn, slicer_cc)
                                         int num_symbols);
                                               
 
-class bbn_slicer_cc : public gr_block {
+class bbn_slicer_cc : public gr::block {
 private:
   bbn_slicer_cc (int samples_per_symbol, int num_symbols);
 };
diff --git a/src/bbn/bbn_tap.cc b/src/bbn/bbn_tap.cc
index e98d294..e085e4a 100644
--- a/src/bbn/bbn_tap.cc
+++ b/src/bbn/bbn_tap.cc
@@ -24,6 +24,8 @@
 #include "config.h"
 #endif
 #include <stdexcept>
+#include <cstdio>
+#include <cstring>
 
 extern "C" {
 #ifdef __linux__
diff --git a/src/bbn/bbn_tap.h b/src/bbn/bbn_tap.h
index a57f89e..5c0de5a 100644
--- a/src/bbn/bbn_tap.h
+++ b/src/bbn/bbn_tap.h
@@ -34,8 +34,9 @@ extern "C" {
 #endif
 }
 
-#include <gr_msg_handler.h>
-#include <omnithread.h>
+#include <boost/shared_ptr.hpp>
+#include <gnuradio/msg_handler.h>
+//#include <omnithread.h>
 
 typedef struct oob_hdr_struct {
   long long timestamp; /* Relative time in microseconds */
diff --git a/src/examples/bbn_80211b.py b/src/examples/bbn_80211b.py
index ad99625..5f094ea 100644
--- a/src/examples/bbn_80211b.py
+++ b/src/examples/bbn_80211b.py
@@ -31,17 +31,20 @@
 # See gnuradio-examples/python/xpsk for examples
 
 from gnuradio import gr
+from gnuradio import blocks
+from gnuradio import digital
+from gnuradio import filter
 from gnuradio import bbn
 from math import pi
-import Numeric
+import numpy
 
 # /////////////////////////////////////////////////////////////////////////////
 #            mPSK mod/demod with steams of bytes as data i/o
 # /////////////////////////////////////////////////////////////////////////////
 
-class bbn_80211b_mod(gr.hier_block):
+class bbn_80211b_mod(gr.hier_block2):
 
-    def __init__(self, fg, spb, alpha, gain, use_barker=0):
+    def __init__(self, spb, alpha, gain, use_barker=0):
         """
        Hierarchical block for RRC-filtered PSK modulation
        modulation.
@@ -49,13 +52,14 @@ class bbn_80211b_mod(gr.hier_block):
        The input is a byte stream (unsigned char) and the
        output is the complex modulated signal at baseband.
 
-       @param fg: flow graph
-       @type fg: flow graph
        @param spb: samples per baud >= 2
        @type spb: integer
        @param alpha: Root-raised cosine filter excess bandwidth
        @type alpha: float
        """
+        gr.hier_block2.__init__(self, "bbn_80211b_mod",
+                                gr.io_signature(1,1,gr.sizeof_char),
+                                gr.io_signature(1,1,gr.sizeof_gr_complex))
         if not isinstance(spb, int) or spb < 2:
             raise TypeError, "sbp must be an integer >= 2"
         self.spb = spb
@@ -65,7 +69,7 @@ class bbn_80211b_mod(gr.hier_block):
         alpha = 0.5
 
         # turn bytes into symbols
-        self.bytes2chunks = gr.packed_to_unpacked_bb(self.bits_per_chunk,
+        self.bytes2chunks = blocks.packed_to_unpacked_bb(self.bits_per_chunk,
                                                      gr.GR_MSB_FIRST)
 
         constellation = ( (),
@@ -77,14 +81,14 @@ class bbn_80211b_mod(gr.hier_block):
                           ( 0+0j,1+0j ),
                           )
 
-        self.chunks2symbols = gr.chunks_to_symbols_bc(constellation[2])
+        self.chunks2symbols = digital.chunks_to_symbols_bc(constellation[2])
         self.scrambler = bbn.scrambler_bb(True)
-        self.diff_encode = gr.diff_encoder_bb(2);
+        self.diff_encode = digital.diff_encoder_bb(2);
 
         self.barker_taps = bbn.firdes_barker(spb)
 
        # Form Raised Cosine filter
-       self.rrc_taps = gr.firdes.root_raised_cosine(
+       self.rrc_taps = filter.firdes.root_raised_cosine(
                4 * gain,       # gain  FIXME may need to be spb
                spb,            # sampling freq
                1.0,            # symbol_rate
@@ -92,28 +96,32 @@ class bbn_80211b_mod(gr.hier_block):
                 ntaps)
 
         if use_barker:
-            self.tx_filter = gr.interp_fir_filter_ccf(spb, self.barker_taps)
+            self.tx_filter = filter.interp_fir_filter_ccf(spb, 
self.barker_taps)
         else:
-            self.tx_filter = gr.interp_fir_filter_ccf(spb, self.rrc_taps)
+            self.tx_filter = filter.interp_fir_filter_ccf(spb, self.rrc_taps)
 
        # Connect
-        fg.connect(self.scrambler, self.bytes2chunks)
-        fg.connect(self.bytes2chunks, self.diff_encode)
-        fg.connect(self.diff_encode, self.chunks2symbols)
-       fg.connect(self.chunks2symbols,self.tx_filter)
+        self.connect(self, self.scrambler)
+        self.connect(self.scrambler, self.bytes2chunks)
+        self.connect(self.bytes2chunks, self.diff_encode)
+        self.connect(self.diff_encode, self.chunks2symbols)
+       self.connect(self.chunks2symbols,self.tx_filter)
+        self.connect(self.tx_filter, self)
 
        # Initialize base class
-        gr.hier_block.__init__(self, fg, self.scrambler, self.tx_filter)
         bbn.crc16_init()
 
 
-class bbn_80211b_demod(gr.hier_block):
-    def __init__(self, fg, pkt_queue, spb, alpha,  use_barker=0,
+class bbn_80211b_demod(gr.hier_block2):
+    def __init__(self, pkt_queue, spb, alpha,  use_barker=0,
                  check_crc=True):
+        gr.hier_block2.__init__(self, "bbn_80211b_demod",
+                                gr.io_signature(1,1,gr.sizeof_gr_complex),
+                                gr.io_signature(0,0,0))
         # RRC data filter
        ntaps = 2 * spb - 1
 
-       self.rrc_taps = gr.firdes.root_raised_cosine(
+       self.rrc_taps = filter.firdes.root_raised_cosine(
                1,              # gain  FIXME may need to be spb
                spb,             # sampling freq
                1.0,            # symbol_rate
@@ -123,19 +131,19 @@ class bbn_80211b_demod(gr.hier_block):
         self.barker_taps = bbn.firdes_barker(spb)
 
         if use_barker == 1:
-            self.rx_filter = gr.fir_filter_ccf(1, self.barker_taps)
+            self.rx_filter = filter.fir_filter_ccf(1, self.barker_taps)
         else:
-            self.rx_filter = gr.fir_filter_ccf(1, self.rrc_taps)
+            self.rx_filter = filter.fir_filter_ccf(1, self.rrc_taps)
 
         self.slicer = bbn.slicer_cc(spb, 16);
         self.demod = bbn.dpsk_demod_cb();
         self.descramble = bbn.scrambler_bb(False);
         self.plcp = bbn.plcp80211_bb(pkt_queue, check_crc);
 
-        fg.connect(self.rx_filter, self.slicer);
-        fg.connect(self.slicer, self.demod);
-        fg.connect((self.demod, 0), (self.plcp, 0));
-        fg.connect((self.demod, 1), (self.plcp, 1));
+        self.connect(self, self.rx_filter)
+        self.connect(self.rx_filter, self.slicer);
+        self.connect(self.slicer, self.demod);
+        self.connect((self.demod, 0), (self.plcp, 0));
+        self.connect((self.demod, 1), (self.plcp, 1));
 
-        gr.hier_block.__init__(self, fg, self.rx_filter, self.plcp)
         bbn.crc16_init()
diff --git a/src/examples/bbn_80211b_pkt.py b/src/examples/bbn_80211b_pkt.py
index 7b2bd4b..197088c 100644
--- a/src/examples/bbn_80211b_pkt.py
+++ b/src/examples/bbn_80211b_pkt.py
@@ -25,9 +25,11 @@
 # 
 
 from math import pi
-import Numeric
+import numpy
 
-from gnuradio import gr, packet_utils
+from gnuradio import gr
+from gnuradio import blocks
+from gnuradio.digital import packet_utils
 from gnuradio import bbn
 from bbn_80211b import *
 
@@ -39,13 +41,13 @@ import bbn_80211b
 #                   xPSK mod/demod with packets as i/o
 # /////////////////////////////////////////////////////////////////////////////
 
-class bbn_80211b_mod_pkts(gr.hier_block):
+class bbn_80211b_mod_pkts(gr.hier_block2):
     """
     PSK modulator that is a GNU Radio source.
 
     Send packets by calling send_pkt
     """
-    def __init__(self, fg, msgq_limit=2, pad_for_usrp=True, *args, **kwargs):
+    def __init__(self, msgq_limit=2, pad_for_usrp=True, *args, **kwargs):
         
         """
        Hierarchical block for PSK modulation.
@@ -53,22 +55,23 @@ class bbn_80211b_mod_pkts(gr.hier_block):
         Packets to be sent are enqueued by calling send_pkt.
         The output is the complex modulated signal at baseband.
 
-       @param fg: flow graph
-       @type fg: flow graph
         @param msgq_limit: maximum number of messages in message queue
         @type msgq_limit: int
         @param pad_for_usrp: If true, packets are padded such that they end up 
a multiple of 128 samples
 
         See xpsk_mod for remaining parameters
         """
+        gr.hier_block2.__init__(self, "bbn_80211b_mod_pkts",
+                                gr.io_signature(0,0,0),
+                                gr.io_signature(1,1,gr.sizeof_gr_complex))
+
         #self.pad_for_usrp = pad_for_usrp
 
         # accepts messages from the outside world
-        self.pkt_input = gr.message_source(gr.sizeof_char, msgq_limit)
+        self.pkt_input = blocks.message_source(gr.sizeof_char, msgq_limit)
 
-        self.xpsk_mod = bbn_80211b.bbn_80211b_mod(fg, *args, **kwargs)
-        fg.connect(self.pkt_input, self.xpsk_mod)
-        gr.hier_block.__init__(self, fg, None, self.xpsk_mod)
+        self.xpsk_mod = bbn_80211b.bbn_80211b_mod(*args, **kwargs)
+        self.connect(self.pkt_input, self.xpsk_mod, self)
 
     def send_pkt(self, payload='', eof=False):
         """
@@ -105,34 +108,37 @@ class bbn_80211b_mod_pkts(gr.hier_block):
 
         self.pkt_input.msgq().insert_tail(msg)
 
-class bbn_80211b_demod_pkts(gr.hier_block):
+class bbn_80211b_demod_pkts(gr.hier_block2):
     """
     PSK demodulator that is a GNU Radio sink.
 
     The input is complex baseband.  When packets are demodulated, they
     are passed to the app via the callback.  """
 
-    def __init__(self, fg, callback=None, spb=8, alpha=0.5, *args, **kwargs):
+    def __init__(self, callback=None, spb=8, alpha=0.5, *args, **kwargs):
         """
        Hierarchical block for PSK demodulation.
 
        The input is the complex modulated signal at baseband.
         Demodulated packets are sent to the handler.
 
-       @param fg: flow graph
-       @type fg: flow graph
         @param callback:  function of two args: ok, payload
         @type callback: ok: bool; payload: string
 
         See bbn_80211b_demod for remaining parameters.
        """
 
+        gr.hier_block2.__init__(self, "bbn_80211b_demod_pkts",
+                                gr.io_signature(1,1,gr.sizeof_gr_complex),
+                                gr.io_signature(0,0,0))
+
         self._rcvd_pktq = gr.msg_queue()          # holds packets from the PHY
-        self.bit_receiver = bbn_80211b_demod(fg, spb=spb, alpha = alpha,
+        self.bit_receiver = bbn_80211b_demod(spb=spb, alpha = alpha,
                                              pkt_queue=self._rcvd_pktq,
                                              *args, **kwargs)
         
-        gr.hier_block.__init__(self, fg, self.bit_receiver, None)
+        self.connect(self, self.bit_receiver)
+
         self._watcher = _queue_watcher_thread(self._rcvd_pktq, callback)
 
 class _queue_watcher_thread(_threading.Thread):
diff --git a/src/examples/bbn_80211b_test.py b/src/examples/bbn_80211b_test.py
index 2b97a2a..837c5c0 100755
--- a/src/examples/bbn_80211b_test.py
+++ b/src/examples/bbn_80211b_test.py
@@ -26,7 +26,7 @@
 # Boston, MA 02111-1307, USA.
 # 
 
-from gnuradio import gr, blks
+from gnuradio import gr, blocks, analog, filter
 from gnuradio.eng_option import eng_option
 from optparse import OptionParser
 import random
@@ -40,39 +40,39 @@ def rx_callback(ok, payload):
     packet_data = payload[size:];
     print packet_data
 
-class my_graph(gr.flow_graph):
+class my_graph(gr.top_block):
 
     def __init__(self, rx_callback, spb, alpha, SNR):
         # m is constellation size
         # if diff==True we are doing DxPSK
-        gr.flow_graph.__init__(self)
+        gr.top_block.__init__(self)
 
         fg = self
 
         # transmitter
-        self.packet_transmitter = bbn_80211b_mod_pkts(fg, spb=spb, alpha=alpha,
+        self.packet_transmitter = bbn_80211b_mod_pkts(spb=spb, alpha=alpha,
                                                       gain=1)
 
         # add some noise
-        add = gr.add_cc()
-        noise = gr.noise_source_c(gr.GR_GAUSSIAN, pow(10.0,-SNR/20.0))
+        add = blocks.add_cc()
+        noise = analog.noise_source_c(analog.GR_GAUSSIAN, pow(10.0,-SNR/20.0))
 
         # channel filter
-        rx_filt_taps = gr.firdes.low_pass(1,spb,0.8,0.1,gr.firdes.WIN_HANN)
-        rx_filt = gr.fir_filter_ccf(1,rx_filt_taps)
+        rx_filt_taps = 
filter.firdes.low_pass(1,spb,0.8,0.1,filter.firdes.WIN_HANN)
+        rx_filt = filter.fir_filter_ccf(1,rx_filt_taps)
 
         # receiver
-        self.bit_receiver = bbn_80211b_demod_pkts(self, spb=spb, alpha=alpha,
+        self.bit_receiver = bbn_80211b_demod_pkts(spb=spb, alpha=alpha,
                                                   callback=rx_callback)
 
-        fg.connect(self.packet_transmitter, (add,0))
-        fg.connect(noise, (add,1))
+        self.connect(self.packet_transmitter, (add,0))
+        self.connect(noise, (add,1))
 
         #xfile=gr.file_sink(gr.sizeof_gr_complex,"txdata");
-        #fg.connect(add, xfile)
+        #self.connect(add, xfile)
 
-        fg.connect(add, rx_filt)
-        fg.connect(rx_filt, self.bit_receiver)
+        self.connect(add, rx_filt)
+        self.connect(rx_filt, self.bit_receiver)
 
 
 class stats(object):
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to