convert to gnuradio 3.7 interface

standalone
Dimitri Stolnikov 10 years ago
parent 9912dcd1e6
commit 3e6a24e5d9
  1. 18
      CMakeLists.txt
  2. 2
      README
  3. 26
      cmake/Modules/FindGnuradioAudio.cmake
  4. 29
      cmake/Modules/FindGnuradioCore.cmake
  5. 2
      cmake/Modules/FindGnuradioFCD.cmake
  6. 10
      cmake/Modules/FindGnuradioIQBalance.cmake
  7. 2
      cmake/Modules/FindGnuradioUHD.cmake
  8. 29
      cmake/Modules/FindGruel.cmake
  9. 38
      cmake/Modules/GrMiscUtils.cmake
  10. 22
      cmake/Modules/GrSwig.cmake
  11. 2
      gnuradio-osmosdr.pc.in
  12. 2
      grc/gen_osmosdr_blocks.py
  13. 2
      include/osmosdr/osmosdr_api.h
  14. 8
      include/osmosdr/osmosdr_sink_c.h
  15. 8
      include/osmosdr/osmosdr_source_c.h
  16. 8
      lib/CMakeLists.txt
  17. 14
      lib/fcd/fcd_source.cc
  18. 8
      lib/fcd/fcd_source.h
  19. 2
      lib/file/CMakeLists.txt
  20. 23
      lib/file/file_source_c.cc
  21. 4
      lib/file/file_source_c.h
  22. 12
      lib/hackrf/hackrf_sink_c.cc
  23. 10
      lib/hackrf/hackrf_sink_c.h
  24. 14
      lib/hackrf/hackrf_source_c.cc
  25. 10
      lib/hackrf/hackrf_source_c.h
  26. 14
      lib/miri/miri_source_c.cc
  27. 10
      lib/miri/miri_source_c.h
  28. 10
      lib/osmosdr/osmosdr_src_c.cc
  29. 12
      lib/osmosdr/osmosdr_src_c.h
  30. 6
      lib/osmosdr_arg_helpers.h
  31. 27
      lib/osmosdr_sink_c_impl.cc
  32. 2
      lib/osmosdr_snk_iface.h
  33. 34
      lib/osmosdr_source_c_impl.cc
  34. 2
      lib/osmosdr_src_iface.h
  35. 14
      lib/rtl/rtl_source_c.cc
  36. 10
      lib/rtl/rtl_source_c.h
  37. 2
      lib/rtl_tcp/CMakeLists.txt
  38. 20
      lib/rtl_tcp/rtl_tcp_source_c.cc
  39. 4
      lib/rtl_tcp/rtl_tcp_source_c.h
  40. 8
      lib/rtl_tcp/rtl_tcp_source_f.cc
  41. 6
      lib/rtl_tcp/rtl_tcp_source_f.h
  42. 10
      lib/uhd/uhd_sink_c.cc
  43. 8
      lib/uhd/uhd_sink_c.h
  44. 10
      lib/uhd/uhd_source_c.cc
  45. 8
      lib/uhd/uhd_source_c.h
  46. 6
      swig/CMakeLists.txt
  47. 18
      swig/osmosdr_swig.i

@ -143,8 +143,8 @@ set(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks)
########################################################################
# Find build dependencies
########################################################################
find_package(Gruel)
find_package(GnuradioCore)
set(GR_REQUIRED_COMPONENTS RUNTIME BLOCKS)
find_package(Gnuradio "3.7.0")
find_package(GnuradioIQBalance)
find_package(UHD)
find_package(GnuradioUHD)
@ -155,12 +155,8 @@ find_package(LibMiriSDR)
find_package(LibHackRF)
find_package(Doxygen)
if(NOT GRUEL_FOUND)
message(FATAL_ERROR "Gruel required to build " ${CMAKE_PROJECT_NAME})
endif()
if(NOT GNURADIO_CORE_FOUND)
message(FATAL_ERROR "GnuRadio Core required to build " ${CMAKE_PROJECT_NAME})
if(NOT GNURADIO_RUNTIME_FOUND)
message(FATAL_ERROR "GnuRadio Runtime required to build " ${CMAKE_PROJECT_NAME})
endif()
########################################################################
@ -170,14 +166,12 @@ include_directories(
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/lib
${Boost_INCLUDE_DIRS}
${GRUEL_INCLUDE_DIRS}
${GNURADIO_CORE_INCLUDE_DIRS}
${GNURADIO_RUNTIME_INCLUDE_DIRS}
)
link_directories(
${Boost_LIBRARY_DIRS}
${GRUEL_LIBRARY_DIRS}
${GNURADIO_CORE_LIBRARY_DIRS}
${GNURADIO_RUNTIME_LIBRARY_DIRS}
)
# Set component parameters

@ -7,7 +7,7 @@ While primarily being developed for the OsmoSDR hardware, this block as well sup
* RTL2832U based DVB-T dongles through librtlsdr
* RTL-TCP spectrum server (see librtlsdr project)
* MSi2500 based DVB-T dongles through libmirisdr
* gnuradio .cfile input through libgnuradio-core
* gnuradio .cfile input through libgnuradio-blocks
By using the OsmoSDR block you can take advantage of a common software api in your application(s) independent of the underlying radio hardware.

