commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r3919 - in gnuradio/branches/developers/jcorgan/hier:


From: jcorgan
Subject: [Commit-gnuradio] r3919 - in gnuradio/branches/developers/jcorgan/hier: gnuradio-core/src/lib/runtime gnuradio-examples/c++/dialtone gnuradio-examples/c++/usrp_wfm_rcv gnuradio-examples/python/audio
Date: Thu, 2 Nov 2006 16:38:10 -0700 (MST)

Author: jcorgan
Date: 2006-11-02 16:38:10 -0700 (Thu, 02 Nov 2006)
New Revision: 3919

Added:
   
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.cc
   
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.h
   
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.i
Modified:
   
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/Makefile.am
   
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_block.i
   
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
   
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.h
   
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.i
   
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_types.h
   
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc
   
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/runtime.i
   
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/dialtone/dialtone.cc
   
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/usrp_wfm_rcv/usrp_wfm_rcv.cc
   
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/python/audio/dial_tone2.py
Log:
Work in progress.  Added stub gr_runtime class and updated
new examples to use.


Modified: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/Makefile.am
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/Makefile.am
 2006-11-02 19:06:52 UTC (rev 3918)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/Makefile.am
 2006-11-02 23:38:10 UTC (rev 3919)
@@ -46,6 +46,7 @@
        gr_pagesize.cc                          \
        gr_preferences.cc                       \
        gr_realtime.cc                          \
+       gr_runtime.cc                           \
        gr_single_threaded_scheduler.cc         \
        gr_tmp_path.cc                          \
        gr_vmcircbuf.cc                         \
@@ -81,6 +82,7 @@
        gr_pagesize.h                           \
        gr_preferences.h                        \
        gr_realtime.h                           \
+       gr_runtime.h                            \
        gr_runtime_types.h                      \
        gr_select_handler.h                     \
        gr_single_threaded_scheduler.h          \
@@ -114,6 +116,7 @@
        gr_msg_handler.i                \
        gr_msg_queue.i                  \
        gr_realtime.i                   \
+       gr_runtime.i                    \
        gr_single_threaded_scheduler.i  \
        gr_swig_block_magic.i           \
        runtime.i

Modified: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_block.i
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_block.i
  2006-11-02 19:06:52 UTC (rev 3918)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_block.i
  2006-11-02 23:38:10 UTC (rev 3919)
@@ -20,6 +20,8 @@
  * Boston, MA 02110-1301, USA.
  */
 
+%include <gr_basic_block.i>
+
 class gr_block;
 typedef boost::shared_ptr<gr_block> gr_block_sptr;
 %template(gr_block_sptr) boost::shared_ptr<gr_block>;

Modified: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
   2006-11-02 19:06:52 UTC (rev 3918)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.cc
   2006-11-02 23:38:10 UTC (rev 3919)
@@ -94,3 +94,9 @@
     gr_connection connection(gr_endpoint(src_name, src_port), 
gr_endpoint(dst_name, dst_port));
     d_impl->d_connections.push_back(connection);
 }
+
+// Stub implementation, accept any topology, create no subcomponents
+bool gr_hier_block2::update_connections(int ninputs, int noutputs)
+{
+    return true;
+}

Modified: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.h
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.h
    2006-11-02 19:06:52 UTC (rev 3918)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.h
    2006-11-02 23:38:10 UTC (rev 3919)
@@ -57,6 +57,7 @@
                   gr_io_signature_sptr input_signature,
                   gr_io_signature_sptr output_signature);
 
+    virtual bool update_connections(int ninputs, int noutputs);
 
 public:
     ~gr_hier_block2();

Modified: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.i
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.i
    2006-11-02 19:06:52 UTC (rev 3918)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_hier_block2.i
    2006-11-02 23:38:10 UTC (rev 3919)
@@ -20,6 +20,8 @@
  * Boston, MA 02110-1301, USA.
  */
 
+%include <gr_basic_block.i>
+
 class gr_hier_block2;
 typedef boost::shared_ptr<gr_hier_block2> gr_hier_block2_sptr;
 %template(gr_hier_block2_sptr) boost::shared_ptr<gr_hier_block2>;

Added: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.cc
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.cc
                               (rev 0)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.cc
       2006-11-02 23:38:10 UTC (rev 3919)
