commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r4214 - gnuradio/branches/developers/trondeau/digital-


From: trondeau
Subject: [Commit-gnuradio] r4214 - gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-examples/python/hier/digital
Date: Mon, 1 Jan 2007 15:50:34 -0700 (MST)

Author: trondeau
Date: 2007-01-01 15:50:34 -0700 (Mon, 01 Jan 2007)
New Revision: 4214

Modified:
   
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-examples/python/hier/digital/benchmark_tx.py
   
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-examples/python/hier/digital/transmit_path.py
Log:
benchmark_tx and transmit_path now work with hier_blocks2 and new PSK mod/demods

Modified: 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-examples/python/hier/digital/benchmark_tx.py
===================================================================
--- 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-examples/python/hier/digital/benchmark_tx.py
    2007-01-01 22:49:55 UTC (rev 4213)
+++ 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-examples/python/hier/digital/benchmark_tx.py
    2007-01-01 22:50:34 UTC (rev 4214)
@@ -36,13 +36,15 @@
 #print os.getpid()
 #raw_input('Attach and press enter')
 
+class my_graph(gr.hier_block2):
+    def __init__(self, mod_class, options):
+        gr.hier_block2.__init__(self, "my_graph",
+                                gr.io_signature(0,0,0), # Input signature
+                                gr.io_signature(0,0,0)) # Output signature
+        self.txpath = transmit_path(mod_class, options)
+        self.define_component("txpath", self.txpath)
 
-class my_graph(gr.flow_graph):
-    def __init__(self, modulator_class, options):
-        gr.flow_graph.__init__(self)
-        self.txpath = transmit_path(self, modulator_class, options)
 
-
 # /////////////////////////////////////////////////////////////////////////////
 #                                   main
 # /////////////////////////////////////////////////////////////////////////////
@@ -50,7 +52,7 @@
 def main():
 
     def send_pkt(payload='', eof=False):
-        return fg.txpath.send_pkt(payload, eof)
+        return top_block.txpath.send_pkt(payload, eof)
 
     def rx_callback(ok, payload):
         print "ok = %r, payload = '%s'" % (ok, payload)
@@ -89,16 +91,17 @@
         parser.print_help(sys.stderr)
         sys.exit(1)
 
-    # build the graph
-    fg = my_graph(mods[options.modulation], options)
+    # Create an instance of a hierarchical block
+    top_block = my_graph(mods[options.modulation], options)
+    
+    # Create an instance of a runtime, passing it the top block
+    runtime = gr.runtime(top_block)
+    runtime.start()
 
     r = gr.enable_realtime_scheduling()
     if r != gr.RT_OK:
         print "Warning: failed to enable realtime scheduling"
 
-    fg.start()                       # start flow graph
-
-
     # generate and send packets
     nbytes = int(1e6 * options.megabytes)
     n = 0
@@ -114,7 +117,7 @@
         pktno += 1
         
     send_pkt(eof=True)
-    fg.wait()                       # wait for it to finish
+    runtime.wait()
 
 if __name__ == '__main__':
     try:

Modified: 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-examples/python/hier/digital/transmit_path.py
===================================================================
--- 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-examples/python/hier/digital/transmit_path.py
   2007-01-01 22:49:55 UTC (rev 4213)
+++ 
gnuradio/branches/developers/trondeau/digital-wip2/gnuradio-examples/python/hier/digital/transmit_path.py
   2007-01-01 22:50:34 UTC (rev 4214)
@@ -19,7 +19,7 @@
 # Boston, MA 02110-1301, USA.
 # 
 
-from gnuradio import gr, gru, blks
+from gnuradio import gr, gru, blks2
 from gnuradio import usrp
 from gnuradio import eng_notation
 
@@ -33,8 +33,8 @@
 #                              transmit path
 # /////////////////////////////////////////////////////////////////////////////
 
-class transmit_path(gr.hier_block): 
-    def __init__(self, fg, modulator_class, options):
+class transmit_path(gr.hier_block2): 
+    def __init__(self, modulator_class, options):
         '''
         See below for what options should hold
         '''
@@ -80,13 +80,11 @@
     
         # transmitter
         self.packet_transmitter = \
-            blks.mod_pkts(fg,
-                          self._modulator_class(fg, **mod_kwargs),
-                          access_code=None,
-                          msgq_limit=4,
-                          pad_for_usrp=True)
+             blks2.mod_pkts(self._modulator_class(**mod_kwargs),
+                            access_code=None,
+                            msgq_limit=4,
+                            pad_for_usrp=True)
 
-
         # Set the USRP for maximum transmit gain
         # (Note that on the RFX cards this is a nop.)
         self.set_gain(self.subdev.gain_range()[0])
@@ -110,7 +108,6 @@
         self.connect("packet_transmitter", 0, "amp", 0)
         self.connect("amp", 0, "usrp", 0)
 
-
     def _setup_usrp_sink(self):
         """
         Creates a USRP sink, determines the settings for best bitrate,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]