@ -1,26 +0,0 @@
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(PC_GNURADIO_AUDIO gnuradio-audio)
FIND_PATH(
GNURADIO_AUDIO_INCLUDE_DIRS
NAMES gnuradio/gr_audio_api.h
HINTS $ENV{GNURADIO_AUDIO_DIR}/include
${PC_GNURADIO_AUDIO_INCLUDEDIR}
PATHS /usr/local/include
/usr/include
)
FIND_LIBRARY(
GNURADIO_AUDIO_LIBRARIES
NAMES gnuradio-audio
HINTS $ENV{GNURADIO_AUDIO_DIR}/lib
${PC_GNURADIO_AUDIO_LIBDIR}
PATHS /usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_AUDIO DEFAULT_MSG GNURADIO_AUDIO_LIBRARIES GNURADIO_AUDIO_INCLUDE_DIRS)
MARK_AS_ADVANCED(GNURADIO_AUDIO_LIBRARIES GNURADIO_AUDIO_INCLUDE_DIRS)

@ -1,29 +0,0 @@
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(PC_GNURADIO_CORE gnuradio-core)
FIND_PATH(
GNURADIO_CORE_INCLUDE_DIRS
NAMES gr_core_api.h
HINTS $ENV{GNURADIO_CORE_DIR}/include/gnuradio
${PC_GNURADIO_CORE_INCLUDEDIR}
${CMAKE_INSTALL_PREFIX}/include/gnuradio
PATHS /usr/local/include/gnuradio
/usr/include/gnuradio
)
FIND_LIBRARY(
GNURADIO_CORE_LIBRARIES
NAMES gnuradio-core
HINTS $ENV{GNURADIO_CORE_DIR}/lib
${PC_GNURADIO_CORE_LIBDIR}
${CMAKE_INSTALL_PREFIX}/lib64
${CMAKE_INSTALL_PREFIX}/lib
PATHS /usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_CORE DEFAULT_MSG GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS)
MARK_AS_ADVANCED(GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS)