@@ -0,0 +1,48 @@
+/* -*- c++ -*- */
+/*
+ * 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 <gr_runtime.h>
+#include <iostream.h>
+
+gr_runtime_sptr gr_make_runtime(gr_hier_block2_sptr top_block)
+{
+    return gr_runtime_sptr(new gr_runtime(top_block));
+}
+
+gr_runtime::gr_runtime(gr_hier_block2_sptr top_block)
+  : d_top_block(top_block)
+{
+}
+  
+gr_runtime::~gr_runtime()
+{
+}
+
+void gr_runtime::run()
+{
+    if (GR_RUNTIME_DEBUG)
+       std::cout << "gr_runtime::run() called." << std::endl;
+}


Property changes on: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.cc
___________________________________________________________________
Name: svn:eol-style
   + native

Added: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.h
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.h
                                (rev 0)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.h
        2006-11-02 23:38:10 UTC (rev 3919)
@@ -0,0 +1,46 @@
+/* -*- c++ -*- */
+/*
+ * 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_GR_RUNTIME_H
+#define INCLUDED_GR_RUNTIME_H
+
+#include <gr_runtime_types.h>
+
+// Define to 0 to eliminate runtime debugging
+#define GR_RUNTIME_DEBUG 1
+
+gr_runtime_sptr gr_make_runtime(gr_hier_block2_sptr top_block);
+
+class gr_runtime
+{
+private:
+    gr_runtime(gr_hier_block2_sptr top_block);
+    friend gr_runtime_sptr gr_make_runtime(gr_hier_block2_sptr top_block);
+
+    gr_hier_block2_sptr d_top_block;
+    
+public:
+    ~gr_runtime();
+    void run();
+};
+
+#endif /* INCLUDED_GR_RUNTIME_H */


Property changes on: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.h
___________________________________________________________________
Name: svn:eol-style
   + native

Added: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.i
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.i
                                (rev 0)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.i
        2006-11-02 23:38:10 UTC (rev 3919)
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 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 gr_runtime;
+typedef boost::shared_ptr<gr_runtime> gr_runtime_sptr;
+%template(gr_runtime_sptr) boost::shared_ptr<gr_runtime>;
+
+%rename(runtime) gr_make_runtime;
+gr_runtime_sptr gr_make_runtime(gr_hier_block2_sptr top_block);
+
+class gr_runtime
+{
+protected:
+    gr_runtime(gr_hier_block2_sptr top_block);
+
+public:
+    void run();
+};


Property changes on: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime.i
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_types.h
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_types.h
  2006-11-02 19:06:52 UTC (rev 3918)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/gr_runtime_types.h
  2006-11-02 23:38:10 UTC (rev 3919)
@@ -36,6 +36,7 @@
 class gr_io_signature;
 class gr_buffer;
 class gr_buffer_reader;
+class gr_runtime;
 
 typedef boost::shared_ptr<gr_basic_block>      gr_basic_block_sptr;
 typedef boost::shared_ptr<gr_block>            gr_block_sptr;
@@ -44,5 +45,6 @@
 typedef boost::shared_ptr<gr_io_signature>     gr_io_signature_sptr;
 typedef boost::shared_ptr<gr_buffer>           gr_buffer_sptr;
 typedef boost::shared_ptr<gr_buffer_reader>    gr_buffer_reader_sptr;
+typedef boost::shared_ptr<gr_runtime>          gr_runtime_sptr;
 
 #endif /* INCLUDED_GR_RUNTIME_TYPES_H */

Modified: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc
        2006-11-02 19:06:52 UTC (rev 3918)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc
        2006-11-02 23:38:10 UTC (rev 3919)
@@ -41,8 +41,7 @@
     gr_test_block();
     friend gr_test_block_sptr gr_make_test_block();
 
-    gr_block_sptr src1;
-    gr_block_sptr sink1;
+    bool update_connections(int inputs, int outputs);
     
 public:
     ~gr_test_block();
@@ -58,11 +57,20 @@
                   gr_make_io_signature(1, 1, sizeof(int)),
                   gr_make_io_signature(1, 1, sizeof(int)))
 {
-    src1 = gr_make_null_source(sizeof(int));
-    sink1 = gr_make_null_sink(sizeof(int));
+    define_component("source", gr_make_null_source(sizeof(int)));
+    define_component("sink", gr_make_null_sink(sizeof(int)));
+}
 
-    define_component("source", src1);
-    define_component("sink", sink1);
+bool gr_test_block::update_connections(int inputs, int outputs)
+{
+    if (inputs != 1 || outputs != 1)
+       return false;
+
+    connect("self-in", 0, "source", 0);
+    connect("source", 0, "sink", 0);
+    connect("sink", 0, "self-out", 0);
+       
+    return true;
 }
 
 gr_test_block::~gr_test_block()

Modified: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/runtime.i
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/runtime.i
   2006-11-02 19:06:52 UTC (rev 3918)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-core/src/lib/runtime/runtime.i
   2006-11-02 23:38:10 UTC (rev 3919)
