diff options
81 files changed, 196 insertions, 1592 deletions
diff --git a/docs/doxygen/other/main_page.dox b/docs/doxygen/other/main_page.dox index 6f422dfd8f..f9e335061c 100644 --- a/docs/doxygen/other/main_page.dox +++ b/docs/doxygen/other/main_page.dox @@ -227,7 +227,7 @@ class mytb(gr.top_block): self.add = blocks.add_cc() self.sub = blocks.sub_cc() self.head = gr.head(gr.sizeof_gr_complex, 1000000) - self.snk = gr.file_sink(gr.sizeof_gr_complex, "output.32fc") + self.snk = blocks.file_sink(gr.sizeof_gr_complex, "output.32fc") self.connect(self.src0, (self.add,0)) self.connect(self.src1, (self.add,1)) @@ -282,7 +282,7 @@ class mytb(gr.top_block): self.add = blocks.add_cc() self.sub = blocks.sub_cc() self.head = gr.head(gr.sizeof_gr_complex, 1000000) - self.snk = gr.file_sink(gr.sizeof_gr_complex, "output.32fc") + self.snk = blocks.file_sink(gr.sizeof_gr_complex, "output.32fc") self.connect(self.src0, (self.add,0)) self.connect(self.src1, (self.add,1)) diff --git a/docs/exploring-gnuradio/fm_demod.py b/docs/exploring-gnuradio/fm_demod.py index 7b19cd826a..c6d8eaa582 100755 --- a/docs/exploring-gnuradio/fm_demod.py +++ b/docs/exploring-gnuradio/fm_demod.py @@ -7,7 +7,7 @@ from gnuradio import mc4020 import sys def high_speed_adc(fg, input_rate): - # return gr.file_source (gr.sizeof_short, "dummy.dat", False) + # return blocks.file_source (gr.sizeof_short, "dummy.dat", False) return mc4020.source(input_rate, mc4020.MCC_CH3_EN | mc4020.MCC_ALL_1V) # diff --git a/docs/exploring-gnuradio/fm_demod_example.xml b/docs/exploring-gnuradio/fm_demod_example.xml index 05c2ee163b..38bfc1e84d 100644 --- a/docs/exploring-gnuradio/fm_demod_example.xml +++ b/docs/exploring-gnuradio/fm_demod_example.xml @@ -11,7 +11,7 @@ from gnuradio import mc4020 import sys def high_speed_adc (fg, input_rate): - # return gr.file_source (gr.sizeof_short, "dummy.dat", False) + # return blocks.file_source (gr.sizeof_short, "dummy.dat", False) return mc4020.source (input_rate, mc4020.MCC_CH3_EN | mc4020.MCC_ALL_1V) # diff --git a/docs/sphinx/source/gr/index.rst b/docs/sphinx/source/gr/index.rst index ebdaa6e00f..92f3b9e271 100644 --- a/docs/sphinx/source/gr/index.rst +++ b/docs/sphinx/source/gr/index.rst @@ -28,8 +28,6 @@ Signal Sources gnuradio.gr.vector_source_f gnuradio.gr.vector_source_i gnuradio.gr.vector_source_s - gnuradio.gr.file_descriptor_source - gnuradio.gr.file_source gnuradio.gr.udp_source Signal Sinks @@ -46,8 +44,6 @@ Signal Sinks gnuradio.gr.vector_sink_f gnuradio.gr.vector_sink_i gnuradio.gr.vector_sink_s - gnuradio.gr.file_descriptor_sink - gnuradio.gr.file_sink gnuradio.gr.histo_sink_f gnuradio.gr.oscope_sink_f gnuradio.gr.udp_sink diff --git a/docs/sphinx/source/gr/sink_blk.rst b/docs/sphinx/source/gr/sink_blk.rst index fef7937742..d738db1d09 100644 --- a/docs/sphinx/source/gr/sink_blk.rst +++ b/docs/sphinx/source/gr/sink_blk.rst @@ -9,8 +9,6 @@ gnuradio.gr: Signal Sinks .. autooldblock:: gnuradio.gr.vector_sink_f .. autooldblock:: gnuradio.gr.vector_sink_i .. autooldblock:: gnuradio.gr.vector_sink_s -.. autooldblock:: gnuradio.gr.file_descriptor_sink -.. autooldblock:: gnuradio.gr.file_sink .. autooldblock:: gnuradio.gr.histo_sink_f .. autooldblock:: gnuradio.gr.oscope_sink_f .. autooldblock:: gnuradio.gr.udp_sink diff --git a/docs/sphinx/source/gr/source_blk.rst b/docs/sphinx/source/gr/source_blk.rst index 5bbd4591ec..ff7b123878 100644 --- a/docs/sphinx/source/gr/source_blk.rst +++ b/docs/sphinx/source/gr/source_blk.rst @@ -8,7 +8,5 @@ gnuradio.gr: Signal Sources .. autooldblock:: gnuradio.gr.vector_source_f .. autooldblock:: gnuradio.gr.vector_source_i .. autooldblock:: gnuradio.gr.vector_source_s -.. autooldblock:: gnuradio.gr.file_descriptor_source -.. autooldblock:: gnuradio.gr.file_source .. autooldblock:: gnuradio.gr.udp_source diff --git a/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc b/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc index 5287257d77..5ccc65140c 100644 --- a/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc +++ b/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc @@ -648,10 +648,10 @@ </param> </block> <block> - <key>gr_file_source</key> + <key>blocks_file_source</key> <param> <key>id</key> - <value>gr_file_source_0</value> + <value>blocks_file_source_0</value> </param> <param> <key>_enabled</key> @@ -809,7 +809,7 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_file_source_0</source_block_id> + <source_block_id>blocks_file_source_0</source_block_id> <sink_block_id>blocks_packed_to_unpacked_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc b/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc index 20e8e7f7db..5b0bfeb793 100644 --- a/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc +++ b/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc @@ -523,10 +523,10 @@ </param> </block> <block> - <key>gr_file_source</key> + <key>blocks_file_source</key> <param> <key>id</key> - <value>gr_file_source_0</value> + <value>blocks_file_source_0</value> </param> <param> <key>_enabled</key> @@ -654,7 +654,7 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_file_source_0</source_block_id> + <source_block_id>blocks_file_source_0</source_block_id> <sink_block_id>blocks_packed_to_unpacked_xx_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gnuradio-core/src/examples/mp-sched/wfm_rcv_pll_to_wav.py b/gnuradio-core/src/examples/mp-sched/wfm_rcv_pll_to_wav.py index 67dbc41960..2f638e26ec 100755 --- a/gnuradio-core/src/examples/mp-sched/wfm_rcv_pll_to_wav.py +++ b/gnuradio-core/src/examples/mp-sched/wfm_rcv_pll_to_wav.py @@ -50,7 +50,7 @@ class wfm_rx_block (gr.top_block): # build graph - self.src = gr.file_source(gr.sizeof_gr_complex, input_filename, False) + self.src = blocks.file_source(gr.sizeof_gr_complex, input_filename, False) adc_rate = 64e6 # 64 MS/s usrp_decim = 200 diff --git a/gnuradio-core/src/examples/network/vector_sink.py b/gnuradio-core/src/examples/network/vector_sink.py index e84a27d9fe..c220278e11 100755 --- a/gnuradio-core/src/examples/network/vector_sink.py +++ b/gnuradio-core/src/examples/network/vector_sink.py @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -30,7 +31,7 @@ class vector_sink(gr.top_block): udp = gr.udp_source(gr.sizeof_float, host, port, pkt_size, eof=eof, wait=wait) - sink = gr.file_sink(gr.sizeof_float, "received.dat") + sink = blocks.file_sink(gr.sizeof_float, "received.dat") self.connect(udp, sink) if __name__ == "__main__": diff --git a/gnuradio-core/src/lib/io/CMakeLists.txt b/gnuradio-core/src/lib/io/CMakeLists.txt index 7d1572ca70..afd1d46b3e 100644 --- a/gnuradio-core/src/lib/io/CMakeLists.txt +++ b/gnuradio-core/src/lib/io/CMakeLists.txt @@ -78,11 +78,6 @@ endif(ENABLE_PYTHON) # Handle triple-threat files that have cc, h, and i ######################################################################## set(gr_core_io_triple_threats - gr_file_sink - gr_file_sink_base - gr_file_source - gr_file_descriptor_sink - gr_file_descriptor_source microtune_xxxx_eval_board microtune_4702_eval_board microtune_4937_eval_board diff --git a/gnuradio-core/src/lib/io/gr_file_descriptor_sink.cc b/gnuradio-core/src/lib/io/gr_file_descriptor_sink.cc deleted file mode 100644 index 099d46dbd0..0000000000 --- a/gnuradio-core/src/lib/io/gr_file_descriptor_sink.cc +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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 3, 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_file_descriptor_sink.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <stdio.h> - -#ifdef HAVE_IO_H -#include <io.h> -#endif - -gr_file_descriptor_sink::gr_file_descriptor_sink (size_t itemsize, int fd) - : gr_sync_block ("file_descriptor_sink", - gr_make_io_signature (1, 1, itemsize), - gr_make_io_signature (0, 0, 0)), - d_itemsize (itemsize), d_fd (fd) -{ -} - -gr_file_descriptor_sink_sptr -gr_make_file_descriptor_sink (size_t itemsize, int fd) -{ - return gnuradio::get_initial_sptr(new gr_file_descriptor_sink (itemsize, fd)); -} - -gr_file_descriptor_sink::~gr_file_descriptor_sink () -{ - close (d_fd); -} - -int -gr_file_descriptor_sink::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - char *inbuf = (char *) input_items[0]; - unsigned long byte_size = noutput_items * d_itemsize; - - while (byte_size > 0){ - ssize_t r; - - r = write (d_fd, inbuf, byte_size); - if (r == -1){ - if (errno == EINTR) - continue; - else { - perror ("gr_file_descriptor_sink"); - return -1; // indicate we're done - } - } - else { - byte_size -= r; - inbuf += r; - } - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/io/gr_file_descriptor_sink.h b/gnuradio-core/src/lib/io/gr_file_descriptor_sink.h deleted file mode 100644 index 3b1c1167f7..0000000000 --- a/gnuradio-core/src/lib/io/gr_file_descriptor_sink.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- 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 3, 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_FILE_DESCRIPTOR_SINK_H -#define INCLUDED_GR_FILE_DESCRIPTOR_SINK_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_file_descriptor_sink; -typedef boost::shared_ptr<gr_file_descriptor_sink> gr_file_descriptor_sink_sptr; - -GR_CORE_API gr_file_descriptor_sink_sptr gr_make_file_descriptor_sink (size_t itemsize, int fd); - -/*! - * \brief Write stream to file descriptor. - * \ingroup sink_blk - */ - -class GR_CORE_API gr_file_descriptor_sink : public gr_sync_block -{ - friend GR_CORE_API gr_file_descriptor_sink_sptr gr_make_file_descriptor_sink (size_t itemsize, int fd); - - private: - size_t d_itemsize; - int d_fd; - - protected: - gr_file_descriptor_sink (size_t itemsize, int fd); - - public: - ~gr_file_descriptor_sink (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_FILE_DESCRIPTOR_SINK_H */ diff --git a/gnuradio-core/src/lib/io/gr_file_descriptor_sink.i b/gnuradio-core/src/lib/io/gr_file_descriptor_sink.i deleted file mode 100644 index 2c256e44d1..0000000000 --- a/gnuradio-core/src/lib/io/gr_file_descriptor_sink.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- 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 3, 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,file_descriptor_sink) - -gr_file_descriptor_sink_sptr -gr_make_file_descriptor_sink (size_t itemsize, int fd); - -class gr_file_descriptor_sink : public gr_sync_block -{ - protected: - gr_file_descriptor_sink (size_t itemsize, int fd); - - public: - ~gr_file_descriptor_sink (); -}; diff --git a/gnuradio-core/src/lib/io/gr_file_descriptor_source.cc b/gnuradio-core/src/lib/io/gr_file_descriptor_source.cc deleted file mode 100644 index a63abf96b7..0000000000 --- a/gnuradio-core/src/lib/io/gr_file_descriptor_source.cc +++ /dev/null @@ -1,151 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2005 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 3, 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_file_descriptor_source.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <stdio.h> -#include <string.h> - -#ifdef HAVE_IO_H -#include <io.h> -#endif - -gr_file_descriptor_source::gr_file_descriptor_source (size_t itemsize, - int fd, - bool repeat) - : gr_sync_block ("file_descriptor_source", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (1, 1, itemsize)), - d_itemsize (itemsize), d_fd (fd), d_repeat (repeat), - d_residue (new unsigned char[itemsize]), d_residue_len (0) -{ -} - -// public constructor that returns a shared_ptr - -gr_file_descriptor_source_sptr -gr_make_file_descriptor_source (size_t itemsize, int fd, bool repeat) -{ - return gr_file_descriptor_source_sptr ( - new gr_file_descriptor_source (itemsize, fd, repeat)); -} - -gr_file_descriptor_source::~gr_file_descriptor_source () -{ - close (d_fd); - delete [] d_residue; -} - -int -gr_file_descriptor_source::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (noutput_items > 0); - - char *o = (char *) output_items[0]; - int nread = 0; - - while (1){ - int r = read_items (o, noutput_items - nread); - if (r == -1){ - if (errno == EINTR) - continue; - else { - perror ("file_descriptor_source[read]"); - return -1; - } - } - else if (r == 0){ // end of file - if (!d_repeat) - break; - else { - flush_residue (); - if (lseek (d_fd, 0, SEEK_SET) == -1){ - perror ("file_descriptor_source[lseek]"); - return -1; - } - } - } - else { - o += r * d_itemsize; - nread += r; - break; - } - } - - if (nread == 0) // EOF - return -1; - - return nread; -} - -int -gr_file_descriptor_source::read_items (char *buf, int nitems) -{ - assert (nitems > 0); - assert (d_residue_len < d_itemsize); - - int nbytes_read = 0; - - if (d_residue_len > 0){ - memcpy (buf, d_residue, d_residue_len); - nbytes_read = d_residue_len; - d_residue_len = 0; - } - - int r = read (d_fd, buf + nbytes_read, nitems * d_itemsize - nbytes_read); - if (r <= 0){ - handle_residue (buf, nbytes_read); - return r; - } - - r = handle_residue (buf, r + nbytes_read); - - if (r == 0) // block until we get something - return read_items (buf, nitems); - - return r; -} - -int -gr_file_descriptor_source::handle_residue (char *buf, int nbytes_read) -{ - assert (nbytes_read >= 0); - int nitems_read = nbytes_read / d_itemsize; - d_residue_len = nbytes_read % d_itemsize; - if (d_residue_len > 0){ - // fprintf (stderr, "handle_residue: %d\n", d_residue_len); - memcpy (d_residue, buf + nbytes_read - d_residue_len, d_residue_len); - } - return nitems_read; -} diff --git a/gnuradio-core/src/lib/io/gr_file_descriptor_source.h b/gnuradio-core/src/lib/io/gr_file_descriptor_source.h deleted file mode 100644 index ebabd81eda..0000000000 --- a/gnuradio-core/src/lib/io/gr_file_descriptor_source.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- 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 3, 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_FILE_DESCRIPTOR_SOURCE_H -#define INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_file_descriptor_source; -typedef boost::shared_ptr<gr_file_descriptor_source> gr_file_descriptor_source_sptr; - -GR_CORE_API gr_file_descriptor_source_sptr -gr_make_file_descriptor_source (size_t itemsize, int fd, bool repeat = false); - -/*! - * \brief Read stream from file descriptor. - * \ingroup source_blk - */ - -class GR_CORE_API gr_file_descriptor_source : public gr_sync_block -{ - friend GR_CORE_API gr_file_descriptor_source_sptr - gr_make_file_descriptor_source (size_t itemsize, int fd, bool repeat); - private: - size_t d_itemsize; - int d_fd; - bool d_repeat; - - unsigned char *d_residue; - unsigned long d_residue_len; - - protected: - gr_file_descriptor_source (size_t itemsize, int fd, bool repeat); - - int read_items (char *buf, int nitems); - int handle_residue (char *buf, int nbytes_read); - void flush_residue () { d_residue_len = 0; } - - - public: - ~gr_file_descriptor_source (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_FILE_DESCRIPTOR_SOURCE_H */ diff --git a/gnuradio-core/src/lib/io/gr_file_descriptor_source.i b/gnuradio-core/src/lib/io/gr_file_descriptor_source.i deleted file mode 100644 index 3ca0825225..0000000000 --- a/gnuradio-core/src/lib/io/gr_file_descriptor_source.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- 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 3, 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,file_descriptor_source) - -gr_file_descriptor_source_sptr -gr_make_file_descriptor_source (size_t itemsize, int fd, bool repeat=false); - -class gr_file_descriptor_source : public gr_sync_block -{ - protected: - gr_file_descriptor_source (size_t itemsize, int fd, bool repeat); - - public: - ~gr_file_descriptor_source (); -}; diff --git a/gnuradio-core/src/lib/io/gr_file_sink.cc b/gnuradio-core/src/lib/io/gr_file_sink.cc deleted file mode 100644 index 10c8360cb6..0000000000 --- a/gnuradio-core/src/lib/io/gr_file_sink.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,2007,2010 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 3, 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_file_sink.h> -#include <gr_io_signature.h> -#include <stdexcept> - - -gr_file_sink_sptr -gr_make_file_sink (size_t itemsize, const char *filename) -{ - return gnuradio::get_initial_sptr(new gr_file_sink (itemsize, filename)); -} - -gr_file_sink::gr_file_sink(size_t itemsize, const char *filename) - : gr_sync_block ("file_sink", - gr_make_io_signature(1, 1, itemsize), - gr_make_io_signature(0, 0, 0)), - gr_file_sink_base(filename, true), - d_itemsize(itemsize) -{ -} - -gr_file_sink::~gr_file_sink () -{ -} - -int -gr_file_sink::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - char *inbuf = (char*)input_items[0]; - int nwritten = 0; - - do_update(); // update d_fp is reqd - - if(!d_fp) - return noutput_items; // drop output on the floor - - while(nwritten < noutput_items) { - int count = fwrite(inbuf, d_itemsize, noutput_items - nwritten, d_fp); - if(count == 0) { - if(ferror(d_fp)) { - std::stringstream s; - s << "file_sink write failed with error " << fileno(d_fp) << std::endl; - throw std::runtime_error(s.str()); - } - else { // is EOF - break; - } - } - nwritten += count; - inbuf += count * d_itemsize; - } - - if(d_unbuffered) - fflush (d_fp); - - return nwritten; -} diff --git a/gnuradio-core/src/lib/io/gr_file_sink.h b/gnuradio-core/src/lib/io/gr_file_sink.h deleted file mode 100644 index e40ec9ab8d..0000000000 --- a/gnuradio-core/src/lib/io/gr_file_sink.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 3, 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_FILE_SINK_H -#define INCLUDED_GR_FILE_SINK_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_file_sink_base.h> - -class gr_file_sink; -typedef boost::shared_ptr<gr_file_sink> gr_file_sink_sptr; - -GR_CORE_API gr_file_sink_sptr gr_make_file_sink(size_t itemsize, const char *filename); - -/*! - * \brief Write stream to file. - * \ingroup sink_blk - */ - -class GR_CORE_API gr_file_sink : public gr_sync_block, public gr_file_sink_base -{ - friend GR_CORE_API gr_file_sink_sptr gr_make_file_sink(size_t itemsize, const char *filename); - - private: - size_t d_itemsize; - - protected: - gr_file_sink(size_t itemsize, const char *filename); - - public: - ~gr_file_sink(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_FILE_SINK_H */ diff --git a/gnuradio-core/src/lib/io/gr_file_sink.i b/gnuradio-core/src/lib/io/gr_file_sink.i deleted file mode 100644 index 47ab9e9649..0000000000 --- a/gnuradio-core/src/lib/io/gr_file_sink.i +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- 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 3, 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,file_sink) - -gr_file_sink_sptr -gr_make_file_sink (size_t itemsize, const char *filename); - -class gr_file_sink : public gr_sync_block, public gr_file_sink_base -{ - protected: - gr_file_sink (size_t itemsize, const char *filename); - - public: - ~gr_file_sink (); - - /*! - * \brief open filename and begin output to it. - */ - bool open(const char *filename); - - /*! - * \brief close current output file. - */ - void close(); -}; diff --git a/gnuradio-core/src/lib/io/gr_file_sink_base.cc b/gnuradio-core/src/lib/io/gr_file_sink_base.cc deleted file mode 100644 index d0aca418e7..0000000000 --- a/gnuradio-core/src/lib/io/gr_file_sink_base.cc +++ /dev/null @@ -1,125 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,2007,2009 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 3, 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_file_sink_base.h> -#include <cstdio> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <stdio.h> -#include <gruel/thread.h> - -// win32 (mingw/msvc) specific -#ifdef HAVE_IO_H -#include <io.h> -#endif -#ifdef O_BINARY -#define OUR_O_BINARY O_BINARY -#else -#define OUR_O_BINARY 0 -#endif - -// should be handled via configure -#ifdef O_LARGEFILE -#define OUR_O_LARGEFILE O_LARGEFILE -#else -#define OUR_O_LARGEFILE 0 -#endif - -gr_file_sink_base::gr_file_sink_base(const char *filename, bool is_binary) - : d_fp(0), d_new_fp(0), d_updated(false), d_is_binary(is_binary) -{ - if (!open(filename)) - throw std::runtime_error ("can't open file"); -} - -gr_file_sink_base::~gr_file_sink_base () -{ - close(); - if (d_fp){ - fclose(d_fp); - d_fp = 0; - } -} - -bool -gr_file_sink_base::open(const char *filename) -{ - gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this function - - // we use the open system call to get access to the O_LARGEFILE flag. - int fd; - if ((fd = ::open (filename, - O_WRONLY|O_CREAT|O_TRUNC|OUR_O_LARGEFILE|OUR_O_BINARY, - 0664)) < 0){ - perror (filename); - return false; - } - if (d_new_fp){ // if we've already got a new one open, close it - fclose(d_new_fp); - d_new_fp = 0; - } - - if ((d_new_fp = fdopen (fd, d_is_binary ? "wb" : "w")) == NULL){ - perror (filename); - ::close(fd); // don't leak file descriptor if fdopen fails. - } - - d_updated = true; - return d_new_fp != 0; -} - -void -gr_file_sink_base::close() -{ - gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this function - - if (d_new_fp){ - fclose(d_new_fp); - d_new_fp = 0; - } - d_updated = true; -} - -void -gr_file_sink_base::do_update() -{ - if (d_updated){ - gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this block - if (d_fp) - fclose(d_fp); - d_fp = d_new_fp; // install new file pointer - d_new_fp = 0; - d_updated = false; - } -} - -void -gr_file_sink_base::set_unbuffered(bool unbuffered) -{ - d_unbuffered = unbuffered; -} diff --git a/gnuradio-core/src/lib/io/gr_file_sink_base.h b/gnuradio-core/src/lib/io/gr_file_sink_base.h deleted file mode 100644 index 8a70cee768..0000000000 --- a/gnuradio-core/src/lib/io/gr_file_sink_base.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2007,2008 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 3, 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_FILE_SINK_BASE_H -#define INCLUDED_GR_FILE_SINK_BASE_H - -#include <gr_core_api.h> -#include <boost/thread.hpp> -#include <cstdio> - -/*! - * \brief Common base class for file sinks - */ -class GR_CORE_API gr_file_sink_base -{ - protected: - FILE *d_fp; // current FILE pointer - FILE *d_new_fp; // new FILE pointer - bool d_updated; // is there a new FILE pointer? - bool d_is_binary; - boost::mutex d_mutex; - bool d_unbuffered; - - protected: - gr_file_sink_base(const char *filename, bool is_binary); - - public: - ~gr_file_sink_base(); - - /*! - * \brief Open filename and begin output to it. - */ - bool open(const char *filename); - - /*! - * \brief Close current output file. - * - * Closes current output file and ignores any output until - * open is called to connect to another file. - */ - void close(); - - /*! - * \brief if we've had an update, do it now. - */ - void do_update(); - - - /*! - * \brief turn on unbuffered writes for slower outputs - */ - void set_unbuffered(bool unbuffered); -}; - - -#endif /* INCLUDED_GR_FILE_SINK_BASE_H */ diff --git a/gnuradio-core/src/lib/io/gr_file_sink_base.i b/gnuradio-core/src/lib/io/gr_file_sink_base.i deleted file mode 100644 index 993dba2770..0000000000 --- a/gnuradio-core/src/lib/io/gr_file_sink_base.i +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- 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 3, 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -class gr_file_sink_base -{ - protected: - gr_file_sink_base(const char *filename, bool is_binary); - - public: - ~gr_file_sink_base(); - - /*! - * \brief Open filename and begin output to it. - */ - bool open(const char *filename); - - /*! - * \brief Close current output file. - * - * Closes current output file and ignores any output until - * open is called to connect to another file. - */ - void close(); - - /*! - * \brief if we've had an update, do it now. - */ - void do_update(); - - /*! - *\brief turn on unbuffered mode for slow outputs - */ - void set_unbuffered(bool unbuffered); -}; diff --git a/gnuradio-core/src/lib/io/gr_file_source.cc b/gnuradio-core/src/lib/io/gr_file_source.cc deleted file mode 100644 index 6da7abac21..0000000000 --- a/gnuradio-core/src/lib/io/gr_file_source.cc +++ /dev/null @@ -1,192 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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 3, 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 <gruel/thread.h> -#include <gr_file_source.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <stdio.h> - -// win32 (mingw/msvc) specific -#ifdef HAVE_IO_H -#include <io.h> -#endif -#ifdef O_BINARY -#define OUR_O_BINARY O_BINARY -#else -#define OUR_O_BINARY 0 -#endif -// should be handled via configure -#ifdef O_LARGEFILE -#define OUR_O_LARGEFILE O_LARGEFILE -#else -#define OUR_O_LARGEFILE 0 -#endif - -gr_file_source::gr_file_source(size_t itemsize, const char *filename, bool repeat) - : gr_sync_block("file_source", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (1, 1, itemsize)), - d_itemsize(itemsize), d_fp(0), d_new_fp (0), d_repeat(repeat), - d_updated(false) -{ - open(filename, repeat); -} - -// public constructor that returns a shared_ptr - -gr_file_source_sptr -gr_make_file_source (size_t itemsize, const char *filename, bool repeat) -{ - return gnuradio::get_initial_sptr(new gr_file_source (itemsize, filename, repeat)); -} - -gr_file_source::~gr_file_source () -{ - close(); - if(d_fp) { - fclose(d_fp); - d_fp = 0; - } -} - -int -gr_file_source::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - char *o = (char *) output_items[0]; - int i; - int size = noutput_items; - - do_update(); // update d_fp is reqd - if(d_fp == NULL) - throw std::runtime_error("work with file not open"); - - gruel::scoped_lock lock(fp_mutex); // hold for the rest of this function - while (size) { - i = fread(o, d_itemsize, size, (FILE *) d_fp); - - size -= i; - o += i * d_itemsize; - - if (size == 0) // done - break; - - if (i > 0) // short read, try again - continue; - - // We got a zero from fread. This is either EOF or error. In - // any event, if we're in repeat mode, seek back to the beginning - // of the file and try again, else break - - if (!d_repeat) - break; - - if (fseek ((FILE *) d_fp, 0, SEEK_SET) == -1) { - std::stringstream s; - s << "[" << __FILE__ << "]" << " fseek failed" << std::endl; - throw std::runtime_error(s.str()); - } - } - - if (size > 0){ // EOF or error - if (size == noutput_items) // we didn't read anything; say we're done - return -1; - return noutput_items - size; // else return partial result - } - - return noutput_items; -} - -bool -gr_file_source::seek (long seek_point, int whence) -{ - // obtain exclusive access for duration of this function - gruel::scoped_lock lock(fp_mutex); - return fseek((FILE *) d_fp, seek_point * d_itemsize, whence) == 0; -} - -void -gr_file_source::open(const char *filename, bool repeat) -{ - // obtain exclusive access for duration of this function - gruel::scoped_lock lock(fp_mutex); - - int fd; - - // we use "open" to use to the O_LARGEFILE flag - if((fd = ::open(filename, O_RDONLY | OUR_O_LARGEFILE | OUR_O_BINARY)) < 0) { - perror(filename); - throw std::runtime_error("can't open file"); - } - - if(d_new_fp) { - fclose(d_new_fp); - d_new_fp = 0; - } - - if((d_new_fp = fdopen (fd, "rb")) == NULL) { - perror(filename); - ::close(fd); // don't leak file descriptor if fdopen fails - throw std::runtime_error("can't open file"); - } - - d_updated = true; - d_repeat = repeat; -} - -void -gr_file_source::close() -{ - // obtain exclusive access for duration of this function - gruel::scoped_lock lock(fp_mutex); - - if(d_new_fp != NULL) { - fclose(d_new_fp); - d_new_fp = NULL; - } - d_updated = true; -} - -void -gr_file_source::do_update() -{ - if(d_updated) { - gruel::scoped_lock lock(fp_mutex); // hold while in scope - - if(d_fp) - fclose(d_fp); - - d_fp = d_new_fp; // install new file pointer - d_new_fp = 0; - d_updated = false; - } -} diff --git a/gnuradio-core/src/lib/io/gr_file_source.h b/gnuradio-core/src/lib/io/gr_file_source.h deleted file mode 100644 index 0478fba04b..0000000000 --- a/gnuradio-core/src/lib/io/gr_file_source.h +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- 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 3, 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_FILE_SOURCE_H -#define INCLUDED_GR_FILE_SOURCE_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <boost/thread/mutex.hpp> - -class gr_file_source; -typedef boost::shared_ptr<gr_file_source> gr_file_source_sptr; - -GR_CORE_API gr_file_source_sptr -gr_make_file_source (size_t itemsize, const char *filename, bool repeat = false); - -/*! - * \brief Read stream from file - * \ingroup source_blk - */ - -class GR_CORE_API gr_file_source : public gr_sync_block -{ - private: - size_t d_itemsize; - FILE *d_fp; - FILE *d_new_fp; - bool d_repeat; - bool d_updated; - - protected: - gr_file_source(size_t itemsize, const char *filename, bool repeat); - - void do_update(); - - boost::mutex fp_mutex; - - public: - /*! - * \brief Create a file source. - * - * Opens \p filename as a source of items into a flowgraph. The data - * is expected to be in binary format, item after item. The \p - * itemsize of the block determines the conversion from bits to - * items. - * - * If \p repeat is turned on, the file will repeat the file after - * it's reached the end. - * - * \param itemsize the size of each item in the file, in bytes - * \param filename name of the file to source from - * \param repeat repeat file from start - */ - friend GR_CORE_API gr_file_source_sptr - gr_make_file_source(size_t itemsize, - const char *filename, - bool repeat); - - ~gr_file_source(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - /*! - * \brief Seek file to \p seek_point relative to \p whence - * - * \param seek_point sample offset in file - * \param whence one of SEEK_SET, SEEK_CUR, SEEK_END (man fseek) - */ - bool seek(long seek_point, int whence); - - /*! - * \brief Opens a new file. - * - * \param filename name of the file to source from - * \param repeat repeat file from start - */ - void open(const char *filename, bool repeat); - - /*! - * \brief Close the file handle. - */ - void close(); - -}; - -#endif /* INCLUDED_GR_FILE_SOURCE_H */ diff --git a/gnuradio-core/src/lib/io/gr_file_source.i b/gnuradio-core/src/lib/io/gr_file_source.i deleted file mode 100644 index e71cef0d14..0000000000 --- a/gnuradio-core/src/lib/io/gr_file_source.i +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- 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 3, 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. - */ - - -%constant int SEEK_SET = 0; /* Seek from beginning of file. */ -%constant int SEEK_CUR = 1; /* Seek from current position. */ -%constant int SEEK_END = 2; /* Seek from end of file. */ - - -GR_SWIG_BLOCK_MAGIC(gr,file_source) - -gr_file_source_sptr -gr_make_file_source (size_t itemsize, const char *filename, bool repeat=false); - -class gr_file_source : public gr_sync_block -{ - protected: - gr_file_source (size_t itemsize, const char *filename, bool repeat); - - public: - ~gr_file_source (); - - bool seek (long seek_point, int whence); - void open (const char *filename, bool repeat); - void close(); -}; diff --git a/gnuradio-core/src/lib/io/io.i b/gnuradio-core/src/lib/io/io.i index b1fcde6d15..5cbb8620a3 100644 --- a/gnuradio-core/src/lib/io/io.i +++ b/gnuradio-core/src/lib/io/io.i @@ -26,10 +26,6 @@ #include "config.h" #endif -#include <gr_file_sink.h> -#include <gr_file_source.h> -#include <gr_file_descriptor_sink.h> -#include <gr_file_descriptor_source.h> #include <gr_histo_sink_f.h> #include <microtune_4702_eval_board.h> #include <microtune_4937_eval_board.h> @@ -41,11 +37,6 @@ #include <gr_udp_source.h> %} -%include "gr_file_sink_base.i" -%include "gr_file_sink.i" -%include "gr_file_source.i" -%include "gr_file_descriptor_sink.i" -%include "gr_file_descriptor_source.i" %include "gr_histo_sink.i" %include "microtune_xxxx_eval_board.i" %include "microtune_4702_eval_board.i" diff --git a/gnuradio-core/src/lib/runtime/gr_top_block.h b/gnuradio-core/src/lib/runtime/gr_top_block.h index cb99752f37..694e9575b4 100644 --- a/gnuradio-core/src/lib/runtime/gr_top_block.h +++ b/gnuradio-core/src/lib/runtime/gr_top_block.h @@ -83,7 +83,7 @@ public: /*! * Wait for a flowgraph to complete. Flowgraphs complete when * either (1) all blocks indicate that they are done (typically only - * when using gr.file_source, or gr.head, or (2) after stop() has been + * when using blocks.file_source, or gr.head, or (2) after stop() has been * called to request shutdown. Calling wait on a top_block that is * not running IS NOT an error (wait returns w/o blocking). */ diff --git a/gr-analog/python/qa_agc.py b/gr-analog/python/qa_agc.py index 2733ed3fae..263f9a647e 100755 --- a/gr-analog/python/qa_agc.py +++ b/gr-analog/python/qa_agc.py @@ -24,14 +24,12 @@ from gnuradio import gr, gr_unittest import analog_swig as analog import math -test_output = False +class test_agc(gr_unittest.TestCase): -class test_agc (gr_unittest.TestCase): + def setUp(self): + self.tb = gr.top_block() - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): + def tearDown(self): self.tb = None @@ -116,9 +114,6 @@ class test_agc (gr_unittest.TestCase): tb.connect(head, agc) tb.connect(agc, dst1) - if test_output == True: - tb.connect(agc, gr.file_sink(gr.sizeof_gr_complex, "test_agc_cc.dat")) - tb.run() dst_data = dst1.data() self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 4) @@ -204,9 +199,6 @@ class test_agc (gr_unittest.TestCase): tb.connect (head, agc) tb.connect (agc, dst1) - if test_output == True: - tb.connect (agc, gr.file_sink(gr.sizeof_float, "test_agc_ff.dat")) - tb.run () dst_data = dst1.data () self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 4) @@ -294,9 +286,6 @@ class test_agc (gr_unittest.TestCase): tb.connect(head, agc) tb.connect(agc, dst1) - if test_output == True: - tb.connect(agc, gr.file_sink(gr.sizeof_gr_complex, "test_agc2_cc.dat")) - tb.run() dst_data = dst1.data() self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 4) @@ -384,9 +373,6 @@ class test_agc (gr_unittest.TestCase): tb.connect(head, agc) tb.connect(agc, dst1) - if test_output == True: - tb.connect(agc, gr.file_sink(gr.sizeof_float, "test_agc2_ff.dat")) - tb.run() dst_data = dst1.data() self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 4) @@ -460,9 +446,6 @@ class test_agc (gr_unittest.TestCase): tb.connect(head, agc) tb.connect(agc, dst1) - if test_output == True: - tb.connect(agc, gr.file_sink(gr.sizeof_gr_complex, "test_agc2_cc.dat")) - tb.run() dst_data = dst1.data() self.assertComplexTuplesAlmostEqual(expected_result, dst_data, 4) @@ -481,10 +464,6 @@ class test_agc (gr_unittest.TestCase): dst = gr.vector_sink_c() self.tb.connect(src, agc, dst) - if test_output == True: - self.tb.connect(agc, gr.file_sink(gr.sizeof_gr_complex, - "test_feedforward_cc.dat")) - self.tb.run() dst_data = dst.data()[0:len(expected_result)] diff --git a/gr-atsc/src/python/all_atsc.py b/gr-atsc/src/python/all_atsc.py index 6fcb02fda7..7cac785149 100644 --- a/gr-atsc/src/python/all_atsc.py +++ b/gr-atsc/src/python/all_atsc.py @@ -49,7 +49,7 @@ def graph (args): tb = gr.top_block () # Convert to a from shorts to a stream of complex numbers. - srcf = gr.file_source (gr.sizeof_short,infile) + srcf = blocks.file_source (gr.sizeof_short,infile) s2ss = blocks.stream_to_streams(gr.sizeof_short,2) s2f1 = blocks.short_to_float() s2f2 = blocks.short_to_float() @@ -128,10 +128,10 @@ def graph (args): rs_dec = atsc.rs_decoder() derand = atsc.derandomizer() depad = atsc.depad() - dst = gr.file_sink(gr.sizeof_char, outfile) + dst = blocks.file_sink(gr.sizeof_char, outfile) tb.connect(fsd, viterbi, deinter, rs_dec, derand, depad, dst) - dst2 = gr.file_sink(gr.sizeof_gr_complex, "atsc_complex.data") + dst2 = blocks.file_sink(gr.sizeof_gr_complex, "atsc_complex.data") tb.connect(src0, dst2) tb.run () diff --git a/gr-atsc/src/python/btl-fsd.py b/gr-atsc/src/python/btl-fsd.py index 826e71016c..6bcab3dce3 100755 --- a/gr-atsc/src/python/btl-fsd.py +++ b/gr-atsc/src/python/btl-fsd.py @@ -22,6 +22,7 @@ from gnuradio import gr from gnuradio import atsc +from gnuradio import blocks import os print os.getpid() @@ -33,9 +34,9 @@ fsc = atsc.fs_checker() eq = atsc.equalizer() fsd = atsc.field_sync_demux() -out_data = gr.file_sink(atsc.sizeof_atsc_soft_data_segment,"/tmp/atsc_pipe_5") +out_data = blocks.file_sink(atsc.sizeof_atsc_soft_data_segment,"/tmp/atsc_pipe_5") -inp = gr.file_source(gr.sizeof_float,"/tmp/atsc_pipe_3") +inp = blocks.file_source(gr.sizeof_float,"/tmp/atsc_pipe_3") tb.connect(inp,btl) tb.connect((btl,0),(fsc,0),(eq,0),(fsd,0)) diff --git a/gr-atsc/src/python/fpll.py b/gr-atsc/src/python/fpll.py index 69749420b4..dee81da13d 100755 --- a/gr-atsc/src/python/fpll.py +++ b/gr-atsc/src/python/fpll.py @@ -31,7 +31,7 @@ def main(): tb = gr.top_block() - u = gr.file_source(gr.sizeof_float,"/tmp/atsc_pipe_2") + u = blocks.file_source(gr.sizeof_float,"/tmp/atsc_pipe_2") input_rate = 19.2e6 IF_freq = 5.75e6 @@ -69,8 +69,8 @@ def main(): iir = filter.single_pole_iir_filter_ff(alpha) remove_dc = blocks.sub_ff() - out = gr.file_sink(gr.sizeof_float,"/tmp/atsc_pipe_3") - # out = gr.file_sink(gr.sizeof_float,"/mnt/sata/atsc_data_float") + out = blocks.file_sink(gr.sizeof_float,"/tmp/atsc_pipe_3") + # out = blocks.file_sink(gr.sizeof_float,"/mnt/sata/atsc_data_float") tb.connect(u, fpll, lp_filter) tb.connect(lp_filter, iir) diff --git a/gr-atsc/src/python/interp.py b/gr-atsc/src/python/interp.py index 39e1caea0d..ee2d234892 100755 --- a/gr-atsc/src/python/interp.py +++ b/gr-atsc/src/python/interp.py @@ -32,6 +32,7 @@ # then at 0 with edges at -3.2MHz and 3.2MHz. from gnuradio import gr +from gnuradio import blocks import sys def graph(args): @@ -45,13 +46,13 @@ def graph(args): tb = gr.top_block() - src0 = gr.file_source(gr.sizeof_gr_complex, infile) + src0 = blocks.file_source(gr.sizeof_gr_complex, infile) lp_coeffs = filter.firdes.low_pass(3, 19.2e6, 3.2e6, .5e6, filter.firdes.WIN_HAMMING ) lp = filter.interp_fir_filter_ccf(1, lp_coeffs) - file = gr.file_sink(gr.sizeof_gr_complex, "/tmp/atsc_pipe_1") + file = blocks.file_sink(gr.sizeof_gr_complex, "/tmp/atsc_pipe_1") tb.connect(src0, lp, file) diff --git a/gr-atsc/src/python/interp_short.py b/gr-atsc/src/python/interp_short.py index 749d15d0a7..d07b941c12 100755 --- a/gr-atsc/src/python/interp_short.py +++ b/gr-atsc/src/python/interp_short.py @@ -50,7 +50,7 @@ def graph (args): tb = gr.top_block() - srcf = gr.file_source(gr.sizeof_short,infile) + srcf = blocks.file_source(gr.sizeof_short,infile) s2ss = blocks.stream_to_streams(gr.sizeof_short,2) s2f1 = blocks.short_to_float() s2f2 = blocks.short_to_float() @@ -61,7 +61,7 @@ def graph (args): filter.firdes.WIN_HAMMING) lp = filter.interp_fir_filter_ccf(3, lp_coeffs) - file = gr.file_sink(gr.sizeof_gr_complex,"/tmp/atsc_pipe_1") + file = blocks.file_sink(gr.sizeof_gr_complex,"/tmp/atsc_pipe_1") tb.connect( srcf, s2ss ) tb.connect( (s2ss, 0), s2f1, (src0,0) ) diff --git a/gr-atsc/src/python/viterbi-out.py b/gr-atsc/src/python/viterbi-out.py index 67edd99b25..cc60ffda42 100755 --- a/gr-atsc/src/python/viterbi-out.py +++ b/gr-atsc/src/python/viterbi-out.py @@ -21,6 +21,7 @@ # from gnuradio import gr, atsc +from gnuradio import blocks import sys, os def main(args): @@ -36,13 +37,13 @@ def main(args): tb = gr.top_block() - src = gr.file_source(atsc.sizeof_atsc_soft_data_segment, "/tmp/atsc_pipe_5") + src = blocks.file_source(atsc.sizeof_atsc_soft_data_segment, "/tmp/atsc_pipe_5") viterbi = atsc.viterbi_decoder() deinter = atsc.deinterleaver() rs_dec = atsc.rs_decoder() derand = atsc.derandomizer() depad = atsc.depad() - dst = gr.file_sink(gr.sizeof_char,outfile) + dst = blocks.file_sink(gr.sizeof_char,outfile) tb.connect(src, viterbi, deinter, rs_dec, derand, depad, dst) tb.run () diff --git a/gr-atsc/src/python/xlate.py b/gr-atsc/src/python/xlate.py index ca7aa667e7..3d049ac524 100755 --- a/gr-atsc/src/python/xlate.py +++ b/gr-atsc/src/python/xlate.py @@ -42,13 +42,13 @@ def graph (): tb = gr.top_block () - src0 = gr.file_source(gr.sizeof_gr_complex,"/tmp/atsc_pipe_1") + src0 = blocks.file_source(gr.sizeof_gr_complex,"/tmp/atsc_pipe_1") duc_coeffs = filter.firdes.low_pass( 1, 19.2e6, 9e6, 1e6, filter.firdes.WIN_HAMMING ) duc = filter.freq_xlating_fir_filter_ccf( 1 duc_coeffs, 5.75e6, 19.2e6 ) c2f = blocks.complex_to_float() - file = gr.file_sink(gr.sizeof_float,"/tmp/atsc_pipe_2") + file = blocks.file_sink(gr.sizeof_float,"/tmp/atsc_pipe_2") tb.connect( src0, duc, c2f, file ) diff --git a/gr-audio/examples/python/audio_play.py b/gr-audio/examples/python/audio_play.py index 465590f69f..94ea72498d 100755 --- a/gr-audio/examples/python/audio_play.py +++ b/gr-audio/examples/python/audio_play.py @@ -22,6 +22,7 @@ from gnuradio import gr from gnuradio import audio +from gnuradio import blocks from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -45,7 +46,7 @@ class my_top_block(gr.top_block): raise SystemExit, 1 sample_rate = int(options.sample_rate) - src = gr.file_source (gr.sizeof_float, options.filename, options.repeat) + src = blocks.file_source (gr.sizeof_float, options.filename, options.repeat) dst = audio.sink (sample_rate, options.audio_output) self.connect(src, dst) diff --git a/gr-audio/examples/python/audio_to_file.py b/gr-audio/examples/python/audio_to_file.py index 3f7a4f8d1c..201ec90bf1 100755 --- a/gr-audio/examples/python/audio_to_file.py +++ b/gr-audio/examples/python/audio_to_file.py @@ -22,6 +22,7 @@ from gnuradio import gr from gnuradio import audio +from gnuradio import blocks from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -47,7 +48,7 @@ class my_top_block(gr.top_block): sample_rate = int(options.sample_rate) src = audio.source (sample_rate, options.audio_input) - dst = gr.file_sink (gr.sizeof_float, filename) + dst = blocks.file_sink (gr.sizeof_float, filename) if options.nsamples is None: self.connect((src, 0), dst) diff --git a/gr-blocks/examples/metadata/file_metadata_source.grc b/gr-blocks/examples/metadata/file_metadata_source.grc index f45c151d3f..5d0a0417a8 100644 --- a/gr-blocks/examples/metadata/file_metadata_source.grc +++ b/gr-blocks/examples/metadata/file_metadata_source.grc @@ -209,10 +209,10 @@ </param> </block> <block> - <key>gr_file_sink</key> + <key>blocks_file_sink</key> <param> <key>id</key> - <value>gr_file_sink_1</value> + <value>blocks_file_sink_1</value> </param> <param> <key>_enabled</key> @@ -319,7 +319,7 @@ </block> <connection> <source_block_id>blocks_throttle_0</source_block_id> - <sink_block_id>gr_file_sink_1</sink_block_id> + <sink_block_id>blocks_file_sink_1</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-blocks/examples/metadata/file_metadata_vector_source.grc b/gr-blocks/examples/metadata/file_metadata_vector_source.grc index 584a033c2d..3c2dda9ded 100644 --- a/gr-blocks/examples/metadata/file_metadata_vector_source.grc +++ b/gr-blocks/examples/metadata/file_metadata_vector_source.grc @@ -84,10 +84,10 @@ </param> </block> <block> - <key>gr_file_sink</key> + <key>blocks_file_sink</key> <param> <key>id</key> - <value>gr_file_sink_1</value> + <value>blocks_file_sink_1</value> </param> <param> <key>_enabled</key> @@ -307,7 +307,7 @@ </block> <connection> <source_block_id>blocks_throttle_0</source_block_id> - <sink_block_id>gr_file_sink_1</sink_block_id> + <sink_block_id>blocks_file_sink_1</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-blocks/lib/wavfile_sink_impl.h b/gr-blocks/lib/wavfile_sink_impl.h index 8a364f2b90..4ad9958884 100644 --- a/gr-blocks/lib/wavfile_sink_impl.h +++ b/gr-blocks/lib/wavfile_sink_impl.h @@ -24,7 +24,6 @@ #define INCLUDED_GR_WAVFILE_SINK_IMPL_H #include <blocks/wavfile_sink.h> -#include <gr_file_sink_base.h> namespace gr { namespace blocks { diff --git a/gr-digital/examples/narrowband/benchmark_add_channel.py b/gr-digital/examples/narrowband/benchmark_add_channel.py index 28824dff4b..b614895b63 100755 --- a/gr-digital/examples/narrowband/benchmark_add_channel.py +++ b/gr-digital/examples/narrowband/benchmark_add_channel.py @@ -42,14 +42,14 @@ class my_top_block(gr.top_block): noise_power = power_in_signal/SNR noise_voltage = math.sqrt(noise_power) - self.src = gr.file_source(gr.sizeof_gr_complex, ifile) + self.src = blocks.file_source(gr.sizeof_gr_complex, ifile) #self.throttle = blocks.throttle(gr.sizeof_gr_complex, options.sample_rate) self.channel = filter.channel_model(noise_voltage, frequency_offset, time_offset, noise_seed=-random.randint(0,100000)) self.phase = blocks.multiply_const_cc(complex(math.cos(phase_offset), math.sin(phase_offset))) - self.snk = gr.file_sink(gr.sizeof_gr_complex, ofile) + self.snk = blocks.file_sink(gr.sizeof_gr_complex, ofile) self.connect(self.src, self.channel, self.phase, self.snk) diff --git a/gr-digital/examples/narrowband/benchmark_rx.py b/gr-digital/examples/narrowband/benchmark_rx.py index 1962fdc4b0..ce47bf87b8 100755 --- a/gr-digital/examples/narrowband/benchmark_rx.py +++ b/gr-digital/examples/narrowband/benchmark_rx.py @@ -21,6 +21,7 @@ # from gnuradio import gr, gru +from gnuradio import blocks from gnuradio import eng_notation from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -57,7 +58,7 @@ class my_top_block(gr.top_block): elif(options.from_file is not None): sys.stderr.write(("Reading samples from '%s'.\n\n" % (options.from_file))) - self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file) + self.source = blocks.file_source(gr.sizeof_gr_complex, options.from_file) else: sys.stderr.write("No source defined, pulling samples from null source.\n\n") self.source = gr.null_source(gr.sizeof_gr_complex) diff --git a/gr-digital/examples/narrowband/benchmark_tx.py b/gr-digital/examples/narrowband/benchmark_tx.py index 9afacb4952..593abb3cae 100755 --- a/gr-digital/examples/narrowband/benchmark_tx.py +++ b/gr-digital/examples/narrowband/benchmark_tx.py @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks from gnuradio import eng_notation from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -56,7 +57,7 @@ class my_top_block(gr.top_block): elif(options.to_file is not None): sys.stderr.write(("Saving samples to '%s'.\n\n" % (options.to_file))) - self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file) + self.sink = blocks.file_sink(gr.sizeof_gr_complex, options.to_file) else: sys.stderr.write("No sink defined, dumping samples to null sink.\n\n") self.sink = gr.null_sink(gr.sizeof_gr_complex) diff --git a/gr-digital/examples/narrowband/digital_bert_rx.py b/gr-digital/examples/narrowband/digital_bert_rx.py index cc66456e93..cf42742736 100755 --- a/gr-digital/examples/narrowband/digital_bert_rx.py +++ b/gr-digital/examples/narrowband/digital_bert_rx.py @@ -27,6 +27,7 @@ import gnuradio.gr.gr_threading as _threading import sys, time, math from gnuradio import digital +from gnuradio import blocks # from current dir from uhd_interface import uhd_receiver @@ -124,7 +125,7 @@ class rx_psk_block(gr.top_block): options.samples_per_symbol = self._source._sps elif(options.from_file is not None): - self._source = gr.file_source(gr.sizeof_gr_complex, options.from_file) + self._source = blocks.file_source(gr.sizeof_gr_complex, options.from_file) else: self._source = gr.null_source(gr.sizeof_gr_complex) diff --git a/gr-digital/examples/narrowband/digital_bert_tx.py b/gr-digital/examples/narrowband/digital_bert_tx.py index 3be9d68f87..2a99137704 100755 --- a/gr-digital/examples/narrowband/digital_bert_tx.py +++ b/gr-digital/examples/narrowband/digital_bert_tx.py @@ -78,7 +78,7 @@ class tx_psk_block(gr.top_block): options.samples_per_symbol = self._sink._sps elif(options.to_file is not None): - self._sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file) + self._sink = blocks.file_sink(gr.sizeof_gr_complex, options.to_file) else: self._sink = gr.null_sink(gr.sizeof_gr_complex) diff --git a/gr-digital/examples/narrowband/rx_voice.py b/gr-digital/examples/narrowband/rx_voice.py index f5d12b5689..b2b4174cc4 100755 --- a/gr-digital/examples/narrowband/rx_voice.py +++ b/gr-digital/examples/narrowband/rx_voice.py @@ -21,6 +21,7 @@ # from gnuradio import gr, audio, uhd +from gnuradio import blocks from gnuradio import filter from gnuradio import eng_notation from gnuradio.eng_option import eng_option @@ -83,7 +84,7 @@ class my_top_block(gr.top_block): elif(options.from_file is not None): self.thr = blocks.throttle(gr.sizeof_gr_complex, options.bitrate) - self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file) + self.source = blocks.file_source(gr.sizeof_gr_complex, options.from_file) self.connect(self.source, self.thr, self.rxpath) else: diff --git a/gr-digital/examples/narrowband/tx_voice.py b/gr-digital/examples/narrowband/tx_voice.py index 3fc4fa46f3..d3df9d788f 100755 --- a/gr-digital/examples/narrowband/tx_voice.py +++ b/gr-digital/examples/narrowband/tx_voice.py @@ -80,7 +80,7 @@ class my_top_block(gr.top_block): rrate = usrp_rate / audio_rate elif(options.to_file is not None): - self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file) + self.sink = blocks.file_sink(gr.sizeof_gr_complex, options.to_file) rrate = 1 else: self.sink = gr.null_sink(gr.sizeof_gr_complex) diff --git a/gr-digital/examples/ofdm/benchmark_add_channel.py b/gr-digital/examples/ofdm/benchmark_add_channel.py index 0d17efd052..f97214f78d 100755 --- a/gr-digital/examples/ofdm/benchmark_add_channel.py +++ b/gr-digital/examples/ofdm/benchmark_add_channel.py @@ -44,14 +44,14 @@ class my_top_block(gr.top_block): frequency_offset = options.frequency_offset / options.fft_length - self.src = gr.file_source(gr.sizeof_gr_complex, ifile) + self.src = blocks.file_source(gr.sizeof_gr_complex, ifile) #self.throttle = blocks.throttle(gr.sizeof_gr_complex, options.sample_rate) self.channel = filter.channel_model(noise_voltage, frequency_offset, time_offset, noise_seed=-random.randint(0,100000)) self.phase = blocks.multiply_const_cc(complex(math.cos(phase_offset), math.sin(phase_offset))) - self.snk = gr.file_sink(gr.sizeof_gr_complex, ofile) + self.snk = blocks.file_sink(gr.sizeof_gr_complex, ofile) self.connect(self.src, self.channel, self.phase, self.snk) diff --git a/gr-digital/examples/ofdm/benchmark_rx.py b/gr-digital/examples/ofdm/benchmark_rx.py index f1b65276d0..740e0aed0e 100755 --- a/gr-digital/examples/ofdm/benchmark_rx.py +++ b/gr-digital/examples/ofdm/benchmark_rx.py @@ -25,6 +25,7 @@ from gnuradio import eng_notation from gnuradio.eng_option import eng_option from optparse import OptionParser +from gnuradio import blocks from gnuradio import digital # from current dir @@ -44,7 +45,7 @@ class my_top_block(gr.top_block): options.spec, options.antenna, options.verbose) elif(options.from_file is not None): - self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file) + self.source = blocks.file_source(gr.sizeof_gr_complex, options.from_file) else: self.source = gr.null_source(gr.sizeof_gr_complex) diff --git a/gr-digital/examples/ofdm/benchmark_tx.py b/gr-digital/examples/ofdm/benchmark_tx.py index 5962fe7ecb..44b127e0cc 100755 --- a/gr-digital/examples/ofdm/benchmark_tx.py +++ b/gr-digital/examples/ofdm/benchmark_tx.py @@ -27,6 +27,7 @@ from optparse import OptionParser import time, struct, sys from gnuradio import digital +from gnuradio import blocks # from current dir from transmit_path import transmit_path @@ -43,7 +44,7 @@ class my_top_block(gr.top_block): options.spec, options.antenna, options.verbose) elif(options.to_file is not None): - self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file) + self.sink = blocks.file_sink(gr.sizeof_gr_complex, options.to_file) else: self.sink = gr.null_sink(gr.sizeof_gr_complex) diff --git a/gr-digital/python/cpm.py b/gr-digital/python/cpm.py index a9915ba91a..b27fb098f5 100644 --- a/gr-digital/python/cpm.py +++ b/gr-digital/python/cpm.py @@ -26,6 +26,7 @@ from gnuradio import gr, filter from gnuradio import analog +from gnuradio import blocks from math import pi import numpy @@ -195,13 +196,13 @@ class cpm_mod(gr.hier_block2): def _setup_logging(self): print "Modulation logging turned on." self.connect(self.B2s, - gr.file_sink(gr.sizeof_float, "symbols.dat")) + blocks.file_sink(gr.sizeof_float, "symbols.dat")) self.connect(self.pam, - gr.file_sink(gr.sizeof_float, "pam.dat")) + blocks.file_sink(gr.sizeof_float, "pam.dat")) self.connect(self.filter, - gr.file_sink(gr.sizeof_float, "filter.dat")) + blocks.file_sink(gr.sizeof_float, "filter.dat")) self.connect(self.fmmod, - gr.file_sink(gr.sizeof_gr_complex, "fmmod.dat")) + blocks.file_sink(gr.sizeof_gr_complex, "fmmod.dat")) def add_options(parser): diff --git a/gr-digital/python/generic_mod_demod.py b/gr-digital/python/generic_mod_demod.py index f5b2084766..b812fe1c37 100644 --- a/gr-digital/python/generic_mod_demod.py +++ b/gr-digital/python/generic_mod_demod.py @@ -198,17 +198,17 @@ class generic_mod(gr.hier_block2): def _setup_logging(self): print "Modulation logging turned on." self.connect(self.bytes2chunks, - gr.file_sink(gr.sizeof_char, "tx_bytes2chunks.8b")) + blocks.file_sink(gr.sizeof_char, "tx_bytes2chunks.8b")) if self.pre_diff_code: self.connect(self.symbol_mapper, - gr.file_sink(gr.sizeof_char, "tx_symbol_mapper.8b")) + blocks.file_sink(gr.sizeof_char, "tx_symbol_mapper.8b")) if self._differential: self.connect(self.diffenc, - gr.file_sink(gr.sizeof_char, "tx_diffenc.8b")) + blocks.file_sink(gr.sizeof_char, "tx_diffenc.8b")) self.connect(self.chunks2symbols, - gr.file_sink(gr.sizeof_gr_complex, "tx_chunks2symbols.32fc")) + blocks.file_sink(gr.sizeof_gr_complex, "tx_chunks2symbols.32fc")) self.connect(self.rrc_filter, - gr.file_sink(gr.sizeof_gr_complex, "tx_rrc_filter.32fc")) + blocks.file_sink(gr.sizeof_gr_complex, "tx_rrc_filter.32fc")) # ///////////////////////////////////////////////////////////////////////////// @@ -338,39 +338,39 @@ class generic_demod(gr.hier_block2): def _setup_logging(self): print "Modulation logging turned on." self.connect(self.agc, - gr.file_sink(gr.sizeof_gr_complex, "rx_agc.32fc")) + blocks.file_sink(gr.sizeof_gr_complex, "rx_agc.32fc")) self.connect((self.freq_recov, 0), - gr.file_sink(gr.sizeof_gr_complex, "rx_freq_recov.32fc")) + blocks.file_sink(gr.sizeof_gr_complex, "rx_freq_recov.32fc")) self.connect((self.freq_recov, 1), - gr.file_sink(gr.sizeof_float, "rx_freq_recov_freq.32f")) + blocks.file_sink(gr.sizeof_float, "rx_freq_recov_freq.32f")) self.connect((self.freq_recov, 2), - gr.file_sink(gr.sizeof_float, "rx_freq_recov_phase.32f")) + blocks.file_sink(gr.sizeof_float, "rx_freq_recov_phase.32f")) self.connect((self.freq_recov, 3), - gr.file_sink(gr.sizeof_float, "rx_freq_recov_error.32f")) + blocks.file_sink(gr.sizeof_float, "rx_freq_recov_error.32f")) self.connect((self.time_recov, 0), - gr.file_sink(gr.sizeof_gr_complex, "rx_time_recov.32fc")) + blocks.file_sink(gr.sizeof_gr_complex, "rx_time_recov.32fc")) self.connect((self.time_recov, 1), - gr.file_sink(gr.sizeof_float, "rx_time_recov_error.32f")) + blocks.file_sink(gr.sizeof_float, "rx_time_recov_error.32f")) self.connect((self.time_recov, 2), - gr.file_sink(gr.sizeof_float, "rx_time_recov_rate.32f")) + blocks.file_sink(gr.sizeof_float, "rx_time_recov_rate.32f")) self.connect((self.time_recov, 3), - gr.file_sink(gr.sizeof_float, "rx_time_recov_phase.32f")) + blocks.file_sink(gr.sizeof_float, "rx_time_recov_phase.32f")) self.connect((self.receiver, 0), - gr.file_sink(gr.sizeof_char, "rx_receiver.8b")) + blocks.file_sink(gr.sizeof_char, "rx_receiver.8b")) self.connect((self.receiver, 1), - gr.file_sink(gr.sizeof_float, "rx_receiver_error.32f")) + blocks.file_sink(gr.sizeof_float, "rx_receiver_error.32f")) self.connect((self.receiver, 2), - gr.file_sink(gr.sizeof_float, "rx_receiver_phase.32f")) + blocks.file_sink(gr.sizeof_float, "rx_receiver_phase.32f")) self.connect((self.receiver, 3), - gr.file_sink(gr.sizeof_float, "rx_receiver_freq.32f")) + blocks.file_sink(gr.sizeof_float, "rx_receiver_freq.32f")) if self._differential: self.connect(self.diffdec, - gr.file_sink(gr.sizeof_char, "rx_diffdec.8b")) + blocks.file_sink(gr.sizeof_char, "rx_diffdec.8b")) if self.pre_diff_code: self.connect(self.symbol_mapper, - gr.file_sink(gr.sizeof_char, "rx_symbol_mapper.8b")) + blocks.file_sink(gr.sizeof_char, "rx_symbol_mapper.8b")) self.connect(self.unpack, - gr.file_sink(gr.sizeof_char, "rx_unpack.8b")) + blocks.file_sink(gr.sizeof_char, "rx_unpack.8b")) def add_options(parser): """ diff --git a/gr-digital/python/gfsk.py b/gr-digital/python/gfsk.py index e4aeef8ef9..54c94b88fd 100644 --- a/gr-digital/python/gfsk.py +++ b/gr-digital/python/gfsk.py @@ -146,11 +146,11 @@ class gfsk_mod(gr.hier_block2): def _setup_logging(self): print "Modulation logging turned on." self.connect(self.nrz, - gr.file_sink(gr.sizeof_float, "nrz.dat")) + blocks.file_sink(gr.sizeof_float, "nrz.dat")) self.connect(self.gaussian_filter, - gr.file_sink(gr.sizeof_float, "gaussian_filter.dat")) + blocks.file_sink(gr.sizeof_float, "gaussian_filter.dat")) self.connect(self.fmmod, - gr.file_sink(gr.sizeof_gr_complex, "fmmod.dat")) + blocks.file_sink(gr.sizeof_gr_complex, "fmmod.dat")) def add_options(parser): @@ -272,11 +272,11 @@ class gfsk_demod(gr.hier_block2): def _setup_logging(self): print "Demodulation logging turned on." self.connect(self.fmdemod, - gr.file_sink(gr.sizeof_float, "fmdemod.dat")) + blocks.file_sink(gr.sizeof_float, "fmdemod.dat")) self.connect(self.clock_recovery, - gr.file_sink(gr.sizeof_float, "clock_recovery.dat")) + blocks.file_sink(gr.sizeof_float, "clock_recovery.dat")) self.connect(self.slicer, - gr.file_sink(gr.sizeof_char, "slicer.dat")) + blocks.file_sink(gr.sizeof_char, "slicer.dat")) def add_options(parser): """ diff --git a/gr-digital/python/gmsk.py b/gr-digital/python/gmsk.py index a90e49a521..055fc6002b 100644 --- a/gr-digital/python/gmsk.py +++ b/gr-digital/python/gmsk.py @@ -142,11 +142,11 @@ class gmsk_mod(gr.hier_block2): def _setup_logging(self): print "Modulation logging turned on." self.connect(self.nrz, - gr.file_sink(gr.sizeof_float, "nrz.dat")) + blocks.file_sink(gr.sizeof_float, "nrz.dat")) self.connect(self.gaussian_filter, - gr.file_sink(gr.sizeof_float, "gaussian_filter.dat")) + blocks.file_sink(gr.sizeof_float, "gaussian_filter.dat")) self.connect(self.fmmod, - gr.file_sink(gr.sizeof_gr_complex, "fmmod.dat")) + blocks.file_sink(gr.sizeof_gr_complex, "fmmod.dat")) def add_options(parser): @@ -262,11 +262,11 @@ class gmsk_demod(gr.hier_block2): def _setup_logging(self): print "Demodulation logging turned on." self.connect(self.fmdemod, - gr.file_sink(gr.sizeof_float, "fmdemod.dat")) + blocks.file_sink(gr.sizeof_float, "fmdemod.dat")) self.connect(self.clock_recovery, - gr.file_sink(gr.sizeof_float, "clock_recovery.dat")) + blocks.file_sink(gr.sizeof_float, "clock_recovery.dat")) self.connect(self.slicer, - gr.file_sink(gr.sizeof_char, "slicer.dat")) + blocks.file_sink(gr.sizeof_char, "slicer.dat")) def add_options(parser): """ diff --git a/gr-digital/python/ofdm.py b/gr-digital/python/ofdm.py index 5bbe111f31..bf129675ab 100644 --- a/gr-digital/python/ofdm.py +++ b/gr-digital/python/ofdm.py @@ -118,13 +118,13 @@ class ofdm_mod(gr.hier_block2): self._print_verbage() if options.log: - self.connect(self._pkt_input, gr.file_sink(gr.sizeof_gr_complex*options.fft_length, + self.connect(self._pkt_input, blocks.file_sink(gr.sizeof_gr_complex*options.fft_length, "ofdm_mapper_c.dat")) - self.connect(self.preambles, gr.file_sink(gr.sizeof_gr_complex*options.fft_length, + self.connect(self.preambles, blocks.file_sink(gr.sizeof_gr_complex*options.fft_length, "ofdm_preambles.dat")) - self.connect(self.ifft, gr.file_sink(gr.sizeof_gr_complex*options.fft_length, + self.connect(self.ifft, blocks.file_sink(gr.sizeof_gr_complex*options.fft_length, "ofdm_ifft_c.dat")) - self.connect(self.cp_adder, gr.file_sink(gr.sizeof_gr_complex, + self.connect(self.cp_adder, blocks.file_sink(gr.sizeof_gr_complex, "ofdm_cp_adder_c.dat")) def send_pkt(self, payload='', eof=False): @@ -256,7 +256,7 @@ class ofdm_demod(gr.hier_block2): if options.log: self.connect(self.ofdm_demod, - gr.file_sink(gr.sizeof_gr_complex*self._occupied_tones, + blocks.file_sink(gr.sizeof_gr_complex*self._occupied_tones, "ofdm_frame_sink_c.dat")) else: self.connect(self.ofdm_demod, diff --git a/gr-digital/python/ofdm_receiver.py b/gr-digital/python/ofdm_receiver.py index f4fc5f5ba3..4fbf76251a 100644 --- a/gr-digital/python/ofdm_receiver.py +++ b/gr-digital/python/ofdm_receiver.py @@ -144,11 +144,11 @@ class ofdm_receiver(gr.hier_block2): self.connect((self.ofdm_frame_acq,1), (self,1)) # frame and symbol timing, and equalization if logging: - self.connect(self.chan_filt, gr.file_sink(gr.sizeof_gr_complex, "ofdm_receiver-chan_filt_c.dat")) - self.connect(self.fft_demod, gr.file_sink(gr.sizeof_gr_complex*fft_length, "ofdm_receiver-fft_out_c.dat")) + self.connect(self.chan_filt, blocks.file_sink(gr.sizeof_gr_complex, "ofdm_receiver-chan_filt_c.dat")) + self.connect(self.fft_demod, blocks.file_sink(gr.sizeof_gr_complex*fft_length, "ofdm_receiver-fft_out_c.dat")) self.connect(self.ofdm_frame_acq, - gr.file_sink(gr.sizeof_gr_complex*occupied_tones, "ofdm_receiver-frame_acq_c.dat")) - self.connect((self.ofdm_frame_acq,1), gr.file_sink(1, "ofdm_receiver-found_corr_b.dat")) - self.connect(self.sampler, gr.file_sink(gr.sizeof_gr_complex*fft_length, "ofdm_receiver-sampler_c.dat")) - self.connect(self.sigmix, gr.file_sink(gr.sizeof_gr_complex, "ofdm_receiver-sigmix_c.dat")) - self.connect(self.nco, gr.file_sink(gr.sizeof_gr_complex, "ofdm_receiver-nco_c.dat")) + blocks.file_sink(gr.sizeof_gr_complex*occupied_tones, "ofdm_receiver-frame_acq_c.dat")) + self.connect((self.ofdm_frame_acq,1), blocks.file_sink(1, "ofdm_receiver-found_corr_b.dat")) + self.connect(self.sampler, blocks.file_sink(gr.sizeof_gr_complex*fft_length, "ofdm_receiver-sampler_c.dat")) + self.connect(self.sigmix, blocks.file_sink(gr.sizeof_gr_complex, "ofdm_receiver-sigmix_c.dat")) + self.connect(self.nco, blocks.file_sink(gr.sizeof_gr_complex, "ofdm_receiver-nco_c.dat")) diff --git a/gr-digital/python/ofdm_sync_fixed.py b/gr-digital/python/ofdm_sync_fixed.py index 9bac789bf6..bd64964651 100644 --- a/gr-digital/python/ofdm_sync_fixed.py +++ b/gr-digital/python/ofdm_sync_fixed.py @@ -22,6 +22,7 @@ import math from gnuradio import gr +from gnuradio import blocks class ofdm_sync_fixed(gr.hier_block2): def __init__(self, fft_length, cp_length, nsymbols, freq_offset, logging=False): @@ -46,5 +47,5 @@ class ofdm_sync_fixed(gr.hier_block2): self.connect(self.peak_trigger, (self,1)) if logging: - self.connect(self.peak_trigger, gr.file_sink(gr.sizeof_char, "ofdm_sync_fixed-peaks_b.dat")) + self.connect(self.peak_trigger, blocks.file_sink(gr.sizeof_char, "ofdm_sync_fixed-peaks_b.dat")) diff --git a/gr-digital/python/ofdm_sync_ml.py b/gr-digital/python/ofdm_sync_ml.py index 76c00f3a54..3afd647098 100644 --- a/gr-digital/python/ofdm_sync_ml.py +++ b/gr-digital/python/ofdm_sync_ml.py @@ -158,18 +158,18 @@ class ofdm_sync_ml(gr.hier_block2): if logging: - self.connect(self.moving_sum_filter, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-energy_f.dat")) - self.connect(self.diff, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-theta_f.dat")) - self.connect(self.angle, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-epsilon_f.dat")) - self.connect(self.corrmag, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-corrmag_f.dat")) - self.connect(self.kscorr, gr.file_sink(gr.sizeof_gr_complex, "ofdm_sync_ml-kscorr_c.dat")) - self.connect(self.div, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-div_f.dat")) - self.connect(self.mul, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-mul_f.dat")) - self.connect(self.slice, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-slice_f.dat")) - self.connect(self.pk_detect, gr.file_sink(gr.sizeof_char, "ofdm_sync_ml-peaks_b.dat")) + self.connect(self.moving_sum_filter, blocks.file_sink(gr.sizeof_float, "ofdm_sync_ml-energy_f.dat")) + self.connect(self.diff, blocks.file_sink(gr.sizeof_float, "ofdm_sync_ml-theta_f.dat")) + self.connect(self.angle, blocks.file_sink(gr.sizeof_float, "ofdm_sync_ml-epsilon_f.dat")) + self.connect(self.corrmag, blocks.file_sink(gr.sizeof_float, "ofdm_sync_ml-corrmag_f.dat")) + self.connect(self.kscorr, blocks.file_sink(gr.sizeof_gr_complex, "ofdm_sync_ml-kscorr_c.dat")) + self.connect(self.div, blocks.file_sink(gr.sizeof_float, "ofdm_sync_ml-div_f.dat")) + self.connect(self.mul, blocks.file_sink(gr.sizeof_float, "ofdm_sync_ml-mul_f.dat")) + self.connect(self.slice, blocks.file_sink(gr.sizeof_float, "ofdm_sync_ml-slice_f.dat")) + self.connect(self.pk_detect, blocks.file_sink(gr.sizeof_char, "ofdm_sync_ml-peaks_b.dat")) if use_dpll: - self.connect(self.dpll, gr.file_sink(gr.sizeof_char, "ofdm_sync_ml-dpll_b.dat")) + self.connect(self.dpll, blocks.file_sink(gr.sizeof_char, "ofdm_sync_ml-dpll_b.dat")) - self.connect(self.sample_and_hold, gr.file_sink(gr.sizeof_float, "ofdm_sync_ml-sample_and_hold_f.dat")) - self.connect(self.input, gr.file_sink(gr.sizeof_gr_complex, "ofdm_sync_ml-input_c.dat")) + self.connect(self.sample_and_hold, blocks.file_sink(gr.sizeof_float, "ofdm_sync_ml-sample_and_hold_f.dat")) + self.connect(self.input, blocks.file_sink(gr.sizeof_gr_complex, "ofdm_sync_ml-input_c.dat")) diff --git a/gr-digital/python/ofdm_sync_pn.py b/gr-digital/python/ofdm_sync_pn.py index 63e85135bc..4c6a30f802 100644 --- a/gr-digital/python/ofdm_sync_pn.py +++ b/gr-digital/python/ofdm_sync_pn.py @@ -124,10 +124,10 @@ class ofdm_sync_pn(gr.hier_block2): self.connect(self.pk_detect, (self,1)) if logging: - self.connect(self.matched_filter, gr.file_sink(gr.sizeof_float, "ofdm_sync_pn-mf_f.dat")) - self.connect(self.normalize, gr.file_sink(gr.sizeof_float, "ofdm_sync_pn-theta_f.dat")) - self.connect(self.angle, gr.file_sink(gr.sizeof_float, "ofdm_sync_pn-epsilon_f.dat")) - self.connect(self.pk_detect, gr.file_sink(gr.sizeof_char, "ofdm_sync_pn-peaks_b.dat")) - self.connect(self.sample_and_hold, gr.file_sink(gr.sizeof_float, "ofdm_sync_pn-sample_and_hold_f.dat")) - self.connect(self.input, gr.file_sink(gr.sizeof_gr_complex, "ofdm_sync_pn-input_c.dat")) + self.connect(self.matched_filter, blocks.file_sink(gr.sizeof_float, "ofdm_sync_pn-mf_f.dat")) + self.connect(self.normalize, blocks.file_sink(gr.sizeof_float, "ofdm_sync_pn-theta_f.dat")) + self.connect(self.angle, blocks.file_sink(gr.sizeof_float, "ofdm_sync_pn-epsilon_f.dat")) + self.connect(self.pk_detect, blocks.file_sink(gr.sizeof_char, "ofdm_sync_pn-peaks_b.dat")) + self.connect(self.sample_and_hold, blocks.file_sink(gr.sizeof_float, "ofdm_sync_pn-sample_and_hold_f.dat")) + self.connect(self.input, blocks.file_sink(gr.sizeof_gr_complex, "ofdm_sync_pn-input_c.dat")) diff --git a/gr-digital/python/ofdm_sync_pnac.py b/gr-digital/python/ofdm_sync_pnac.py index 547b1e93c0..ee7c82927a 100644 --- a/gr-digital/python/ofdm_sync_pnac.py +++ b/gr-digital/python/ofdm_sync_pnac.py @@ -125,11 +125,11 @@ class ofdm_sync_pnac(gr.hier_block2): self.connect(self.peaks, (self,1)) if logging: - self.connect(self.compare, gr.file_sink(gr.sizeof_float, "ofdm_sync_pnac-compare_f.dat")) - self.connect(self.c2mag, gr.file_sink(gr.sizeof_float, "ofdm_sync_pnac-theta_f.dat")) - self.connect(self.power, gr.file_sink(gr.sizeof_float, "ofdm_sync_pnac-inputpower_f.dat")) - self.connect(self.angle, gr.file_sink(gr.sizeof_float, "ofdm_sync_pnac-epsilon_f.dat")) - self.connect(self.threshold, gr.file_sink(gr.sizeof_float, "ofdm_sync_pnac-threshold_f.dat")) - self.connect(self.peaks, gr.file_sink(gr.sizeof_char, "ofdm_sync_pnac-peaks_b.dat")) - self.connect(self.sample_and_hold, gr.file_sink(gr.sizeof_float, "ofdm_sync_pnac-sample_and_hold_f.dat")) - self.connect(self.input, gr.file_sink(gr.sizeof_gr_complex, "ofdm_sync_pnac-input_c.dat")) + self.connect(self.compare, blocks.file_sink(gr.sizeof_float, "ofdm_sync_pnac-compare_f.dat")) + self.connect(self.c2mag, blocks.file_sink(gr.sizeof_float, "ofdm_sync_pnac-theta_f.dat")) + self.connect(self.power, blocks.file_sink(gr.sizeof_float, "ofdm_sync_pnac-inputpower_f.dat")) + self.connect(self.angle, blocks.file_sink(gr.sizeof_float, "ofdm_sync_pnac-epsilon_f.dat")) + self.connect(self.threshold, blocks.file_sink(gr.sizeof_float, "ofdm_sync_pnac-threshold_f.dat")) + self.connect(self.peaks, blocks.file_sink(gr.sizeof_char, "ofdm_sync_pnac-peaks_b.dat")) + self.connect(self.sample_and_hold, blocks.file_sink(gr.sizeof_float, "ofdm_sync_pnac-sample_and_hold_f.dat")) + self.connect(self.input, blocks.file_sink(gr.sizeof_gr_complex, "ofdm_sync_pnac-input_c.dat")) diff --git a/gr-noaa/examples/file_rx_hrpt.grc b/gr-noaa/examples/file_rx_hrpt.grc index 0b490269b4..3a7caaed71 100644 --- a/gr-noaa/examples/file_rx_hrpt.grc +++ b/gr-noaa/examples/file_rx_hrpt.grc @@ -318,7 +318,7 @@ </param> </block> <block> - <key>gr_file_sink</key> + <key>blocks_file_sink</key> <param> <key>id</key> <value>frame_sink</value> @@ -469,10 +469,10 @@ </param> </block> <block> - <key>gr_file_source</key> + <key>blocks_file_source</key> <param> <key>id</key> - <value>gr_file_source_0</value> + <value>blocks_file_source_0</value> </param> <param> <key>_enabled</key> @@ -883,7 +883,7 @@ <sink_key>0</sink_key> </connection> <connection> - <source_block_id>gr_file_source_0</source_block_id> + <source_block_id>blocks_file_source_0</source_block_id> <sink_block_id>throttle</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> diff --git a/gr-noaa/examples/hrpt_decode.grc b/gr-noaa/examples/hrpt_decode.grc index 39fe195d15..2fb57746e8 100644 --- a/gr-noaa/examples/hrpt_decode.grc +++ b/gr-noaa/examples/hrpt_decode.grc @@ -323,7 +323,7 @@ </param> </block> <block> - <key>gr_file_source</key> + <key>blocks_file_source</key> <param> <key>id</key> <value>file_source</value> diff --git a/gr-noaa/examples/hrpt_demod.grc b/gr-noaa/examples/hrpt_demod.grc index feb352d9d2..1400f5ed1f 100644 --- a/gr-noaa/examples/hrpt_demod.grc +++ b/gr-noaa/examples/hrpt_demod.grc @@ -196,7 +196,7 @@ </param> </block> <block> - <key>gr_file_source</key> + <key>blocks_file_source</key> <param> <key>id</key> <value>file_source</value> @@ -521,10 +521,10 @@ </param> </block> <block> - <key>gr_file_sink</key> + <key>blocks_file_sink</key> <param> <key>id</key> - <value>gr_file_sink_0</value> + <value>blocks_file_sink_0</value> </param> <param> <key>_enabled</key> @@ -720,7 +720,7 @@ </connection> <connection> <source_block_id>noaa_hrpt_deframer_0</source_block_id> - <sink_block_id>gr_file_sink_0</sink_block_id> + <sink_block_id>blocks_file_sink_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gr-noaa/examples/usrp_rx_hrpt.grc b/gr-noaa/examples/usrp_rx_hrpt.grc index 2cf2a7fe0c..1f61a8880f 100644 --- a/gr-noaa/examples/usrp_rx_hrpt.grc +++ b/gr-noaa/examples/usrp_rx_hrpt.grc @@ -1872,7 +1872,7 @@ </param> </block> <block> - <key>gr_file_sink</key> + <key>blocks_file_sink</key> <param> <key>id</key> <value>frame_sink</value> diff --git a/gr-noaa/examples/usrp_rx_hrpt_nogui.grc b/gr-noaa/examples/usrp_rx_hrpt_nogui.grc index cfaa8c6310..3594ca035f 100644 --- a/gr-noaa/examples/usrp_rx_hrpt_nogui.grc +++ b/gr-noaa/examples/usrp_rx_hrpt_nogui.grc @@ -1250,7 +1250,7 @@ </param> </block> <block> - <key>gr_file_sink</key> + <key>blocks_file_sink</key> <param> <key>id</key> <value>frame_sink</value> diff --git a/gr-pager/apps/usrp_flex b/gr-pager/apps/usrp_flex index 33877ea4ee..811c6e95c0 100755 --- a/gr-pager/apps/usrp_flex +++ b/gr-pager/apps/usrp_flex @@ -21,6 +21,7 @@ # from gnuradio import gr, gru, uhd, optfir, eng_notation, pager +from gnuradio import blocks from gnuradio.eng_option import eng_option from optparse import OptionParser import time, os, sys @@ -65,12 +66,12 @@ class app_top_block(gr.top_block): else: # Use supplied file as source of samples - self.u = gr.file_source(gr.sizeof_gr_complex, options.from_file) + self.u = blocks.file_source(gr.sizeof_gr_complex, options.from_file) if options.verbose: print "Reading samples from", options.from_file if options.log and not options.from_file: - usrp_sink = gr.file_sink(gr.sizeof_gr_complex, 'usrp.dat') + usrp_sink = blocks.file_sink(gr.sizeof_gr_complex, 'usrp.dat') self.connect(self.u, usrp_sink) # Set up 22KHz-wide bandpass about center frequency. Decimate by 10 @@ -91,7 +92,7 @@ class app_top_block(gr.top_block): 250e3) # Sample rate if options.log: - chan_sink = gr.file_sink(gr.sizeof_gr_complex, 'chan.dat') + chan_sink = blocks.file_sink(gr.sizeof_gr_complex, 'chan.dat') self.connect(self.chan, chan_sink) # FLEX protocol demodulator diff --git a/gr-pager/apps/usrp_flex_all b/gr-pager/apps/usrp_flex_all index 06b5eb7e36..58fcc0af45 100755 --- a/gr-pager/apps/usrp_flex_all +++ b/gr-pager/apps/usrp_flex_all @@ -21,6 +21,7 @@ # from gnuradio import gr, uhd, eng_notation, pager +from gnuradio import blocks from gnuradio import filter from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -32,7 +33,7 @@ class app_top_block(gr.top_block): gr.top_block.__init__(self, "usrp_flex_all") if options.from_file is not None: - self.u = gr.file_source(gr.sizeof_gr_complex, options.from_file) + self.u = blocks.file_source(gr.sizeof_gr_complex, options.from_file) self.nchan = options.nchan if options.verbose: print "Reading samples from file", options.from_file @@ -93,7 +94,7 @@ class app_top_block(gr.top_block): self.connect(self.u, self.bank) if options.log and options.from_file == None: - src_sink = gr.file_sink(gr.sizeof_gr_complex, 'usrp.dat') + src_sink = blocks.file_sink(gr.sizeof_gr_complex, 'usrp.dat') self.connect(self.u, src_sink) mid_chan = int(self.nchan/2) @@ -108,7 +109,7 @@ class app_top_block(gr.top_block): else: self.connect((self.bank, i), pager.flex_demod(queue, freq, options.verbose, options.log)) if options.log: - self.connect((self.bank, i), gr.file_sink(gr.sizeof_gr_complex, 'chan_'+'%3.3f'%(freq/1e6)+'.dat')) + self.connect((self.bank, i), blocks.file_sink(gr.sizeof_gr_complex, 'chan_'+'%3.3f'%(freq/1e6)+'.dat')) def get_options(): diff --git a/gr-pager/apps/usrp_flex_band b/gr-pager/apps/usrp_flex_band index 78b87aabad..3a24d6cd52 100755 --- a/gr-pager/apps/usrp_flex_band +++ b/gr-pager/apps/usrp_flex_band @@ -21,6 +21,7 @@ # from gnuradio import gr, uhd, eng_notation, pager +from gnuradio import blocks from gnuradio import filter from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -31,7 +32,7 @@ class app_top_block(gr.top_block): gr.top_block.__init__(self, "usrp_flex_all") if options.from_file is not None: - self.u = gr.file_source(gr.sizeof_gr_complex, options.from_file) + self.u = blocks.file_source(gr.sizeof_gr_complex, options.from_file) if options.verbose: print "Reading samples from file", options.from_file else: @@ -78,7 +79,7 @@ class app_top_block(gr.top_block): self.connect(self.u, bank) if options.log and options.from_file == None: - src_sink = gr.file_sink(gr.sizeof_gr_complex, 'usrp.dat') + src_sink = blocks.file_sink(gr.sizeof_gr_complex, 'usrp.dat') self.connect(self.u, src_sink) for i in range(40): @@ -89,7 +90,7 @@ class app_top_block(gr.top_block): self.connect((bank, i), pager.flex_demod(queue, freq, options.verbose, options.log)) if options.log: - self.connect((bank, i), gr.file_sink(gr.sizeof_gr_complex, 'chan_'+'%3.3f'%(freq/1e6)+'.dat')) + self.connect((bank, i), blocks.file_sink(gr.sizeof_gr_complex, 'chan_'+'%3.3f'%(freq/1e6)+'.dat')) def get_options(): diff --git a/gr-pager/python/flex_demod.py b/gr-pager/python/flex_demod.py index 85797f3701..3ed469886c 100644 --- a/gr-pager/python/flex_demod.py +++ b/gr-pager/python/flex_demod.py @@ -21,6 +21,7 @@ from gnuradio import gr from gnuradio import analog +from gnuradio import blocks from gnuradio import filter from math import pi import pager_swig @@ -54,9 +55,9 @@ class flex_demod(gr.hier_block2): if log: suffix = '_'+ "%3.3f" % (freq/1e6,) + '.dat' - quad_sink = gr.file_sink(gr.sizeof_float, 'quad'+suffix) - rsamp_sink = gr.file_sink(gr.sizeof_float, 'rsamp'+suffix) - slicer_sink = gr.file_sink(gr.sizeof_char, 'slicer'+suffix) + quad_sink = blocks.file_sink(gr.sizeof_float, 'quad'+suffix) + rsamp_sink = blocks.file_sink(gr.sizeof_float, 'rsamp'+suffix) + slicer_sink = blocks.file_sink(gr.sizeof_char, 'slicer'+suffix) self.connect(rsamp, rsamp_sink) self.connect(quad, quad_sink) self.connect(self.slicer, slicer_sink) diff --git a/gr-qtgui/apps/uhd_display.py b/gr-qtgui/apps/uhd_display.py index 81950b99aa..0e0c8a177d 100755 --- a/gr-qtgui/apps/uhd_display.py +++ b/gr-qtgui/apps/uhd_display.py @@ -235,7 +235,7 @@ class my_top_block(gr.top_block): self.lock() # Add file sink to save data - self.file_sink = gr.file_sink(gr.sizeof_gr_complex, name) + self.file_sink = blocks.file_sink(gr.sizeof_gr_complex, name) self.connect(self.amp, self.file_sink) self.unlock() diff --git a/gr-shd/apps/shd_rx_cfile b/gr-shd/apps/shd_rx_cfile index 5b4178cf7b..ceae858343 100755 --- a/gr-shd/apps/shd_rx_cfile +++ b/gr-shd/apps/shd_rx_cfile @@ -27,6 +27,7 @@ outputs single precision complex float values or complex short values """ from gnuradio import gr, eng_notation +from gnuradio import blocks from gnuradio import shd from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -44,12 +45,12 @@ class rx_cfile_block(gr.top_block): self._src = shd.smini_source(device_addr=options.address, io_type=shd.io_type.COMPLEX_INT16, num_channels=1) - self._sink = gr.file_sink(gr.sizeof_short*2, filename) + self._sink = blocks.file_sink(gr.sizeof_short*2, filename) else: self._src = shd.smini_source(device_addr=options.address, io_type=shd.io_type.COMPLEX_FLOAT32, num_channels=1) - self._sink = gr.file_sink(gr.sizeof_gr_complex, filename) + self._sink = blocks.file_sink(gr.sizeof_gr_complex, filename) # Set receiver sample rate self._src.set_samp_rate(options.samp_rate) diff --git a/gr-uhd/apps/hf_explorer/hfx.py b/gr-uhd/apps/hf_explorer/hfx.py index 9e00805134..93d34c0977 100755 --- a/gr-uhd/apps/hf_explorer/hfx.py +++ b/gr-uhd/apps/hf_explorer/hfx.py @@ -255,7 +255,7 @@ class MyFrame(wx.Frame): self.tune_offset = 0 else: - self.src = gr.file_source (gr.sizeof_short,options.input_file) + self.src = blocks.file_source (gr.sizeof_short,options.input_file) self.tune_offset = 2200 # 2200 works for 3.5-4Mhz band # convert rf data in interleaved short int form to complex @@ -271,7 +271,7 @@ class MyFrame(wx.Frame): # save radio data to a file if SAVE_RADIO_TO_FILE: - radio_file = gr.file_sink(gr.sizeof_short, options.radio_file) + radio_file = blocks.file_sink(gr.sizeof_short, options.radio_file) self.tb.connect (self.src, radio_file) # 2nd DDC @@ -375,7 +375,7 @@ class MyFrame(wx.Frame): self.tb.connect(agc,dst) if SAVE_AUDIO_TO_FILE: - f_out = gr.file_sink(gr.sizeof_short,options.audio_file) + f_out = blocks.file_sink(gr.sizeof_short,options.audio_file) sc1 = blocks.multiply_const_ff(64000) f2s1 = blocks.float_to_short() self.tb.connect(agc,sc1,f2s1,f_out) diff --git a/gr-uhd/apps/uhd_rx_cfile b/gr-uhd/apps/uhd_rx_cfile index 62874771c1..f9ed392564 100755 --- a/gr-uhd/apps/uhd_rx_cfile +++ b/gr-uhd/apps/uhd_rx_cfile @@ -27,6 +27,7 @@ outputs single precision complex float values or complex short values """ from gnuradio import gr, gru, eng_notation +from gnuradio import blocks from gnuradio import uhd from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -43,11 +44,11 @@ class rx_cfile_block(gr.top_block): if options.output_shorts: self._u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('sc16', options.wire_format, args=options.stream_args)) - self._sink = gr.file_sink(gr.sizeof_short*2, filename) + self._sink = blocks.file_sink(gr.sizeof_short*2, filename) else: self._u = uhd.usrp_source(device_addr=options.args, stream_args=uhd.stream_args('fc32', options.wire_format, args=options.stream_args)) - self._sink = gr.file_sink(gr.sizeof_gr_complex, filename) + self._sink = blocks.file_sink(gr.sizeof_gr_complex, filename) # Set the subdevice spec if(options.spec): diff --git a/gr-uhd/examples/python/fm_tx4.py b/gr-uhd/examples/python/fm_tx4.py index e4cf3ded24..fefa67861b 100755 --- a/gr-uhd/examples/python/fm_tx4.py +++ b/gr-uhd/examples/python/fm_tx4.py @@ -56,7 +56,7 @@ class pipeline(gr.hier_block2): gr.io_signature(1, 1, gr.sizeof_gr_complex)) try: - src = gr.file_source (gr.sizeof_float, filename, True) + src = blocks.file_source (gr.sizeof_float, filename, True) except RuntimeError: sys.stderr.write(("\nError: Could not open file '%s'\n\n" % \ filename)) diff --git a/gr-uhd/examples/python/usrp_tv_rcv.py b/gr-uhd/examples/python/usrp_tv_rcv.py index 3e612f6a02..d94b651660 100755 --- a/gr-uhd/examples/python/usrp_tv_rcv.py +++ b/gr-uhd/examples/python/usrp_tv_rcv.py @@ -124,7 +124,7 @@ class tv_rx_block (stdgui2.std_top_block): if not ((filename is None) or (filename=="usrp")): # file is data source - self.filesource = gr.file_source(gr.sizeof_short,filename,options.repeat) + self.filesource = blocks.file_source(gr.sizeof_short,filename,options.repeat) self.istoc = blocks.interleaved_short_to_complex() self.connect(self.filesource,self.istoc) self.src=self.istoc @@ -193,7 +193,7 @@ class tv_rx_block (stdgui2.std_top_block): + " gray:" + options.out_filename print "(Use the spacebar to advance to next frames)" options.repeat=False - file_sink=gr.file_sink(gr.sizeof_char, options.out_filename) + file_sink = blocks.file_sink(gr.sizeof_char, options.out_filename) self.dst =file_sink self.agc = analog.agc_cc(1e-7,1.0,1.0) #1e-7 diff --git a/gr-uhd/examples/python/usrp_tv_rcv_nogui.py b/gr-uhd/examples/python/usrp_tv_rcv_nogui.py index 5eef4a00f6..13395cef46 100755 --- a/gr-uhd/examples/python/usrp_tv_rcv_nogui.py +++ b/gr-uhd/examples/python/usrp_tv_rcv_nogui.py @@ -120,9 +120,9 @@ class my_top_block(gr.top_block): if not (options.in_filename=="usrp"): # file is data source, capture with usr_rx_csfile.py - self.filesource = gr.file_source(gr.sizeof_short, - options.in_filename, - options.repeat) + self.filesource = blocks.file_source(gr.sizeof_short, + options.in_filename, + options.repeat) self.istoc = blocks.interleaved_short_to_complex() self.connect(self.filesource,self.istoc) self.src=self.istoc @@ -196,7 +196,7 @@ class my_top_block(gr.top_block): print "use the following line to show the demodulated TV-signal:" print "display -depth 8 -size " +str(width)+ "x" + str(height) + " gray:" +filename print "(Use the spacebar to advance to next frames)" - file_sink=gr.file_sink(gr.sizeof_char, filename) + file_sink = blocks.file_sink(gr.sizeof_char, filename) self.dst =file_sink if options.nframes is None: diff --git a/gr-vocoder/examples/cvsd_audio_loopback.py b/gr-vocoder/examples/cvsd_audio_loopback.py index ef4c6ded21..b9385b7dc6 100755 --- a/gr-vocoder/examples/cvsd_audio_loopback.py +++ b/gr-vocoder/examples/cvsd_audio_loopback.py @@ -50,15 +50,15 @@ def build_graph(): tb.connect(enc, dec, s2f, decim, sink_scale, sink) if 0: # debug - tb.conect(src, gr.file_sink(gr.sizeof_float, "source.dat")) - tb.conect(src_scale, gr.file_sink(gr.sizeof_float, "src_scale.dat")) - tb.conect(interp, gr.file_sink(gr.sizeof_float, "interp.dat")) - tb.conect(f2s, gr.file_sink(gr.sizeof_short, "f2s.dat")) - tb.conect(enc, gr.file_sink(gr.sizeof_char, "enc.dat")) - tb.conect(dec, gr.file_sink(gr.sizeof_short, "dec.dat")) - tb.conect(s2f, gr.file_sink(gr.sizeof_float, "s2f.dat")) - tb.conect(decim, gr.file_sink(gr.sizeof_float, "decim.dat")) - tb.conect(sink_scale, gr.file_sink(gr.sizeof_float, "sink_scale.dat")) + tb.conect(src, blocks.file_sink(gr.sizeof_float, "source.dat")) + tb.conect(src_scale, blocks.file_sink(gr.sizeof_float, "src_scale.dat")) + tb.conect(interp, blocks.file_sink(gr.sizeof_float, "interp.dat")) + tb.conect(f2s, blocks.file_sink(gr.sizeof_short, "f2s.dat")) + tb.conect(enc, blocks.file_sink(gr.sizeof_char, "enc.dat")) + tb.conect(dec, blocks.file_sink(gr.sizeof_short, "dec.dat")) + tb.conect(s2f, blocks.file_sink(gr.sizeof_float, "s2f.dat")) + tb.conect(decim, blocks.file_sink(gr.sizeof_float, "decim.dat")) + tb.conect(sink_scale, blocks.file_sink(gr.sizeof_float, "sink_scale.dat")) return tb diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index 94225e976e..62117e69ec 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -11,7 +11,6 @@ <block>gr_vector_source_x</block> <block>random_source_x</block> <block>gr_null_source</block> - <block>gr_file_source</block> <block>blks2_tcp_source</block> <block>gr_udp_source</block> <block>pad_source</block> @@ -21,7 +20,6 @@ <name>Sinks</name> <block>gr_vector_sink_x</block> <block>gr_null_sink</block> - <block>gr_file_sink</block> <block>blks2_tcp_sink</block> <block>gr_udp_sink</block> <block>pad_sink</block> diff --git a/grc/blocks/gr_file_sink.xml b/grc/blocks/gr_file_sink.xml deleted file mode 100644 index d0a693900f..0000000000 --- a/grc/blocks/gr_file_sink.xml +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##File Sink -################################################### - --> -<block> - <name>File Sink</name> - <key>gr_file_sink</key> - <import>from gnuradio import gr</import> - <make>gr.file_sink($type.size*$vlen, $file) -self.$(id).set_unbuffered($unbuffered)</make> - <callback>set_unbuffered($unbuffered)</callback> - <callback>open($file)</callback> - <param> - <name>File</name> - <key>file</key> - <value></value> - <type>file_save</type> - </param> - <param> - <name>Input Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>size:gr.sizeof_gr_complex</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>size:gr.sizeof_float</opt> - </option> - <option> - <name>Int</name> - <key>int</key> - <opt>size:gr.sizeof_int</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>size:gr.sizeof_short</opt> - </option> - <option> - <name>Byte</name> - <key>byte</key> - <opt>size:gr.sizeof_char</opt> - </option> - </param> - <param> - <name>Vec Length</name> - <key>vlen</key> - <value>1</value> - <type>int</type> - </param> - <param> - <name>Unbuffered</name> - <key>unbuffered</key> - <value>False</value> - <type>bool</type> - <option> - <name>Off</name> - <key>False</key> - </option> - <option> - <name>On</name> - <key>True</key> - </option> - </param> - - <check>$vlen > 0</check> - <sink> - <name>in</name> - <type>$type</type> - <vlen>$vlen</vlen> - </sink> -</block> diff --git a/grc/blocks/gr_file_source.xml b/grc/blocks/gr_file_source.xml deleted file mode 100644 index 5f0e16b279..0000000000 --- a/grc/blocks/gr_file_source.xml +++ /dev/null @@ -1,75 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##File Source -################################################### - --> -<block> - <name>File Source</name> - <key>gr_file_source</key> - <import>from gnuradio import gr</import> - <make>gr.file_source($type.size*$vlen, $file, $repeat)</make> - <callback>open($file, $repeat)</callback> - <param> - <name>File</name> - <key>file</key> - <value></value> - <type>file_open</type> - </param> - <param> - <name>Output Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>size:gr.sizeof_gr_complex</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>size:gr.sizeof_float</opt> - </option> - <option> - <name>Int</name> - <key>int</key> - <opt>size:gr.sizeof_int</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>size:gr.sizeof_short</opt> - </option> - <option> - <name>Byte</name> - <key>byte</key> - <opt>size:gr.sizeof_char</opt> - </option> - </param> - <param> - <name>Repeat</name> - <key>repeat</key> - <value>True</value> - <type>enum</type> - <option> - <name>Yes</name> - <key>True</key> - </option> - <option> - <name>No</name> - <key>False</key> - </option> - </param> - <param> - <name>Vec Length</name> - <key>vlen</key> - <value>1</value> - <type>int</type> - </param> - <check>$vlen > 0</check> - <source> - <name>out</name> - <type>$type</type> - <vlen>$vlen</vlen> - </source> -</block> |