@ -3,7 +3,7 @@ PKG_CHECK_MODULES(PC_GNURADIO_FCD gnuradio-fcd)
FIND_PATH(
GNURADIO_FCD_INCLUDE_DIRS
NAMES gnuradio/fcd_api.h
NAMES gnuradio/fcd/api.h
HINTS $ENV{GNURADIO_FCD_DIR}/include
${PC_GNURADIO_FCD_INCLUDEDIR}
PATHS /usr/local/include

@ -3,12 +3,12 @@ PKG_CHECK_MODULES(PC_GNURADIO_IQBALANCE gnuradio-iqbalance)
FIND_PATH(
GNURADIO_IQBALANCE_INCLUDE_DIRS
NAMES iqbalance_api.h
HINTS $ENV{GNURADIO_IQBALANCE_DIR}/include/iqbalance
NAMES iqbalance/api.h
HINTS $ENV{GNURADIO_IQBALANCE_DIR}/include
${PC_GNURADIO_IQBALANCE_INCLUDEDIR}
${CMAKE_INSTALL_PREFIX}/include/iqbalance
PATHS /usr/local/include/iqbalance
/usr/include/iqbalance
${CMAKE_INSTALL_PREFIX}/include
PATHS /usr/local/include
/usr/include
)
FIND_LIBRARY(

@ -3,7 +3,7 @@ PKG_CHECK_MODULES(PC_GNURADIO_UHD gnuradio-uhd)
FIND_PATH(
GNURADIO_UHD_INCLUDE_DIRS
NAMES gnuradio/gr_uhd_api.h
NAMES gnuradio/uhd/api.h
HINTS $ENV{GNURADIO_UHD_DIR}/include
${PC_GNURADIO_UHD_INCLUDEDIR}
PATHS /usr/local/include

@ -1,29 +0,0 @@
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(PC_GRUEL gruel)
FIND_PATH(
GRUEL_INCLUDE_DIRS
NAMES gruel/attributes.h
HINTS $ENV{GRUEL_DIR}/include
${PC_GRUEL_INCLUDEDIR}
${CMAKE_INSTALL_PREFIX}/include
PATHS /usr/local/include
/usr/include
)
FIND_LIBRARY(
GRUEL_LIBRARIES
NAMES gruel
HINTS $ENV{GRUEL_DIR}/lib
${PC_GRUEL_LIBDIR}
${CMAKE_INSTALL_PREFIX}/lib
${CMAKE_INSTALL_PREFIX}/lib64
PATHS /usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GRUEL DEFAULT_MSG GRUEL_LIBRARIES GRUEL_INCLUDE_DIRS)
MARK_AS_ADVANCED(GRUEL_LIBRARIES GRUEL_INCLUDE_DIRS)

@ -268,15 +268,15 @@ function(GRCC)
set(filenames ${ARGV})
file(MAKE_DIRECTORY ${directory})
SET(GRCC_COMMAND ${CMAKE_SOURCE_DIR}/gr-utils/src/python/grcc)
SET(GRCC_COMMAND ${CMAKE_SOURCE_DIR}/gr-utils/python/grcc)
# GRCC uses some stuff in grc and gnuradio-core, so we force
# GRCC uses some stuff in grc and gnuradio-runtime, so we force
# the known paths here
list(APPEND PYTHONPATHS
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/gnuradio-core/src/python
${CMAKE_SOURCE_DIR}/gnuradio-core/src/lib/swig
${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig
${CMAKE_SOURCE_DIR}/gnuradio-runtime/python
${CMAKE_SOURCE_DIR}/gnuradio-runtime/lib/swig
${CMAKE_BINARY_DIR}/gnuradio-runtime/lib/swig
)
if(WIN32)
@ -317,3 +317,31 @@ function(GRCC)
set(PYFILES ${pyfiles} PARENT_SCOPE)
endfunction(GRCC)
########################################################################
# Check if HAVE_PTHREAD_SETSCHEDPARAM and HAVE_SCHED_SETSCHEDULER
# should be defined
########################################################################
macro(GR_CHECK_LINUX_SCHED_AVAIL)
set(CMAKE_REQUIRED_LIBRARIES -lpthread)
CHECK_CXX_SOURCE_COMPILES("
#include <pthread.h>
int main(){
pthread_t pthread;
pthread_setschedparam(pthread, 0, 0);
return 0;
} " HAVE_PTHREAD_SETSCHEDPARAM
)
GR_ADD_COND_DEF(HAVE_PTHREAD_SETSCHEDPARAM)
CHECK_CXX_SOURCE_COMPILES("
#include <sched.h>
int main(){
pid_t pid;
sched_setscheduler(pid, 0, 0);
return 0;
} " HAVE_SCHED_SETSCHEDULER
)
GR_ADD_COND_DEF(HAVE_SCHED_SETSCHEDULER)
endmacro(GR_CHECK_LINUX_SCHED_AVAIL)

@ -105,21 +105,35 @@ endfunction(GR_SWIG_MAKE_DOCS)
macro(GR_SWIG_MAKE name)
set(ifiles ${ARGN})
# Shimming this in here to take care of a SWIG bug with handling
# vector<size_t> and vector<unsigned int> (on 32-bit machines) and
# vector<long unsigned int> (on 64-bit machines). Use this to test
# the size of size_t, then set SIZE_T_32 if it's a 32-bit machine
# or not if it's 64-bit. The logic in gr_type.i handles the rest.
INCLUDE (CheckTypeSize)
CHECK_TYPE_SIZE("size_t" SIZEOF_SIZE_T)
CHECK_TYPE_SIZE("unsigned int" SIZEOF_UINT)
if(${SIZEOF_SIZE_T} EQUAL ${SIZEOF_UINT})
list(APPEND GR_SWIG_FLAGS -DSIZE_T_32)
endif(${SIZEOF_SIZE_T} EQUAL ${SIZEOF_UINT})
#do swig doc generation if specified
if (GR_SWIG_DOC_FILE)
set(GR_SWIG_DOCS_SOURCE_DEPS ${GR_SWIG_SOURCE_DEPS})
set(GR_SWIG_DOCS_TARGET_DEPS ${GR_SWIG_TARGET_DEPS})
list(APPEND GR_SWIG_DOCS_TARGET_DEPS ${GR_SWIG_TARGET_DEPS})
GR_SWIG_MAKE_DOCS(${GR_SWIG_DOC_FILE} ${GR_SWIG_DOC_DIRS})
add_custom_target(${name}_swig_doc DEPENDS ${GR_SWIG_DOC_FILE})
list(APPEND GR_SWIG_TARGET_DEPS ${name}_swig_doc)
list(APPEND GR_SWIG_TARGET_DEPS ${name}_swig_doc ${GR_RUNTIME_SWIG_DOC_FILE})
endif()
#append additional include directories
find_package(PythonLibs)
list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_PATH}) #deprecated name (now dirs)
list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
list(APPEND GR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
list(APPEND GR_SWIG_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR})
#prepend local swig directories
list(INSERT GR_SWIG_INCLUDE_DIRS 0 ${CMAKE_CURRENT_SOURCE_DIR})
list(INSERT GR_SWIG_INCLUDE_DIRS 0 ${CMAKE_CURRENT_BINARY_DIR})
#determine include dependencies for swig file
execute_process(

@ -7,7 +7,7 @@ Name: @CPACK_PACKAGE_NAME@
Description: @CPACK_PACKAGE_DESCRIPTION_SUMMARY@
URL: http://sdr.osmocom.org/trac/
Version: @CPACK_PACKAGE_VERSION@
Requires: gnuradio-core
Requires: gnuradio-runtime gnuradio-blocks
Requires.private: @GR_OSMOSDR_PC_REQUIRES@
Conflicts:
Cflags: -I${includedir} @GR_OSMOSDR_PC_CFLAGS@

@ -115,7 +115,7 @@ While primarily being developed for the OsmoSDR hardware, this block as well sup
* RTL2832U based DVB-T dongles through librtlsdr
* RTL-TCP spectrum server (see librtlsdr project)
* MSi2500 based DVB-T dongles through libmirisdr
* gnuradio .cfile input through libgnuradio-core
* gnuradio .cfile input through libgnuradio-blocks
By using the OsmoSDR block you can take advantage of a common software api in your application(s) independent of the underlying radio hardware.

@ -22,7 +22,7 @@
#ifndef INCLUDED_OSMOSDR_API_H
#define INCLUDED_OSMOSDR_API_H
#include <gruel/attributes.h>
#include <gnuradio/attributes.h>
#ifdef gnuradio_osmosdr_EXPORTS
# define OSMOSDR_API __GR_ATTR_EXPORT

@ -22,13 +22,13 @@
#include <osmosdr/osmosdr_api.h>
#include <osmosdr/osmosdr_ranges.h>
#include <gnuradio/gr_hier_block2.h>
#include <gnuradio/hier_block2.h>
class osmosdr_sink_c;
/*
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr_blocks (and many other data structures). The shared_ptr gets
* to gr::blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
* C++ / Python system.
@ -52,9 +52,9 @@ OSMOSDR_API osmosdr_sink_c_sptr osmosdr_make_sink_c ( const std::string & args =
* \brief Takes a stream of complex samples.
* \ingroup block
*
* This uses the preferred technique: subclassing gr_hier_block2.
* This uses the preferred technique: subclassing gr::hier_block2.
*/
class OSMOSDR_API osmosdr_sink_c : virtual public gr_hier_block2
class OSMOSDR_API osmosdr_sink_c : virtual public gr::hier_block2
{
public:
/*!

@ -22,13 +22,13 @@
#include <osmosdr/osmosdr_api.h>
#include <osmosdr/osmosdr_ranges.h>
#include <gnuradio/gr_hier_block2.h>
#include <gnuradio/hier_block2.h>
class osmosdr_source_c;
/*
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr_blocks (and many other data structures). The shared_ptr gets
* to gr::blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
* C++ / Python system.
@ -52,9 +52,9 @@ OSMOSDR_API osmosdr_source_c_sptr osmosdr_make_source_c ( const std::string & ar
* \brief Provides a stream of complex samples.
* \ingroup block
*
* This uses the preferred technique: subclassing gr_hier_block2.
* This uses the preferred technique: subclassing gr::hier_block2.
*/
class OSMOSDR_API osmosdr_source_c : virtual public gr_hier_block2
class OSMOSDR_API osmosdr_source_c : virtual public gr::hier_block2
{
public:
/*!

@ -44,8 +44,8 @@ GR_OSMOSDR_APPEND_SRCS(
GR_OSMOSDR_APPEND_LIBS(
${Boost_LIBRARIES}
${GRUEL_LIBRARIES}
${GNURADIO_CORE_LIBRARIES}
${GNURADIO_RUNTIME_LIBRARIES}
${GNURADIO_BLOCKS_LIBRARIES}
)
########################################################################
@ -77,7 +77,7 @@ endif(ENABLE_FCD)
########################################################################
# Setup File component
########################################################################
GR_REGISTER_COMPONENT("IQ File Source" ENABLE_FILE GNURADIO_CORE_FOUND)
GR_REGISTER_COMPONENT("IQ File Source" ENABLE_FILE GNURADIO_BLOCKS_FOUND)
if(ENABLE_FILE)
GR_INCLUDE_SUBDIRECTORY(file)
endif(ENABLE_FILE)
@ -93,7 +93,7 @@ endif(ENABLE_RTL)
########################################################################
# Setup RTL_TCP component
########################################################################
GR_REGISTER_COMPONENT("RTLSDR TCP Client" ENABLE_RTL_TCP GNURADIO_CORE_FOUND)
GR_REGISTER_COMPONENT("RTLSDR TCP Client" ENABLE_RTL_TCP GNURADIO_BLOCKS_FOUND)
if(ENABLE_RTL_TCP)
GR_INCLUDE_SUBDIRECTORY(rtl_tcp)
endif(ENABLE_RTL_TCP)

@ -25,11 +25,11 @@
#include <boost/assign.hpp>
#include <boost/foreach.hpp>
#include <gr_io_signature.h>
#include <gnuradio/io_signature.h>
#include <fcd_source.h>
#include "fcd_source.h"
#include <osmosdr_arg_helpers.h>
#include "osmosdr_arg_helpers.h"
using namespace boost::assign;
@ -74,9 +74,9 @@ static std::vector< std::string > _get_devices()
}
fcd_source::fcd_source(const std::string &args) :
gr_hier_block2("fcd_source",
gr_make_io_signature (0, 0, 0),
gr_make_io_signature (1, 1, sizeof (gr_complex)))
gr::hier_block2("fcd_source",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(1, 1, sizeof (gr_complex)))
{
std::string dev_name;
unsigned int dev_index = 0;
@ -93,7 +93,7 @@ fcd_source::fcd_source(const std::string &args) :
else
throw std::runtime_error("No FunCube Dongle found.");
_src = fcd_make_source_c( dev_name );
_src = gr::fcd::source_c::make( dev_name );
connect( _src, 0, self(), 0 );
}

@ -20,9 +20,9 @@
#ifndef FCD_SOURCE_H
#define FCD_SOURCE_H
#include <gr_hier_block2.h>
#include <gnuradio/hier_block2.h>
#include <fcd_source_c.h>
#include <gnuradio/fcd/source_c.h>
#include "osmosdr_src_iface.h"
@ -33,7 +33,7 @@ typedef boost::shared_ptr< fcd_source > fcd_source_sptr;
fcd_source_sptr make_fcd_source( const std::string & args = "" );
class fcd_source :
public gr_hier_block2,
public gr::hier_block2,
public osmosdr_src_iface
{
private:
@ -73,7 +73,7 @@ public:
std::string get_antenna( size_t chan = 0 );
private:
fcd_source_c_sptr _src;
gr::fcd::source_c::sptr _src;
double _gain, _freq;
int32_t _correct;
};

@ -33,5 +33,5 @@ set(file_srcs
# Append gnuradio-osmosdr library sources
########################################################################
list(APPEND gr_osmosdr_srcs ${file_srcs})
list(APPEND gr_osmosdr_libs ${GNURADIO_CORE_LIBRARIES})
list(APPEND gr_osmosdr_libs ${GNURADIO_BLOCKS_LIBRARIES})

@ -24,13 +24,13 @@
#include <boost/assign.hpp>
#include <gr_io_signature.h>
#include <gr_file_source.h>
#include <gr_throttle.h>
#include <gnuradio/io_signature.h>
#include <gnuradio/blocks/file_source.h>
#include <gnuradio/blocks/throttle.h>
#include "file_source_c.h"
#include <osmosdr_arg_helpers.h>
#include "osmosdr_arg_helpers.h"
using namespace boost::assign;
@ -40,9 +40,9 @@ file_source_c_sptr make_file_source_c(const std::string &args)
}
file_source_c::file_source_c(const std::string &args) :
gr_hier_block2("file_source_c",
gr_make_io_signature (0, 0, 0),
gr_make_io_signature (1, 1, sizeof (gr_complex)))
gr::hier_block2("file_source_c",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(1, 1, sizeof (gr_complex)))
{
std::string filename;
bool repeat = true;
@ -76,12 +76,13 @@ file_source_c::file_source_c(const std::string &args) :
if (0 == _rate)
throw std::runtime_error("Parameter 'rate' is missing in arguments.");
gr_file_source_sptr src = gr_make_file_source( sizeof(gr_complex),
filename.c_str(),
repeat );
gr::blocks::file_source::sptr src = \
gr::blocks::file_source::make( sizeof(gr_complex),
filename.c_str(),
repeat );
if (throttle) {
gr_throttle::sptr throttle = gr_make_throttle( sizeof(gr_complex), _rate );
gr::blocks::throttle::sptr throttle = gr::blocks::throttle::make( sizeof(gr_complex), _rate );
connect( src, 0, throttle, 0 );
connect( throttle, 0, self(), 0 );

@ -20,7 +20,7 @@
#ifndef FILE_SOURCE_C_H
#define FILE_SOURCE_C_H
#include <gr_hier_block2.h>
#include <gnuradio/hier_block2.h>
#include "osmosdr_src_iface.h"
@ -31,7 +31,7 @@ typedef boost::shared_ptr< file_source_c > file_source_c_sptr;
file_source_c_sptr make_file_source_c( const std::string & args = "" );
class file_source_c :
public gr_hier_block2,
public gr::hier_block2,
public osmosdr_src_iface
{
private:

@ -42,7 +42,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/thread/thread.hpp>
#include <gnuradio/gr_io_signature.h>
#include <gnuradio/io_signature.h>
#include "hackrf_sink_c.h"
@ -126,7 +126,7 @@ hackrf_sink_c_sptr make_hackrf_sink_c (const std::string & args)
/*
* Specify constraints on number of input and output streams.
* This info is used to construct the input and output signatures
* (2nd & 3rd args to gr_block's constructor). The input and
* (2nd & 3rd args to gr::block's constructor). The input and
* output signatures are used by the runtime system to
* check that a valid number and type of inputs and outputs
* are connected to this block. In this case, we accept
@ -141,9 +141,9 @@ static const int MAX_OUT = 0; // maximum number of output streams
* The private constructor
*/
hackrf_sink_c::hackrf_sink_c (const std::string &args)
: gr_sync_block ("hackrf_sink_c",
gr_make_io_signature (MIN_IN, MAX_IN, sizeof (gr_complex)),
gr_make_io_signature (MIN_OUT, MAX_OUT, sizeof (gr_complex))),
: gr::sync_block ("hackrf_sink_c",
gr::io_signature::make(MIN_IN, MAX_IN, sizeof (gr_complex)),
gr::io_signature::make(MIN_OUT, MAX_OUT, sizeof (gr_complex))),
_dev(NULL),
_buf(NULL),
_sample_rate(0),
@ -219,7 +219,7 @@ hackrf_sink_c::hackrf_sink_c (const std::string &args)
cb_init( &_cbuf, _buf_num, BUF_LEN );
// _thread = gruel::thread(_hackrf_wait, this);
// _thread = gr::thread::thread(_hackrf_wait, this);
}
/*

@ -20,8 +20,8 @@
#ifndef INCLUDED_HACKRF_SINK_C_H
#define INCLUDED_HACKRF_SINK_C_H
#include <gruel/thread.h>
#include <gnuradio/gr_sync_block.h>
#include <gnuradio/thread/thread.h>
#include <gnuradio/sync_block.h>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
@ -45,7 +45,7 @@ typedef struct circular_buffer
/*
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr_blocks (and many other data structures). The shared_ptr gets
* to gr::blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
* C++ / Python system.
@ -66,7 +66,7 @@ typedef boost::shared_ptr<hackrf_sink_c> hackrf_sink_c_sptr;
hackrf_sink_c_sptr make_hackrf_sink_c (const std::string & args = "");
class hackrf_sink_c :
public gr_sync_block,
public gr::sync_block,
public osmosdr_snk_iface
{
private:
@ -131,7 +131,7 @@ private:
static boost::mutex _usage_mutex;
hackrf_device *_dev;
// gruel::thread _thread;
// gr::thread::thread _thread;
circular_buffer_t _cbuf;
unsigned char *_buf;

@ -28,7 +28,7 @@
#endif
#include "hackrf_source_c.h"
#include <gnuradio/gr_io_signature.h>
#include <gnuradio/io_signature.h>
#include <boost/assign.hpp>
#include <boost/format.hpp>
@ -39,7 +39,7 @@
#include <stdexcept>
#include <iostream>
#include <osmosdr_arg_helpers.h>
#include "osmosdr_arg_helpers.h"
using namespace boost::assign;
@ -59,7 +59,7 @@ hackrf_source_c_sptr make_hackrf_source_c (const std::string & args)
/*
* Specify constraints on number of input and output streams.
* This info is used to construct the input and output signatures
* (2nd & 3rd args to gr_block's constructor). The input and
* (2nd & 3rd args to gr::block's constructor). The input and
* output signatures are used by the runtime system to
* check that a valid number and type of inputs and outputs
* are connected to this block. In this case, we accept
@ -74,9 +74,9 @@ static const int MAX_OUT = 1; // maximum number of output streams
* The private constructor
*/
hackrf_source_c::hackrf_source_c (const std::string &args)
: gr_sync_block ("hackrf_source_c",
gr_make_io_signature (MIN_IN, MAX_IN, sizeof (gr_complex)),
gr_make_io_signature (MIN_OUT, MAX_OUT, sizeof (gr_complex))),
: gr::sync_block ("hackrf_source_c",
gr::io_signature::make(MIN_IN, MAX_IN, sizeof (gr_complex)),
gr::io_signature::make(MIN_OUT, MAX_OUT, sizeof (gr_complex))),
_dev(NULL),
_buf(NULL),
_sample_rate(0),
@ -177,7 +177,7 @@ hackrf_source_c::hackrf_source_c (const std::string &args)
_buf[i] = (unsigned short *) malloc(_buf_len);
}
// _thread = gruel::thread(_hackrf_wait, this);
// _thread = gr::thread::thread(_hackrf_wait, this);
}
/*

@ -22,8 +22,8 @@
#ifndef INCLUDED_HACKRF_SOURCE_C_H
#define INCLUDED_HACKRF_SOURCE_C_H
#include <gruel/thread.h>
#include <gnuradio/gr_sync_block.h>
#include <gnuradio/thread/thread.h>
#include <gnuradio/sync_block.h>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
@ -36,7 +36,7 @@ class hackrf_source_c;
/*
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr_blocks (and many other data structures). The shared_ptr gets
* to gr::blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
* C++ / Python system.
@ -61,7 +61,7 @@ hackrf_source_c_sptr make_hackrf_source_c (const std::string & args = "");
* \ingroup block
*/
class hackrf_source_c :
public gr_sync_block,
public gr::sync_block,
public osmosdr_src_iface
{
private:
@ -132,7 +132,7 @@ private:
std::vector<gr_complex> _lut;
hackrf_device *_dev;
gruel::thread _thread;
gr::thread::thread _thread;
unsigned short **_buf;
unsigned int _buf_num;
unsigned int _buf_len;

@ -29,7 +29,7 @@
#endif
#include "miri_source_c.h"
#include <gr_io_signature.h>
#include <gnuradio/io_signature.h>
#include <boost/assign.hpp>
#include <boost/format.hpp>
@ -40,7 +40,7 @@
#include <mirisdr.h>
#include <osmosdr_arg_helpers.h>
#include "osmosdr_arg_helpers.h"
using namespace boost::assign;
@ -64,7 +64,7 @@ make_miri_source_c (const std::string &args)
/*
* Specify constraints on number of input and output streams.
* This info is used to construct the input and output signatures
* (2nd & 3rd args to gr_block's constructor). The input and
* (2nd & 3rd args to gr::block's constructor). The input and
* output signatures are used by the runtime system to
* check that a valid number and type of inputs and outputs
* are connected to this block. In this case, we accept
@ -79,9 +79,9 @@ static const int MAX_OUT = 1; // maximum number of output streams
* The private constructor
*/
miri_source_c::miri_source_c (const std::string &args)
: gr_sync_block ("miri_source_c",
gr_make_io_signature (MIN_IN, MAX_IN, sizeof (gr_complex)),
gr_make_io_signature (MIN_OUT, MAX_OUT, sizeof (gr_complex))),
: gr::sync_block ("miri_source_c",
gr::io_signature::make(MIN_IN, MAX_IN, sizeof (gr_complex)),
gr::io_signature::make(MIN_OUT, MAX_OUT, sizeof (gr_complex))),
_running(true),
_auto_gain(false),
_skipped(0)
@ -140,7 +140,7 @@ miri_source_c::miri_source_c (const std::string &args)
_buf[i] = (unsigned short *) malloc(BUF_SIZE);
}
_thread = gruel::thread(_mirisdr_wait, this);
_thread = gr::thread::thread(_mirisdr_wait, this);
}
/*

@ -20,9 +20,9 @@
#ifndef INCLUDED_MIRI_SOURCE_C_H
#define INCLUDED_MIRI_SOURCE_C_H
#include <gr_sync_block.h>
#include <gnuradio/sync_block.h>
#include <gruel/thread.h>
#include <gnuradio/thread/thread.h>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
@ -33,7 +33,7 @@ typedef struct mirisdr_dev mirisdr_dev_t;
/*
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr_blocks (and many other data structures). The shared_ptr gets
* to gr::blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
* C++ / Python system.
@ -58,7 +58,7 @@ miri_source_c_sptr make_miri_source_c (const std::string & args = "");
* \ingroup block
*/
class miri_source_c :
public gr_sync_block,
public gr::sync_block,
public osmosdr_src_iface
{
private:
@ -114,7 +114,7 @@ private:
void mirisdr_wait();
mirisdr_dev_t *_dev;
gruel::thread _thread;
gr::thread::thread _thread;
unsigned short **_buf;
unsigned int *_buf_lens;
unsigned int _buf_num;

@ -28,7 +28,7 @@
#endif
#include "osmosdr_src_c.h"
#include <gr_io_signature.h>
#include <gnuradio/io_signature.h>
#include <boost/assign.hpp>
#include <boost/format.hpp>
@ -39,7 +39,7 @@
#include <osmosdr.h>
#include <osmosdr_arg_helpers.h>
#include "osmosdr_arg_helpers.h"
using namespace boost::assign;
@ -63,8 +63,8 @@ osmosdr_make_src_c (const std::string &args)
* The private constructor
*/
osmosdr_src_c::osmosdr_src_c (const std::string &args)
: gr_sync_block ("osmosdr_src_c",
gr_make_io_signature (0, 0, sizeof (gr_complex)),
: gr::sync_block ("osmosdr_src_c",
gr::io_signature::make(0, 0, sizeof (gr_complex)),
args_to_io_signature(args)),
_dev(NULL),
_buf(NULL),
@ -139,7 +139,7 @@ osmosdr_src_c::osmosdr_src_c (const std::string &args)
_buf[i] = (unsigned short *) malloc(_buf_len);
}
_thread = gruel::thread(_osmosdr_wait, this);
_thread = gr::thread::thread(_osmosdr_wait, this);
}
/*

@ -20,9 +20,9 @@
#ifndef INCLUDED_OSMOSDR_SRC_C_H
#define INCLUDED_OSMOSDR_SRC_C_H
#include <gr_sync_block.h>
#include <gnuradio/sync_block.h>
#include <gruel/thread.h>
#include <gnuradio/thread/thread.h>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
@ -33,7 +33,7 @@ typedef struct osmosdr_dev osmosdr_dev_t;
/*
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr_blocks (and many other data structures). The shared_ptr gets
* to gr::blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid
* C++ / Python system.
@ -57,10 +57,10 @@ osmosdr_src_c_sptr osmosdr_make_src_c (const std::string & args = "");
* \brief Provides a stream of complex samples.
* \ingroup block
*
* \sa osmosdr_sink_c for a version that subclasses gr_hier_block2.
* \sa osmosdr_sink_c for a version that subclasses gr::hier_block2.
*/
class osmosdr_src_c :
public gr_sync_block,
public gr::sync_block,
public osmosdr_src_iface
{
private:
@ -118,7 +118,7 @@ private:
void osmosdr_wait();
osmosdr_dev_t *_dev;
gruel::thread _thread;
gr::thread::thread _thread;
unsigned short **_buf;
unsigned int _buf_num;
unsigned int _buf_len;

@ -25,7 +25,7 @@
#include <vector>
#include <map>
#include <gr_io_signature.h>
#include <gnuradio/io_signature.h>
#include <boost/lexical_cast.hpp>
#include <boost/tokenizer.hpp>
@ -106,7 +106,7 @@ struct is_nchan_argument
}
};
inline gr_io_signature_sptr args_to_io_signature( const std::string &args )
inline gr::io_signature::sptr args_to_io_signature( const std::string &args )
{
size_t max_nchan = 0;
size_t dev_nchan = 0;
@ -147,7 +147,7 @@ inline gr_io_signature_sptr args_to_io_signature( const std::string &args )
throw std::runtime_error("Wrong device arguments specified. Missing nchan?");
const size_t nchan = std::max<size_t>(dev_nchan, 1); // assume at least one
return gr_make_io_signature(nchan, nchan, sizeof(gr_complex));
return gr::io_signature::make(nchan, nchan, sizeof(gr_complex));
}
#endif // OSMOSDR_ARG_HELPERS_H

