convert to gnuradio 3.7 interface

This commit is contained in:
Dimitri Stolnikov 2013-05-29 22:34:40 +02:00
parent 9912dcd1e6
commit 3e6a24e5d9
47 changed files with 253 additions and 293 deletions

View File

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

2
README
View File

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

View File

@ -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)

View File

@ -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)

View File

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

View File

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

View File

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

View File

@ -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)

View File

@ -268,15 +268,15 @@ function(GRCC)
set(filenames ${ARGV}) set(filenames ${ARGV})
file(MAKE_DIRECTORY ${directory}) 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 # the known paths here
list(APPEND PYTHONPATHS list(APPEND PYTHONPATHS
${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/gnuradio-core/src/python ${CMAKE_SOURCE_DIR}/gnuradio-runtime/python
${CMAKE_SOURCE_DIR}/gnuradio-core/src/lib/swig ${CMAKE_SOURCE_DIR}/gnuradio-runtime/lib/swig
${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig ${CMAKE_BINARY_DIR}/gnuradio-runtime/lib/swig
) )
if(WIN32) if(WIN32)
@ -317,3 +317,31 @@ function(GRCC)
set(PYFILES ${pyfiles} PARENT_SCOPE) set(PYFILES ${pyfiles} PARENT_SCOPE)
endfunction(GRCC) 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)

View File

@ -105,21 +105,35 @@ endfunction(GR_SWIG_MAKE_DOCS)
macro(GR_SWIG_MAKE name) macro(GR_SWIG_MAKE name)
set(ifiles ${ARGN}) 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 #do swig doc generation if specified
if (GR_SWIG_DOC_FILE) if (GR_SWIG_DOC_FILE)
set(GR_SWIG_DOCS_SOURCE_DEPS ${GR_SWIG_SOURCE_DEPS}) 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}) GR_SWIG_MAKE_DOCS(${GR_SWIG_DOC_FILE} ${GR_SWIG_DOC_DIRS})
add_custom_target(${name}_swig_doc DEPENDS ${GR_SWIG_DOC_FILE}) 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() endif()
#append additional include directories #append additional include directories
find_package(PythonLibs) find_package(PythonLibs)
list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_PATH}) #deprecated name (now dirs) 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 ${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 #determine include dependencies for swig file
execute_process( execute_process(

View File

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

View File

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

View File

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

View File

@ -22,13 +22,13 @@
#include <osmosdr/osmosdr_api.h> #include <osmosdr/osmosdr_api.h>
#include <osmosdr/osmosdr_ranges.h> #include <osmosdr/osmosdr_ranges.h>
#include <gnuradio/gr_hier_block2.h> #include <gnuradio/hier_block2.h>
class osmosdr_sink_c; class osmosdr_sink_c;
/* /*
* We use boost::shared_ptr's instead of raw pointers for all access * 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 * us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid * management issues. This is especially helpful in our hybrid
* C++ / Python system. * 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. * \brief Takes a stream of complex samples.
* \ingroup block * \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: public:
/*! /*!

View File

@ -22,13 +22,13 @@
#include <osmosdr/osmosdr_api.h> #include <osmosdr/osmosdr_api.h>
#include <osmosdr/osmosdr_ranges.h> #include <osmosdr/osmosdr_ranges.h>
#include <gnuradio/gr_hier_block2.h> #include <gnuradio/hier_block2.h>
class osmosdr_source_c; class osmosdr_source_c;
/* /*
* We use boost::shared_ptr's instead of raw pointers for all access * 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 * us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid * management issues. This is especially helpful in our hybrid
* C++ / Python system. * 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. * \brief Provides a stream of complex samples.
* \ingroup block * \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: public:
/*! /*!

View File

@ -44,8 +44,8 @@ GR_OSMOSDR_APPEND_SRCS(
GR_OSMOSDR_APPEND_LIBS( GR_OSMOSDR_APPEND_LIBS(
${Boost_LIBRARIES} ${Boost_LIBRARIES}
${GRUEL_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES}
${GNURADIO_CORE_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES}
) )
######################################################################## ########################################################################
@ -77,7 +77,7 @@ endif(ENABLE_FCD)
######################################################################## ########################################################################
# Setup File component # 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) if(ENABLE_FILE)
GR_INCLUDE_SUBDIRECTORY(file) GR_INCLUDE_SUBDIRECTORY(file)
endif(ENABLE_FILE) endif(ENABLE_FILE)
@ -93,7 +93,7 @@ endif(ENABLE_RTL)
######################################################################## ########################################################################
# Setup RTL_TCP component # 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) if(ENABLE_RTL_TCP)
GR_INCLUDE_SUBDIRECTORY(rtl_tcp) GR_INCLUDE_SUBDIRECTORY(rtl_tcp)
endif(ENABLE_RTL_TCP) endif(ENABLE_RTL_TCP)

View File

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

View File

@ -20,9 +20,9 @@
#ifndef FCD_SOURCE_H #ifndef FCD_SOURCE_H
#define 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" #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 = "" ); fcd_source_sptr make_fcd_source( const std::string & args = "" );
class fcd_source : class fcd_source :
public gr_hier_block2, public gr::hier_block2,
public osmosdr_src_iface public osmosdr_src_iface
{ {
private: private:
@ -73,7 +73,7 @@ public:
std::string get_antenna( size_t chan = 0 ); std::string get_antenna( size_t chan = 0 );
private: private:
fcd_source_c_sptr _src; gr::fcd::source_c::sptr _src;
double _gain, _freq; double _gain, _freq;
int32_t _correct; int32_t _correct;
}; };

View File

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

View File

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

View File

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

View File

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

View File

@ -20,8 +20,8 @@
#ifndef INCLUDED_HACKRF_SINK_C_H #ifndef INCLUDED_HACKRF_SINK_C_H
#define INCLUDED_HACKRF_SINK_C_H #define INCLUDED_HACKRF_SINK_C_H
#include <gruel/thread.h> #include <gnuradio/thread/thread.h>
#include <gnuradio/gr_sync_block.h> #include <gnuradio/sync_block.h>
#include <boost/thread/mutex.hpp> #include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.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 * 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 * us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid * management issues. This is especially helpful in our hybrid
* C++ / Python system. * 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 = ""); hackrf_sink_c_sptr make_hackrf_sink_c (const std::string & args = "");
class hackrf_sink_c : class hackrf_sink_c :
public gr_sync_block, public gr::sync_block,
public osmosdr_snk_iface public osmosdr_snk_iface
{ {
private: private:
@ -131,7 +131,7 @@ private:
static boost::mutex _usage_mutex; static boost::mutex _usage_mutex;
hackrf_device *_dev; hackrf_device *_dev;
// gruel::thread _thread; // gr::thread::thread _thread;
circular_buffer_t _cbuf; circular_buffer_t _cbuf;
unsigned char *_buf; unsigned char *_buf;

View File

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

View File

@ -22,8 +22,8 @@
#ifndef INCLUDED_HACKRF_SOURCE_C_H #ifndef INCLUDED_HACKRF_SOURCE_C_H
#define INCLUDED_HACKRF_SOURCE_C_H #define INCLUDED_HACKRF_SOURCE_C_H
#include <gruel/thread.h> #include <gnuradio/thread/thread.h>
#include <gnuradio/gr_sync_block.h> #include <gnuradio/sync_block.h>
#include <boost/thread/mutex.hpp> #include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.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 * 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 * us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid * management issues. This is especially helpful in our hybrid
* C++ / Python system. * C++ / Python system.
@ -61,7 +61,7 @@ hackrf_source_c_sptr make_hackrf_source_c (const std::string & args = "");
* \ingroup block * \ingroup block
*/ */
class hackrf_source_c : class hackrf_source_c :
public gr_sync_block, public gr::sync_block,
public osmosdr_src_iface public osmosdr_src_iface
{ {
private: private:
@ -132,7 +132,7 @@ private:
std::vector<gr_complex> _lut; std::vector<gr_complex> _lut;
hackrf_device *_dev; hackrf_device *_dev;
gruel::thread _thread; gr::thread::thread _thread;
unsigned short **_buf; unsigned short **_buf;
unsigned int _buf_num; unsigned int _buf_num;
unsigned int _buf_len; unsigned int _buf_len;

View File

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

View File

@ -20,9 +20,9 @@
#ifndef INCLUDED_MIRI_SOURCE_C_H #ifndef INCLUDED_MIRI_SOURCE_C_H
#define 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/mutex.hpp>
#include <boost/thread/condition_variable.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 * 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 * us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid * management issues. This is especially helpful in our hybrid
* C++ / Python system. * C++ / Python system.
@ -58,7 +58,7 @@ miri_source_c_sptr make_miri_source_c (const std::string & args = "");
* \ingroup block * \ingroup block
*/ */
class miri_source_c : class miri_source_c :
public gr_sync_block, public gr::sync_block,
public osmosdr_src_iface public osmosdr_src_iface
{ {
private: private:
@ -114,7 +114,7 @@ private:
void mirisdr_wait(); void mirisdr_wait();
mirisdr_dev_t *_dev; mirisdr_dev_t *_dev;
gruel::thread _thread; gr::thread::thread _thread;
unsigned short **_buf; unsigned short **_buf;
unsigned int *_buf_lens; unsigned int *_buf_lens;
unsigned int _buf_num; unsigned int _buf_num;

View File

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

View File

@ -20,9 +20,9 @@
#ifndef INCLUDED_OSMOSDR_SRC_C_H #ifndef INCLUDED_OSMOSDR_SRC_C_H
#define 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/mutex.hpp>
#include <boost/thread/condition_variable.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 * 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 * us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid * management issues. This is especially helpful in our hybrid
* C++ / Python system. * 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. * \brief Provides a stream of complex samples.
* \ingroup block * \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 : class osmosdr_src_c :
public gr_sync_block, public gr::sync_block,
public osmosdr_src_iface public osmosdr_src_iface
{ {
private: private:
@ -118,7 +118,7 @@ private:
void osmosdr_wait(); void osmosdr_wait();
osmosdr_dev_t *_dev; osmosdr_dev_t *_dev;
gruel::thread _thread; gr::thread::thread _thread;
unsigned short **_buf; unsigned short **_buf;
unsigned int _buf_num; unsigned int _buf_num;
unsigned int _buf_len; unsigned int _buf_len;

View File

@ -25,7 +25,7 @@
#include <vector> #include <vector>
#include <map> #include <map>
#include <gr_io_signature.h> #include <gnuradio/io_signature.h>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/tokenizer.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 max_nchan = 0;
size_t dev_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?"); 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 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 #endif // OSMOSDR_ARG_HELPERS_H

View File

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

View File

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

View File

@ -28,10 +28,10 @@
#endif #endif
#include <osmosdr_source_c_impl.h> #include <osmosdr_source_c_impl.h>
#include <gr_io_signature.h> #include <gnuradio/io_signature.h>
#include <gr_noise_source_c.h> #include <gnuradio/blocks/null_source.h>
#include <gr_throttle.h> #include <gnuradio/blocks/throttle.h>
#include <gnuradio/gr_constants.h> #include <gnuradio/constants.h>
#ifdef ENABLE_OSMOSDR #ifdef ENABLE_OSMOSDR
#include <osmosdr_src_c.h> #include <osmosdr_src_c.h>
@ -65,9 +65,9 @@
#include <hackrf_source_c.h> #include <hackrf_source_c.h>
#endif #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. */ with this behavior in a clean way. The GR maintainer Rondeau has been informed. */
#define WORKAROUND_GR_HIER_BLOCK2_BUG #define WORKAROUND_GR_HIER_BLOCK2_BUG
@ -85,8 +85,8 @@ osmosdr_make_source_c (const std::string &args)
* The private constructor * The private constructor
*/ */
osmosdr_source_c_impl::osmosdr_source_c_impl (const std::string &args) osmosdr_source_c_impl::osmosdr_source_c_impl (const std::string &args)
: gr_hier_block2 ("osmosdr_source_c_impl", : gr::hier_block2 ("osmosdr_source_c_impl",
gr_make_io_signature (0, 0, 0), gr::io_signature::make(0, 0, 0),
args_to_io_signature(args)) args_to_io_signature(args))
{ {
size_t channel = 0; size_t channel = 0;
@ -123,7 +123,7 @@ osmosdr_source_c_impl::osmosdr_source_c_impl (const std::string &args)
std::cerr << "gr-osmosdr " std::cerr << "gr-osmosdr "
<< GR_OSMOSDR_VERSION " (" GR_OSMOSDR_LIBVER ") " << GR_OSMOSDR_VERSION " (" GR_OSMOSDR_LIBVER ") "
<< "gnuradio " << gr_version() << std::endl; << "gnuradio " << gr::version() << std::endl;
std::cerr << "built-in source types: "; std::cerr << "built-in source types: ";
BOOST_FOREACH(std::string dev_type, dev_types) BOOST_FOREACH(std::string dev_type, dev_types)
std::cerr << dev_type << " "; std::cerr << dev_type << " ";
@ -186,7 +186,7 @@ osmosdr_source_c_impl::osmosdr_source_c_impl (const std::string &args)
// std::cerr << "'" << entry.first << "' = '" << entry.second << "'" << std::endl; // std::cerr << "'" << entry.first << "' = '" << entry.second << "'" << std::endl;
osmosdr_src_iface *iface = NULL; osmosdr_src_iface *iface = NULL;
gr_basic_block_sptr block; gr::basic_block_sptr block;
#ifdef ENABLE_OSMOSDR #ifdef ENABLE_OSMOSDR
if ( dict.count("osmosdr") ) { if ( dict.count("osmosdr") ) {
@ -276,18 +276,20 @@ osmosdr_source_c_impl::osmosdr_source_c_impl (const std::string &args)
std::cerr << std::endl << "FATAL: " << ex.what() << std::endl << std::endl; std::cerr << std::endl << "FATAL: " << ex.what() << std::endl << std::endl;
/* we try to prevent the whole application from crashing by faking /* we try to prevent the whole application from crashing by faking
* the missing hardware (channels) with a gaussian noise source */ * the missing hardware (channels) with null sourc(e) */
gr_noise_source_c_sptr noise_source = \
gr_make_noise_source_c( GR_GAUSSIAN, 10 );
gr_throttle::sptr throttle = gr_make_throttle(sizeof(gr_complex), 1e6); gr::blocks::null_source::sptr null_source = \
gr::blocks::null_source::make( sizeof(gr_complex) );
connect(noise_source, 0, throttle, 0); gr::blocks::throttle::sptr throttle = \
gr::blocks::throttle::make( sizeof(gr_complex), 1e5 );
connect(null_source, 0, throttle, 0);
size_t missing_chans = output_signature()->max_streams() - channel; size_t missing_chans = output_signature()->max_streams() - channel;
std::cerr << "Trying to fill up " << missing_chans std::cerr << "Trying to fill up " << missing_chans
<< " missing channel(s) with gaussian noise.\n" << " missing channel(s) with null source(s).\n"
<< "This is being done to prevent the application from crashing\n" << "This is being done to prevent the application from crashing\n"
<< "due to a gnuradio bug. The maintainers have been informed.\n" << "due to a gnuradio bug. The maintainers have been informed.\n"
<< std::endl; << std::endl;

View File

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

View File

@ -28,7 +28,7 @@
#endif #endif
#include "rtl_source_c.h" #include "rtl_source_c.h"
#include <gr_io_signature.h> #include <gnuradio/io_signature.h>
#include <boost/assign.hpp> #include <boost/assign.hpp>
#include <boost/format.hpp> #include <boost/format.hpp>
@ -41,7 +41,7 @@
#include <rtl-sdr.h> #include <rtl-sdr.h>
#include <osmosdr_arg_helpers.h> #include "osmosdr_arg_helpers.h"
using namespace boost::assign; using namespace boost::assign;
@ -64,7 +64,7 @@ make_rtl_source_c (const std::string &args)
/* /*
* Specify constraints on number of input and output streams. * Specify constraints on number of input and output streams.
* This info is used to construct the input and output signatures * 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 * output signatures are used by the runtime system to
* check that a valid number and type of inputs and outputs * check that a valid number and type of inputs and outputs
* are connected to this block. In this case, we accept * 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 * The private constructor
*/ */
rtl_source_c::rtl_source_c (const std::string &args) rtl_source_c::rtl_source_c (const std::string &args)
: gr_sync_block ("rtl_source_c", : gr::sync_block ("rtl_source_c",
gr_make_io_signature (MIN_IN, MAX_IN, sizeof (gr_complex)), gr::io_signature::make(MIN_IN, MAX_IN, sizeof (gr_complex)),
gr_make_io_signature (MIN_OUT, MAX_OUT, sizeof (gr_complex))), gr::io_signature::make(MIN_OUT, MAX_OUT, sizeof (gr_complex))),
_dev(NULL), _dev(NULL),
_buf(NULL), _buf(NULL),
_running(true), _running(true),
@ -233,7 +233,7 @@ rtl_source_c::rtl_source_c (const std::string &args)
_buf[i] = (unsigned short *) malloc(_buf_len); _buf[i] = (unsigned short *) malloc(_buf_len);
} }
_thread = gruel::thread(_rtlsdr_wait, this); _thread = gr::thread::thread(_rtlsdr_wait, this);
} }
/* /*

View File

@ -22,9 +22,9 @@
#ifndef INCLUDED_RTLSDR_SOURCE_C_H #ifndef INCLUDED_RTLSDR_SOURCE_C_H
#define INCLUDED_RTLSDR_SOURCE_C_H #define INCLUDED_RTLSDR_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/mutex.hpp>
#include <boost/thread/condition_variable.hpp> #include <boost/thread/condition_variable.hpp>
@ -35,7 +35,7 @@ typedef struct rtlsdr_dev rtlsdr_dev_t;
/* /*
* We use boost::shared_ptr's instead of raw pointers for all access * 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 * us transparent reference counting, which greatly simplifies storage
* management issues. This is especially helpful in our hybrid * management issues. This is especially helpful in our hybrid
* C++ / Python system. * C++ / Python system.
@ -61,7 +61,7 @@ rtl_source_c_sptr make_rtl_source_c (const std::string & args = "");
* *
*/ */
class rtl_source_c : class rtl_source_c :
public gr_sync_block, public gr::sync_block,
public osmosdr_src_iface public osmosdr_src_iface
{ {
private: private:
@ -121,7 +121,7 @@ private:
std::vector<gr_complex> _lut; std::vector<gr_complex> _lut;
rtlsdr_dev_t *_dev; rtlsdr_dev_t *_dev;
gruel::thread _thread; gr::thread::thread _thread;
unsigned short **_buf; unsigned short **_buf;
unsigned int _buf_num; unsigned int _buf_num;
unsigned int _buf_len; unsigned int _buf_len;

View File

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

View File

@ -25,13 +25,13 @@
#include <boost/assign.hpp> #include <boost/assign.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <gr_io_signature.h> #include <gnuradio/io_signature.h>
#include <gr_deinterleave.h> #include <gnuradio/blocks/deinterleave.h>
#include <gr_float_to_complex.h> #include <gnuradio/blocks/float_to_complex.h>
#include "rtl_tcp_source_c.h" #include "rtl_tcp_source_c.h"
#include <osmosdr_arg_helpers.h> #include "osmosdr_arg_helpers.h"
using namespace boost::assign; using namespace boost::assign;
@ -57,9 +57,9 @@ rtl_tcp_source_c_sptr make_rtl_tcp_source_c(const std::string &args)
} }
rtl_tcp_source_c::rtl_tcp_source_c(const std::string &args) : rtl_tcp_source_c::rtl_tcp_source_c(const std::string &args) :
gr_hier_block2("rtl_tcp_source_c", gr::hier_block2("rtl_tcp_source_c",
gr_make_io_signature (0, 0, 0), gr::io_signature::make(0, 0, 0),
gr_make_io_signature (1, 1, sizeof (gr_complex))), gr::io_signature::make(1, 1, sizeof (gr_complex))),
_no_tuner(false), _no_tuner(false),
_auto_gain(false), _auto_gain(false),
_if_gain(0) _if_gain(0)
@ -127,10 +127,12 @@ rtl_tcp_source_c::rtl_tcp_source_c(const std::string &args) :
_src->set_offset_tuning(offset_tune); _src->set_offset_tuning(offset_tune);
/* rtl tcp source provides a stream of interleaved IQ floats */ /* rtl tcp source provides a stream of interleaved IQ floats */
gr_deinterleave_sptr deinterleave = gr_make_deinterleave(sizeof(float)); gr::blocks::deinterleave::sptr deinterleave = \
gr::blocks::deinterleave::make( sizeof(float) );
/* block to convert deinterleaved floats to a complex stream */ /* block to convert deinterleaved floats to a complex stream */
gr_float_to_complex_sptr f2c = gr_make_float_to_complex(1); gr::blocks::float_to_complex::sptr f2c = \
gr::blocks::float_to_complex::make( 1 );
connect(_src, 0, deinterleave, 0); connect(_src, 0, deinterleave, 0);
connect(deinterleave, 0, f2c, 0); /* I */ connect(deinterleave, 0, f2c, 0); /* I */

View File

@ -20,7 +20,7 @@
#ifndef RTL_TCP_SOURCE_C_H #ifndef RTL_TCP_SOURCE_C_H
#define RTL_TCP_SOURCE_C_H #define RTL_TCP_SOURCE_C_H
#include <gr_hier_block2.h> #include <gnuradio/hier_block2.h>
#include "osmosdr_src_iface.h" #include "osmosdr_src_iface.h"
@ -33,7 +33,7 @@ typedef boost::shared_ptr< rtl_tcp_source_c > rtl_tcp_source_c_sptr;
rtl_tcp_source_c_sptr make_rtl_tcp_source_c( const std::string & args = "" ); rtl_tcp_source_c_sptr make_rtl_tcp_source_c( const std::string & args = "" );
class rtl_tcp_source_c : class rtl_tcp_source_c :
public gr_hier_block2, public gr::hier_block2,
public osmosdr_src_iface public osmosdr_src_iface
{ {
private: private:

View File

@ -22,7 +22,7 @@
#include <rtl_tcp_source_f.h> #include <rtl_tcp_source_f.h>
#include <gr_io_signature.h> #include <gnuradio/io_signature.h>
#include <stdexcept> #include <stdexcept>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
@ -88,9 +88,9 @@ rtl_tcp_source_f::rtl_tcp_source_f(size_t itemsize,
int payload_size, int payload_size,
bool eof, bool eof,
bool wait) bool wait)
: gr_sync_block ("rtl_tcp_source_f", : gr::sync_block ("rtl_tcp_source_f",
gr_make_io_signature(0, 0, 0), gr::io_signature::make(0, 0, 0),
gr_make_io_signature(1, 1, sizeof(float))), gr::io_signature::make(1, 1, sizeof(float))),
d_itemsize(itemsize), d_itemsize(itemsize),
d_payload_size(payload_size), d_payload_size(payload_size),
d_eof(eof), d_eof(eof),

View File

@ -21,8 +21,8 @@
#ifndef RTL_TCP_SOURCE_F_H #ifndef RTL_TCP_SOURCE_F_H
#define RTL_TCP_SOURCE_F_H #define RTL_TCP_SOURCE_F_H
#include <gr_sync_block.h> #include <gnuradio/sync_block.h>
#include <gruel/thread.h> #include <gnuradio/thread/thread.h>
#if defined(_WIN32) #if defined(_WIN32)
// if not posix, assume winsock // if not posix, assume winsock
@ -65,7 +65,7 @@ rtl_tcp_source_f_sptr make_rtl_tcp_source_f (
bool eof = false, bool eof = false,
bool wait = false); bool wait = false);
class rtl_tcp_source_f : public gr_sync_block class rtl_tcp_source_f : public gr::sync_block
{ {
private: private:
size_t d_itemsize; size_t d_itemsize;

View File

@ -36,9 +36,9 @@ uhd_sink_c_sptr make_uhd_sink_c(const std::string &args)
} }
uhd_sink_c::uhd_sink_c(const std::string &args) : uhd_sink_c::uhd_sink_c(const std::string &args) :
gr_hier_block2("uhd_sink_c", gr::hier_block2("uhd_sink_c",
args_to_io_signature(args), args_to_io_signature(args),
gr_make_io_signature (0, 0, 0)), gr::io_signature::make(0, 0, 0)),
_lo_offset(0.0f) _lo_offset(0.0f)
{ {
size_t nchan = 1; size_t nchan = 1;
@ -63,9 +63,9 @@ uhd_sink_c::uhd_sink_c(const std::string &args) :
} }
} }
_snk = uhd_make_usrp_sink( arguments, _snk = gr::uhd::usrp_sink::make( arguments,
uhd::io_type_t::COMPLEX_FLOAT32, uhd::io_type_t::COMPLEX_FLOAT32,
nchan ); nchan );
if (dict.count("subdev")) { if (dict.count("subdev")) {
_snk->set_subdev_spec( dict["subdev"] ); _snk->set_subdev_spec( dict["subdev"] );

View File

@ -20,8 +20,8 @@
#ifndef UHD_SINK_C_H #ifndef UHD_SINK_C_H
#define UHD_SINK_C_H #define UHD_SINK_C_H
#include <gnuradio/gr_hier_block2.h> #include <gnuradio/hier_block2.h>
#include <gnuradio/gr_uhd_usrp_sink.h> #include <gnuradio/uhd/usrp_sink.h>
#include "osmosdr_snk_iface.h" #include "osmosdr_snk_iface.h"
@ -32,7 +32,7 @@ typedef boost::shared_ptr< uhd_sink_c > uhd_sink_c_sptr;
uhd_sink_c_sptr make_uhd_sink_c(const std::string &args = ""); uhd_sink_c_sptr make_uhd_sink_c(const std::string &args = "");
class uhd_sink_c : class uhd_sink_c :
public gr_hier_block2, public gr::hier_block2,
public osmosdr_snk_iface public osmosdr_snk_iface
{ {
private: private:
@ -73,7 +73,7 @@ public:
private: private:
double _lo_offset; double _lo_offset;
boost::shared_ptr<uhd_usrp_sink> _snk; gr::uhd::usrp_sink::sptr _snk;
}; };
#endif // UHD_SINK_C_H #endif // UHD_SINK_C_H

View File

@ -36,8 +36,8 @@ uhd_source_c_sptr make_uhd_source_c(const std::string &args)
} }
uhd_source_c::uhd_source_c(const std::string &args) : uhd_source_c::uhd_source_c(const std::string &args) :
gr_hier_block2("uhd_source_c", gr::hier_block2("uhd_source_c",
gr_make_io_signature (0, 0, 0), gr::io_signature::make(0, 0, 0),
args_to_io_signature(args)), args_to_io_signature(args)),
_lo_offset(0.0f) _lo_offset(0.0f)
{ {
@ -63,9 +63,9 @@ uhd_source_c::uhd_source_c(const std::string &args) :
} }
} }
_src = uhd_make_usrp_source( arguments, _src = gr::uhd::usrp_source::make( arguments,
uhd::io_type_t::COMPLEX_FLOAT32, uhd::io_type_t::COMPLEX_FLOAT32,
nchan ); nchan );
if (dict.count("subdev")) { if (dict.count("subdev")) {
_src->set_subdev_spec( dict["subdev"] ); _src->set_subdev_spec( dict["subdev"] );

View File

@ -20,8 +20,8 @@
#ifndef UHD_SOURCE_C_H #ifndef UHD_SOURCE_C_H
#define UHD_SOURCE_C_H #define UHD_SOURCE_C_H
#include <gnuradio/gr_hier_block2.h> #include <gnuradio/hier_block2.h>
#include <gnuradio/gr_uhd_usrp_source.h> #include <gnuradio/uhd/usrp_source.h>
#include "osmosdr_src_iface.h" #include "osmosdr_src_iface.h"
@ -32,7 +32,7 @@ typedef boost::shared_ptr< uhd_source_c > uhd_source_c_sptr;
uhd_source_c_sptr make_uhd_source_c(const std::string &args = ""); uhd_source_c_sptr make_uhd_source_c(const std::string &args = "");
class uhd_source_c : class uhd_source_c :
public gr_hier_block2, public gr::hier_block2,
public osmosdr_src_iface public osmosdr_src_iface
{ {
private: private:
@ -73,7 +73,7 @@ public:
private: private:
double _lo_offset; double _lo_offset;
boost::shared_ptr<uhd_usrp_source> _src; gr::uhd::usrp_source::sptr _src;
}; };
#endif // UHD_SOURCE_C_H #endif // UHD_SOURCE_C_H

View File

@ -31,12 +31,12 @@ include(GrPython)
######################################################################## ########################################################################
# Setup swig generation # Setup swig generation
######################################################################## ########################################################################
foreach(incdir ${GNURADIO_CORE_INCLUDE_DIRS}) foreach(incdir ${GNURADIO_RUNTIME_INCLUDE_DIRS})
list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/swig) list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/swig)
endforeach(incdir) endforeach(incdir)
foreach(incdir ${GRUEL_INCLUDE_DIRS}) foreach(incdir ${GNURADIO_RUNTIME_INCLUDE_DIRS})
list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gruel/swig) list(APPEND GR_SWIG_INCLUDE_DIRS ${incdir}/gnuradio/swig)
endforeach(incdir) endforeach(incdir)
set(GR_SWIG_LIBRARIES gnuradio-osmosdr) set(GR_SWIG_LIBRARIES gnuradio-osmosdr)

View File

@ -16,6 +16,15 @@
#include "osmosdr/osmosdr_sink_c.h" #include "osmosdr/osmosdr_sink_c.h"
%} %}
// Workaround for a SWIG 2.0.4 bug with templates. Probably needs to be looked in to.
%{
#if PY_VERSION_HEX >= 0x03020000
# define SWIGPY_SLICE_ARG(obj) ((PyObject*) (obj))
#else
# define SWIGPY_SLICE_ARG(obj) ((PySliceObject*) (obj))
#endif
%}
%template(string_vector_t) std::vector<std::string>; %template(string_vector_t) std::vector<std::string>;
//%template(size_vector_t) std::vector<size_t>; //%template(size_vector_t) std::vector<size_t>;
@ -37,12 +46,3 @@ GR_SWIG_BLOCK_MAGIC(osmosdr,source_c);
GR_SWIG_BLOCK_MAGIC(osmosdr,sink_c); GR_SWIG_BLOCK_MAGIC(osmosdr,sink_c);
%include "osmosdr/osmosdr_sink_c.h" %include "osmosdr/osmosdr_sink_c.h"
#if SWIGGUILE
%scheme %{
(load-extension-global "libguile-gnuradio-osmosdr_swig" "scm_init_gnuradio_osmosdr_swig_module")
%}
%goops %{
(use-modules (gnuradio gnuradio_core_runtime))
%}
#endif