summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README13
-rw-r--r--config/gr_pwin32.m413
-rw-r--r--config/grc_gr_uhd.m44
-rw-r--r--config/grc_grc.m45
-rw-r--r--config/mkstemp.m411
-rw-r--r--configure.ac6
-rw-r--r--gcell/apps/test_all.cc7
-rw-r--r--gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc2
-rw-r--r--gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc2
-rw-r--r--gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc2
-rw-r--r--gnuradio-core/src/lib/general/gr_firdes.cc2
-rw-r--r--gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc2
-rw-r--r--gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc2
-rw-r--r--gnuradio-core/src/lib/general/gri_fft.cc35
-rw-r--r--gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc4
-rw-r--r--gnuradio-core/src/lib/missing/Makefile.am4
-rw-r--r--gnuradio-core/src/lib/runtime/gr_preferences.cc39
-rw-r--r--gnuradio-core/src/lib/runtime/gr_unittests.h40
-rw-r--r--gnuradio-core/src/tests/benchmark_vco.cc2
-rw-r--r--gnuradio-core/src/tests/test_all.cc7
-rw-r--r--gnuradio-core/src/tests/test_atsc.cc7
-rw-r--r--gnuradio-core/src/tests/test_filter.cc7
-rw-r--r--gnuradio-core/src/tests/test_general.cc7
-rw-r--r--gnuradio-core/src/tests/test_runtime.cc7
-rw-r--r--gr-atsc/src/lib/test_atsci.cc7
-rw-r--r--gr-howto-write-a-block/config/gr_pwin32.m413
-rw-r--r--gr-howto-write-a-block/config/mkstemp.m411
-rw-r--r--gr-howto-write-a-block/lib/test_all.cc7
-rw-r--r--gr-qtgui/src/lib/FrequencyDisplayPlot.h1
-rw-r--r--gr-qtgui/src/lib/SpectrumGUIClass.cc4
-rw-r--r--gr-qtgui/src/lib/SpectrumGUIClass.h4
-rw-r--r--gr-qtgui/src/lib/TimeDomainDisplayPlot.h1
-rw-r--r--gr-qtgui/src/lib/WaterfallDisplayPlot.cc6
-rw-r--r--gr-qtgui/src/lib/WaterfallDisplayPlot.h13
-rw-r--r--gr-qtgui/src/lib/plot_waterfall.h2
-rwxr-xr-xgr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py16
-rwxr-xr-xgr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py14
-rw-r--r--gr-uhd/lib/Makefile.am3
-rw-r--r--gr-uhd/lib/gr_uhd_api.h33
-rw-r--r--gr-uhd/lib/uhd_multi_usrp_sink.cc51
-rw-r--r--gr-uhd/lib/uhd_multi_usrp_sink.h15
-rw-r--r--gr-uhd/lib/uhd_multi_usrp_source.cc12
-rw-r--r--gr-uhd/lib/uhd_multi_usrp_source.h15
-rw-r--r--gr-uhd/lib/uhd_single_usrp_sink.cc15
-rw-r--r--gr-uhd/lib/uhd_single_usrp_sink.h15
-rw-r--r--gr-uhd/lib/uhd_single_usrp_source.cc94
-rw-r--r--gr-uhd/lib/uhd_single_usrp_source.h19
-rw-r--r--gr-uhd/swig/__init__.py48
-rw-r--r--gr-uhd/swig/uhd_swig.i37
-rw-r--r--gruel/src/lib/Makefile.am4
-rw-r--r--gruel/src/lib/test_gruel.cc53
-rw-r--r--volk/config/gr_pwin32.m413
-rw-r--r--volk/config/mkstemp.m411
53 files changed, 385 insertions, 382 deletions
diff --git a/README b/README
index 4656af2c9..069d32024 100644
--- a/README
+++ b/README
@@ -262,3 +262,16 @@ locations:
LDFLAGS="-L/usr/pkg/lib -R/usr/pkg/lib" CPPFLAGS="-I/usr/pkg/include" ./configure --prefix=/usr/gnuradio
+
+-------------------------------------------------------------------------------
+
+ Legal Matters
+
+-------------------------------------------------------------------------------
+
+Some files have been changed many times throughout the
+years. Copyright notices at the tops of these files list which years
+changes have been made. For some files, changes have occurred in many
+consecutive years. These files may often have the format of a year
+range (e.g., "2006 - 2011"), which indicates that these files have had
+copyrightable changes made during each year in the range, inclusive.
diff --git a/config/gr_pwin32.m4 b/config/gr_pwin32.m4
index 495e9dd4d..6b27b439f 100644
--- a/config/gr_pwin32.m4
+++ b/config/gr_pwin32.m4
@@ -1,6 +1,6 @@
# Check for (mingw)win32 POSIX replacements. -*- Autoconf -*-
-# Copyright 2003,2004,2005 Free Software Foundation, Inc.
+# Copyright 2003,2004,2005,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -61,17 +61,6 @@ AC_TRY_LINK([ #include <windows.h>
AC_MSG_RESULT(no)
)
-dnl Under Win32, mkdir prototype in io.h has only one arg
-AC_MSG_CHECKING(whether mkdir accepts only one arg)
-AC_TRY_COMPILE([#include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>], [
- mkdir("")
- ], [ AC_MSG_RESULT(yes)
- AC_DEFINE(MKDIR_TAKES_ONE_ARG,[],[Define if mkdir accepts only one arg]) ],
- [ AC_MSG_RESULT(no)
- ])
-
AH_BOTTOM(
[
/* Define missing prototypes, implemented in replacement lib */
diff --git a/config/grc_gr_uhd.m4 b/config/grc_gr_uhd.m4
index 80052bb50..e94747c1a 100644
--- a/config/grc_gr_uhd.m4
+++ b/config/grc_gr_uhd.m4
@@ -26,8 +26,8 @@ AC_DEFUN([GRC_GR_UHD],[
if test $passed = yes; then
dnl Don't do gr-uhd if the 'uhd' package is not installed
PKG_CHECK_MODULES(
- [UHD], [uhd >= 1.0.0 uhd < 2.0.0], [],
- [passed=no; AC_MSG_RESULT([gr-uhd requires libuhd 1.x.x])]
+ [UHD], [uhd >= 2.0.0 uhd < 3.0.0], [],
+ [passed=no; AC_MSG_RESULT([gr-uhd requires libuhd 2.x.x])]
)
UHD_CPPFLAGS="${UHD_CPPFLAGS} -I\${abs_top_srcdir}/gr-uhd/lib"
AC_SUBST(UHD_CPPFLAGS)
diff --git a/config/grc_grc.m4 b/config/grc_grc.m4
index 446bba3c5..c21acccff 100644
--- a/config/grc_grc.m4
+++ b/config/grc_grc.m4
@@ -1,4 +1,4 @@
-dnl Copyright 2008, 2009 Free Software Foundation, Inc.
+dnl Copyright 2008, 2009, 2011 Free Software Foundation, Inc.
dnl
dnl This file is part of GNU Radio
dnl
@@ -20,8 +20,6 @@ dnl Boston, MA 02110-1301, USA.
AC_DEFUN([GRC_GRC],[
GRC_ENABLE(grc)
-dnl GRC_CHECK_DEPENDENCY(grc, gr-wxgui)
-
AC_CHECK_PROG(XDG_UTILS, xdg-mime, true, false)
AM_CONDITIONAL(XDG_UTILS, $XDG_UTILS)
@@ -33,6 +31,7 @@ dnl GRC_CHECK_DEPENDENCY(grc, gr-wxgui)
PYTHON_CHECK_MODULE([Cheetah],[Python Cheetah templates >= 2.0.0],[],[passed=no],[Cheetah.Version >= "2.0.0"])
PYTHON_CHECK_MODULE([lxml.etree],[Python lxml wrappers >= 1.3.6],[],[passed=no],[lxml.etree.LXML_VERSION >= (1, 3, 6, 0)])
PYTHON_CHECK_MODULE([gtk],[Python gtk wrappers >= 2.10.0],[],[passed=no],[gtk.pygtk_version >= (2, 10, 0)])
+ PYTHON_CHECK_MODULE([numpy],[NumPy],[],[passed=no],[True])
fi
dnl ########################################
diff --git a/config/mkstemp.m4 b/config/mkstemp.m4
index 4af0f0a9b..2d1fbee9b 100644
--- a/config/mkstemp.m4
+++ b/config/mkstemp.m4
@@ -75,15 +75,4 @@ AC_DEFUN([jm_PREREQ_TEMPNAME],
AC_CHECK_FUNCS(__secure_getenv gettimeofday lstat)
AC_CHECK_DECLS_ONCE(getenv)
# AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
-
- dnl Under Win32, mkdir prototype in io.h has only one arg
- AC_MSG_CHECKING(whether mkdir accepts only one arg)
- AC_TRY_COMPILE([#include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>], [
- mkdir("")
- ], [ AC_MSG_RESULT(yes)
- AC_DEFINE(MKDIR_TAKES_ONE_ARG,[],[Define if mkdir accepts only one arg]) ],
- [ AC_MSG_RESULT(no)
- ])
])
diff --git a/configure.ac b/configure.ac
index 3de2b069e..ff969c27f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-dnl Copyright 2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
+dnl Copyright 2001-2011 Free Software Foundation, Inc.
dnl
dnl This file is part of GNU Radio
dnl
@@ -304,13 +304,13 @@ dnl
dnl all the rest of these call AC_SUBST(BOOST_<foo>_LIB) and define HAVE_BOOST_<foo>
dnl
AX_BOOST_DATE_TIME
-dnl AX_BOOST_FILESYSTEM
+AX_BOOST_FILESYSTEM
dnl AX_BOOST_IOSTREAMS
AX_BOOST_PROGRAM_OPTIONS
dnl AX_BOOST_REGEX
dnl AX_BOOST_SERIALIZATION
dnl AX_BOOST_SIGNALS
-dnl AX_BOOST_SYSTEM
+AX_BOOST_SYSTEM
dnl AX_BOOST_TEST_EXEC_MONITOR
dnl AX_BOOST_UNIT_TEST_FRAMEWORK
dnl AX_BOOST_WSERIALIZATION
diff --git a/gcell/apps/test_all.cc b/gcell/apps/test_all.cc
index 0b608e13b..fc3afd8ca 100644
--- a/gcell/apps/test_all.cc
+++ b/gcell/apps/test_all.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007,2010 Free Software Foundation, Inc.
+ * Copyright 2007,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -29,11 +29,8 @@
int
main(int argc, char **argv)
{
- char path[200];
- get_unittest_path ("gcell_all.xml", path, 200);
-
CppUnit::TextTestRunner runner;
- std::ofstream xmlfile(path);
+ std::ofstream xmlfile(get_unittest_path("gcell_all.xml").c_str());
CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
runner.addTest(qa_gcell_runtime::suite());
diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc
index 1bf4a6f4b..891905dd0 100644
--- a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc
+++ b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc
@@ -99,7 +99,7 @@ gri_fft_filter_ccc_generic::compute_sizes(int ntaps)
{
int old_fftsize = d_fftsize;
d_ntaps = ntaps;
- d_fftsize = (int) (2 * pow(2.0, ceil(log(ntaps) / log(2))));
+ d_fftsize = (int) (2 * pow(2.0, ceil(log(double(ntaps)) / log(2.0))));
d_nsamples = d_fftsize - d_ntaps + 1;
if (0)
diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc
index 74058fa93..b3fbe1d1a 100644
--- a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc
+++ b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc
@@ -86,7 +86,7 @@ gri_fft_filter_fff_generic::compute_sizes(int ntaps)
{
int old_fftsize = d_fftsize;
d_ntaps = ntaps;
- d_fftsize = (int) (2 * pow(2.0, ceil(log(ntaps) / log(2))));
+ d_fftsize = (int) (2 * pow(2.0, ceil(log(double(ntaps)) / log(2.0))));
d_nsamples = d_fftsize - d_ntaps + 1;
if (0)
diff --git a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc
index d5425bfc8..c5e1320a3 100644
--- a/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc
+++ b/gnuradio-core/src/lib/general/gr_decode_ccsds_27_fb.cc
@@ -39,7 +39,7 @@ gr_decode_ccsds_27_fb::gr_decode_ccsds_27_fb()
{
float RATE = 0.5;
float ebn0 = 12.0;
- float esn0 = RATE*pow(10.0, ebn0/10);
+ float esn0 = RATE*pow(10.0, ebn0/10.0);
gen_met(d_mettab, 100, esn0, 0.0, 256);
viterbi_chunks_init(d_state0);
diff --git a/gnuradio-core/src/lib/general/gr_firdes.cc b/gnuradio-core/src/lib/general/gr_firdes.cc
index 8efeb3438..5d192d67e 100644
--- a/gnuradio-core/src/lib/general/gr_firdes.cc
+++ b/gnuradio-core/src/lib/general/gr_firdes.cc
@@ -574,7 +574,7 @@ gr_firdes::gaussian (double gain,
vector<float> taps(ntaps);
double scale = 0;
double dt = 1.0/spb;
- double s = 1.0/(sqrt(log(2)) / (2*M_PI*bt));
+ double s = 1.0/(sqrt(log(2.0)) / (2*M_PI*bt));
double t0 = -0.5 * ntaps;
double ts;
for(int i=0;i<ntaps;i++)
diff --git a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc
index 3457370eb..279945766 100644
--- a/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc
+++ b/gnuradio-core/src/lib/general/gr_ofdm_frame_sink.cc
@@ -281,7 +281,7 @@ gr_ofdm_frame_sink::set_sym_value_out(const std::vector<gr_complex> &sym_positio
d_sym_position = sym_position;
d_sym_value_out = sym_value_out;
- d_nbits = (unsigned long)ceil(log10(d_sym_value_out.size()) / log10(2.0));
+ d_nbits = (unsigned long)ceil(log10(float(d_sym_value_out.size())) / log10(2.0));
return true;
}
diff --git a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc b/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc
index 370b029cd..cc4aba0cb 100644
--- a/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc
+++ b/gnuradio-core/src/lib/general/gr_ofdm_mapper_bcv.cc
@@ -113,7 +113,7 @@ gr_ofdm_mapper_bcv::gr_ofdm_mapper_bcv (const std::vector<gr_complex> &constella
throw std::invalid_argument("gr_ofdm_mapper_bcv: subcarriers allocated exceeds size of occupied carriers");
}
- d_nbits = (unsigned long)ceil(log10(d_constellation.size()) / log10(2.0));
+ d_nbits = (unsigned long)ceil(log10(float(d_constellation.size())) / log10(2.0));
}
gr_ofdm_mapper_bcv::~gr_ofdm_mapper_bcv(void)
diff --git a/gnuradio-core/src/lib/general/gri_fft.cc b/gnuradio-core/src/lib/general/gri_fft.cc
index e535f28c7..eebe3b9c5 100644
--- a/gnuradio-core/src/lib/general/gri_fft.cc
+++ b/gnuradio-core/src/lib/general/gri_fft.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2003,2008 Free Software Foundation, Inc.
+ * Copyright 2003,2008,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -29,6 +29,17 @@
#include <cassert>
#include <stdexcept>
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
+namespace fs = boost::filesystem;
+
+static std::string get_home_dir(void){
+ #if defined(BOOST_WINDOWS)
+ return getenv ("APPDATA");
+ #else
+ return getenv ("HOME");
+ #endif
+}
boost::mutex &
gri_fft_planner::mutex()
@@ -38,26 +49,18 @@ gri_fft_planner::mutex()
return s_planning_mutex;
}
-static char *
+static const char *
wisdom_filename ()
{
- static const char *filename = ".gr_fftw_wisdom";
-
- char *home = getenv ("HOME");
- if (home){
- char *p = new char[strlen (home) + strlen (filename) + 2];
- strcpy (p, home);
- strcat (p, "/");
- strcat (p, filename);
- return p;
- }
- return 0;
+ static fs::path path;
+ path = fs::path(get_home_dir()) / ".gr_fftw_wisdom";
+ return path.string().c_str();
}
static void
gri_fftw_import_wisdom ()
{
- char *filename = wisdom_filename ();
+ const char *filename = wisdom_filename ();
FILE *fp = fopen (filename, "r");
if (fp != 0){
int r = fftwf_import_wisdom_from_file (fp);
@@ -66,13 +69,12 @@ gri_fftw_import_wisdom ()
fprintf (stderr, "gri_fftw: can't import wisdom from %s\n", filename);
}
}
- delete [] filename;
}
static void
gri_fftw_export_wisdom ()
{
- char *filename = wisdom_filename ();
+ const char *filename = wisdom_filename ();
FILE *fp = fopen (filename, "w");
if (fp != 0){
fftwf_export_wisdom_to_file (fp);
@@ -82,7 +84,6 @@ gri_fftw_export_wisdom ()
fprintf (stderr, "gri_fftw: ");
perror (filename);
}
- delete [] filename;
}
// ----------------------------------------------------------------
diff --git a/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc b/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc
index 9885b3852..113006a22 100644
--- a/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc
+++ b/gnuradio-core/src/lib/general/qa_gr_fxpt_vco.cc
@@ -53,7 +53,7 @@ qa_gr_fxpt_vco::t0 ()
float input[SIN_COS_BLOCK_SIZE];
for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){
- input[i] = sin(i);
+ input[i] = sin(double(i));
}
for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){
@@ -85,7 +85,7 @@ qa_gr_fxpt_vco::t1 ()
double max_error = 0;
for (int i = 0; i < SIN_COS_BLOCK_SIZE; i++){
- input[i] = sin(i);
+ input[i] = sin(double(i));
}
ref_vco.cos (ref_block, input, SIN_COS_BLOCK_SIZE, SIN_COS_K, SIN_COS_AMPL);
diff --git a/gnuradio-core/src/lib/missing/Makefile.am b/gnuradio-core/src/lib/missing/Makefile.am
index bd18cf143..1cc6014a1 100644
--- a/gnuradio-core/src/lib/missing/Makefile.am
+++ b/gnuradio-core/src/lib/missing/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2003,2004,2008,2009 Free Software Foundation, Inc.
+# Copyright 2003,2004,2008,2009,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,7 +21,7 @@
include $(top_srcdir)/Makefile.common
-AM_CPPFLAGS = $(GNURADIO_INCLUDES) $(WITH_INCLUDES)
+AM_CPPFLAGS = $(GRUEL_INCLUDES) $(GNURADIO_INCLUDES) $(WITH_INCLUDES)
EXTRA_DIST += \
getopt.h \
diff --git a/gnuradio-core/src/lib/runtime/gr_preferences.cc b/gnuradio-core/src/lib/runtime/gr_preferences.cc
index 5f7412248..e9216e4ac 100644
--- a/gnuradio-core/src/lib/runtime/gr_preferences.cc
+++ b/gnuradio-core/src/lib/runtime/gr_preferences.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2003,2010 Free Software Foundation, Inc.
+ * Copyright 2003,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -33,12 +33,17 @@
#include <unistd.h>
#include <string.h>
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
+namespace fs = boost::filesystem;
-#ifdef MKDIR_TAKES_ONE_ARG
-#define gr_mkdir(pathname, mode) mkdir(pathname)
-#else
-#define gr_mkdir(pathname, mode) mkdir((pathname), (mode))
-#endif
+static std::string get_home_dir(void){
+ #if defined(BOOST_WINDOWS)
+ return getenv ("APPDATA");
+ #else
+ return getenv ("HOME");
+ #endif
+}
/*
* The simplest thing that could possibly work:
@@ -48,27 +53,19 @@
static const char *
pathname (const char *key)
{
- static char buf[200];
- snprintf (buf, sizeof (buf), "%s/.gnuradio/prefs/%s", getenv ("HOME"), key);
- return buf;
+ static fs::path path;
+ path = fs::path(get_home_dir()) / ".gnuradio" / "prefs" / key;
+ return path.string().c_str();
}
static void
ensure_dir_path ()
{
- char path[200];
- struct stat statbuf;
-
- snprintf (path, sizeof (path), "%s/.gnuradio/prefs", getenv ("HOME"));
- if (stat (path, &statbuf) == 0 && S_ISDIR (statbuf.st_mode))
- return;
-
- // blindly try to make it // FIXME make this robust. C++ SUCKS!
+ fs::path path = fs::path(get_home_dir()) / ".gnuradio";
+ if (!fs::is_directory(path)) fs::create_directory(path);
- snprintf (path, sizeof (path), "%s/.gnuradio", getenv ("HOME"));
- gr_mkdir (path, 0750);
- snprintf (path, sizeof (path), "%s/.gnuradio/prefs", getenv ("HOME"));
- gr_mkdir (path, 0750);
+ path = path / "prefs";
+ if (!fs::is_directory(path)) fs::create_directory(path);
}
const char *
diff --git a/gnuradio-core/src/lib/runtime/gr_unittests.h b/gnuradio-core/src/lib/runtime/gr_unittests.h
index 70aa6f294..59149bb2e 100644
--- a/gnuradio-core/src/lib/runtime/gr_unittests.h
+++ b/gnuradio-core/src/lib/runtime/gr_unittests.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2010 Free Software Foundation, Inc.
+ * Copyright 2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -31,37 +31,11 @@
#include <sys/stat.h>
#include <unistd.h>
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
-#ifdef MKDIR_TAKES_ONE_ARG
-#define gr_mkdir(pathname, mode) mkdir(pathname)
-#else
-#define gr_mkdir(pathname, mode) mkdir((pathname), (mode))
-#endif
-
-/*
- * Mostly taken from gr_preferences.cc/h
- * The simplest thing that could possibly work:
- * the key is the filename; the value is the file contents.
- */
-
-static void
-ensure_unittest_path (const char *path)
-{
- struct stat statbuf;
- if (stat (path, &statbuf) == 0 && S_ISDIR (statbuf.st_mode))
- return;
-
- // blindly try to make it // FIXME make this robust. C++ SUCKS!
- gr_mkdir (path, 0750);
+static std::string get_unittest_path(const std::string &filename){
+ boost::filesystem::path path = boost::filesystem::current_path() / ".unittests";
+ if (!boost::filesystem::is_directory(path)) boost::filesystem::create_directory(path);
+ return (path / filename).string();
}
-
-static void
-get_unittest_path (const char *filename, char *fullpath, size_t pathsize)
-{
- char path[200];
- snprintf (path, sizeof(path), "./.unittests");
- snprintf (fullpath, pathsize, "%s/%s", path, filename);
-
- ensure_unittest_path(path);
-}
-
diff --git a/gnuradio-core/src/tests/benchmark_vco.cc b/gnuradio-core/src/tests/benchmark_vco.cc
index ed0ae3b67..3a6ade78c 100644
--- a/gnuradio-core/src/tests/benchmark_vco.cc
+++ b/gnuradio-core/src/tests/benchmark_vco.cc
@@ -63,7 +63,7 @@ benchmark (void test (float *x, const float *y), const char *implementation_name
// touch memory
memset(output, 0, BLOCK_SIZE*sizeof(float));
for (int i = 0; i<BLOCK_SIZE; i++)
- input[i] = sin(i);
+ input[i] = sin(double(i));
// get starting CPU usage
#ifdef HAVE_SYS_RESOURCE_H
diff --git a/gnuradio-core/src/tests/test_all.cc b/gnuradio-core/src/tests/test_all.cc
index 17ee32f34..6cec8ad0e 100644
--- a/gnuradio-core/src/tests/test_all.cc
+++ b/gnuradio-core/src/tests/test_all.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002,2010 Free Software Foundation, Inc.
+ * Copyright 2002,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -34,11 +34,8 @@
int
main (int argc, char **argv)
{
- char path[200];
- get_unittest_path ("gnuradio_core_all.xml", path, 200);
-
CppUnit::TextTestRunner runner;
- std::ofstream xmlfile(path);
+ std::ofstream xmlfile(get_unittest_path("gnuradio_core_all.xml").c_str());
CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
runner.addTest (qa_runtime::suite ());
diff --git a/gnuradio-core/src/tests/test_atsc.cc b/gnuradio-core/src/tests/test_atsc.cc
index 51642f81a..66cb2a312 100644
--- a/gnuradio-core/src/tests/test_atsc.cc
+++ b/gnuradio-core/src/tests/test_atsc.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002 Free Software Foundation, Inc.
+ * Copyright 2002,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -29,11 +29,8 @@
int
main (int argc, char **argv)
{
- char path[200];
- get_unittest_path ("gnuradio_core_atsc.xml", path, 200);
-
CppUnit::TextTestRunner runner;
- std::ofstream xmlfile(path);
+ std::ofstream xmlfile(get_unittest_path("gnuradio_core_atsc.xml").c_str());
CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
runner.addTest (qa_atsc::suite ());
diff --git a/gnuradio-core/src/tests/test_filter.cc b/gnuradio-core/src/tests/test_filter.cc
index 2781cfb35..3227a9ff2 100644
--- a/gnuradio-core/src/tests/test_filter.cc
+++ b/gnuradio-core/src/tests/test_filter.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002,2010 Free Software Foundation, Inc.
+ * Copyright 2002,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -29,11 +29,8 @@
int
main (int argc, char **argv)
{
- char path[200];
- get_unittest_path ("gnuradio_core_filter.xml", path, 200);
-
CppUnit::TextTestRunner runner;
- std::ofstream xmlfile(path);
+ std::ofstream xmlfile(get_unittest_path("gnuradio_core_filter.xml").c_str());
CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
runner.addTest (qa_filter::suite ());
diff --git a/gnuradio-core/src/tests/test_general.cc b/gnuradio-core/src/tests/test_general.cc
index 16ee9c3ad..ca6dee40a 100644
--- a/gnuradio-core/src/tests/test_general.cc
+++ b/gnuradio-core/src/tests/test_general.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002,2010 Free Software Foundation, Inc.
+ * Copyright 2002,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -29,11 +29,8 @@
int
main (int argc, char **argv)
{
- char path[200];
- get_unittest_path ("gnuradio_core_general.xml", path, 200);
-
CppUnit::TextTestRunner runner;
- std::ofstream xmlfile(path);
+ std::ofstream xmlfile(get_unittest_path("gnuradio_core_general.xml").c_str());
CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
runner.addTest (qa_general::suite ());
diff --git a/gnuradio-core/src/tests/test_runtime.cc b/gnuradio-core/src/tests/test_runtime.cc
index c7983a23e..77af3001b 100644
--- a/gnuradio-core/src/tests/test_runtime.cc
+++ b/gnuradio-core/src/tests/test_runtime.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002,2010 Free Software Foundation, Inc.
+ * Copyright 2002,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -29,11 +29,8 @@
int
main (int argc, char **argv)
{
- char path[200];
- get_unittest_path ("gnuradio_core_runtime.xml", path, 200);
-
CppUnit::TextTestRunner runner;
- std::ofstream xmlfile(path);
+ std::ofstream xmlfile(get_unittest_path("gnuradio_core_runtime.xml").c_str());
CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
runner.addTest (qa_runtime::suite ());
diff --git a/gr-atsc/src/lib/test_atsci.cc b/gr-atsc/src/lib/test_atsci.cc
index 184895a90..031ca42ae 100644
--- a/gr-atsc/src/lib/test_atsci.cc
+++ b/gr-atsc/src/lib/test_atsci.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002,2006,2010 Free Software Foundation, Inc.
+ * Copyright 2002,2006,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -28,11 +28,8 @@
int
main (int argc, char **argv)
{
- char path[200];
- get_unittest_path ("gr_atsc.xml", path, 200);
-
CppUnit::TextTestRunner runner;
- std::ofstream xmlfile(path);
+ std::ofstream xmlfile(get_unittest_path("gr_atsc.xml").c_str());
CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
runner.addTest (qa_atsc::suite ());
diff --git a/gr-howto-write-a-block/config/gr_pwin32.m4 b/gr-howto-write-a-block/config/gr_pwin32.m4
index 495e9dd4d..6b27b439f 100644
--- a/gr-howto-write-a-block/config/gr_pwin32.m4
+++ b/gr-howto-write-a-block/config/gr_pwin32.m4
@@ -1,6 +1,6 @@
# Check for (mingw)win32 POSIX replacements. -*- Autoconf -*-
-# Copyright 2003,2004,2005 Free Software Foundation, Inc.
+# Copyright 2003,2004,2005,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -61,17 +61,6 @@ AC_TRY_LINK([ #include <windows.h>
AC_MSG_RESULT(no)
)
-dnl Under Win32, mkdir prototype in io.h has only one arg
-AC_MSG_CHECKING(whether mkdir accepts only one arg)
-AC_TRY_COMPILE([#include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>], [
- mkdir("")
- ], [ AC_MSG_RESULT(yes)
- AC_DEFINE(MKDIR_TAKES_ONE_ARG,[],[Define if mkdir accepts only one arg]) ],
- [ AC_MSG_RESULT(no)
- ])
-
AH_BOTTOM(
[
/* Define missing prototypes, implemented in replacement lib */
diff --git a/gr-howto-write-a-block/config/mkstemp.m4 b/gr-howto-write-a-block/config/mkstemp.m4
index 4af0f0a9b..2d1fbee9b 100644
--- a/gr-howto-write-a-block/config/mkstemp.m4
+++ b/gr-howto-write-a-block/config/mkstemp.m4
@@ -75,15 +75,4 @@ AC_DEFUN([jm_PREREQ_TEMPNAME],
AC_CHECK_FUNCS(__secure_getenv gettimeofday lstat)
AC_CHECK_DECLS_ONCE(getenv)
# AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
-
- dnl Under Win32, mkdir prototype in io.h has only one arg
- AC_MSG_CHECKING(whether mkdir accepts only one arg)
- AC_TRY_COMPILE([#include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>], [
- mkdir("")
- ], [ AC_MSG_RESULT(yes)
- AC_DEFINE(MKDIR_TAKES_ONE_ARG,[],[Define if mkdir accepts only one arg]) ],
- [ AC_MSG_RESULT(no)
- ])
])
diff --git a/gr-howto-write-a-block/lib/test_all.cc b/gr-howto-write-a-block/lib/test_all.cc
index ac1e83839..c12958691 100644
--- a/gr-howto-write-a-block/lib/test_all.cc
+++ b/gr-howto-write-a-block/lib/test_all.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2009,2010 Free Software Foundation, Inc.
+ * Copyright 2009,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -29,11 +29,8 @@
int
main (int argc, char **argv)
{
- char path[200];
- get_unittest_path ("gr_howto_write_a_block.xml", path, 200);
-
CppUnit::TextTestRunner runner;
- std::ofstream xmlfile(path);
+ std::ofstream xmlfile(get_unittest_path("gr_howto_write_a_block.xml").c_str());
CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
runner.addTest(qa_howto::suite ());
diff --git a/gr-qtgui/src/lib/FrequencyDisplayPlot.h b/gr-qtgui/src/lib/FrequencyDisplayPlot.h
index c78e1667e..3c22c1397 100644
--- a/gr-qtgui/src/lib/FrequencyDisplayPlot.h
+++ b/gr-qtgui/src/lib/FrequencyDisplayPlot.h
@@ -1,6 +1,7 @@
#ifndef FREQUENCY_DISPLAY_PLOT_HPP
#define FREQUENCY_DISPLAY_PLOT_HPP
+#include <stdint.h>
#include <cstdio>
#include <qwt_plot.h>
#include <qwt_painter.h>
diff --git a/gr-qtgui/src/lib/SpectrumGUIClass.cc b/gr-qtgui/src/lib/SpectrumGUIClass.cc
index 563ed34ba..052730fc2 100644
--- a/gr-qtgui/src/lib/SpectrumGUIClass.cc
+++ b/gr-qtgui/src/lib/SpectrumGUIClass.cc
@@ -6,8 +6,8 @@
#include <QEvent>
#include <QCustomEvent>
-const long SpectrumGUIClass::MAX_FFT_SIZE;
-const long SpectrumGUIClass::MIN_FFT_SIZE;
+const long SpectrumGUIClass::MAX_FFT_SIZE = 32768;
+const long SpectrumGUIClass::MIN_FFT_SIZE = 1024;
SpectrumGUIClass::SpectrumGUIClass(const uint64_t maxDataSize,
const uint64_t fftSize,
diff --git a/gr-qtgui/src/lib/SpectrumGUIClass.h b/gr-qtgui/src/lib/SpectrumGUIClass.h
index 63a340c34..57a749a6a 100644
--- a/gr-qtgui/src/lib/SpectrumGUIClass.h
+++ b/gr-qtgui/src/lib/SpectrumGUIClass.h
@@ -67,8 +67,8 @@ public:
void DecrementPendingGUIUpdateEvents();
void ResetPendingGUIUpdateEvents();
- static const long MAX_FFT_SIZE = /*1048576*/32768;
- static const long MIN_FFT_SIZE = 1024;
+ static const long MAX_FFT_SIZE;
+ static const long MIN_FFT_SIZE;
QWidget* qwidget();
diff --git a/gr-qtgui/src/lib/TimeDomainDisplayPlot.h b/gr-qtgui/src/lib/TimeDomainDisplayPlot.h
index 5525bbabe..952b5c8cf 100644
--- a/gr-qtgui/src/lib/TimeDomainDisplayPlot.h
+++ b/gr-qtgui/src/lib/TimeDomainDisplayPlot.h
@@ -1,6 +1,7 @@
#ifndef TIME_DOMAIN_DISPLAY_PLOT_HPP
#define TIME_DOMAIN_DISPLAY_PLOT_HPP
+#include <stdint.h>
#include <cstdio>
#include <qwt_plot.h>
#include <qwt_painter.h>
diff --git a/gr-qtgui/src/lib/WaterfallDisplayPlot.cc b/gr-qtgui/src/lib/WaterfallDisplayPlot.cc
index 680c44756..805af1d8d 100644
--- a/gr-qtgui/src/lib/WaterfallDisplayPlot.cc
+++ b/gr-qtgui/src/lib/WaterfallDisplayPlot.cc
@@ -210,12 +210,6 @@ private:
};
-const int WaterfallDisplayPlot::INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR;
-const int WaterfallDisplayPlot::INTENSITY_COLOR_MAP_TYPE_WHITE_HOT;
-const int WaterfallDisplayPlot::INTENSITY_COLOR_MAP_TYPE_BLACK_HOT;
-const int WaterfallDisplayPlot::INTENSITY_COLOR_MAP_TYPE_INCANDESCENT;
-const int WaterfallDisplayPlot::INTENSITY_COLOR_MAP_TYPE_USER_DEFINED;
-
WaterfallDisplayPlot::WaterfallDisplayPlot(QWidget* parent)
: QwtPlot(parent)
{
diff --git a/gr-qtgui/src/lib/WaterfallDisplayPlot.h b/gr-qtgui/src/lib/WaterfallDisplayPlot.h
index a5ccaec40..6b4e978bb 100644
--- a/gr-qtgui/src/lib/WaterfallDisplayPlot.h
+++ b/gr-qtgui/src/lib/WaterfallDisplayPlot.h
@@ -1,6 +1,7 @@
#ifndef WATERFALL_DISPLAY_PLOT_HPP
#define WATERFALL_DISPLAY_PLOT_HPP
+#include <stdint.h>
#include <cstdio>
#include <qwt_plot.h>
#include <qwt_plot_zoomer.h>
@@ -39,11 +40,13 @@ public:
const QColor GetUserDefinedLowIntensityColor()const;
const QColor GetUserDefinedHighIntensityColor()const;
- static const int INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR = 0;
- static const int INTENSITY_COLOR_MAP_TYPE_WHITE_HOT = 1;
- static const int INTENSITY_COLOR_MAP_TYPE_BLACK_HOT = 2;
- static const int INTENSITY_COLOR_MAP_TYPE_INCANDESCENT = 3;
- static const int INTENSITY_COLOR_MAP_TYPE_USER_DEFINED = 4;
+ enum{
+ INTENSITY_COLOR_MAP_TYPE_MULTI_COLOR = 0,
+ INTENSITY_COLOR_MAP_TYPE_WHITE_HOT = 1,
+ INTENSITY_COLOR_MAP_TYPE_BLACK_HOT = 2,
+ INTENSITY_COLOR_MAP_TYPE_INCANDESCENT = 3,
+ INTENSITY_COLOR_MAP_TYPE_USER_DEFINED = 4
+ };
public slots:
void resizeSlot( QSize *s );
diff --git a/gr-qtgui/src/lib/plot_waterfall.h b/gr-qtgui/src/lib/plot_waterfall.h
index 91746e3f3..a11461611 100644
--- a/gr-qtgui/src/lib/plot_waterfall.h
+++ b/gr-qtgui/src/lib/plot_waterfall.h
@@ -19,7 +19,7 @@ class QwtColorMap;
\sa QwtRasterData, QwtColorMap
*/
-class QWT_EXPORT PlotWaterfall: public QwtPlotRasterItem
+class PlotWaterfall: public QwtPlotRasterItem
{
public:
explicit PlotWaterfall(WaterfallData* data, const QString &title = QString::null);
diff --git a/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py b/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
index 5902fa855..9f413f2a8 100755
--- a/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
+++ b/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
"""
-Copyright 2010 Free Software Foundation, Inc.
+Copyright 2010-2011 Free Software Foundation, Inc.
This file is part of GNU Radio
@@ -27,16 +27,12 @@ MAIN_TMPL = """\
<import>from gnuradio import uhd</import>
<make>uhd.multi_usrp_$(sourk)(
device_addr=\$dev_addr,
- io_type=uhd.io_type_t.\$type.type,
+ io_type=uhd.io_type.\$type.type,
num_channels=\$nchan,
)
\#if \$sync()
-_clk_cfg = uhd.clock_config_t()
-_clk_cfg.ref_source = uhd.clock_config_t.REF_SMA
-_clk_cfg.pps_source = uhd.clock_config_t.PPS_SMA
-_clk_cfg.pps_polarity = uhd.clock_config_t.PPS_POS
-self.\$(id).set_clock_config(_clk_cfg, uhd.ALL_MBOARDS);
-self.\$(id).set_time_unknown_pps(uhd.time_spec_t())
+self.\$(id).set_clock_config(uhd.clock_config.external(), uhd.ALL_MBOARDS);
+self.\$(id).setime_unknown_pps(uhd.time_spec())
\#end if
#for $m in range($max_mboards)
\#if \$num_mboards() > $m and \$sd_spec$(m)()
@@ -201,8 +197,8 @@ If the requested rate is not possible, the UHD block will print an error at runt
Center frequency:
The center frequency is the overall frequency of the RF chain. \\
For greater control of how the UHD tunes elements in the RF chain, \\
-pass a tune_request_t object rather than a simple target frequency.
-Tuning with an LO offset example: uhd.tune_request_t(freq, lo_off)
+pass a tune_request object rather than a simple target frequency.
+Tuning with an LO offset example: uhd.tune_request(freq, lo_off)
Antenna:
For subdevices with only one antenna, this may be left blank. \\
diff --git a/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py b/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py
index 66728fe28..4de21c989 100755
--- a/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py
+++ b/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
"""
-Copyright 2010 Free Software Foundation, Inc.
+Copyright 2010-2011 Free Software Foundation, Inc.
This file is part of GNU Radio
@@ -27,15 +27,11 @@ MAIN_TMPL = """\
<import>from gnuradio import uhd</import>
<make>uhd.single_usrp_$(sourk)(
device_addr=\$dev_addr,
- io_type=uhd.io_type_t.\$type.type,
+ io_type=uhd.io_type.\$type.type,
num_channels=\$nchan,
)
\#if \$ref_clk()
-_clk_cfg = uhd.clock_config_t()
-_clk_cfg.ref_source = uhd.clock_config_t.REF_SMA
-_clk_cfg.pps_source = uhd.clock_config_t.PPS_SMA
-_clk_cfg.pps_polarity = uhd.clock_config_t.PPS_POS
-self.\$(id).set_clock_config(_clk_cfg);
+self.\$(id).set_clock_config(uhd.clock_config.external());
\#end if
\#if \$sd_spec()
self.\$(id).set_subdev_spec(\$sd_spec)
@@ -180,8 +176,8 @@ If the requested rate is not possible, the UHD block will print an error at runt
Center frequency:
The center frequency is the overall frequency of the RF chain. \\
For greater control of how the UHD tunes elements in the RF chain, \\
-pass a tune_request_t object rather than a simple target frequency.
-Tuning with an LO offset example: uhd.tune_request_t(freq, lo_off)
+pass a tune_request object rather than a simple target frequency.
+Tuning with an LO offset example: uhd.tune_request(freq, lo_off)
Antenna:
For subdevices with only one antenna, this may be left blank. \\
diff --git a/gr-uhd/lib/Makefile.am b/gr-uhd/lib/Makefile.am
index 1bcfbbbdc..7ddb45cb3 100644
--- a/gr-uhd/lib/Makefile.am
+++ b/gr-uhd/lib/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2010 Free Software Foundation, Inc.
+# Copyright 2010-2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -41,6 +41,7 @@ libgnuradio_uhd_la_LIBADD = \
libgnuradio_uhd_la_LDFLAGS = $(LTVERSIONFLAGS)
grinclude_HEADERS = \
+ gr_uhd_api.h \
uhd_multi_usrp_source.h \
uhd_multi_usrp_sink.h \
uhd_single_usrp_source.h \
diff --git a/gr-uhd/lib/gr_uhd_api.h b/gr-uhd/lib/gr_uhd_api.h
new file mode 100644
index 000000000..a9b99fd87
--- /dev/null
+++ b/gr-uhd/lib/gr_uhd_api.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2011 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_UHD_API_H
+#define INCLUDED_GR_UHD_API_H
+
+#include <uhd/config.hpp>
+
+#ifdef gnuradio_uhd_EXPORTS
+# define GR_UHD_API UHD_EXPORT
+#else
+# define GR_UHD_API UHD_EXPORT
+#endif
+
+#endif /* INCLUDED_GR_UHD_API_H */
diff --git a/gr-uhd/lib/uhd_multi_usrp_sink.cc b/gr-uhd/lib/uhd_multi_usrp_sink.cc
index ee16e2928..32039e44a 100644
--- a/gr-uhd/lib/uhd_multi_usrp_sink.cc
+++ b/gr-uhd/lib/uhd_multi_usrp_sink.cc
@@ -1,5 +1,5 @@
/*
- * Copyright 2010 Free Software Foundation, Inc.
+ * Copyright 2010-2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -37,7 +37,7 @@ uhd_multi_usrp_sink::uhd_multi_usrp_sink(gr_io_signature_sptr sig)
class uhd_multi_usrp_sink_impl : public uhd_multi_usrp_sink{
public:
uhd_multi_usrp_sink_impl(
- const std::string &device_addr,
+ const uhd::device_addr_t &device_addr,
const uhd::io_type_t &io_type,
size_t num_channels
):
@@ -56,6 +56,7 @@ public:
void set_samp_rate(double rate){
_dev->set_tx_rate(rate);
+ _sample_rate = this->get_samp_rate();
}
double get_samp_rate(void){
@@ -72,11 +73,11 @@ public:
return _dev->get_tx_freq_range(chan);
}
- void set_gain(float gain, size_t chan){
+ void set_gain(double gain, size_t chan){
return _dev->set_tx_gain(gain, chan);
}
- float get_gain(size_t chan){
+ double get_gain(size_t chan){
return _dev->get_tx_gain(chan);
}
@@ -128,28 +129,31 @@ public:
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items
){
- uhd::tx_metadata_t metadata;
- metadata.start_of_burst = true;
+ //send a mid-burst packet with time spec
+ _metadata.start_of_burst = false;
+ _metadata.end_of_burst = false;
+ _metadata.has_time_spec = true;
- return _dev->get_device()->send(
- input_items, noutput_items, metadata,
+ size_t num_sent = _dev->get_device()->send(
+ input_items, noutput_items, _metadata,
_type, uhd::device::SEND_MODE_FULL_BUFF, 1.0
);
+
+ //increment the timespec by the number of samples sent
+ _metadata.time_spec += uhd::time_spec_t(0, num_sent, _sample_rate);
+ return num_sent;
}
//Send an empty start-of-burst packet to begin streaming.
- //Set at a time in the near future so data will be sync'd.
+ //Set at a time in the near future to avoid late packets.
bool start(void){
- uhd::tx_metadata_t metadata;
- metadata.start_of_burst = true;
- metadata.has_time_spec = true;
- //TODO: Time in the near future, must be less than source time in future
- //because ethernet pause frames with throttle stream commands.
- //It will be fixed with the invention of host-based flow control.
- metadata.time_spec = get_time_now() + uhd::time_spec_t(0.05);
+ _metadata.start_of_burst = true;
+ _metadata.end_of_burst = false;
+ _metadata.has_time_spec = true;
+ _metadata.time_spec = get_time_now() + uhd::time_spec_t(0.01);
_dev->get_device()->send(
- gr_vector_const_void_star(_nchan), 0, metadata,
+ gr_vector_const_void_star(_nchan), 0, _metadata,
_type, uhd::device::SEND_MODE_ONE_PACKET, 1.0
);
return true;
@@ -158,11 +162,12 @@ public:
//Send an empty end-of-burst packet to end streaming.
//Ending the burst avoids an underflow error on stop.
bool stop(void){
- uhd::tx_metadata_t metadata;
- metadata.end_of_burst = true;
+ _metadata.start_of_burst = false;
+ _metadata.end_of_burst = true;
+ _metadata.has_time_spec = false;
_dev->get_device()->send(
- gr_vector_const_void_star(_nchan), 0, metadata,
+ gr_vector_const_void_star(_nchan), 0, _metadata,
_type, uhd::device::SEND_MODE_ONE_PACKET, 1.0
);
return true;
@@ -172,14 +177,16 @@ protected:
uhd::usrp::multi_usrp::sptr _dev;
const uhd::io_type_t _type;
size_t _nchan;
+ uhd::tx_metadata_t _metadata;
+ double _sample_rate;
};
/***********************************************************************
* Make UHD Multi USRP Sink
**********************************************************************/
boost::shared_ptr<uhd_multi_usrp_sink> uhd_make_multi_usrp_sink(
- const std::string &device_addr,
- const uhd::io_type_t::tid_t &io_type,
+ const uhd::device_addr_t &device_addr,
+ const uhd::io_type_t &io_type,
size_t num_channels
){
return boost::shared_ptr<uhd_multi_usrp_sink>(
diff --git a/gr-uhd/lib/uhd_multi_usrp_sink.h b/gr-uhd/lib/uhd_multi_usrp_sink.h
index 370e59d0e..4866f2cbb 100644
--- a/gr-uhd/lib/uhd_multi_usrp_sink.h
+++ b/gr-uhd/lib/uhd_multi_usrp_sink.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2010 Free Software Foundation, Inc.
+ * Copyright 2010-2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -22,18 +22,19 @@
#ifndef INCLUDED_UHD_MULTI_USRP_SINK_H
#define INCLUDED_UHD_MULTI_USRP_SINK_H
+#include <gr_uhd_api.h>
#include <gr_sync_block.h>
#include <uhd/usrp/multi_usrp.hpp>
class uhd_multi_usrp_sink;
-boost::shared_ptr<uhd_multi_usrp_sink> uhd_make_multi_usrp_sink(
- const std::string &device_addr,
- const uhd::io_type_t::tid_t &io_type,
+GR_UHD_API boost::shared_ptr<uhd_multi_usrp_sink> uhd_make_multi_usrp_sink(
+ const uhd::device_addr_t &device_addr,
+ const uhd::io_type_t &io_type,
size_t num_channels
);
-class uhd_multi_usrp_sink : public gr_sync_block{
+class GR_UHD_API uhd_multi_usrp_sink : public gr_sync_block{
public:
/*!
@@ -96,14 +97,14 @@ public:
* \param gain the gain in dB
* \param chan the channel index 0 to N-1
*/
- virtual void set_gain(float gain, size_t chan) = 0;
+ virtual void set_gain(double gain, size_t chan) = 0;
/*!
* Get the actual dboard gain setting.
* \param chan the channel index 0 to N-1
* \return the actual gain in dB
*/
- virtual float get_gain(size_t chan) = 0;
+ virtual double get_gain(size_t chan) = 0;
/*!
* Get the settable gain range.
diff --git a/gr-uhd/lib/uhd_multi_usrp_source.cc b/gr-uhd/lib/uhd_multi_usrp_source.cc
index 029a763e3..181cf1eb4 100644
--- a/gr-uhd/lib/uhd_multi_usrp_source.cc
+++ b/gr-uhd/lib/uhd_multi_usrp_source.cc
@@ -1,5 +1,5 @@
/*
- * Copyright 2010 Free Software Foundation, Inc.
+ * Copyright 2010-2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -39,7 +39,7 @@ uhd_multi_usrp_source::uhd_multi_usrp_source(gr_io_signature_sptr sig)
class uhd_multi_usrp_source_impl : public uhd_multi_usrp_source{
public:
uhd_multi_usrp_source_impl(
- const std::string &device_addr,
+ const uhd::device_addr_t &device_addr,
const uhd::io_type_t &io_type,
size_t num_channels
):
@@ -73,11 +73,11 @@ public:
return _dev->get_rx_freq_range(chan);
}
- void set_gain(float gain, size_t chan){
+ void set_gain(double gain, size_t chan){
return _dev->set_rx_gain(gain, chan);
}
- float get_gain(size_t chan){
+ double get_gain(size_t chan){
return _dev->get_rx_gain(chan);
}
@@ -177,8 +177,8 @@ private:
* Make UHD Multi USRP Source
**********************************************************************/
boost::shared_ptr<uhd_multi_usrp_source> uhd_make_multi_usrp_source(
- const std::string &device_addr,
- const uhd::io_type_t::tid_t &io_type,
+ const uhd::device_addr_t &device_addr,
+ const uhd::io_type_t &io_type,
size_t num_channels
){
return boost::shared_ptr<uhd_multi_usrp_source>(
diff --git a/gr-uhd/lib/uhd_multi_usrp_source.h b/gr-uhd/lib/uhd_multi_usrp_source.h
index b3cbdae1f..9cbec52aa 100644
--- a/gr-uhd/lib/uhd_multi_usrp_source.h
+++ b/gr-uhd/lib/uhd_multi_usrp_source.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2010 Free Software Foundation, Inc.
+ * Copyright 2010-2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -22,18 +22,19 @@
#ifndef INCLUDED_UHD_MULTI_USRP_SOURCE_H
#define INCLUDED_UHD_MULTI_USRP_SOURCE_H
+#include <gr_uhd_api.h>
#include <gr_sync_block.h>
#include <uhd/usrp/multi_usrp.hpp>
class uhd_multi_usrp_source;
-boost::shared_ptr<uhd_multi_usrp_source> uhd_make_multi_usrp_source(
- const std::string &device_addr,
- const uhd::io_type_t::tid_t &io_type,
+GR_UHD_API boost::shared_ptr<uhd_multi_usrp_source> uhd_make_multi_usrp_source(
+ const uhd::device_addr_t &device_addr,
+ const uhd::io_type_t &io_type,
size_t num_channels
);
-class uhd_multi_usrp_source : public gr_sync_block{
+class GR_UHD_API uhd_multi_usrp_source : public gr_sync_block{
public:
/*!
@@ -96,14 +97,14 @@ public:
* \param gain the gain in dB
* \param chan the channel index 0 to N-1
*/
- virtual void set_gain(float gain, size_t chan) = 0;
+ virtual void set_gain(double gain, size_t chan) = 0;
/*!
* Get the actual dboard gain setting.
* \param chan the channel index 0 to N-1
* \return the actual gain in dB
*/
- virtual float get_gain(size_t chan) = 0;
+ virtual double get_gain(size_t chan) = 0;
/*!
* Get the settable gain range.
diff --git a/gr-uhd/lib/uhd_single_usrp_sink.cc b/gr-uhd/lib/uhd_single_usrp_sink.cc
index 622f506b5..d9aaac893 100644
--- a/gr-uhd/lib/uhd_single_usrp_sink.cc
+++ b/gr-uhd/lib/uhd_single_usrp_sink.cc
@@ -1,5 +1,5 @@
/*
- * Copyright 2010 Free Software Foundation, Inc.
+ * Copyright 2010-2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -37,7 +37,7 @@ uhd_single_usrp_sink::uhd_single_usrp_sink(gr_io_signature_sptr sig)
class uhd_single_usrp_sink_impl : public uhd_single_usrp_sink{
public:
uhd_single_usrp_sink_impl(
- const std::string &device_addr,
+ const uhd::device_addr_t &device_addr,
const uhd::io_type_t &io_type,
size_t num_channels
):
@@ -72,11 +72,11 @@ public:
return _dev->get_tx_freq_range(chan);
}
- void set_gain(float gain, size_t chan){
+ void set_gain(double gain, size_t chan){
return _dev->set_tx_gain(gain, chan);
}
- float get_gain(size_t chan){
+ double get_gain(size_t chan){
return _dev->get_tx_gain(chan);
}
@@ -128,8 +128,7 @@ public:
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items
){
- uhd::tx_metadata_t metadata;
- metadata.start_of_burst = true;
+ uhd::tx_metadata_t metadata; //send a mid-burst packet
return _dev->get_device()->send(
input_items, noutput_items, metadata,
@@ -173,8 +172,8 @@ protected:
* Make UHD Single USRP Sink
**********************************************************************/
boost::shared_ptr<uhd_single_usrp_sink> uhd_make_single_usrp_sink(
- const std::string &device_addr,
- const uhd::io_type_t::tid_t &io_type,
+ const uhd::device_addr_t &device_addr,
+ const uhd::io_type_t &io_type,
size_t num_channels
){
return boost::shared_ptr<uhd_single_usrp_sink>(
diff --git a/gr-uhd/lib/uhd_single_usrp_sink.h b/gr-uhd/lib/uhd_single_usrp_sink.h
index a4c4e6452..4929d0f13 100644
--- a/gr-uhd/lib/uhd_single_usrp_sink.h
+++ b/gr-uhd/lib/uhd_single_usrp_sink.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2010 Free Software Foundation, Inc.
+ * Copyright 2010-2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -22,18 +22,19 @@
#ifndef INCLUDED_UHD_SINGLE_USRP_SINK_H
#define INCLUDED_UHD_SINGLE_USRP_SINK_H
+#include <gr_uhd_api.h>
#include <gr_sync_block.h>
#include <uhd/usrp/single_usrp.hpp>
class uhd_single_usrp_sink;
-boost::shared_ptr<uhd_single_usrp_sink> uhd_make_single_usrp_sink(
- const std::string &device_addr,
- const uhd::io_type_t::tid_t &io_type,
+GR_UHD_API boost::shared_ptr<uhd_single_usrp_sink> uhd_make_single_usrp_sink(
+ const uhd::device_addr_t &device_addr,
+ const uhd::io_type_t &io_type,
size_t num_channels = 1
);
-class uhd_single_usrp_sink : public gr_sync_block{
+class GR_UHD_API uhd_single_usrp_sink : public gr_sync_block{
public:
/*!
@@ -95,14 +96,14 @@ public:
* \param gain the gain in dB
* \param chan the channel index 0 to N-1
*/
- virtual void set_gain(float gain, size_t chan = 0) = 0;
+ virtual void set_gain(double gain, size_t chan = 0) = 0;
/*!
* Get the actual dboard gain setting.
* \param chan the channel index 0 to N-1
* \return the actual gain in dB
*/
- virtual float get_gain(size_t chan = 0) = 0;
+ virtual double get_gain(size_t chan = 0) = 0;
/*!
* Get the settable gain range.
diff --git a/gr-uhd/lib/uhd_single_usrp_source.cc b/gr-uhd/lib/uhd_single_usrp_source.cc
index 45f852a3e..5a26d44b1 100644
--- a/gr-uhd/lib/uhd_single_usrp_source.cc
+++ b/gr-uhd/lib/uhd_single_usrp_source.cc
@@ -1,5 +1,5 @@
/*
- * Copyright 2010 Free Software Foundation, Inc.
+ * Copyright 2010-2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -39,7 +39,7 @@ uhd_single_usrp_source::uhd_single_usrp_source(gr_io_signature_sptr sig)
class uhd_single_usrp_source_impl : public uhd_single_usrp_source{
public:
uhd_single_usrp_source_impl(
- const std::string &device_addr,
+ const uhd::device_addr_t &device_addr,
const uhd::io_type_t &io_type,
size_t num_channels
):
@@ -49,7 +49,6 @@ public:
_type(io_type)
{
_dev = uhd::usrp::single_usrp::make(device_addr);
- d_tag_srcid = pmt::mp("uhd_single_usrp_source");
}
void set_subdev_spec(const std::string &spec){
@@ -74,11 +73,11 @@ public:
return _dev->get_rx_freq_range(chan);
}
- void set_gain(float gain, size_t chan){
+ void set_gain(double gain, size_t chan){
return _dev->set_rx_gain(gain, chan);
}
- float get_gain(size_t chan){
+ double get_gain(size_t chan){
return _dev->get_rx_gain(chan);
}
@@ -125,7 +124,7 @@ public:
/***********************************************************************
* Work
**********************************************************************/
- int work(
+ virtual int work(
int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items
@@ -139,16 +138,7 @@ public:
switch(metadata.error_code){
case uhd::rx_metadata_t::ERROR_CODE_NONE:
- if(metadata.has_time_spec) {
- d_tstamp_pair = pmt::mp(pmt::mp(metadata.time_spec.get_full_secs()),
- pmt::mp(metadata.time_spec.get_frac_secs()));
- add_item_tag(0, nitems_written(0),
- //gr_tags::key_time,
- pmt::pmt_string_to_symbol("time"),
- d_tstamp_pair,
- d_tag_srcid);
- }
- return num_samps;
+ return num_samps;
case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW:
//ignore overflows and try work again
@@ -172,9 +162,68 @@ public:
return true;
}
-private:
+protected:
uhd::usrp::single_usrp::sptr _dev;
const uhd::io_type_t _type;
+};
+
+/***********************************************************************
+ * UHD Single USRP Source Impl with Tags
+ **********************************************************************/
+class uhd_single_usrp_source_impl_with_tags : public uhd_single_usrp_source_impl{
+public:
+ uhd_single_usrp_source_impl_with_tags(
+ const uhd::device_addr_t &device_addr,
+ const uhd::io_type_t &io_type,
+ size_t num_channels
+ ):
+ uhd_single_usrp_source_impl(device_addr, io_type, num_channels)
+ {
+ d_tag_srcid = pmt::mp("uhd_single_usrp_source");
+ }
+
+ int work(
+ int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items
+ ){
+ uhd::rx_metadata_t metadata; //not passed out of this block
+
+ size_t num_samps = _dev->get_device()->recv(
+ output_items, noutput_items, metadata,
+ _type, uhd::device::RECV_MODE_FULL_BUFF
+ );
+
+ switch(metadata.error_code){
+ case uhd::rx_metadata_t::ERROR_CODE_NONE:
+ //FIXME in RECV_MODE_FULL_BUFF we are probably get remainders,
+ //there is no guarantee of has_time_spec, its random
+ if(metadata.has_time_spec) {
+ d_tstamp_pair = pmt::mp(pmt::mp(metadata.time_spec.get_full_secs()),
+ pmt::mp(metadata.time_spec.get_frac_secs()));
+ add_item_tag(0, nitems_written(0),
+ //gr_tags::key_time,
+ pmt::pmt_string_to_symbol("time"),
+ d_tstamp_pair,
+ d_tag_srcid);
+ }
+ return num_samps;
+
+ case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW:
+ //ignore overflows and try work again
+ return work(noutput_items, input_items, output_items);
+
+ default:
+ std::cout << boost::format(
+ "UHD source block got error code 0x%x"
+ ) % metadata.error_code << std::endl;
+ return num_samps;
+ }
+ }
+
+private:
+ size_t d_num_packet_samps;
+ pmt::pmt_t d_tstamp_pair;
pmt::pmt_t d_tag_srcid;
};
@@ -182,11 +231,18 @@ private:
/***********************************************************************
* Make UHD Single USRP Source
**********************************************************************/
+#include <gr_prefs.h>
boost::shared_ptr<uhd_single_usrp_source> uhd_make_single_usrp_source(
- const std::string &device_addr,
- const uhd::io_type_t::tid_t &io_type,
+ const uhd::device_addr_t &device_addr,
+ const uhd::io_type_t &io_type,
size_t num_channels
){
+ //use the tags constructor if tags is set to on
+ bool tags_enabled = (gr_prefs().get_string("gr-uhd", "tags", "off") == "on");
+ if (tags_enabled) return boost::shared_ptr<uhd_single_usrp_source>(
+ new uhd_single_usrp_source_impl_with_tags(device_addr, io_type, num_channels)
+ );
+
return boost::shared_ptr<uhd_single_usrp_source>(
new uhd_single_usrp_source_impl(device_addr, io_type, num_channels)
);
diff --git a/gr-uhd/lib/uhd_single_usrp_source.h b/gr-uhd/lib/uhd_single_usrp_source.h
index 2a011b2b3..262f6696c 100644
--- a/gr-uhd/lib/uhd_single_usrp_source.h
+++ b/gr-uhd/lib/uhd_single_usrp_source.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2010 Free Software Foundation, Inc.
+ * Copyright 2010-2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -22,18 +22,19 @@
#ifndef INCLUDED_UHD_SINGLE_USRP_SOURCE_H
#define INCLUDED_UHD_SINGLE_USRP_SOURCE_H
+#include <gr_uhd_api.h>
#include <gr_sync_block.h>
#include <uhd/usrp/single_usrp.hpp>
class uhd_single_usrp_source;
-boost::shared_ptr<uhd_single_usrp_source> uhd_make_single_usrp_source(
- const std::string &device_addr,
- const uhd::io_type_t::tid_t &io_type,
+GR_UHD_API boost::shared_ptr<uhd_single_usrp_source> uhd_make_single_usrp_source(
+ const uhd::device_addr_t &device_addr,
+ const uhd::io_type_t &io_type,
size_t num_channels = 1
);
-class uhd_single_usrp_source : public gr_sync_block{
+class GR_UHD_API uhd_single_usrp_source : public gr_sync_block{
public:
/*!
@@ -95,14 +96,14 @@ public:
* \param gain the gain in dB
* \param chan the channel index 0 to N-1
*/
- virtual void set_gain(float gain, size_t chan = 0) = 0;
+ virtual void set_gain(double gain, size_t chan = 0) = 0;
/*!
* Get the actual dboard gain setting.
* \param chan the channel index 0 to N-1
* \return the actual gain in dB
*/
- virtual float get_gain(size_t chan = 0) = 0;
+ virtual double get_gain(size_t chan = 0) = 0;
/*!
* Get the settable gain range.
@@ -168,10 +169,6 @@ public:
* \return the single usrp device object
*/
virtual uhd::usrp::single_usrp::sptr get_device(void) = 0;
-
- protected:
- size_t d_num_packet_samps;
- pmt::pmt_t d_tstamp_pair;
};
#endif /* INCLUDED_UHD_SINGLE_USRP_SOURCE_H */
diff --git a/gr-uhd/swig/__init__.py b/gr-uhd/swig/__init__.py
index 0fdacb796..1a9f8358d 100644
--- a/gr-uhd/swig/__init__.py
+++ b/gr-uhd/swig/__init__.py
@@ -1,5 +1,5 @@
#
-# Copyright 2010 Free Software Foundation, Inc.
+# Copyright 2010-2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -22,6 +22,17 @@
# The presence of this file turns this directory into a Python package
########################################################################
+# Create aliases for uhd swig attributes to avoid the "_t"
+# Install the __str__ and __repr__ handlers if applicable
+########################################################################
+import uhd_swig
+for attr in dir(uhd_swig):
+ myobj = getattr(uhd_swig, attr)
+ if hasattr(myobj, 'to_string'): myobj.__repr__ = lambda s: s.to_string().strip()
+ if hasattr(myobj, 'to_pp_string'): myobj.__str__ = lambda s: s.to_pp_string().strip()
+ if attr.endswith('_t'): setattr(uhd_swig, attr[:-2], myobj)
+
+########################################################################
# Add SWIG generated code to this namespace
########################################################################
from uhd_swig import *
@@ -29,6 +40,8 @@ from uhd_swig import *
########################################################################
# Add other content from pure-Python modules here
########################################################################
+class freq_range_t(meta_range_t): pass #a typedef for the user
+class gain_range_t(meta_range_t): pass #a typedef for the user
class tune_request_t(tune_request_t, float):
"""
@@ -38,3 +51,36 @@ class tune_request_t(tune_request_t, float):
"""
def __new__(self, *args): return float.__new__(self)
def __float__(self): return self.target_freq
+
+class device_addr_t(device_addr_t, str):
+ """
+ Make the python tune request object inherit from string
+ so that it can be passed in GRC as a string parameter.
+ The type checking in GRC will accept the device address.
+ Define the set/get item special methods for dict access.
+ """
+ def __new__(self, *args): return str.__new__(self)
+ def __getitem__(self, key): return self.get(key)
+ def __setitem__(self, key, val): self.set(key, val)
+
+########################################################################
+# Cast constructor args (FIXME swig handle overloads?)
+########################################################################
+for attr in (
+ 'single_usrp_source', 'single_usrp_sink',
+ 'multi_usrp_source', 'multi_usrp_sink'
+):
+ def constructor_factory(old_constructor):
+ def constructor_interceptor(*args, **kwargs):
+ args = list(args)
+ kwargs = dict(kwargs)
+ for index, key, cast in (
+ (0, 'device_addr', device_addr),
+ (1, 'io_type', io_type),
+ ):
+ if len(args) > index: args[index] = cast(args[index])
+ if kwargs.has_key(key): kwargs[key] = cast(kwargs[key])
+ return old_constructor(*args, **kwargs)
+ return constructor_interceptor
+ import uhd_swig
+ globals()[attr] = constructor_factory(getattr(uhd_swig, attr))
diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i
index 76f44a491..3c317beb4 100644
--- a/gr-uhd/swig/uhd_swig.i
+++ b/gr-uhd/swig/uhd_swig.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2010 Free Software Foundation, Inc.
+ * Copyright 2010-2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -24,6 +24,8 @@
// header files if UHD was not installed.
#ifdef GR_HAVE_UHD
+#define GR_UHD_API
+
////////////////////////////////////////////////////////////////////////
// Language independent exception handler
////////////////////////////////////////////////////////////////////////
@@ -47,10 +49,6 @@
////////////////////////////////////////////////////////////////////////
%include "gnuradio.i"
-namespace std {
- %template(StringVector) vector<string>;
-}
-
////////////////////////////////////////////////////////////////////////
// block headers
////////////////////////////////////////////////////////////////////////
@@ -64,25 +62,36 @@ namespace std {
////////////////////////////////////////////////////////////////////////
// used types
////////////////////////////////////////////////////////////////////////
+%template(string_vector_t) std::vector<std::string>;
+
%include <uhd/config.hpp>
+
%include <uhd/utils/pimpl.hpp>
+
+%include <uhd/types/dict.hpp>
+%template(string_string_dict_t) uhd::dict<std::string, std::string>; //define after dict
+
+%include <uhd/types/device_addr.hpp>
+
+%include <uhd/types/io_type.hpp>
+
+%template(range_vector_t) std::vector<uhd::range_t>; //define before range
%include <uhd/types/ranges.hpp>
+
%include <uhd/types/tune_request.hpp>
+
%include <uhd/types/tune_result.hpp>
+
%include <uhd/types/io_type.hpp>
+
%include <uhd/types/time_spec.hpp>
-%include <uhd/types/clock_config.hpp>
-//Re-create range typedefs here with %template as they are not imported.
-//Replicate all the levels of templated inheritance so swig understands.
+%include <uhd/types/clock_config.hpp>
-%template(float_range_t) uhd::range_t<float>;
-%template(_float_range_vector_t) std::vector<uhd::range_t<float> >;
-%template(gain_range_t) uhd::meta_range_t<float>;
+%include <uhd/types/metadata.hpp>
-%template(double_range_t) uhd::range_t<double>;
-%template(_double_range_vector_t) std::vector<uhd::range_t<double> >;
-%template(freq_range_t) uhd::meta_range_t<double>;
+%include <uhd/device.hpp>
+%template(device_addr_vector_t) std::vector<uhd::device_addr_t>;
////////////////////////////////////////////////////////////////////////
// block magic
diff --git a/gruel/src/lib/Makefile.am b/gruel/src/lib/Makefile.am
index 5c3302f19..b9b35ae10 100644
--- a/gruel/src/lib/Makefile.am
+++ b/gruel/src/lib/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2008,2009,2010 Free Software Foundation, Inc.
+# Copyright 2008,2009,2010,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -51,6 +51,8 @@ libgruel_la_SOURCES = \
libgruel_la_LIBADD = \
$(BOOST_THREAD_LIB) \
+ $(BOOST_SYSTEM_LIB) \
+ $(BOOST_FILESYSTEM_LIB) \
$(PMT_LIB) \
$(MSG_LIB) \
-lstdc++
diff --git a/gruel/src/lib/test_gruel.cc b/gruel/src/lib/test_gruel.cc
index 2c9528b0a..7ef3520e6 100644
--- a/gruel/src/lib/test_gruel.cc
+++ b/gruel/src/lib/test_gruel.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006,2009,2010 Free Software Foundation, Inc.
+ * Copyright 2006,2009,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -28,16 +28,19 @@
#include "pmt/qa_pmt.h"
-static void get_unittest_path (const char *filename, char *fullpath, size_t pathsize);
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
+namespace fs = boost::filesystem;
int
main(int argc, char **argv)
{
- char path[200];
- get_unittest_path ("gruel.xml", path, 200);
-
+ fs::path path = fs::current_path() / ".unittests";
+ if (!fs::is_directory(path)) fs::create_directory(path);
+ path = path / "gruel.xml";
+
CppUnit::TextTestRunner runner;
- std::ofstream xmlfile(path);
+ std::ofstream xmlfile(path.string().c_str());
CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
runner.addTest(qa_pmt::suite ());
@@ -47,41 +50,3 @@ main(int argc, char **argv)
return was_successful ? 0 : 1;
}
-
-
-// NOTE: These are defined in gr_unittest.h for the rest of the project;
-// rewriting here since we don't depend on gnuradio-core in gruel
-
-#ifdef MKDIR_TAKES_ONE_ARG
-#define gr_mkdir(pathname, mode) mkdir(pathname)
-#else
-#define gr_mkdir(pathname, mode) mkdir((pathname), (mode))
-#endif
-
-/*
- * Mostly taken from gr_preferences.cc/h
- * The simplest thing that could possibly work:
- * the key is the filename; the value is the file contents.
- */
-
-static void
-ensure_unittest_path (const char *path)
-{
- struct stat statbuf;
- if (stat (path, &statbuf) == 0 && S_ISDIR (statbuf.st_mode))
- return;
-
- // blindly try to make it // FIXME make this robust. C++ SUCKS!
- gr_mkdir (path, 0750);
-}
-
-static void
-get_unittest_path (const char *filename, char *fullpath, size_t pathsize)
-{
- char path[200];
- snprintf (path, sizeof(path), "./.unittests");
- snprintf (fullpath, pathsize, "%s/%s", path, filename);
-
- ensure_unittest_path(path);
-}
-
diff --git a/volk/config/gr_pwin32.m4 b/volk/config/gr_pwin32.m4
index 7b99cba6b..b55bc64b1 100644
--- a/volk/config/gr_pwin32.m4
+++ b/volk/config/gr_pwin32.m4
@@ -1,6 +1,6 @@
# Check for (mingw)win32 POSIX replacements. -*- Autoconf -*-
-# Copyright 2003,2004,2005 Free Software Foundation, Inc.
+# Copyright 2003,2004,2005,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -61,17 +61,6 @@ AC_TRY_LINK([ #include <windows.h>
AC_MSG_RESULT(no)
)
-dnl Under Win32, mkdir prototype in io.h has only one arg
-AC_MSG_CHECKING(whether mkdir accepts only one arg)
-AC_TRY_COMPILE([#include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>], [
- mkdir("")
- ], [ AC_MSG_RESULT(yes)
- AC_DEFINE(MKDIR_TAKES_ONE_ARG,[],[Define if mkdir accepts only one arg]) ],
- [ AC_MSG_RESULT(no)
- ])
-
AH_BOTTOM(
[
/* Define missing prototypes, implemented in replacement lib */
diff --git a/volk/config/mkstemp.m4 b/volk/config/mkstemp.m4
index 4af0f0a9b..2d1fbee9b 100644
--- a/volk/config/mkstemp.m4
+++ b/volk/config/mkstemp.m4
@@ -75,15 +75,4 @@ AC_DEFUN([jm_PREREQ_TEMPNAME],
AC_CHECK_FUNCS(__secure_getenv gettimeofday lstat)
AC_CHECK_DECLS_ONCE(getenv)
# AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])
-
- dnl Under Win32, mkdir prototype in io.h has only one arg
- AC_MSG_CHECKING(whether mkdir accepts only one arg)
- AC_TRY_COMPILE([#include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>], [
- mkdir("")
- ], [ AC_MSG_RESULT(yes)
- AC_DEFINE(MKDIR_TAKES_ONE_ARG,[],[Define if mkdir accepts only one arg]) ],
- [ AC_MSG_RESULT(no)
- ])
])