@ -27,10 +27,10 @@
#include "config.h"
#endif
#include <gnuradio/gr_io_signature.h>
#include <gnuradio/gr_constants.h>
#include <gnuradio/gr_throttle.h>
#include <gnuradio/gr_null_sink.h>
#include <gnuradio/io_signature.h>
#include <gnuradio/constants.h>
#include <gnuradio/blocks/throttle.h>
#include <gnuradio/blocks/null_sink.h>
#include "osmosdr_sink_c_impl.h"
@ -43,7 +43,7 @@
#include "osmosdr_arg_helpers.h"
/* This avoids throws in ctor of gr_hier_block2, as gnuradio is unable to deal
/* This avoids throws in ctor of gr::hier_block2, as gnuradio is unable to deal
with this behavior in a clean way. The GR maintainer Rondeau has been informed. */
#define WORKAROUND_GR_HIER_BLOCK2_BUG
@ -61,9 +61,9 @@ osmosdr_make_sink_c (const std::string &args)
* The private constructor
*/
osmosdr_sink_c_impl::osmosdr_sink_c_impl (const std::string &args)
: gr_hier_block2 ("osmosdr_sink_c_impl",
: gr::hier_block2 ("osmosdr_sink_c_impl",
args_to_io_signature(args),
gr_make_io_signature (0, 0, 0))
gr::io_signature::make(0, 0, 0))
{
size_t channel = 0;
bool device_specified = false;
@ -81,7 +81,7 @@ osmosdr_sink_c_impl::osmosdr_sink_c_impl (const std::string &args)
std::cerr << "gr-osmosdr "
<< GR_OSMOSDR_VERSION " (" GR_OSMOSDR_LIBVER ") "
<< "gnuradio " << gr_version() << std::endl;
<< "gnuradio " << gr::version() << std::endl;
std::cerr << "built-in sink types: ";
BOOST_FOREACH(std::string dev_type, dev_types)
std::cerr << dev_type << " ";
@ -128,7 +128,7 @@ osmosdr_sink_c_impl::osmosdr_sink_c_impl (const std::string &args)
// std::cerr << "'" << entry.first << "' = '" << entry.second << "'" << std::endl;
osmosdr_snk_iface *iface = NULL;
gr_basic_block_sptr block;
gr::basic_block_sptr block;
#ifdef ENABLE_UHD
if ( dict.count("uhd") ) {
@ -163,7 +163,7 @@ osmosdr_sink_c_impl::osmosdr_sink_c_impl (const std::string &args)
size_t missing_chans = output_signature()->max_streams() - channel;
std::cerr << "Trying to fill up " << missing_chans
<< " missing channel(s) with null sinks.\n"
<< " missing channel(s) with null sink(s).\n"
<< "This is being done to prevent the application from crashing\n"
<< "due to a gnuradio bug. The maintainers have been informed.\n"
<< std::endl;
@ -171,9 +171,12 @@ osmosdr_sink_c_impl::osmosdr_sink_c_impl (const std::string &args)
for (size_t i = 0; i < missing_chans; i++) {
/* we try to prevent the whole application from crashing by faking
* the missing hardware (channels) with a null sink */
gr_null_sink_sptr null_sink = gr_make_null_sink( sizeof(gr_complex) );
gr_throttle::sptr throttle = gr_make_throttle(sizeof(gr_complex), 1e6);
gr::blocks::null_sink::sptr null_sink = \
gr::blocks::null_sink::make( sizeof(gr_complex) );
gr::blocks::throttle::sptr throttle = \
gr::blocks::throttle::make( sizeof(gr_complex), 1e5 );
connect(self(), channel++, throttle, 0);
connect(throttle, 0, null_sink, 0);

@ -22,7 +22,7 @@
#define OSMOSDR_SNK_IFACE_H
#include <osmosdr/osmosdr_ranges.h>
#include <gr_basic_block.h>
#include <gnuradio/basic_block.h>
class osmosdr_snk_iface;

@ -28,10 +28,10 @@
#endif
#include <osmosdr_source_c_impl.h>
#include <gr_io_signature.h>
#include <gr_noise_source_c.h>
#include <gr_throttle.h>
#include <gnuradio/gr_constants.h>
#include <gnuradio/io_signature.h>
#include <gnuradio/blocks/null_source.h>
#include <gnuradio/blocks/throttle.h>
#include <gnuradio/constants.h>
#ifdef ENABLE_OSMOSDR
#include <osmosdr_src_c.h>
@ -65,9 +65,9 @@
#include <hackrf_source_c.h>
#endif
#include <osmosdr_arg_helpers.h>
#include "osmosdr_arg_helpers.h"
/* This avoids throws in ctor of gr_hier_block2, as gnuradio is unable to deal
/* This avoids throws in ctor of gr::hier_block2, as gnuradio is unable to deal
with this behavior in a clean way. The GR maintainer Rondeau has been informed. */
#define WORKAROUND_GR_HIER_BLOCK2_BUG