[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r4508 - in gnuradio/branches/developers/n4hy/ofdm2/gnu
From: |
n4hy |
Subject: |
[Commit-gnuradio] r4508 - in gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python: channel-coding channel-coding/fsm_files digital hier/networking |
Date: |
Mon, 19 Feb 2007 12:38:15 -0700 (MST) |
Author: n4hy
Date: 2007-02-19 12:38:14 -0700 (Mon, 19 Feb 2007)
New Revision: 4508
Added:
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/channel-coding/fsm_files/irregular.fsm
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/digital/run_length.py
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/audio_sink.py
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/audio_source.py
Modified:
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/channel-coding/README
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/channel-coding/test_tcm_combined.py
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/channel-coding/test_turbo_equalization.py
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/channel-coding/test_viterbi_equalization1.py
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/digital/Makefile.am
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/digital/README
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/digital/benchmark_tx.py
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/digital/transmit_path.py
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/dial_tone_sink.py
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/dial_tone_source.py
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/vector_sink.py
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/vector_source.py
Log:
bringing ofdm2 up to date
Modified:
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/channel-coding/README
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/channel-coding/README
2007-02-19 19:33:29 UTC (rev 4507)
+++
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/channel-coding/README
2007-02-19 19:38:14 UTC (rev 4508)
@@ -14,9 +14,9 @@
./test_tcm_combined.py fsm_files/awgn1o2_4.fsm 6.0 1000
./test_tcm_parallel.py fsm_files/awgn1o2_4.fsm 6.0 1000
-./test_sccc_hard.py fsm_files/awgn1o2_4.fsm fsm_files/awgn1o2_4_msb.fsm 10.0
100
-./test_sccc_soft.py fsm_files/awgn1o2_4.fsm fsm_files/awgn1o2_4_msb.fsm 8.0
100
-./test_sccc_turbo.py fsm_files/awgn1o2_4.fsm fsm_files/awgn1o2_4_msb.fsm 5.0
100
+./test_sccc_hard.py fsm_files/awgn1o2_4.fsm fsm_files/awgn2o3_4_msb.fsm 10.0
100
+./test_sccc_soft.py fsm_files/awgn1o2_4.fsm fsm_files/awgn2o3_4_msb.fsm 8.0
100
+./test_sccc_turbo.py fsm_files/awgn1o2_4.fsm fsm_files/awgn2o3_4_msb.fsm 5.0
100
./test_viterbi_equalization.py 12.0 100
./test_viterbi_equalization1.py 12.0 100
Copied:
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/channel-coding/fsm_files/irregular.fsm
(from rev 4505,
gnuradio/trunk/gnuradio-examples/python/channel-coding/fsm_files/irregular.fsm)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/channel-coding/fsm_files/irregular.fsm
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/channel-coding/fsm_files/irregular.fsm
2007-02-19 19:38:14 UTC (rev 4508)
@@ -0,0 +1,11 @@
+2 2 2
+
+0 0
+0 1
+
+0 1
+0 1
+
+
+useless irregular FSM for testing. state 0 has 3 incoming edges and state
+1 has 1 incoming edge.
Modified:
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/channel-coding/test_tcm_combined.py
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/channel-coding/test_tcm_combined.py
2007-02-19 19:33:29 UTC (rev 4507)
+++
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/channel-coding/test_tcm_combined.py
2007-02-19 19:38:14 UTC (rev 4508)
@@ -25,7 +25,7 @@
# RX
- va =
trellis.viterbi_combined_s(f,K,0,-1,dimensionality,constellation,trellis.TRELLIS_EUCLIDEAN)
# Put -1 if the Initial/Final states are not set.
+ va =
trellis.viterbi_combined_fs(f,K,0,-1,dimensionality,constellation,trellis.TRELLIS_EUCLIDEAN)
# Put -1 if the Initial/Final states are not set.
fsmi2s = gr.unpacked_to_packed_ss(bitspersymbol,gr.GR_MSB_FIRST) # pack
FSM input symbols to shorts
dst = gr.check_lfsr_32k_s();
Modified:
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/channel-coding/test_turbo_equalization.py
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/channel-coding/test_turbo_equalization.py
2007-02-19 19:33:29 UTC (rev 4507)
+++
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/channel-coding/test_turbo_equalization.py
2007-02-19 19:38:14 UTC (rev 4508)
@@ -110,6 +110,7 @@
sys.exit (1)
bitspersymbol = int(round(math.log(fo.I())/math.log(2))) # bits per FSM
input symbol
K=Kb/bitspersymbol # packet size in trellis steps
+ print 'size = ',K
interleaver=trellis.interleaver(K,666) # construct a random interleaver
tot_channel = fsm_utils.make_isi_lookup(modulation,channel,True) #
generate the lookup table (normalize energy to 1)
dimensionality = tot_channel[0]
@@ -126,6 +127,7 @@
for i in range(rep):
(s,e)=run_test(fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,tot_constellation,1,N0,IT,-long(666+i))
# run experiment with different seed to get different noise realizations
+ print s
tot_s=tot_s+s
terr_s=terr_s+e
terr_p=terr_p+(terr_s!=0)
Modified:
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/channel-coding/test_viterbi_equalization1.py
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/channel-coding/test_viterbi_equalization1.py
2007-02-19 19:33:29 UTC (rev 4507)
+++
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/channel-coding/test_viterbi_equalization1.py
2007-02-19 19:38:14 UTC (rev 4508)
@@ -34,7 +34,7 @@
skip = gr.skiphead(gr.sizeof_float, L) # skip the first L samples since
you know they are coming from the L zero symbols
#metrics =
trellis.metrics_f(f.O(),dimensionality,tot_constellation,trellis.TRELLIS_EUCLIDEAN)
# data preprocessing to generate metrics for Viterbi
#va = trellis.viterbi_s(f,K+L,-1,0) # Put -1 if the Initial/Final states
are not set.
- va =
trellis.viterbi_combined_s(f,K+L,0,0,dimensionality,tot_constellation,trellis.TRELLIS_EUCLIDEAN)
# using viterbi_combined_s instead of metrics_f/viterbi_s allows larger packet
lengths because metrics_f is complaining for not being able to allocate large
buffers. This is due to the large f.O() in this application...
+ va =
trellis.viterbi_combined_fs(f,K+L,0,0,dimensionality,tot_constellation,trellis.TRELLIS_EUCLIDEAN)
# using viterbi_combined_fs instead of metrics_f/viterbi_s allows larger
packet lengths because metrics_f is complaining for not being able to allocate
large buffers. This is due to the large f.O() in this application...
dst = gr.vector_sink_s()
fg.connect (src,mod)
Modified:
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/digital/Makefile.am
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/digital/Makefile.am
2007-02-19 19:33:29 UTC (rev 4507)
+++
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/digital/Makefile.am
2007-02-19 19:38:14 UTC (rev 4508)
@@ -28,6 +28,7 @@
pick_bitrate.py \
receive_path.py \
rx_voice.py \
+ run_length.py \
transmit_path.py \
tunnel.py \
tx_voice.py
Modified:
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/digital/README
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/digital/README
2007-02-19 19:33:29 UTC (rev 4507)
+++
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/digital/README
2007-02-19 19:38:14 UTC (rev 4508)
@@ -1,6 +1,6 @@
Quick overview of what's here:
-* benchmark_rx.py: generates packets of the size you
+* benchmark_tx.py: generates packets of the size you
specify and sends them across the air using the USRP. Known to work
well using the USRP with the RFX transceiver daughterboards.
You can specify the bitrate to use with the -r <bitrate> command line
@@ -8,7 +8,7 @@
You can select the modulation to use with the -m <modulation> command
line argument. The legal values for <modulation> are gmsk, dbpsk and dqpsk.
-* benchmark_tx.py: the receiver half of benchmark_tx.py.
+* benchmark_rx.py: the receiver half of benchmark_tx.py.
Command line arguments are pretty much the same as rx. Works well
with a USRP and RFX transceiver daughterboards. Will also work
with TVRX daugherboard, but you'll need to fiddle with the gain. See
@@ -75,3 +75,10 @@
This now uses a carrier sense MAC, so you should be able to ssh
between the machines, web browse, etc.
+
+* run_length.py: This program takes a single argument '-f FILE' and
+outputs the number of runs of similar bits within the file. It is
+useful as a diagnostic tool when experimenting with line coding or
+whitening algorithms.
+
+
Modified:
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/digital/benchmark_tx.py
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/digital/benchmark_tx.py
2007-02-19 19:33:29 UTC (rev 4507)
+++
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/digital/benchmark_tx.py
2007-02-19 19:38:14 UTC (rev 4508)
@@ -71,6 +71,8 @@
help="set megabytes to transmit [default=%default]")
parser.add_option("","--discontinuous", action="store_true", default=False,
help="enable discontinous transmission (bursts of 5
packets)")
+ parser.add_option("","--from-file", default=None,
+ help="use file for packet contents")
transmit_path.add_options(parser, expert_grp)
@@ -89,6 +91,9 @@
parser.print_help(sys.stderr)
sys.exit(1)
+ if options.from_file is not None:
+ source_file = open(options.from_file, 'r')
+
# build the graph
fg = my_graph(mods[options.modulation], options)
@@ -98,7 +103,6 @@
fg.start() # start flow graph
-
# generate and send packets
nbytes = int(1e6 * options.megabytes)
n = 0
@@ -106,8 +110,16 @@
pkt_size = int(options.size)
while n < nbytes:
- send_pkt(struct.pack('!H', pktno) + (pkt_size - 2) * chr(pktno & 0xff))
- n += pkt_size
+ if options.from_file is None:
+ data = (pkt_size - 2) * chr(pktno & 0xff)
+ else:
+ data = source_file.read(pkt_size - 2)
+ if data == '':
+ break;
+
+ payload = struct.pack('!H', pktno) + data
+ send_pkt(payload)
+ n += len(payload)
sys.stderr.write('.')
if options.discontinuous and pktno % 5 == 4:
time.sleep(1)
Copied:
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/digital/run_length.py
(from rev 4505, gnuradio/trunk/gnuradio-examples/python/digital/run_length.py)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/digital/run_length.py
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/digital/run_length.py
2007-02-19 19:38:14 UTC (rev 4508)
@@ -0,0 +1,83 @@
+#!/usr/bin/env python
+#
+# Copyright 2007 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.
+#
+
+from optparse import OptionParser
+import sys
+
+def main():
+ parser = OptionParser()
+ parser.add_option("-f", "--file", default=None,
+ help="Choose file to read data from.")
+ (options, args) = parser.parse_args()
+
+ if options.file == None:
+ print "Must specify file to read from using '-f'."
+ sys.exit(1)
+ print "Using", options.file, "for data."
+
+ f = open(options.file, 'r')
+ runs = []
+ count = 0
+ current = 0
+ bytes = 0
+ bits = 0
+
+ for ch in f.read():
+ x = ord(ch)
+ bytes = bytes + 1
+ for i in range(7,-1,-1):
+ bits = bits + 1
+ t = (x >> i) & 0x1
+ if t == current:
+ count = count + 1
+ else:
+ if count > 0:
+ if len(runs) < count:
+ for j in range(count - len(runs)):
+ runs.append(0);
+ runs[count-1] = runs[count-1] + 1
+
+ current = 1-current;
+ count = 1
+
+ # Deal with last run at EOF
+ if len(runs) < count and count > 0:
+ for j in range(count - len(runs)):
+ runs.append(0);
+ runs[count-1] = runs[count-1] + 1
+
+ chk = 0
+ print "Bytes read: ", bytes
+ print "Bits read: ", bits
+ print
+ for i in range(len(runs)):
+ chk = chk + runs[i]*(i+1)
+ print "Runs of length", i+1, ":", runs[i]
+ print
+ print "Sum of runs:", chk, "bits"
+ print
+ print "Maximum run length is", len(runs), "bits"
+
+if __name__ == "__main__":
+ main()
+
+
Modified:
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/digital/transmit_path.py
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/digital/transmit_path.py
2007-02-19 19:33:29 UTC (rev 4507)
+++
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/digital/transmit_path.py
2007-02-19 19:38:14 UTC (rev 4508)
@@ -50,7 +50,8 @@
self._samples_per_symbol = options.samples_per_symbol # desired
samples/baud
self._fusb_block_size = options.fusb_block_size # usb info for USRP
self._fusb_nblocks = options.fusb_nblocks # usb info for USRP
-
+ self._use_whitener_offset = options.use_whitener_offset # increment
start of whitener XOR data
+
self._modulator_class = modulator_class # the modulator_class
we are using
if self._tx_freq is None:
@@ -80,7 +81,8 @@
self._modulator_class(fg, **mod_kwargs),
access_code=None,
msgq_limit=4,
- pad_for_usrp=True)
+ pad_for_usrp=True,
+ use_whitener_offset=options.use_whitener_offset)
# Set the USRP for maximum transmit gain
@@ -200,6 +202,8 @@
help="set fpga interpolation rate to INTERP
[default=%default]")
expert.add_option("", "--log", action="store_true", default=False,
help="Log all parts of flow graph to file (CAUTION:
lots of data)")
+ expert.add_option("","--use-whitener-offset", action="store_true",
default=False,
+ help="make sequential packets use different
whitening")
# Make a static method to call before instantiation
add_options = staticmethod(add_options)
Copied:
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/audio_sink.py
(from rev 4505,
gnuradio/trunk/gnuradio-examples/python/hier/networking/audio_sink.py)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/audio_sink.py
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/audio_sink.py
2007-02-19 19:38:14 UTC (rev 4508)
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, audio
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+
+class audio_sink(gr.hier_block2):
+ 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)
+
+if __name__ == '__main__':
+ parser = OptionParser(option_class=eng_option)
+ parser.add_option("", "--src-name", type="string", default="localhost",
+ help="local host name (domain name or IP address)")
+ parser.add_option("", "--src-port", type="int", default=65500,
+ help="port value to listen to for connection")
+ parser.add_option("", "--packet-size", type="int", default=1472,
+ help="packet size.")
+ parser.add_option("-r", "--sample-rate", type="int", default=32000,
+ help="audio signal sample rate [default=%default]")
+ (options, args) = parser.parse_args()
+ if len(args) != 0:
+ parser.print_help()
+ raise SystemExit, 1
+
+ # Create an instance of a hierarchical block
+ top_block = audio_sink(options.src_name, options.src_port,
+ options.packet_size, options.sample_rate)
+
+ # Create an instance of a runtime, passing it the top block
+ runtime = gr.runtime(top_block)
+
+ try:
+ # Run forever
+ runtime.run()
+ except KeyboardInterrupt:
+ # Ctrl-C exits
+ pass
+
Copied:
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/audio_source.py
(from rev 4505,
gnuradio/trunk/gnuradio-examples/python/hier/networking/audio_source.py)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/audio_source.py
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/audio_source.py
2007-02-19 19:38:14 UTC (rev 4508)
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+#
+# 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.
+#
+
+from gnuradio import gr, audio
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+
+class audio_source(gr.hier_block2):
+ 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
+
+ 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",
+ help="local host name (domain name or IP address)")
+ parser.add_option("", "--dst-name", type="string", default="localhost",
+ help="Remote host name (domain name or IP address")
+ parser.add_option("", "--dst-port", type="int", default=65500,
+ help="port value to connect to")
+ parser.add_option("", "--packet-size", type="int", default=1472,
+ help="packet size.")
+ parser.add_option("-r", "--sample-rate", type="int", default=32000 ,
+ help="audio signal sample rate [default=%default]")
+ (options, args) = parser.parse_args()
+ if len(args) != 0:
+ parser.print_help()
+ raise SystemExit, 1
+
+ # Create an instance of a hierarchical block
+ top_block = audio_source(options.src_name, options.dst_name,
options.dst_port,
+ options.packet_size, options.sample_rate)
+
+ # Create an instance of a runtime, passing it the top block
+ runtime = gr.runtime(top_block)
+
+ try:
+ # Run forever
+ runtime.run()
+ except KeyboardInterrupt:
+ # Ctrl-C exits
+ pass
+
Modified:
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/dial_tone_sink.py
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/dial_tone_sink.py
2007-02-19 19:33:29 UTC (rev 4507)
+++
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/dial_tone_sink.py
2007-02-19 19:38:14 UTC (rev 4508)
@@ -25,28 +25,26 @@
from optparse import OptionParser
class dial_tone_sink(gr.hier_block2):
- def __init__(self, local_ipaddress, port, mtu, sample_rate):
+ 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,
- local_ipaddress, port,
- mtu))
+ 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)
+ self.connect("src", 0, "dst", 0)
if __name__ == '__main__':
parser = OptionParser(option_class=eng_option)
- parser.add_option("", "--local-ipaddr", type="string", default="127.0.0.1",
- help="local IP address")
- parser.add_option("", "--local-port", type="int", default=65500,
+ parser.add_option("", "--src-name", type="string", default="localhost",
+ help="local host name (domain name or IP address)")
+ parser.add_option("", "--src-port", type="int", default=65500,
help="port value to listen to for connection")
- parser.add_option("", "--mtu", type="int", default=540,
- help="packet size.")
+ parser.add_option("", "--packet-size", type="int", default=1472,
+ help="packet size.")
parser.add_option("-r", "--sample-rate", type="int", default=8000,
help="audio signal sample rate [default=%default]")
(options, args) = parser.parse_args()
@@ -55,8 +53,8 @@
raise SystemExit, 1
# Create an instance of a hierarchical block
- top_block = dial_tone_sink(options.local_ipaddr, options.local_port,
- options.mtu, options.sample_rate)
+ top_block = dial_tone_sink(options.src_name, options.src_port,
+ options.packet_size, options.sample_rate)
# Create an instance of a runtime, passing it the top block
runtime = gr.runtime(top_block)
Modified:
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/dial_tone_source.py
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/dial_tone_source.py
2007-02-19 19:33:29 UTC (rev 4507)
+++
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/dial_tone_source.py
2007-02-19 19:38:14 UTC (rev 4508)
@@ -25,7 +25,7 @@
from optparse import OptionParser
class dial_tone_source(gr.hier_block2):
- def __init__(self, local_ipaddress, remote_ipaddress, port, mtu,
sample_rate):
+ 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
@@ -38,37 +38,37 @@
440, amplitude))
self.define_component("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,
- local_ipaddress, 0,
- remote_ipaddress, port,
- mtu))
-
+ self.define_component("dst", gr.udp_sink(gr.sizeof_float, src, 0, dst,
port, pkt_size))
+
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("", "--local-ipaddr", type="string", default="127.0.0.1",
- help="local IP address")
- parser.add_option("", "--remote-ipaddr", type="string",
default="127.0.0.1",
- help="Remote IP address")
- parser.add_option("", "--remote-port", type="int", default=65500,
+ parser.add_option("", "--src-name", type="string", default="localhost",
+ help="local host name (domain name or IP address)")
+ parser.add_option("", "--dst-name", type="string", default="localhost",
+ help="Remote host name (domain name or IP address")
+ parser.add_option("", "--dst-port", type="int", default=65500,
help="port value to connect to")
- parser.add_option("", "--mtu", type="int", default=540,
- help="packet size.")
+ parser.add_option("", "--packet-size", type="int", default=1472,
+ help="packet size.")
parser.add_option("-r", "--sample-rate", type="int", default=8000,
- help="audio signal sample rate [default=%default]")
+ help="audio signal sample rate [default=%default]")
(options, args) = parser.parse_args()
if len(args) != 0:
parser.print_help()
raise SystemExit, 1
# Create an instance of a hierarchical block
- top_block = dial_tone_source(options.local_ipaddr, options.remote_ipaddr,
- options.remote_port, options.mtu,
options.sample_rate)
+ top_block = dial_tone_source(options.src_name, options.dst_name,
options.dst_port,
+ options.packet_size, options.sample_rate)
# Create an instance of a runtime, passing it the top block
runtime = gr.runtime(top_block)
Modified:
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/vector_sink.py
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/vector_sink.py
2007-02-19 19:33:29 UTC (rev 4507)
+++
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/vector_sink.py
2007-02-19 19:38:14 UTC (rev 4508)
@@ -25,35 +25,34 @@
from optparse import OptionParser
class vector_sink(gr.hier_block2):
- def __init__(self, local_ipaddress, port, mtu):
+ 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
- udp = gr.udp_source(gr.sizeof_char, local_ipaddress, port, mtu)
+ 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_char,
"received.dat"))
+ self.define_component("dst", gr.file_sink(gr.sizeof_float,
"received.dat"))
self.connect("src", 0, "dst", 0)
if __name__ == "__main__":
parser = OptionParser(option_class=eng_option)
- parser.add_option("", "--local-ipaddr", type="string", default="127.0.0.1",
- help="local IP address")
- parser.add_option("", "--local-port", type="int", default=65500,
+ parser.add_option("", "--src-name", type="string", default="localhost",
+ help="local host name (domain name or IP address)")
+ parser.add_option("", "--src-port", type="int", default=65500,
help="port value to listen to for connection")
- parser.add_option("", "--mtu", type="int", default=540,
- help="packet size.")
+ parser.add_option("", "--packet-size", type="int", default=1471,
+ help="packet size.")
(options, args) = parser.parse_args()
if len(args) != 0:
parser.print_help()
raise SystemExit, 1
# Create an instance of a hierarchical block
- top_block = vector_sink(options.local_ipaddr, options.local_port,
- options.mtu)
+ top_block = vector_sink(options.src_name, options.src_port,
options.packet_size)
# Create an instance of a runtime, passing it the top block
runtime = gr.runtime(top_block)
Modified:
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/vector_source.py
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/vector_source.py
2007-02-19 19:33:29 UTC (rev 4507)
+++
gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python/hier/networking/vector_source.py
2007-02-19 19:38:14 UTC (rev 4508)
@@ -25,41 +25,38 @@
from optparse import OptionParser
class vector_source(gr.hier_block2):
- def __init__(self, local_ipaddress, remote_ipaddress, port, mtu):
+ 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
- data = [i*0.1 for i in range(1000)]
+ data = [i*0.01 for i in range(1000)]
self.define_component("data", gr.vector_source_f(data, True))
- self.define_component("thr", gr.throttle(gr.sizeof_float, 8000))
- udp = gr.udp_sink(gr.sizeof_float, local_ipaddress, 0,
- remote_ipaddress, port, mtu)
+ udp = gr.udp_sink(gr.sizeof_float, src, 0, dst, port, pkt_size)
self.define_component("dst", udp)
- self.connect("data", 0, "thr", 0)
- self.connect("thr", 0, "dst", 0)
+ self.connect("data", 0, "dst", 0)
if __name__ == '__main__':
parser = OptionParser(option_class=eng_option)
- parser.add_option("", "--local-ipaddr", type="string", default="127.0.0.1",
- help="local IP address")
- parser.add_option("", "--remote-ipaddr", type="string",
default="127.0.0.1",
- help="Remote IP address")
- parser.add_option("", "--remote-port", type="int", default=65500,
+ parser.add_option("", "--src-name", type="string", default="localhost",
+ help="local host name (domain name or IP address)")
+ parser.add_option("", "--dst-name", type="string", default="localhost",
+ help="Remote host name (domain name or IP address")
+ parser.add_option("", "--dst-port", type="int", default=65500,
help="port value to connect to")
- parser.add_option("", "--mtu", type="int", default=540,
- help="packet size.")
+ parser.add_option("", "--packet-size", type="int", default=1471,
+ help="packet size.")
(options, args) = parser.parse_args()
if len(args) != 0:
parser.print_help()
raise SystemExit, 1
# Create an instance of a hierarchical block
- top_block = vector_source(options.local_ipaddr, options.remote_ipaddr,
- options.remote_port, options.mtu)
+ top_block = vector_source(options.src_name, options.dst_name,
+ options.dst_port, options.packet_size)
# Create an instance of a runtime, passing it the top block
runtime = gr.runtime(top_block)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r4508 - in gnuradio/branches/developers/n4hy/ofdm2/gnuradio-examples/python: channel-coding channel-coding/fsm_files digital hier/networking,
n4hy <=