[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r5168 - gnuradio/branches/developers/jcorgan/hb/gnurad
From: |
jcorgan |
Subject: |
[Commit-gnuradio] r5168 - gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking |
Date: |
Fri, 27 Apr 2007 18:54:57 -0600 (MDT) |
Author: jcorgan
Date: 2007-04-27 18:54:56 -0600 (Fri, 27 Apr 2007)
New Revision: 5168
Modified:
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/audio_sink.py
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/audio_source.py
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/dial_tone_sink.py
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/dial_tone_source.py
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/vector_sink.py
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/vector_source.py
Log:
Converted hier2 networking examples to new API.
Modified:
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/audio_sink.py
===================================================================
---
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/audio_sink.py
2007-04-28 00:33:58 UTC (rev 5167)
+++
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/audio_sink.py
2007-04-28 00:54:56 UTC (rev 5168)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2006 Free Software Foundation, Inc.
+# Copyright 2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -24,18 +24,12 @@
from gnuradio.eng_option import eng_option
from optparse import OptionParser
-class audio_sink(gr.hier_block2):
+class audio_sink(gr.top_block):
def __init__(self, src, port, pkt_size, sample_rate):
- gr.hier_block2.__init__(self,
- "audio_sink", # Block type
- gr.io_signature(0,0,0), # Input signature
- gr.io_signature(0,0,0)) # Output signature
-
-
- self.define_component("src", gr.udp_source(gr.sizeof_float, src,
port, pkt_size))
- self.define_component("dst", audio.sink(sample_rate))
-
- self.connect("src", 0, "dst", 0)
+ gr.top_block.__init__(self, "audio_sink")
+ src = gr.udp_source(gr.sizeof_float, src, port, pkt_size)
+ dst = audio.sink(sample_rate)
+ self.connect(src, dst)
if __name__ == '__main__':
parser = OptionParser(option_class=eng_option)
Modified:
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/audio_source.py
===================================================================
---
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/audio_source.py
2007-04-28 00:33:58 UTC (rev 5167)
+++
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/audio_source.py
2007-04-28 00:54:56 UTC (rev 5168)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2006 Free Software Foundation, Inc.
+# Copyright 2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -24,17 +24,13 @@
from gnuradio.eng_option import eng_option
from optparse import OptionParser
-class audio_source(gr.hier_block2):
+class audio_source(gr.top_block):
def __init__(self, src, dst, port, pkt_size, sample_rate):
- gr.hier_block2.__init__(self,
- "audio_source", # Block type
- gr.io_signature(0,0,0), # Input signature
- gr.io_signature(0,0,0)) # Output signature
+ gr.top_block.__init__(self, "audio_source")
+ self.audio = audio.source(sample_rate)
+ self.sink = gr.udp_sink(gr.sizeof_float, src, 0, dst, port, pkt_size)
+ self.connect(self.audio, self.sink)
- self.define_component("src", audio.source(sample_rate))
- self.define_component("dst", gr.udp_sink(gr.sizeof_float, src, 0, dst,
port, pkt_size))
- self.connect("src", 0, "dst", 0)
-
if __name__ == '__main__':
parser = OptionParser(option_class=eng_option)
parser.add_option("", "--src-name", type="string", default="localhost",
Modified:
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/dial_tone_sink.py
===================================================================
---
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/dial_tone_sink.py
2007-04-28 00:33:58 UTC (rev 5167)
+++
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/dial_tone_sink.py
2007-04-28 00:54:56 UTC (rev 5168)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2006 Free Software Foundation, Inc.
+# Copyright 2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -24,18 +24,12 @@
from gnuradio.eng_option import eng_option
from optparse import OptionParser
-class dial_tone_sink(gr.hier_block2):
+class dial_tone_sink(gr.top_block):
def __init__(self, src, port, pkt_size, sample_rate):
- gr.hier_block2.__init__(self,
- "dial_tone_sink", # Block type
- gr.io_signature(0,0,0), # Input signature
- gr.io_signature(0,0,0)) # Output signature
-
-
- self.define_component("src", gr.udp_source(gr.sizeof_float, src,
port, pkt_size))
- self.define_component("dst", audio.sink(sample_rate))
-
- self.connect("src", 0, "dst", 0)
+ gr.top_block.__init__(self, "dial_tone_sink")
+ udp = gr.udp_source(gr.sizeof_float, src, port, pkt_size)
+ sink = audio.sink(sample_rate)
+ self.connect(udp, sink)
if __name__ == '__main__':
parser = OptionParser(option_class=eng_option)
Modified:
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/dial_tone_source.py
===================================================================
---
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/dial_tone_source.py
2007-04-28 00:33:58 UTC (rev 5167)
+++
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/dial_tone_source.py
2007-04-28 00:54:56 UTC (rev 5168)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2006 Free Software Foundation, Inc.
+# Copyright 2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -24,31 +24,22 @@
from gnuradio.eng_option import eng_option
from optparse import OptionParser
-class dial_tone_source(gr.hier_block2):
+class dial_tone_source(gr.top_block):
def __init__(self, src, dst, port, pkt_size, sample_rate):
- gr.hier_block2.__init__(self,
- "dial_tone_source", # Block type
- gr.io_signature(0,0,0), # Input signature
- gr.io_signature(0,0,0)) # Output signature
+ gr.top_block.__init__(self, "dial_tone_source")
amplitude = 0.3
- self.define_component("src0", gr.sig_source_f (sample_rate,
gr.GR_SIN_WAVE,
- 350, amplitude))
- self.define_component("src1", gr.sig_source_f (sample_rate,
gr.GR_SIN_WAVE,
- 440, amplitude))
- self.define_component("add", gr.add_ff())
+ src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, amplitude)
+ src1 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 440, amplitude)
+ add = gr.add_ff()
# Throttle needed here to account for the other side's audio card
sampling rate
- self.define_component("thr", gr.throttle(gr.sizeof_float, sample_rate))
- self.define_component("dst", gr.udp_sink(gr.sizeof_float, src, 0, dst,
port, pkt_size))
+ thr = gr.throttle(gr.sizeof_float, sample_rate)
+ sink = gr.udp_sink(gr.sizeof_float, src, 0, dst, port, pkt_size)
+ self.connect(src0, (add, 0))
+ self.connect(src1, (add, 1))
+ self.connect(add, thr, sink)
- self.connect("src0", 0, "add", 0)
- self.connect("src1", 0, "add", 1)
- self.connect("add", 0, "thr", 0)
- self.connect("thr", 0, "dst", 0)
-
-
-
if __name__ == '__main__':
parser = OptionParser(option_class=eng_option)
parser.add_option("", "--src-name", type="string", default="localhost",
Modified:
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/vector_sink.py
===================================================================
---
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/vector_sink.py
2007-04-28 00:33:58 UTC (rev 5167)
+++
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/vector_sink.py
2007-04-28 00:54:56 UTC (rev 5168)
@@ -24,20 +24,14 @@
from gnuradio.eng_option import eng_option
from optparse import OptionParser
-class vector_sink(gr.hier_block2):
+class vector_sink(gr.top_block):
def __init__(self, src, port, pkt_size):
- gr.hier_block2.__init__(self,
- "vector_sink", # Block type
- gr.io_signature(0,0,0), # Input signature
- gr.io_signature(0,0,0)) # Output signature
+ gr.top_block.__init__(self, "vector_sink")
udp = gr.udp_source(gr.sizeof_float, src, port, pkt_size)
-
- self.define_component("src", udp)
- self.define_component("dst", gr.file_sink(gr.sizeof_float,
"received.dat"))
+ sink = gr.file_sink(gr.sizeof_float, "received.dat")
+ self.connect(udp, sink)
- self.connect("src", 0, "dst", 0)
-
if __name__ == "__main__":
parser = OptionParser(option_class=eng_option)
parser.add_option("", "--src-name", type="string", default="localhost",
Modified:
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/vector_source.py
===================================================================
---
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/vector_source.py
2007-04-28 00:33:58 UTC (rev 5167)
+++
gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking/vector_source.py
2007-04-28 00:54:56 UTC (rev 5168)
@@ -24,21 +24,14 @@
from gnuradio.eng_option import eng_option
from optparse import OptionParser
-class vector_source(gr.hier_block2):
+class vector_source(gr.top_block):
def __init__(self, src, dst, port, pkt_size):
- gr.hier_block2.__init__(self,
- "vector_source", # Block type
- gr.io_signature(0,0,0), # Input signature
- gr.io_signature(0,0,0)) # Output signature
-
+ gr.top_block.__init__(self, "vector_source")
data = [i*0.01 for i in range(1000)]
- self.define_component("data", gr.vector_source_f(data, True))
-
+ vec = gr.vector_source_f(data, True)
udp = gr.udp_sink(gr.sizeof_float, src, 0, dst, port, pkt_size)
- self.define_component("dst", udp)
+ self.connect(vec, udp)
- self.connect("data", 0, "dst", 0)
-
if __name__ == '__main__':
parser = OptionParser(option_class=eng_option)
parser.add_option("", "--src-name", type="string", default="localhost",
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r5168 - gnuradio/branches/developers/jcorgan/hb/gnuradio-examples/python/hier/networking,
jcorgan <=