@@ -21,7 +21,7 @@
  */
 
 %{
-#include <gr_runtime_types.h>
+#include <gr_runtime.h>
 #include <gr_io_signature.h>
 #include <gr_buffer.h>
 #include <gr_block.h>
@@ -50,3 +50,4 @@
 %include <gr_dispatcher.i>
 %include <gr_error_handler.i>
 %include <gr_realtime.i>
+%include <gr_runtime.i>

Modified: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/dialtone/dialtone.cc
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/dialtone/dialtone.cc
        2006-11-02 19:06:52 UTC (rev 3918)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/dialtone/dialtone.cc
        2006-11-02 23:38:10 UTC (rev 3919)
@@ -23,40 +23,56 @@
 #include <audio_alsa_sink.h>
 #include <gr_hier_block2.h>
 #include <gr_io_signature.h>
+#include <gr_runtime.h>
 
+// Dial tone hierarchical block
+
+class dial_tone;
+typedef boost::shared_ptr<dial_tone> dial_tone_sptr;
+dial_tone_sptr make_dial_tone();
+
 class dial_tone : public gr_hier_block2
 {
 private:
-    gr_sig_source_f_sptr d_src0;
-    gr_sig_source_f_sptr d_src1;
-    audio_alsa_sink_sptr d_sink;
-    
-public:
     dial_tone();
+    friend dial_tone_sptr make_dial_tone();
+
+    bool update_connections(int inputs, int outputs);
 };
 
-dial_tone::dial_tone()
-  : gr_hier_block2("dial_tone",
-                  gr_make_io_signature(0,0,0),
-                  gr_make_io_signature(0,0,0))
+dial_tone_sptr make_dial_tone()
 {
-    d_src0 = gr_make_sig_source_f(48000, GR_SIN_WAVE, 350, 0.5);
-    d_src1 = gr_make_sig_source_f(48000, GR_SIN_WAVE, 440, 0.5);
-    d_sink = audio_alsa_make_sink(48000);
-    
-    define_component("source0", d_src0);
-    define_component("source1", d_src1);
-    define_component("sink", d_sink);
+    return dial_tone_sptr(new dial_tone());
+}
 
+dial_tone::dial_tone() : 
+gr_hier_block2("dial_tone",
+              gr_make_io_signature(0,0,0),
+              gr_make_io_signature(0,0,0))
+{
+    define_component("source0", gr_make_sig_source_f(48000, GR_SIN_WAVE, 350, 
0.5));
+    define_component("source1", gr_make_sig_source_f(48000, GR_SIN_WAVE, 440, 
0.5));
+    define_component("sink", audio_alsa_make_sink(48000));
+}
+
+bool dial_tone::update_connections(int ninputs, int noutputs)
+{
+    if (ninputs || noutputs) // Top-level blocks have no external connections
+       return false;   
+
     connect("source0", 0, "sink", 0);
     connect("source1", 0, "sink", 1);    
+
+    return true;
 }    
 
+// Main loop
+
 int main()
 {
-    dial_tone top_block;
-    
-    // Not implemented yet
-    // top_block.run();
+    dial_tone_sptr  top_block = make_dial_tone();
+    gr_runtime_sptr runtime   = gr_make_runtime(top_block);
+
+    runtime->run();   
     return 0;
 }

Modified: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/usrp_wfm_rcv/usrp_wfm_rcv.cc
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/usrp_wfm_rcv/usrp_wfm_rcv.cc
        2006-11-02 19:06:52 UTC (rev 3918)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/c++/usrp_wfm_rcv/usrp_wfm_rcv.cc
        2006-11-02 23:38:10 UTC (rev 3919)
@@ -25,6 +25,7 @@
 #include <audio_alsa_sink.h>
 #include <gr_hier_block2.h>
 #include <gr_io_signature.h>
+#include <gr_runtime.h>
 
 #define RX_BOARD               0
 #define USRP_DECIM             200
@@ -35,54 +36,63 @@
 
 // *** THIS IS NOT SUPPOSED TO WORK YET, INTENTIONALLY BROKEN ***
 
+class usrp_wfm_rcv;
+typedef boost::shared_ptr<usrp_wfm_rcv> usrp_wfm_rcv_sptr;
+usrp_wfm_rcv_sptr usrp_make_wfm_rcv();
+
 class usrp_wfm_rcv : public gr_hier_block2
 {
 private:
-    usrp1_source_c_sptr         d_src;
-    gr_quadrature_demod_cf_sptr d_quad;
-    gr_block_sptr              d_null;
-    audio_alsa_sink_sptr        d_sink;
+    usrp_wfm_rcv();
+    friend usrp_wfm_rcv_sptr usrp_make_wfm_rcv();
 
-public:
-    usrp_wfm_rcv();
+    bool update_connections(int ninputs, int noutputs);
 };
 
-usrp_wfm_rcv::usrp_wfm_rcv()
-  : gr_hier_block2("usrp_wfm_rcv",
-                  gr_make_io_signature(0,0,0),
-                  gr_make_io_signature(0,0,0))
+usrp_wfm_rcv_sptr usrp_make_wfm_rcv()
 {
-    d_src = usrp1_make_source_c(RX_BOARD,
-                               USRP_DECIM,
-                               USRP_NCHAN,
-                               USRP_MUX,
-                               0, // mode
-                               0, // fusb_block_size
-                               0, // fusb_nblocks
-                               USRP_FPGA_FILENAME,
-                               USRP_FIRMWARE_FILENAME);
-                             
+    return usrp_wfm_rcv_sptr(new usrp_wfm_rcv());
+}
+
+usrp_wfm_rcv::usrp_wfm_rcv() :
+gr_hier_block2("usrp_wfm_rcv",
+              gr_make_io_signature(0,0,0),
+               gr_make_io_signature(0,0,0))
+{
     const float max_dev = 75000.0;
     const float demod_gain = 2*M_PI*max_dev;
-    d_quad = gr_make_quadrature_demod_cf(demod_gain);
-    
-    d_null = gr_make_null_sink(sizeof(gr_complex));
-    d_sink = audio_alsa_make_sink(48000);
 
-    define_component("src", d_src);
-    define_component("quad", d_quad);
-    define_component("null", d_null);
-    define_component("sink", d_sink);
-    
+    define_component("src", 
+                      usrp1_make_source_c(RX_BOARD,
+                                         USRP_DECIM,
+                                         USRP_NCHAN,
+                                         USRP_MUX,
+                                         0, // mode
+                                         0, // fusb_block_size
+                                         0, // fusb_nblocks
+                                         USRP_FPGA_FILENAME,
+                                         USRP_FIRMWARE_FILENAME));
+    define_component("quad", gr_make_quadrature_demod_cf(demod_gain));
+    define_component("null", gr_make_null_sink(sizeof(gr_complex)));
+    define_component("sink", audio_alsa_make_sink(48000));
+}
+
+bool usrp_wfm_rcv::update_connections(int ninputs, int noutputs)
+{
+    if (ninputs || noutputs) // Top level blocks shouldn't have any inputs or 
outputs
+       return false;
+           
     connect("src", 0, "quad", 0);
-    connect("quad", 0, "sink", 0);
+    connect("quad", 0, "null", 0);
+
+    return true;
 }
 
 int main()
 {
-    usrp_wfm_rcv top_block;
+    usrp_wfm_rcv_sptr top_block = usrp_make_wfm_rcv();
+    gr_runtime_sptr runtime = gr_make_runtime(top_block);
     
-    // NOT YET IMPLEMENTED
-    // top_block.run();
+    runtime->run();
     return 0;
 }

Modified: 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/python/audio/dial_tone2.py
===================================================================
--- 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/python/audio/dial_tone2.py
      2006-11-02 19:06:52 UTC (rev 3918)
+++ 
gnuradio/branches/developers/jcorgan/hier/gnuradio-examples/python/audio/dial_tone2.py
      2006-11-02 23:38:10 UTC (rev 3919)
@@ -27,7 +27,10 @@
 
 class dial_tone(gr.hier_block2):
     def __init__(self):
-        gr.hier_block2.__init__(self)
+        gr.hier_block2.__init__(self, 
+                               "dial_tone", 
+                               gr.io_signature(0,0,0), 
+                               gr.io_signature(0,0,0))
 
         parser = OptionParser(option_class=eng_option)
         parser.add_option("-O", "--audio-output", type="string", default="",
@@ -42,24 +45,23 @@
         sample_rate = int(options.sample_rate)
         ampl = 0.1
 
-       # Create sub-components
-        src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, ampl)
-        src1 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 440, ampl)
-        dst = audio.sink (sample_rate, options.audio_output)
+       self.define_component("source0", gr.sig_source_f (sample_rate, 
gr.GR_SIN_WAVE, 350, ampl))
+       self.define_component("source1", gr.sig_source_f (sample_rate, 
gr.GR_SIN_WAVE, 440, ampl))
+       self.define_component("dest", audio.sink(sample_rate, 
options.audio_output))
 
-       # Register them with us
-       self.define_component("source0", src0)
-       self.define_component("source1", src1)
-       self.define_component("dest", dst)
+    def update_connections(self, ninputs, noutputs):
+       if ninputs or noutputs: # Top level blocks shouldn't have inputs or 
outputs
+           return False
 
-       # Wire things up (there will be convenience functions for these)
        self.connect("source0", 0, "dest", 0)   
        self.connect("source1", 0, "dest", 1)
+       return True
+       
+if __name__ == '__main__':
+    top_block = dial_tone()
+    runtime = gr.runtime(top_block)
 
-if __name__ == '__main__':
     try:
-       pass
-       # Not implemented yet
-        # dial_tone().run() 
+       runtime.run()
     except KeyboardInterrupt:
         pass





reply via email to

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