aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/doxygen/Doxyfile.in2
-rw-r--r--grc/CMakeLists.txt6
-rw-r--r--grc/gen_osmosdr_blocks.py18
-rw-r--r--include/osmosdr/CMakeLists.txt12
-rw-r--r--include/osmosdr/api.h (renamed from include/osmosdr/osmosdr_api.h)0
-rw-r--r--include/osmosdr/device.h (renamed from include/osmosdr/osmosdr_device.h)4
-rw-r--r--include/osmosdr/pimpl.h (renamed from include/osmosdr/osmosdr_pimpl.h)2
-rw-r--r--include/osmosdr/ranges.h (renamed from include/osmosdr/osmosdr_ranges.h)4
-rw-r--r--include/osmosdr/sink.h (renamed from include/osmosdr/osmosdr_sink_c.h)52
-rw-r--r--include/osmosdr/source.h (renamed from include/osmosdr/osmosdr_source_c.h)52
-rw-r--r--lib/CMakeLists.txt8
-rw-r--r--lib/arg_helpers.h (renamed from lib/osmosdr_arg_helpers.h)0
-rw-r--r--lib/device.cc (renamed from lib/osmosdr_device.cc)8
-rw-r--r--lib/fcd/CMakeLists.txt2
-rw-r--r--lib/fcd/fcd_source_c.cc (renamed from lib/fcd/fcd_source.cc)56
-rw-r--r--lib/fcd/fcd_source_c.h (renamed from lib/fcd/fcd_source.h)24
-rw-r--r--lib/file/file_source_c.cc2
-rw-r--r--lib/file/file_source_c.h4
-rw-r--r--lib/hackrf/hackrf_sink_c.cc2
-rw-r--r--lib/hackrf/hackrf_sink_c.h4
-rw-r--r--lib/hackrf/hackrf_source_c.cc2
-rw-r--r--lib/hackrf/hackrf_source_c.h4
-rw-r--r--lib/miri/miri_source_c.cc2
-rw-r--r--lib/miri/miri_source_c.h4
-rw-r--r--lib/osmosdr/osmosdr_src_c.cc2
-rw-r--r--lib/osmosdr/osmosdr_src_c.h6
-rw-r--r--lib/ranges.cc (renamed from lib/osmosdr_ranges.cc)2
-rw-r--r--lib/rtl/rtl_source_c.cc2
-rw-r--r--lib/rtl/rtl_source_c.h4
-rw-r--r--lib/rtl_tcp/rtl_tcp_source_c.cc2
-rw-r--r--lib/rtl_tcp/rtl_tcp_source_c.h4
-rw-r--r--lib/sink_iface.h (renamed from lib/osmosdr_snk_iface.h)14
-rw-r--r--lib/sink_impl.cc (renamed from lib/osmosdr_sink_c_impl.cc)123
-rw-r--r--lib/sink_impl.h (renamed from lib/osmosdr_sink_c_impl.h)22
-rw-r--r--lib/source_iface.h (renamed from lib/osmosdr_src_iface.h)14
-rw-r--r--lib/source_impl.cc (renamed from lib/osmosdr_source_c_impl.cc)134
-rw-r--r--lib/source_impl.h (renamed from lib/osmosdr_source_c_impl.h)22
-rw-r--r--lib/uhd/uhd_sink_c.cc2
-rw-r--r--lib/uhd/uhd_sink_c.h4
-rw-r--r--lib/uhd/uhd_source_c.cc2
-rw-r--r--lib/uhd/uhd_source_c.h4
-rw-r--r--swig/osmosdr_swig.i27
42 files changed, 323 insertions, 341 deletions
diff --git a/docs/doxygen/Doxyfile.in b/docs/doxygen/Doxyfile.in
index 40449c3..8dde978 100644
--- a/docs/doxygen/Doxyfile.in
+++ b/docs/doxygen/Doxyfile.in
@@ -679,7 +679,7 @@ INPUT_FILTER =
# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
# is applied to all files.
-FILTER_PATTERNS = *.py=@top_srcdir@/gnuradio-core/doc/other/doxypy.py
+FILTER_PATTERNS = *.py=@top_srcdir@/gnuradio-runtime/doc/other/doxypy.py
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
# INPUT_FILTER) will be used to filter the input files when producing source
diff --git a/grc/CMakeLists.txt b/grc/CMakeLists.txt
index aa15df3..09838c1 100644
--- a/grc/CMakeLists.txt
+++ b/grc/CMakeLists.txt
@@ -32,9 +32,9 @@ macro(GEN_BLOCK_XML _generator _xml_block)
)
endmacro(GEN_BLOCK_XML)
-GEN_BLOCK_XML(gen_osmosdr_blocks.py rtlsdr_source_c.xml)
-GEN_BLOCK_XML(gen_osmosdr_blocks.py osmosdr_source_c.xml)
-GEN_BLOCK_XML(gen_osmosdr_blocks.py osmosdr_sink_c.xml)
+GEN_BLOCK_XML(gen_osmosdr_blocks.py rtlsdr_source.xml)
+GEN_BLOCK_XML(gen_osmosdr_blocks.py osmosdr_source.xml)
+GEN_BLOCK_XML(gen_osmosdr_blocks.py osmosdr_sink.xml)
add_custom_target(osmosdr_grc_xml_blocks ALL DEPENDS ${xml_blocks})
diff --git a/grc/gen_osmosdr_blocks.py b/grc/gen_osmosdr_blocks.py
index 7b97d1b..c118b8c 100644
--- a/grc/gen_osmosdr_blocks.py
+++ b/grc/gen_osmosdr_blocks.py
@@ -22,11 +22,11 @@ MAIN_TMPL = """\
<?xml version="1.0"?>
<block>
<name>$(title) $sourk.title()</name>
- <key>$(prefix)_$(sourk)_c</key>
+ <key>$(prefix)_$(sourk)</key>
<category>$($sourk.title())s</category>
<throttle>1</throttle>
<import>import osmosdr</import>
- <make>osmosdr.$(sourk)_c( args="nchan=" + str(\$nchan) + " " + \$args )
+ <make>osmosdr.$(sourk)( args="nchan=" + str(\$nchan) + " " + \$args )
self.\$(id).set_sample_rate(\$sample_rate)
#for $n in range($max_nchan)
\#if \$nchan() > $n
@@ -104,12 +104,12 @@ self.\$(id).set_bandwidth(\$bw$(n), $n)
<nports>\$nchan</nports>
</$sourk>
<doc>
-The OSMOCOM block:
+The osmocom block:
While primarily being developed for the OsmoSDR hardware, this block as well supports:
* FunCube Dongle through libgnuradio-fcd
- * OSMOCOM OsmoSDR Devices through libosmosdr
+ * sysmocom OsmoSDR Devices through libosmosdr
* Great Scott Gadgets HackRF through libhackrf
* Ettus USRP Devices through Ettus UHD library
* RTL2832U based DVB-T dongles through librtlsdr
@@ -192,9 +192,9 @@ Bandwidth:
Set the bandpass filter on the radio frontend. To use the default (automatic) bandwidth filter setting, this should be zero.
See the OsmoSDR project page for more detailed documentation:
-http://sdr.osmocom.org/trac/
-http://sdr.osmocom.org/trac/wiki/rtl-sdr
http://sdr.osmocom.org/trac/wiki/GrOsmoSDR
+http://sdr.osmocom.org/trac/wiki/rtl-sdr
+http://sdr.osmocom.org/trac/
</doc>
</block>
"""
@@ -318,14 +318,14 @@ if __name__ == '__main__':
title = 'RTL-SDR'
prefix = 'rtlsdr'
elif tail.startswith('osmosdr'):
- title = 'OSMOCOM'
+ title = 'osmocom'
prefix = 'osmosdr'
else: raise Exception, 'file %s has wrong syntax!'%tail
- if tail.endswith ('source_c.xml'):
+ if tail.endswith ('source.xml'):
sourk = 'source'
dir = 'out'
- elif tail.endswith ('sink_c.xml'):
+ elif tail.endswith ('sink.xml'):
sourk = 'sink'
dir = 'in'
else: raise Exception, 'is %s a source or sink?'%file
diff --git a/include/osmosdr/CMakeLists.txt b/include/osmosdr/CMakeLists.txt
index 3616384..ecdf792 100644
--- a/include/osmosdr/CMakeLists.txt
+++ b/include/osmosdr/CMakeLists.txt
@@ -21,11 +21,11 @@
# Install public header files
########################################################################
install(FILES
- osmosdr_api.h
- osmosdr_pimpl.h
- osmosdr_ranges.h
- osmosdr_device.h
- osmosdr_source_c.h
- osmosdr_sink_c.h
+ api.h
+ pimpl.h
+ ranges.h
+ device.h
+ source.h
+ sink.h
DESTINATION include/osmosdr
)
diff --git a/include/osmosdr/osmosdr_api.h b/include/osmosdr/api.h
index d3adbf0..d3adbf0 100644
--- a/include/osmosdr/osmosdr_api.h
+++ b/include/osmosdr/api.h
diff --git a/include/osmosdr/osmosdr_device.h b/include/osmosdr/device.h
index 1f59751..b43bef0 100644
--- a/include/osmosdr/osmosdr_device.h
+++ b/include/osmosdr/device.h
@@ -21,8 +21,8 @@
#ifndef INCLUDED_OSMOSDR_DEVICE_H
#define INCLUDED_OSMOSDR_DEVICE_H
-#include <osmosdr/osmosdr_api.h>
-#include <osmosdr/osmosdr_pimpl.h>
+#include <osmosdr/api.h>
+#include <osmosdr/pimpl.h>
#include <boost/noncopyable.hpp>
#include <boost/lexical_cast.hpp>
#include <stdexcept>
diff --git a/include/osmosdr/osmosdr_pimpl.h b/include/osmosdr/pimpl.h
index b06e0d8..e1985b4 100644
--- a/include/osmosdr/osmosdr_pimpl.h
+++ b/include/osmosdr/pimpl.h
@@ -20,7 +20,7 @@
#include <boost/shared_ptr.hpp>
-/*! \file osmosdr_pimpl.h
+/*! \file pimpl.h
* "Pimpl idiom" (pointer to implementation idiom).
* The OSMOSDR_PIMPL_* macros simplify code overhead for declaring and making pimpls.
*
diff --git a/include/osmosdr/osmosdr_ranges.h b/include/osmosdr/ranges.h
index e085661..ccb2dbc 100644
--- a/include/osmosdr/osmosdr_ranges.h
+++ b/include/osmosdr/ranges.h
@@ -18,8 +18,8 @@
#ifndef INCLUDED_OSMOSDR_RANGES_H
#define INCLUDED_OSMOSDR_RANGES_H
-#include <osmosdr/osmosdr_api.h>
-#include <osmosdr/osmosdr_pimpl.h>
+#include <osmosdr/api.h>
+#include <osmosdr/pimpl.h>
#include <string>
#include <vector>
diff --git a/include/osmosdr/osmosdr_sink_c.h b/include/osmosdr/sink.h
index fa03300..f6f304f 100644
--- a/include/osmosdr/osmosdr_sink_c.h
+++ b/include/osmosdr/sink.h
@@ -17,36 +17,16 @@
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_OSMOSDR_SINK_C_H
-#define INCLUDED_OSMOSDR_SINK_C_H
+#ifndef INCLUDED_OSMOSDR_SINK_H
+#define INCLUDED_OSMOSDR_SINK_H
-#include <osmosdr/osmosdr_api.h>
-#include <osmosdr/osmosdr_ranges.h>
+#include <osmosdr/api.h>
+#include <osmosdr/ranges.h>
#include <gnuradio/hier_block2.h>
-class osmosdr_sink_c;
+namespace osmosdr {
-/*
- * 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
- * us transparent reference counting, which greatly simplifies storage
- * management issues. This is especially helpful in our hybrid
- * C++ / Python system.
- *
- * See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
- *
- * As a convention, the _sptr suffix indicates a boost::shared_ptr
- */
-typedef boost::shared_ptr<osmosdr_sink_c> osmosdr_sink_c_sptr;
-
-/*!
- * \brief Return a shared_ptr to a new instance of osmosdr_sink_c.
- *
- * To avoid accidental use of raw pointers, osmosdr_sink_c's
- * constructor is private. osmosdr_make_sink_c is the public
- * interface for creating new instances.
- */
-OSMOSDR_API osmosdr_sink_c_sptr osmosdr_make_sink_c ( const std::string & args = "" );
+class sink;
/*!
* \brief Takes a stream of complex samples.
@@ -54,9 +34,23 @@ OSMOSDR_API osmosdr_sink_c_sptr osmosdr_make_sink_c ( const std::string & args =
*
* This uses the preferred technique: subclassing gr::hier_block2.
*/
-class OSMOSDR_API osmosdr_sink_c : virtual public gr::hier_block2
+class OSMOSDR_API sink : virtual public gr::hier_block2
{
public:
+ typedef boost::shared_ptr< sink > sptr;
+
+ /*!
+ * \brief Return a shared_ptr to a new instance of sink.
+ *
+ * To avoid accidental use of raw pointers, sink's
+ * constructor is private. osmosdr::sink::make is the public
+ * interface for creating new instances.
+ *
+ * \param args the address to identify the hardware
+ * \return a new osmosdr sink block object
+ */
+ static sptr make( const std::string & args = "" );
+
/*!
* Get the number of channels the underlying radio hardware offers.
* \return the number of available channels
@@ -287,4 +281,6 @@ public:
virtual osmosdr::freq_range_t get_bandwidth_range( size_t chan = 0 ) = 0;
};
-#endif /* INCLUDED_OSMOSDR_SINK_C_H */
+} /* namespace osmosdr */
+
+#endif /* INCLUDED_OSMOSDR_SINK_H */
diff --git a/include/osmosdr/osmosdr_source_c.h b/include/osmosdr/source.h
index 9b506df..2d0da3b 100644
--- a/include/osmosdr/osmosdr_source_c.h
+++ b/include/osmosdr/source.h
@@ -17,36 +17,16 @@
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_OSMOSDR_SOURCE_C_H
-#define INCLUDED_OSMOSDR_SOURCE_C_H
+#ifndef INCLUDED_OSMOSDR_SOURCE_H
+#define INCLUDED_OSMOSDR_SOURCE_H
-#include <osmosdr/osmosdr_api.h>
-#include <osmosdr/osmosdr_ranges.h>
+#include <osmosdr/api.h>
+#include <osmosdr/ranges.h>
#include <gnuradio/hier_block2.h>
-class osmosdr_source_c;
+namespace osmosdr {
-/*
- * 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
- * us transparent reference counting, which greatly simplifies storage
- * management issues. This is especially helpful in our hybrid
- * C++ / Python system.
- *
- * See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
- *
- * As a convention, the _sptr suffix indicates a boost::shared_ptr
- */
-typedef boost::shared_ptr<osmosdr_source_c> osmosdr_source_c_sptr;
-
-/*!
- * \brief Return a shared_ptr to a new instance of osmosdr_source_c.
- *
- * To avoid accidental use of raw pointers, osmosdr_source_c's
- * constructor is private. osmosdr_make_source_c is the public
- * interface for creating new instances.
- */
-OSMOSDR_API osmosdr_source_c_sptr osmosdr_make_source_c ( const std::string & args = "" );
+class source;
/*!
* \brief Provides a stream of complex samples.
@@ -54,9 +34,23 @@ OSMOSDR_API osmosdr_source_c_sptr osmosdr_make_source_c ( const std::string & ar
*
* This uses the preferred technique: subclassing gr::hier_block2.
*/
-class OSMOSDR_API osmosdr_source_c : virtual public gr::hier_block2
+class OSMOSDR_API source : virtual public gr::hier_block2
{
public:
+ typedef boost::shared_ptr< source > sptr;
+
+ /*!
+ * \brief Return a shared_ptr to a new instance of source.
+ *
+ * To avoid accidental use of raw pointers, source's
+ * constructor is private. osmosdr::source::make is the public
+ * interface for creating new instances.
+ *
+ * \param args the address to identify the hardware
+ * \return a new osmosdr source block object
+ */
+ static sptr make( const std::string & args = "" );
+
/*!
* Get the number of channels the underlying radio hardware offers.
* \return the number of available channels
@@ -287,4 +281,6 @@ public:
virtual osmosdr::freq_range_t get_bandwidth_range( size_t chan = 0 ) = 0;
};
-#endif /* INCLUDED_OSMOSDR_SOURCE_C_H */
+} /* namespace osmosdr */
+
+#endif /* INCLUDED_OSMOSDR_SOURCE_H */
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index e4d764b..fef9638 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -36,10 +36,10 @@ MACRO(GR_OSMOSDR_APPEND_LIBS)
ENDMACRO(GR_OSMOSDR_APPEND_LIBS)
GR_OSMOSDR_APPEND_SRCS(
- osmosdr_source_c_impl.cc
- osmosdr_sink_c_impl.cc
- osmosdr_ranges.cc
- osmosdr_device.cc
+ source_impl.cc
+ sink_impl.cc
+ ranges.cc
+ device.cc
)
GR_OSMOSDR_APPEND_LIBS(
diff --git a/lib/osmosdr_arg_helpers.h b/lib/arg_helpers.h
index c1a4fb3..c1a4fb3 100644
--- a/lib/osmosdr_arg_helpers.h
+++ b/lib/arg_helpers.h
diff --git a/lib/osmosdr_device.cc b/lib/device.cc
index c0a20b2..0126053 100644
--- a/lib/osmosdr_device.cc
+++ b/lib/device.cc
@@ -18,7 +18,7 @@
* Boston, MA 02110-1301, USA.
*/
-#include <osmosdr/osmosdr_device.h>
+#include <osmosdr/device.h>
#include <stdexcept>
#include <boost/foreach.hpp>
#include <boost/format.hpp>
@@ -35,7 +35,7 @@
#endif
#ifdef ENABLE_FCD
-#include <fcd_source.h>
+#include <fcd_source_c.h>
#endif
#ifdef ENABLE_FILE
@@ -62,7 +62,7 @@
#include <hackrf_source_c.h>
#endif
-#include "osmosdr_arg_helpers.h"
+#include "arg_helpers.h"
using namespace osmosdr;
@@ -118,7 +118,7 @@ devices_t device::find(const device_t &hint)
devices.push_back( device_t(dev) );
#endif
#ifdef ENABLE_FCD
- BOOST_FOREACH( std::string dev, fcd_source::get_devices() )
+ BOOST_FOREACH( std::string dev, fcd_source_c::get_devices() )
devices.push_back( device_t(dev) );
#endif
#ifdef ENABLE_RTL
diff --git a/lib/fcd/CMakeLists.txt b/lib/fcd/CMakeLists.txt
index dbcb5e7..94581f4 100644
--- a/lib/fcd/CMakeLists.txt
+++ b/lib/fcd/CMakeLists.txt
@@ -27,7 +27,7 @@ include_directories(
)
set(fcd_srcs
- ${CMAKE_CURRENT_SOURCE_DIR}/fcd_source.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/fcd_source_c.cc
)
########################################################################
diff --git a/lib/fcd/fcd_source.cc b/lib/fcd/fcd_source_c.cc
index 8b53c64..c5a89b6 100644
--- a/lib/fcd/fcd_source.cc
+++ b/lib/fcd/fcd_source_c.cc
@@ -27,15 +27,15 @@
#include <gnuradio/io_signature.h>
-#include "fcd_source.h"
+#include "fcd_source_c.h"
-#include "osmosdr_arg_helpers.h"
+#include "arg_helpers.h"
using namespace boost::assign;
-fcd_source_sptr make_fcd_source(const std::string &args)
+fcd_source_c_sptr make_fcd_source_c(const std::string &args)
{
- return gnuradio::get_initial_sptr(new fcd_source(args));
+ return gnuradio::get_initial_sptr(new fcd_source_c(args));
}
/*
@@ -73,8 +73,8 @@ static std::vector< std::string > _get_devices()
return devices;
}
-fcd_source::fcd_source(const std::string &args) :
- gr::hier_block2("fcd_source",
+fcd_source_c::fcd_source_c(const std::string &args) :
+ gr::hier_block2("fcd_source_c",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(1, 1, sizeof (gr_complex)))
{
@@ -98,11 +98,11 @@ fcd_source::fcd_source(const std::string &args) :
connect( _src, 0, self(), 0 );
}
-fcd_source::~fcd_source()
+fcd_source_c::~fcd_source_c()
{
}
-std::vector< std::string > fcd_source::get_devices()
+std::vector< std::string > fcd_source_c::get_devices()
{
int id = 0;
std::vector< std::string > devices;
@@ -116,17 +116,17 @@ std::vector< std::string > fcd_source::get_devices()
return devices;
}
-std::string fcd_source::name()
+std::string fcd_source_c::name()
{
return "FUNcube Dongle";
}
-size_t fcd_source::get_num_channels( void )
+size_t fcd_source_c::get_num_channels( void )
{
return 1;
}
-osmosdr::meta_range_t fcd_source::get_sample_rates( void )
+osmosdr::meta_range_t fcd_source_c::get_sample_rates( void )
{
osmosdr::meta_range_t range;
@@ -135,24 +135,24 @@ osmosdr::meta_range_t fcd_source::get_sample_rates( void )
return range;
}
-double fcd_source::set_sample_rate( double rate )
+double fcd_source_c::set_sample_rate( double rate )
{
return get_sample_rate();
}
-double fcd_source::get_sample_rate( void )
+double fcd_source_c::get_sample_rate( void )
{
return 96e3;
}
-osmosdr::freq_range_t fcd_source::get_freq_range( size_t chan )
+osmosdr::freq_range_t fcd_source_c::get_freq_range( size_t chan )
{
osmosdr::freq_range_t range( 52e6, 2.2e9 );
return range;
}
-double fcd_source::set_center_freq( double freq, size_t chan )
+double fcd_source_c::set_center_freq( double freq, size_t chan )
{
_src->set_freq(float(freq));
@@ -161,12 +161,12 @@ double fcd_source::set_center_freq( double freq, size_t chan )
return get_center_freq(chan);
}
-double fcd_source::get_center_freq( size_t chan )
+double fcd_source_c::get_center_freq( size_t chan )
{
return _freq;
}
-double fcd_source::set_freq_corr( double ppm, size_t chan )
+double fcd_source_c::set_freq_corr( double ppm, size_t chan )
{
_src->set_freq_corr( ppm );
@@ -175,12 +175,12 @@ double fcd_source::set_freq_corr( double ppm, size_t chan )
return get_freq_corr( chan );
}
-double fcd_source::get_freq_corr( size_t chan )
+double fcd_source_c::get_freq_corr( size_t chan )
{
return _correct;
}
-std::vector<std::string> fcd_source::get_gain_names( size_t chan )
+std::vector<std::string> fcd_source_c::get_gain_names( size_t chan )
{
std::vector< std::string > names;
@@ -189,19 +189,19 @@ std::vector<std::string> fcd_source::get_gain_names( size_t chan )
return names;
}
-osmosdr::gain_range_t fcd_source::get_gain_range( size_t chan )
+osmosdr::gain_range_t fcd_source_c::get_gain_range( size_t chan )
{
osmosdr::gain_range_t range(-5, 30, 2.5);
return range;
}
-osmosdr::gain_range_t fcd_source::get_gain_range( const std::string & name, size_t chan )
+osmosdr::gain_range_t fcd_source_c::get_gain_range( const std::string & name, size_t chan )
{
return get_gain_range( chan );
}
-double fcd_source::set_gain( double gain, size_t chan )
+double fcd_source_c::set_gain( double gain, size_t chan )
{
_src->set_lna_gain(gain);
@@ -210,22 +210,22 @@ double fcd_source::set_gain( double gain, size_t chan )
return get_gain(chan);
}
-double fcd_source::set_gain( double gain, const std::string & name, size_t chan )
+double fcd_source_c::set_gain( double gain, const std::string & name, size_t chan )
{
return set_gain(chan);
}
-double fcd_source::get_gain( size_t chan )
+double fcd_source_c::get_gain( size_t chan )
{
return _gain;
}
-double fcd_source::get_gain( const std::string & name, size_t chan )
+double fcd_source_c::get_gain( const std::string & name, size_t chan )
{
return get_gain(chan);
}
-std::vector< std::string > fcd_source::get_antennas( size_t chan )
+std::vector< std::string > fcd_source_c::get_antennas( size_t chan )
{
std::vector< std::string > antennas;
@@ -234,12 +234,12 @@ std::vector< std::string > fcd_source::get_antennas( size_t chan )
return antennas;
}
-std::string fcd_source::set_antenna( const std::string & antenna, size_t chan )
+std::string fcd_source_c::set_antenna( const std::string & antenna, size_t chan )
{
return get_antenna(chan);
}
-std::string fcd_source::get_antenna( size_t chan )
+std::string fcd_source_c::get_antenna( size_t chan )
{
return "RX";
}
diff --git a/lib/fcd/fcd_source.h b/lib/fcd/fcd_source_c.h
index ce84946..c134a4c 100644
--- a/lib/fcd/fcd_source.h
+++ b/lib/fcd/fcd_source_c.h
@@ -17,32 +17,32 @@
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
-#ifndef FCD_SOURCE_H
-#define FCD_SOURCE_H
+#ifndef FCD_SOURCE_C_H
+#define FCD_SOURCE_C_H
#include <gnuradio/hier_block2.h>
#include <gnuradio/fcd/source_c.h>
-#include "osmosdr_src_iface.h"
+#include "source_iface.h"
-class fcd_source;
+class fcd_source_c;
-typedef boost::shared_ptr< fcd_source > fcd_source_sptr;
+typedef boost::shared_ptr< fcd_source_c > fcd_source_c_sptr;
-fcd_source_sptr make_fcd_source( const std::string & args = "" );
+fcd_source_c_sptr make_fcd_source_c( const std::string & args = "" );
-class fcd_source :
+class fcd_source_c :
public gr::hier_block2,
- public osmosdr_src_iface
+ public source_iface
{
private:
- friend fcd_source_sptr make_fcd_source(const std::string &args);
+ friend fcd_source_c_sptr make_fcd_source_c(const std::string &args);
- fcd_source(const std::string &args);
+ fcd_source_c(const std::string &args);
public:
- ~fcd_source();
+ ~fcd_source_c();
static std::vector< std::string > get_devices();
@@ -78,4 +78,4 @@ private:
int32_t _correct;
};
-#endif // FCD_SOURCE_H
+#endif // FCD_SOURCE_C_H
diff --git a/lib/file/file_source_c.cc b/lib/file/file_source_c.cc
index dc2587d..2db1727 100644
--- a/lib/file/file_source_c.cc
+++ b/lib/file/file_source_c.cc
@@ -30,7 +30,7 @@
#include "file_source_c.h"
-#include "osmosdr_arg_helpers.h"
+#include "arg_helpers.h"
using namespace boost::assign;
diff --git a/lib/file/file_source_c.h b/lib/file/file_source_c.h
index 29fafa1..22e1650 100644
--- a/lib/file/file_source_c.h
+++ b/lib/file/file_source_c.h
@@ -22,7 +22,7 @@
#include <gnuradio/hier_block2.h>
-#include "osmosdr_src_iface.h"
+#include "source_iface.h"
class file_source_c;
@@ -32,7 +32,7 @@ file_source_c_sptr make_file_source_c( const std::string & args = "" );
class file_source_c :
public gr::hier_block2,
- public osmosdr_src_iface
+ public source_iface
{
private:
friend file_source_c_sptr make_file_source_c(const std::string &args);
diff --git a/lib/hackrf/hackrf_sink_c.cc b/lib/hackrf/hackrf_sink_c.cc
index af0c963..17ab275 100644
--- a/lib/hackrf/hackrf_sink_c.cc
+++ b/lib/hackrf/hackrf_sink_c.cc
@@ -46,7 +46,7 @@
#include "hackrf_sink_c.h"
-#include "osmosdr_arg_helpers.h"
+#include "arg_helpers.h"
using namespace boost::assign;
diff --git a/lib/hackrf/hackrf_sink_c.h b/lib/hackrf/hackrf_sink_c.h
index c1c5598..f4c533f 100644
--- a/lib/hackrf/hackrf_sink_c.h
+++ b/lib/hackrf/hackrf_sink_c.h
@@ -28,7 +28,7 @@
#include <libhackrf/hackrf.h>
-#include "osmosdr_snk_iface.h"
+#include "sink_iface.h"
class hackrf_sink_c;
@@ -67,7 +67,7 @@ hackrf_sink_c_sptr make_hackrf_sink_c (const std::string & args = "");
class hackrf_sink_c :
public gr::sync_block,
- public osmosdr_snk_iface
+ public sink_iface
{
private:
// The friend declaration allows hackrf_make_sink_c to
diff --git a/lib/hackrf/hackrf_source_c.cc b/lib/hackrf/hackrf_source_c.cc
index 48eabb1..c015195 100644
--- a/lib/hackrf/hackrf_source_c.cc
+++ b/lib/hackrf/hackrf_source_c.cc
@@ -39,7 +39,7 @@
#include <stdexcept>
#include <iostream>
-#include "osmosdr_arg_helpers.h"
+#include "arg_helpers.h"
using namespace boost::assign;
diff --git a/lib/hackrf/hackrf_source_c.h b/lib/hackrf/hackrf_source_c.h
index 658bcea..6ae81d2 100644
--- a/lib/hackrf/hackrf_source_c.h
+++ b/lib/hackrf/hackrf_source_c.h
@@ -30,7 +30,7 @@
#include <libhackrf/hackrf.h>
-#include "osmosdr_src_iface.h"
+#include "source_iface.h"
class hackrf_source_c;
@@ -62,7 +62,7 @@ hackrf_source_c_sptr make_hackrf_source_c (const std::string & args = "");
*/
class hackrf_source_c :
public gr::sync_block,
- public osmosdr_src_iface
+ public source_iface
{
private:
// The friend declaration allows make_hackrf_source_c to
diff --git a/lib/miri/miri_source_c.cc b/lib/miri/miri_source_c.cc
index 5fe3c55..bac2fcf 100644
--- a/lib/miri/miri_source_c.cc
+++ b/lib/miri/miri_source_c.cc
@@ -40,7 +40,7 @@
#include <mirisdr.h>
-#include "osmosdr_arg_helpers.h"
+#include "arg_helpers.h"
using namespace boost::assign;
diff --git a/lib/miri/miri_source_c.h b/lib/miri/miri_source_c.h
index a418617..5363db5 100644
--- a/lib/miri/miri_source_c.h
+++ b/lib/miri/miri_source_c.h
@@ -26,7 +26,7 @@
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
-#include "osmosdr_src_iface.h"
+#include "source_iface.h"
class miri_source_c;
typedef struct mirisdr_dev mirisdr_dev_t;
@@ -59,7 +59,7 @@ miri_source_c_sptr make_miri_source_c (const std::string & args = "");
*/
class miri_source_c :
public gr::sync_block,
- public osmosdr_src_iface
+ public source_iface
{
private:
// The friend declaration allows make_miri_source_c to
diff --git a/lib/osmosdr/osmosdr_src_c.cc b/lib/osmosdr/osmosdr_src_c.cc
index 7995002..54393b9 100644
--- a/lib/osmosdr/osmosdr_src_c.cc
+++ b/lib/osmosdr/osmosdr_src_c.cc
@@ -39,7 +39,7 @@
#include <osmosdr.h>
-#include "osmosdr_arg_helpers.h"
+#include "arg_helpers.h"
using namespace boost::assign;
diff --git a/lib/osmosdr/osmosdr_src_c.h b/lib/osmosdr/osmosdr_src_c.h
index 9ff5030..0f62b09 100644
--- a/lib/osmosdr/osmosdr_src_c.h
+++ b/lib/osmosdr/osmosdr_src_c.h
@@ -26,7 +26,7 @@
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
-#include "osmosdr_src_iface.h"
+#include "source_iface.h"
class osmosdr_src_c;
typedef struct osmosdr_dev osmosdr_dev_t;
@@ -57,11 +57,11 @@ 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 sink for a version that subclasses gr::hier_block2.
*/
class osmosdr_src_c :
public gr::sync_block,
- public osmosdr_src_iface
+ public source_iface
{
private:
// The friend declaration allows osmosdr_make_src_c to
diff --git a/lib/osmosdr_ranges.cc b/lib/ranges.cc
index a8e589d..cdff969 100644
--- a/lib/osmosdr_ranges.cc
+++ b/lib/ranges.cc
@@ -15,7 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
-#include <osmosdr/osmosdr_ranges.h>
+#include <osmosdr/ranges.h>
#include <stdexcept>
#include <boost/math/special_functions/round.hpp>
#include <boost/foreach.hpp>
diff --git a/lib/rtl/rtl_source_c.cc b/lib/rtl/rtl_source_c.cc
index 43dd1ac..15bde78 100644
--- a/lib/rtl/rtl_source_c.cc
+++ b/lib/rtl/rtl_source_c.cc
@@ -41,7 +41,7 @@
#include <rtl-sdr.h>
-#include "osmosdr_arg_helpers.h"
+#include "arg_helpers.h"
using namespace boost::assign;
diff --git a/lib/rtl/rtl_source_c.h b/lib/rtl/rtl_source_c.h
index 6b65d41..13008cc 100644
--- a/lib/rtl/rtl_source_c.h
+++ b/lib/rtl/rtl_source_c.h
@@ -28,7 +28,7 @@
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
-#include "osmosdr_src_iface.h"
+#include "source_iface.h"
class rtl_source_c;
typedef struct rtlsdr_dev rtlsdr_dev_t;
@@ -62,7 +62,7 @@ rtl_source_c_sptr make_rtl_source_c (const std::string & args = "");
*/
class rtl_source_c :
public gr::sync_block,
- public osmosdr_src_iface
+ public source_iface
{
private:
// The friend declaration allows make_rtl_source_c to
diff --git a/lib/rtl_tcp/rtl_tcp_source_c.cc b/lib/rtl_tcp/rtl_tcp_source_c.cc
index cfa36a2..ad95b02 100644
--- a/lib/rtl_tcp/rtl_tcp_source_c.cc
+++ b/lib/rtl_tcp/rtl_tcp_source_c.cc
@@ -31,7 +31,7 @@
#include "rtl_tcp_source_c.h"
-#include "osmosdr_arg_helpers.h"
+#include "arg_helpers.h"
using namespace boost::assign;
diff --git a/lib/rtl_tcp/rtl_tcp_source_c.h b/lib/rtl_tcp/rtl_tcp_source_c.h
index 8143566..c875d95 100644
--- a/lib/rtl_tcp/rtl_tcp_source_c.h
+++ b/lib/rtl_tcp/rtl_tcp_source_c.h
@@ -22,7 +22,7 @@
#include <gnuradio/hier_block2.h>
-#include "osmosdr_src_iface.h"
+#include "source_iface.h"
#include "rtl_tcp_source_f.h"
@@ -34,7 +34,7 @@ rtl_tcp_source_c_sptr make_rtl_tcp_source_c( const std::string & args = "" );
class rtl_tcp_source_c :
public gr::hier_block2,
- public osmosdr_src_iface
+ public source_iface
{
private:
friend rtl_tcp_source_c_sptr make_rtl_tcp_source_c(const std::string &args);
diff --git a/lib/osmosdr_snk_iface.h b/lib/sink_iface.h
index a0b2e73..f451489 100644
--- a/lib/osmosdr_snk_iface.h
+++ b/lib/sink_iface.h
@@ -18,21 +18,17 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef OSMOSDR_SNK_IFACE_H
-#define OSMOSDR_SNK_IFACE_H
+#ifndef OSMOSDR_SINK_IFACE_H
+#define OSMOSDR_SINK_IFACE_H
-#include <osmosdr/osmosdr_ranges.h>
+#include <osmosdr/ranges.h>
#include <gnuradio/basic_block.h>
-class osmosdr_snk_iface;
-
-typedef boost::shared_ptr<osmosdr_snk_iface> osmosdr_snk_iface_sptr;
-
/*!
* TODO: document
*
*/
-class osmosdr_snk_iface
+class sink_iface
{
public:
/*!
@@ -258,4 +254,4 @@ public:
{ return osmosdr::freq_range_t(); }
};
-#endif // OSMOSDR_SNK_IFACE_H
+#endif // OSMOSDR_SINK_IFACE_H
diff --git a/lib/osmosdr_sink_c_impl.cc b/lib/sink_impl.cc
index 13494ee..0063dc1 100644
--- a/lib/osmosdr_sink_c_impl.cc
+++ b/lib/sink_impl.cc
@@ -32,8 +32,6 @@
#include <gnuradio/blocks/throttle.h>
#include <gnuradio/blocks/null_sink.h>
-#include "osmosdr_sink_c_impl.h"
-
#ifdef ENABLE_UHD
#include "uhd_sink_c.h"
#endif
@@ -41,27 +39,28 @@
#include "hackrf_sink_c.h"
#endif
-#include "osmosdr_arg_helpers.h"
+#include "arg_helpers.h"
+#include "sink_impl.h"
/* 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
/*
- * Create a new instance of osmosdr_sink_c_impl and return
+ * Create a new instance of sink_impl and return
* a boost shared_ptr. This is effectively the public constructor.
*/
-osmosdr_sink_c_sptr
-osmosdr_make_sink_c (const std::string &args)
+osmosdr::sink::sptr
+osmosdr::sink::make( const std::string &args )
{
- return gnuradio::get_initial_sptr(new osmosdr_sink_c_impl (args));
+ return gnuradio::get_initial_sptr( new sink_impl(args) );
}
/*
* The private constructor
*/
-osmosdr_sink_c_impl::osmosdr_sink_c_impl (const std::string &args)
- : gr::hier_block2 ("osmosdr_sink_c_impl",
+sink_impl::sink_impl( const std::string &args )
+ : gr::hier_block2 ("sink_impl",
args_to_io_signature(args),
gr::io_signature::make(0, 0, 0))
{
@@ -127,7 +126,7 @@ osmosdr_sink_c_impl::osmosdr_sink_c_impl (const std::string &args)
// BOOST_FOREACH( dict_t::value_type &entry, dict )
// std::cerr << "'" << entry.first << "' = '" << entry.second << "'" << std::endl;
- osmosdr_snk_iface *iface = NULL;
+ sink_iface *iface = NULL;
gr::basic_block_sptr block;
#ifdef ENABLE_UHD
@@ -185,11 +184,11 @@ osmosdr_sink_c_impl::osmosdr_sink_c_impl (const std::string &args)
#endif
}
-size_t osmosdr_sink_c_impl::get_num_channels()
+size_t sink_impl::get_num_channels()
{
size_t channels = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
channels += dev->get_num_channels();
return channels;
@@ -197,7 +196,7 @@ size_t osmosdr_sink_c_impl::get_num_channels()
#define NO_DEVICES_MSG "FATAL: No device(s) available to work with."
-osmosdr::meta_range_t osmosdr_sink_c_impl::get_sample_rates()
+osmosdr::meta_range_t sink_impl::get_sample_rates()
{
if ( ! _devs.empty() )
return _devs[0]->get_sample_rates(); // assume same devices used in the group
@@ -208,7 +207,7 @@ osmosdr::meta_range_t osmosdr_sink_c_impl::get_sample_rates()
return osmosdr::meta_range_t();
}
-double osmosdr_sink_c_impl::set_sample_rate(double rate)
+double sink_impl::set_sample_rate(double rate)
{
double sample_rate = 0;
@@ -217,7 +216,7 @@ double osmosdr_sink_c_impl::set_sample_rate(double rate)
if (_devs.empty())
throw std::runtime_error(NO_DEVICES_MSG);
#endif
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
sample_rate = dev->set_sample_rate(rate);
_sample_rate = sample_rate;
@@ -226,7 +225,7 @@ double osmosdr_sink_c_impl::set_sample_rate(double rate)
return sample_rate;
}
-double osmosdr_sink_c_impl::get_sample_rate()
+double sink_impl::get_sample_rate()
{
double sample_rate = 0;
@@ -239,10 +238,10 @@ double osmosdr_sink_c_impl::get_sample_rate()
return sample_rate;
}
-osmosdr::freq_range_t osmosdr_sink_c_impl::get_freq_range( size_t chan )
+osmosdr::freq_range_t sink_impl::get_freq_range( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_freq_range( dev_chan );
@@ -250,10 +249,10 @@ osmosdr::freq_range_t osmosdr_sink_c_impl::get_freq_range( size_t chan )
return osmosdr::freq_range_t();
}
-double osmosdr_sink_c_impl::set_center_freq( double freq, size_t chan )
+double sink_impl::set_center_freq( double freq, size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
if ( _center_freq[ chan ] != freq ) {
@@ -264,10 +263,10 @@ double osmosdr_sink_c_impl::set_center_freq( double freq, size_t chan )
return 0;
}
-double osmosdr_sink_c_impl::get_center_freq( size_t chan )
+double sink_impl::get_center_freq( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_center_freq( dev_chan );
@@ -275,10 +274,10 @@ double osmosdr_sink_c_impl::get_center_freq( size_t chan )
return 0;
}
-double osmosdr_sink_c_impl::set_freq_corr( double ppm, size_t chan )
+double sink_impl::set_freq_corr( double ppm, size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
if ( _freq_corr[ chan ] != ppm ) {
@@ -289,10 +288,10 @@ double osmosdr_sink_c_impl::set_freq_corr( double ppm, size_t chan )
return 0;
}
-double osmosdr_sink_c_impl::get_freq_corr( size_t chan )
+double sink_impl::get_freq_corr( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_freq_corr( dev_chan );
@@ -300,10 +299,10 @@ double osmosdr_sink_c_impl::get_freq_corr( size_t chan )
return 0;
}
-std::vector<std::string> osmosdr_sink_c_impl::get_gain_names( size_t chan )
+std::vector<std::string> sink_impl::get_gain_names( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain_names( dev_chan );
@@ -311,10 +310,10 @@ std::vector<std::string> osmosdr_sink_c_impl::get_gain_names( size_t chan )
return std::vector< std::string >();
}
-osmosdr::gain_range_t osmosdr_sink_c_impl::get_gain_range( size_t chan )
+osmosdr::gain_range_t sink_impl::get_gain_range( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain_range( dev_chan );
@@ -322,10 +321,10 @@ osmosdr::gain_range_t osmosdr_sink_c_impl::get_gain_range( size_t chan )
return osmosdr::gain_range_t();
}
-osmosdr::gain_range_t osmosdr_sink_c_impl::get_gain_range( const std::string & name, size_t chan )
+osmosdr::gain_range_t sink_impl::get_gain_range( const std::string & name, size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain_range( name, dev_chan );
@@ -333,10 +332,10 @@ osmosdr::gain_range_t osmosdr_sink_c_impl::get_gain_range( const std::string & n
return osmosdr::gain_range_t();
}
-bool osmosdr_sink_c_impl::set_gain_mode( bool automatic, size_t chan )
+bool sink_impl::set_gain_mode( bool automatic, size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
if ( _gain_mode[ chan ] != automatic ) {
@@ -350,10 +349,10 @@ bool osmosdr_sink_c_impl::set_gain_mode( bool automatic, size_t chan )
return false;
}
-bool osmosdr_sink_c_impl::get_gain_mode( size_t chan )
+bool sink_impl::get_gain_mode( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain_mode( dev_chan );
@@ -361,10 +360,10 @@ bool osmosdr_sink_c_impl::get_gain_mode( size_t chan )
return false;
}
-double osmosdr_sink_c_impl::set_gain( double gain, size_t chan )
+double sink_impl::set_gain( double gain, size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
if ( _gain[ chan ] != gain ) {
@@ -375,10 +374,10 @@ double osmosdr_sink_c_impl::set_gain( double gain, size_t chan )
return 0;
}
-double osmosdr_sink_c_impl::set_gain( double gain, const std::string & name, size_t chan)
+double sink_impl::set_gain( double gain, const std::string & name, size_t chan)
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->set_gain( gain, name, dev_chan );
@@ -386,10 +385,10 @@ double osmosdr_sink_c_impl::set_gain( double gain, const std::string & name, siz
return 0;
}
-double osmosdr_sink_c_impl::get_gain( size_t chan )
+double sink_impl::get_gain( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain( dev_chan );
@@ -397,10 +396,10 @@ double osmosdr_sink_c_impl::get_gain( size_t chan )
return 0;
}
-double osmosdr_sink_c_impl::get_gain( const std::string & name, size_t chan )
+double sink_impl::get_gain( const std::string & name, size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain( name, dev_chan );
@@ -408,10 +407,10 @@ double osmosdr_sink_c_impl::get_gain( const std::string & name, size_t chan )
return 0;
}
-double osmosdr_sink_c_impl::set_if_gain( double gain, size_t chan )
+double sink_impl::set_if_gain( double gain, size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
if ( _if_gain[ chan ] != gain ) {
@@ -422,10 +421,10 @@ double osmosdr_sink_c_impl::set_if_gain( double gain, size_t chan )
return 0;
}
-double osmosdr_sink_c_impl::set_bb_gain( double gain, size_t chan )
+double sink_impl::set_bb_gain( double gain, size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
if ( _bb_gain[ chan ] != gain ) {
@@ -436,10 +435,10 @@ double osmosdr_sink_c_impl::set_bb_gain( double gain, size_t chan )
return 0;
}
-std::vector< std::string > osmosdr_sink_c_impl::get_antennas( size_t chan )
+std::vector< std::string > sink_impl::get_antennas( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_antennas( dev_chan );
@@ -447,10 +446,10 @@ std::vector< std::string > osmosdr_sink_c_impl::get_antennas( size_t chan )
return std::vector< std::string >();
}
-std::string osmosdr_sink_c_impl::set_antenna( const std::string & antenna, size_t chan )
+std::string sink_impl::set_antenna( const std::string & antenna, size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
if ( _antenna[ chan ] != antenna ) {
@@ -461,10 +460,10 @@ std::string osmosdr_sink_c_impl::set_antenna( const std::string & antenna, size_
return "";
}
-std::string osmosdr_sink_c_impl::get_antenna( size_t chan )
+std::string sink_impl::get_antenna( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_antenna( dev_chan );
@@ -472,20 +471,20 @@ std::string osmosdr_sink_c_impl::get_antenna( size_t chan )
return "";
}
-void osmosdr_sink_c_impl::set_iq_balance_mode( int mode, size_t chan )
+void sink_impl::set_iq_balance_mode( int mode, size_t chan )
{
}
-void osmosdr_sink_c_impl::set_iq_balance( const std::complex<double> &correction, size_t chan )
+void sink_impl::set_iq_balance( const std::complex<double> &correction, size_t chan )
{
}
-double osmosdr_sink_c_impl::set_bandwidth( double bandwidth, size_t chan )
+double sink_impl::set_bandwidth( double bandwidth, size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
if ( _bandwidth[ chan ] != bandwidth ) {
@@ -496,10 +495,10 @@ double osmosdr_sink_c_impl::set_bandwidth( double bandwidth, size_t chan )
return 0;
}
-double osmosdr_sink_c_impl::get_bandwidth( size_t chan )
+double sink_impl::get_bandwidth( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_bandwidth( dev_chan );
@@ -507,10 +506,10 @@ double osmosdr_sink_c_impl::get_bandwidth( size_t chan )
return 0;
}
-osmosdr::freq_range_t osmosdr_sink_c_impl::get_bandwidth_range( size_t chan )
+osmosdr::freq_range_t sink_impl::get_bandwidth_range( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_snk_iface *dev, _devs )
+ BOOST_FOREACH( sink_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_bandwidth_range( dev_chan );
diff --git a/lib/osmosdr_sink_c_impl.h b/lib/sink_impl.h
index 766be75..22ba6ae 100644
--- a/lib/osmosdr_sink_c_impl.h
+++ b/lib/sink_impl.h
@@ -17,18 +17,20 @@
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_OSMOSDR_SINK_C_IMPL_H
-#define INCLUDED_OSMOSDR_SINK_C_IMPL_H
+#ifndef INCLUDED_OSMOSDR_SINK_IMPL_H
+#define INCLUDED_OSMOSDR_SINK_IMPL_H
-#include "osmosdr/osmosdr_sink_c.h"
+#include "osmosdr/sink.h"
-#include "osmosdr_snk_iface.h"
+#include "sink_iface.h"
#include <map>
-class osmosdr_sink_c_impl : public osmosdr_sink_c
+class sink_impl : public osmosdr::sink
{
public:
+ sink_impl(const std::string & args);
+
size_t get_num_channels( void );
osmosdr::meta_range_t get_sample_rates( void );
@@ -66,13 +68,7 @@ public:
osmosdr::freq_range_t get_bandwidth_range( size_t chan = 0 );
private:
- osmosdr_sink_c_impl (const std::string & args); // private constructor
-
- // The friend declaration allows osmosdr_make_sink_c to
- // access the private constructor.
- friend osmosdr_sink_c_sptr osmosdr_make_sink_c (const std::string & args);
-
- std::vector< osmosdr_snk_iface * > _devs;
+ std::vector< sink_iface * > _devs;
double _sample_rate;
std::map< size_t, double > _center_freq;
@@ -85,4 +81,4 @@ private:
std::map< size_t, double > _bandwidth;
};
-#endif /* INCLUDED_OSMOSDR_SINK_C_IMPL_H */
+#endif /* INCLUDED_OSMOSDR_SINK_IMPL_H */
diff --git a/lib/osmosdr_src_iface.h b/lib/source_iface.h
index 7e3f23a..cbf7838 100644
--- a/lib/osmosdr_src_iface.h
+++ b/lib/source_iface.h
@@ -18,21 +18,17 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef OSMOSDR_SRC_IFACE_H
-#define OSMOSDR_SRC_IFACE_H
+#ifndef OSMOSDR_SOURCE_IFACE_H
+#define OSMOSDR_SOURCE_IFACE_H
-#include <osmosdr/osmosdr_ranges.h>
+#include <osmosdr/ranges.h>
#include <gnuradio/basic_block.h>
-class osmosdr_src_iface;
-
-typedef boost::shared_ptr<osmosdr_src_iface> osmosdr_src_iface_sptr;
-
/*!
* TODO: document
*
*/
-class osmosdr_src_iface
+class source_iface
{
public:
/*!
@@ -258,4 +254,4 @@ public:
{ return osmosdr::freq_range_t(); }
};
-#endif // OSMOSDR_SRC_IFACE_H
+#endif // OSMOSDR_SOURCE_IFACE_H
diff --git a/lib/osmosdr_source_c_impl.cc b/lib/source_impl.cc
index 2c3e0a4..fd95098 100644
--- a/lib/osmosdr_source_c_impl.cc
+++ b/lib/source_impl.cc
@@ -27,7 +27,6 @@
#include "config.h"
#endif
-#include <osmosdr_source_c_impl.h>
#include <gnuradio/io_signature.h>
#include <gnuradio/blocks/null_source.h>
#include <gnuradio/blocks/throttle.h>
@@ -38,7 +37,7 @@
#endif
#ifdef ENABLE_FCD
-#include <fcd_source.h>
+#include <fcd_source_c.h>
#endif
#ifdef ENABLE_FILE
@@ -65,27 +64,28 @@
#include <hackrf_source_c.h>
#endif
-#include "osmosdr_arg_helpers.h"
+#include "arg_helpers.h"
+#include "source_impl.h"
/* 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
/*
- * Create a new instance of osmosdr_source_c_impl and return
+ * Create a new instance of source_impl and return
* a boost shared_ptr. This is effectively the public constructor.
*/
-osmosdr_source_c_sptr
-osmosdr_make_source_c (const std::string &args)
+osmosdr::source::sptr
+osmosdr::source::make( const std::string &args )
{
- return gnuradio::get_initial_sptr(new osmosdr_source_c_impl (args));
+ return gnuradio::get_initial_sptr( new source_impl(args) );
}
/*
* The private constructor
*/
-osmosdr_source_c_impl::osmosdr_source_c_impl (const std::string &args)
- : gr::hier_block2 ("osmosdr_source_c_impl",
+source_impl::source_impl( const std::string &args )
+ : gr::hier_block2 ("source_impl",
gr::io_signature::make(0, 0, 0),
args_to_io_signature(args))
{
@@ -147,7 +147,7 @@ osmosdr_source_c_impl::osmosdr_source_c_impl (const std::string &args)
dev_list.push_back( dev );
#endif
#ifdef ENABLE_FCD
- BOOST_FOREACH( std::string dev, fcd_source::get_devices() )
+ BOOST_FOREACH( std::string dev, fcd_source_c::get_devices() )
dev_list.push_back( dev );
#endif
#ifdef ENABLE_RTL
@@ -185,7 +185,7 @@ osmosdr_source_c_impl::osmosdr_source_c_impl (const std::string &args)
// BOOST_FOREACH( dict_t::value_type &entry, dict )
// std::cerr << "'" << entry.first << "' = '" << entry.second << "'" << std::endl;
- osmosdr_src_iface *iface = NULL;
+ source_iface *iface = NULL;
gr::basic_block_sptr block;
#ifdef ENABLE_OSMOSDR
@@ -197,7 +197,7 @@ osmosdr_source_c_impl::osmosdr_source_c_impl (const std::string &args)
#ifdef ENABLE_FCD
if ( dict.count("fcd") ) {
- fcd_source_sptr src = make_fcd_source( arg );
+ fcd_source_c_sptr src = make_fcd_source_c( arg );
block = src; iface = src.get();
}
#endif
@@ -300,11 +300,11 @@ osmosdr_source_c_impl::osmosdr_source_c_impl (const std::string &args)
#endif
}
-size_t osmosdr_source_c_impl::get_num_channels()
+size_t source_impl::get_num_channels()
{
size_t channels = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
channels += dev->get_num_channels();
return channels;
@@ -312,7 +312,7 @@ size_t osmosdr_source_c_impl::get_num_channels()
#define NO_DEVICES_MSG "FATAL: No device(s) available to work with."
-osmosdr::meta_range_t osmosdr_source_c_impl::get_sample_rates()
+osmosdr::meta_range_t source_impl::get_sample_rates()
{
if ( ! _devs.empty() )
return _devs[0]->get_sample_rates(); // assume same devices used in the group
@@ -323,7 +323,7 @@ osmosdr::meta_range_t osmosdr_source_c_impl::get_sample_rates()
return osmosdr::meta_range_t();;
}
-double osmosdr_source_c_impl::set_sample_rate(double rate)
+double source_impl::set_sample_rate(double rate)
{
double sample_rate = 0;
@@ -332,12 +332,12 @@ double osmosdr_source_c_impl::set_sample_rate(double rate)
if (_devs.empty())
throw std::runtime_error(NO_DEVICES_MSG);
#endif
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
sample_rate = dev->set_sample_rate(rate);
#ifdef HAVE_IQBALANCE
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs ) {
+ BOOST_FOREACH( source_iface *dev, _devs ) {
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++) {
if ( channel < _iq_opt.size() ) {
iqbalance_optimize_c *opt = _iq_opt[channel];
@@ -359,7 +359,7 @@ double osmosdr_source_c_impl::set_sample_rate(double rate)
return sample_rate;
}
-double osmosdr_source_c_impl::get_sample_rate()
+double source_impl::get_sample_rate()
{
double sample_rate = 0;
@@ -372,10 +372,10 @@ double osmosdr_source_c_impl::get_sample_rate()
return sample_rate;
}
-osmosdr::freq_range_t osmosdr_source_c_impl::get_freq_range( size_t chan )
+osmosdr::freq_range_t source_impl::get_freq_range( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_freq_range( dev_chan );
@@ -383,10 +383,10 @@ osmosdr::freq_range_t osmosdr_source_c_impl::get_freq_range( size_t chan )
return osmosdr::freq_range_t();
}
-double osmosdr_source_c_impl::set_center_freq( double freq, size_t chan )
+double source_impl::set_center_freq( double freq, size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
if ( _center_freq[ chan ] != freq ) {
@@ -397,10 +397,10 @@ double osmosdr_source_c_impl::set_center_freq( double freq, size_t chan )
return 0;
}
-double osmosdr_source_c_impl::get_center_freq( size_t chan )
+double source_impl::get_center_freq( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_center_freq( dev_chan );
@@ -408,10 +408,10 @@ double osmosdr_source_c_impl::get_center_freq( size_t chan )
return 0;
}
-double osmosdr_source_c_impl::set_freq_corr( double ppm, size_t chan )
+double source_impl::set_freq_corr( double ppm, size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
if ( _freq_corr[ chan ] != ppm ) {
@@ -422,10 +422,10 @@ double osmosdr_source_c_impl::set_freq_corr( double ppm, size_t chan )
return 0;
}
-double osmosdr_source_c_impl::get_freq_corr( size_t chan )
+double source_impl::get_freq_corr( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_freq_corr( dev_chan );
@@ -433,10 +433,10 @@ double osmosdr_source_c_impl::get_freq_corr( size_t chan )
return 0;
}
-std::vector<std::string> osmosdr_source_c_impl::get_gain_names( size_t chan )
+std::vector<std::string> source_impl::get_gain_names( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain_names( dev_chan );
@@ -444,10 +444,10 @@ std::vector<std::string> osmosdr_source_c_impl::get_gain_names( size_t chan )
return std::vector< std::string >();
}
-osmosdr::gain_range_t osmosdr_source_c_impl::get_gain_range( size_t chan )
+osmosdr::gain_range_t source_impl::get_gain_range( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain_range( dev_chan );
@@ -455,10 +455,10 @@ osmosdr::gain_range_t osmosdr_source_c_impl::get_gain_range( size_t chan )
return osmosdr::gain_range_t();
}
-osmosdr::gain_range_t osmosdr_source_c_impl::get_gain_range( const std::string & name, size_t chan )
+osmosdr::gain_range_t source_impl::get_gain_range( const std::string & name, size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain_range( name, dev_chan );
@@ -466,10 +466,10 @@ osmosdr::gain_range_t osmosdr_source_c_impl::get_gain_range( const std::string &
return osmosdr::gain_range_t();
}
-bool osmosdr_source_c_impl::set_gain_mode( bool automatic, size_t chan )
+bool source_impl::set_gain_mode( bool automatic, size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
if ( _gain_mode[ chan ] != automatic ) {
@@ -483,10 +483,10 @@ bool osmosdr_source_c_impl::set_gain_mode( bool automatic, size_t chan )
return false;
}
-bool osmosdr_source_c_impl::get_gain_mode( size_t chan )
+bool source_impl::get_gain_mode( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain_mode( dev_chan );
@@ -494,10 +494,10 @@ bool osmosdr_source_c_impl::get_gain_mode( size_t chan )
return false;
}
-double osmosdr_source_c_impl::set_gain( double gain, size_t chan )
+double source_impl::set_gain( double gain, size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
if ( _gain[ chan ] != gain ) {
@@ -508,10 +508,10 @@ double osmosdr_source_c_impl::set_gain( double gain, size_t chan )
return 0;
}
-double osmosdr_source_c_impl::set_gain( double gain, const std::string & name, size_t chan)
+double source_impl::set_gain( double gain, const std::string & name, size_t chan)
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->set_gain( gain, name, dev_chan );
@@ -519,10 +519,10 @@ double osmosdr_source_c_impl::set_gain( double gain, const std::string & name, s
return 0;
}
-double osmosdr_source_c_impl::get_gain( size_t chan )
+double source_impl::get_gain( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain( dev_chan );
@@ -530,10 +530,10 @@ double osmosdr_source_c_impl::get_gain( size_t chan )
return 0;
}
-double osmosdr_source_c_impl::get_gain( const std::string & name, size_t chan )
+double source_impl::get_gain( const std::string & name, size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_gain( name, dev_chan );
@@ -541,10 +541,10 @@ double osmosdr_source_c_impl::get_gain( const std::string & name, size_t chan )
return 0;
}
-double osmosdr_source_c_impl::set_if_gain( double gain, size_t chan )
+double source_impl::set_if_gain( double gain, size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
if ( _if_gain[ chan ] != gain ) {
@@ -555,10 +555,10 @@ double osmosdr_source_c_impl::set_if_gain( double gain, size_t chan )
return 0;
}
-double osmosdr_source_c_impl::set_bb_gain( double gain, size_t chan )
+double source_impl::set_bb_gain( double gain, size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
if ( _bb_gain[ chan ] != gain ) {
@@ -569,10 +569,10 @@ double osmosdr_source_c_impl::set_bb_gain( double gain, size_t chan )
return 0;
}
-std::vector< std::string > osmosdr_source_c_impl::get_antennas( size_t chan )
+std::vector< std::string > source_impl::get_antennas( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_antennas( dev_chan );
@@ -580,10 +580,10 @@ std::vector< std::string > osmosdr_source_c_impl::get_antennas( size_t chan )
return std::vector< std::string >();
}
-std::string osmosdr_source_c_impl::set_antenna( const std::string & antenna, size_t chan )
+std::string source_impl::set_antenna( const std::string & antenna, size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
if ( _antenna[ chan ] != antenna ) {
@@ -594,10 +594,10 @@ std::string osmosdr_source_c_impl::set_antenna( const std::string & antenna, siz
return "";
}
-std::string osmosdr_source_c_impl::get_antenna( size_t chan )
+std::string source_impl::get_antenna( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_antenna( dev_chan );
@@ -605,11 +605,11 @@ std::string osmosdr_source_c_impl::get_antenna( size_t chan )
return "";
}
-void osmosdr_source_c_impl::set_iq_balance_mode( int mode, size_t chan )
+void source_impl::set_iq_balance_mode( int mode, size_t chan )
{
#ifdef HAVE_IQBALANCE
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs ) {
+ BOOST_FOREACH( source_iface *dev, _devs ) {
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++) {
if ( chan == channel++ ) {
if ( chan < _iq_opt.size() && chan < _iq_fix.size() ) {
@@ -641,11 +641,11 @@ void osmosdr_source_c_impl::set_iq_balance_mode( int mode, size_t chan )
#endif
}
-void osmosdr_source_c_impl::set_iq_balance( const std::complex<double> &correction, size_t chan )
+void source_impl::set_iq_balance( const std::complex<double> &correction, size_t chan )
{
#ifdef HAVE_IQBALANCE
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs ) {
+ BOOST_FOREACH( source_iface *dev, _devs ) {
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++) {
if ( chan == channel++ ) {
if ( chan < _iq_opt.size() && chan < _iq_fix.size() ) {
@@ -663,10 +663,10 @@ void osmosdr_source_c_impl::set_iq_balance( const std::complex<double> &correcti
#endif
}
-double osmosdr_source_c_impl::set_bandwidth( double bandwidth, size_t chan )
+double source_impl::set_bandwidth( double bandwidth, size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
if ( _bandwidth[ chan ] != bandwidth ) {
@@ -677,10 +677,10 @@ double osmosdr_source_c_impl::set_bandwidth( double bandwidth, size_t chan )
return 0;
}
-double osmosdr_source_c_impl::get_bandwidth( size_t chan )
+double source_impl::get_bandwidth( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_bandwidth( dev_chan );
@@ -688,10 +688,10 @@ double osmosdr_source_c_impl::get_bandwidth( size_t chan )
return 0;
}
-osmosdr::freq_range_t osmosdr_source_c_impl::get_bandwidth_range( size_t chan )
+osmosdr::freq_range_t source_impl::get_bandwidth_range( size_t chan )
{
size_t channel = 0;
- BOOST_FOREACH( osmosdr_src_iface *dev, _devs )
+ BOOST_FOREACH( source_iface *dev, _devs )
for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++)
if ( chan == channel++ )
return dev->get_bandwidth_range( dev_chan );
diff --git a/lib/osmosdr_source_c_impl.h b/lib/source_impl.h
index bbefc84..82b90ed 100644
--- a/lib/osmosdr_source_c_impl.h
+++ b/lib/source_impl.h
@@ -17,23 +17,25 @@
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_OSMOSDR_SOURCE_C_IMPL_H
-#define INCLUDED_OSMOSDR_SOURCE_C_IMPL_H
+#ifndef INCLUDED_OSMOSDR_SOURCE_IMPL_H
+#define INCLUDED_OSMOSDR_SOURCE_IMPL_H
-#include <osmosdr/osmosdr_source_c.h>
+#include <osmosdr/source.h>
#ifdef HAVE_IQBALANCE
#include <iqbalance_optimize_c.h>
#include <iqbalance_fix_cc.h>
#endif
-#include <osmosdr_src_iface.h>
+#include <source_iface.h>
#include <map>
-class osmosdr_source_c_impl : public osmosdr_source_c
+class source_impl : public osmosdr::source
{
public:
+ source_impl( const std::string & args );
+
size_t get_num_channels( void );
osmosdr::meta_range_t get_sample_rates( void );
@@ -71,13 +73,7 @@ public:
osmosdr::freq_range_t get_bandwidth_range( size_t chan = 0 );
private:
- osmosdr_source_c_impl (const std::string & args); // private constructor
-
- // The friend declaration allows osmosdr_make_source_c to
- // access the private constructor.
- friend osmosdr_source_c_sptr osmosdr_make_source_c (const std::string & args);
-
- std::vector< osmosdr_src_iface * > _devs;
+ std::vector< source_iface * > _devs;
double _sample_rate;
std::map< size_t, double > _center_freq;
@@ -95,4 +91,4 @@ private:
std::map< size_t, double > _bandwidth;
};
-#endif /* INCLUDED_OSMOSDR_SOURCE_C_IMPL_H */
+#endif /* INCLUDED_OSMOSDR_SOURCE_IMPL_H */
diff --git a/lib/uhd/uhd_sink_c.cc b/lib/uhd/uhd_sink_c.cc
index 20644f8..255d8bf 100644
--- a/lib/uhd/uhd_sink_c.cc
+++ b/lib/uhd/uhd_sink_c.cc
@@ -24,7 +24,7 @@
//#include <uhd/property_tree.hpp>
-#include "osmosdr_arg_helpers.h"
+#include "arg_helpers.h"
#include "uhd_sink_c.h"
diff --git a/lib/uhd/uhd_sink_c.h b/lib/uhd/uhd_sink_c.h
index a4e87b9..c85dfb1 100644
--- a/lib/uhd/uhd_sink_c.h
+++ b/lib/uhd/uhd_sink_c.h
@@ -23,7 +23,7 @@
#include <gnuradio/hier_block2.h>
#include <gnuradio/uhd/usrp_sink.h>
-#include "osmosdr_snk_iface.h"
+#include "sink_iface.h"
class uhd_sink_c;
@@ -33,7 +33,7 @@ uhd_sink_c_sptr make_uhd_sink_c(const std::string &args = "");
class uhd_sink_c :
public gr::hier_block2,
- public osmosdr_snk_iface
+ public sink_iface
{
private:
friend uhd_sink_c_sptr make_uhd_sink_c(const std::string &args);
diff --git a/lib/uhd/uhd_source_c.cc b/lib/uhd/uhd_source_c.cc
index ff9e871..3137b27 100644
--- a/lib/uhd/uhd_source_c.cc
+++ b/lib/uhd/uhd_source_c.cc
@@ -24,7 +24,7 @@
//#include <uhd/property_tree.hpp>
-#include "osmosdr_arg_helpers.h"
+#include "arg_helpers.h"
#include "uhd_source_c.h"
diff --git a/lib/uhd/uhd_source_c.h b/lib/uhd/uhd_source_c.h
index 17970bf..90da3bc 100644
--- a/lib/uhd/uhd_source_c.h
+++ b/lib/uhd/uhd_source_c.h
@@ -23,7 +23,7 @@
#include <gnuradio/hier_block2.h>
#include <gnuradio/uhd/usrp_source.h>
-#include "osmosdr_src_iface.h"
+#include "source_iface.h"
class uhd_source_c;
@@ -33,7 +33,7 @@ uhd_source_c_sptr make_uhd_source_c(const std::string &args = "");
class uhd_source_c :
public gr::hier_block2,
- public osmosdr_src_iface
+ public source_iface
{
private:
friend uhd_source_c_sptr make_uhd_source_c(const std::string &args);
diff --git a/swig/osmosdr_swig.i b/swig/osmosdr_swig.i
index 3f44af1..4de4892 100644
--- a/swig/osmosdr_swig.i
+++ b/swig/osmosdr_swig.i
@@ -11,9 +11,9 @@
%include "osmosdr_swig_doc.i"
%{
-#include "osmosdr/osmosdr_device.h"
-#include "osmosdr/osmosdr_source_c.h"
-#include "osmosdr/osmosdr_sink_c.h"
+#include "osmosdr/device.h"
+#include "osmosdr/source.h"
+#include "osmosdr/sink.h"
%}
// Workaround for a SWIG 2.0.4 bug with templates. Probably needs to be looked in to.
@@ -29,20 +29,27 @@
//%template(size_vector_t) std::vector<size_t>;
-%include <osmosdr/osmosdr_pimpl.h>
+%include <osmosdr/pimpl.h>
%ignore osmosdr::device_t::operator[]; //ignore warnings about %extend
%template(string_string_dict_t) std::map<std::string, std::string>; //define before device
%template(devices_t) std::vector<osmosdr::device_t>;
-%include <osmosdr/osmosdr_device.h>
+%include <osmosdr/device.h>
%template(range_vector_t) std::vector<osmosdr::range_t>; //define before range
-%include <osmosdr/osmosdr_ranges.h>
+%include <osmosdr/ranges.h>
-GR_SWIG_BLOCK_MAGIC(osmosdr,source_c);
-%include "osmosdr/osmosdr_source_c.h"
+%define OSMOSDR_SWIG_BLOCK_MAGIC2(PKG, BASE_NAME)
+%template(BASE_NAME ## _sptr) boost::shared_ptr<PKG ## :: ## BASE_NAME>;
+%pythoncode %{
+BASE_NAME ## _sptr.__repr__ = lambda self: "<gr_block %s (%d)>" % (self.name(), self.unique_id())
+BASE_NAME = BASE_NAME.make;
+%}
+%enddef
-GR_SWIG_BLOCK_MAGIC(osmosdr,sink_c);
-%include "osmosdr/osmosdr_sink_c.h"
+%include "osmosdr/source.h"
+%include "osmosdr/sink.h"
+OSMOSDR_SWIG_BLOCK_MAGIC2(osmosdr,source);
+OSMOSDR_SWIG_BLOCK_MAGIC2(osmosdr,sink);