From 13477f279f94cd6749cee077b7c742f1cecc9378 Mon Sep 17 00:00:00 2001 From: Dimitri Stolnikov Date: Tue, 30 Apr 2013 21:00:57 +0200 Subject: [PATCH] source/sink: return freq_range_t in get_bandwidth_range() it was meta_range_t (which is binary compatible) before. --- include/osmosdr/osmosdr_sink_c.h | 2 +- include/osmosdr/osmosdr_source_c.h | 2 +- lib/hackrf/hackrf_sink_c.cc | 6 +++--- lib/hackrf/hackrf_sink_c.h | 2 +- lib/hackrf/hackrf_source_c.cc | 6 +++--- lib/hackrf/hackrf_source_c.h | 2 +- lib/osmosdr_sink_c_impl.cc | 12 +++++------- lib/osmosdr_sink_c_impl.h | 2 +- lib/osmosdr_snk_iface.h | 4 ++-- lib/osmosdr_source_c_impl.cc | 12 +++++------- lib/osmosdr_source_c_impl.h | 2 +- lib/osmosdr_src_iface.h | 4 ++-- 12 files changed, 26 insertions(+), 30 deletions(-) diff --git a/include/osmosdr/osmosdr_sink_c.h b/include/osmosdr/osmosdr_sink_c.h index d76a6ba..d3911e1 100644 --- a/include/osmosdr/osmosdr_sink_c.h +++ b/include/osmosdr/osmosdr_sink_c.h @@ -284,7 +284,7 @@ public: * \param chan the channel index 0 to N-1 * \return a range of bandwidths in Hz */ - virtual osmosdr::meta_range_t get_bandwidth_range( size_t chan = 0 ) = 0; + virtual osmosdr::freq_range_t get_bandwidth_range( size_t chan = 0 ) = 0; }; #endif /* INCLUDED_OSMOSDR_SINK_C_H */ diff --git a/include/osmosdr/osmosdr_source_c.h b/include/osmosdr/osmosdr_source_c.h index 9947af7..8ffdb90 100644 --- a/include/osmosdr/osmosdr_source_c.h +++ b/include/osmosdr/osmosdr_source_c.h @@ -284,7 +284,7 @@ public: * \param chan the channel index 0 to N-1 * \return a range of bandwidths in Hz */ - virtual osmosdr::meta_range_t get_bandwidth_range( size_t chan = 0 ) = 0; + virtual osmosdr::freq_range_t get_bandwidth_range( size_t chan = 0 ) = 0; }; #endif /* INCLUDED_OSMOSDR_SOURCE_C_H */ diff --git a/lib/hackrf/hackrf_sink_c.cc b/lib/hackrf/hackrf_sink_c.cc index 58a49cb..470509b 100644 --- a/lib/hackrf/hackrf_sink_c.cc +++ b/lib/hackrf/hackrf_sink_c.cc @@ -671,7 +671,7 @@ std::string hackrf_sink_c::get_antenna( size_t chan ) double hackrf_sink_c::set_bandwidth( double bandwidth, size_t chan ) { int ret; -// osmosdr::meta_range_t bandwidths = get_bandwidth_range( chan ); +// osmosdr::freq_range_t bandwidths = get_bandwidth_range( chan ); if ( bandwidth == 0.0 ) /* bandwidth of 0 means automatic filter selection */ bandwidth = _sample_rate; @@ -695,9 +695,9 @@ double hackrf_sink_c::get_bandwidth( size_t chan ) return _bandwidth; } -osmosdr::meta_range_t hackrf_sink_c::get_bandwidth_range( size_t chan ) +osmosdr::freq_range_t hackrf_sink_c::get_bandwidth_range( size_t chan ) { - osmosdr::meta_range_t bandwidths; + osmosdr::freq_range_t bandwidths; // TODO: read out from libhackrf when an API is available diff --git a/lib/hackrf/hackrf_sink_c.h b/lib/hackrf/hackrf_sink_c.h index 4c0ca5f..cfa6619 100644 --- a/lib/hackrf/hackrf_sink_c.h +++ b/lib/hackrf/hackrf_sink_c.h @@ -119,7 +119,7 @@ public: double set_bandwidth( double bandwidth, size_t chan = 0 ); double get_bandwidth( size_t chan = 0 ); - osmosdr::meta_range_t get_bandwidth_range( size_t chan = 0 ); + osmosdr::freq_range_t get_bandwidth_range( size_t chan = 0 ); private: static int _hackrf_tx_callback(hackrf_transfer* transfer); diff --git a/lib/hackrf/hackrf_source_c.cc b/lib/hackrf/hackrf_source_c.cc index c2699fa..76eb5fd 100644 --- a/lib/hackrf/hackrf_source_c.cc +++ b/lib/hackrf/hackrf_source_c.cc @@ -649,7 +649,7 @@ std::string hackrf_source_c::get_antenna( size_t chan ) double hackrf_source_c::set_bandwidth( double bandwidth, size_t chan ) { int ret; -// osmosdr::meta_range_t bandwidths = get_bandwidth_range( chan ); +// osmosdr::freq_range_t bandwidths = get_bandwidth_range( chan ); if ( bandwidth == 0.0 ) /* bandwidth of 0 means automatic filter selection */ bandwidth = _sample_rate; @@ -673,9 +673,9 @@ double hackrf_source_c::get_bandwidth( size_t chan ) return _bandwidth; } -osmosdr::meta_range_t hackrf_source_c::get_bandwidth_range( size_t chan ) +osmosdr::freq_range_t hackrf_source_c::get_bandwidth_range( size_t chan ) { - osmosdr::meta_range_t bandwidths; + osmosdr::freq_range_t bandwidths; // TODO: read out from libhackrf when an API is available diff --git a/lib/hackrf/hackrf_source_c.h b/lib/hackrf/hackrf_source_c.h index 02ff2a5..ccd6201 100644 --- a/lib/hackrf/hackrf_source_c.h +++ b/lib/hackrf/hackrf_source_c.h @@ -118,7 +118,7 @@ public: double set_bandwidth( double bandwidth, size_t chan = 0 ); double get_bandwidth( size_t chan = 0 ); - osmosdr::meta_range_t get_bandwidth_range( size_t chan = 0 ); + osmosdr::freq_range_t get_bandwidth_range( size_t chan = 0 ); private: static int _hackrf_rx_callback(hackrf_transfer* transfer); diff --git a/lib/osmosdr_sink_c_impl.cc b/lib/osmosdr_sink_c_impl.cc index 6152069..bd43fd4 100644 --- a/lib/osmosdr_sink_c_impl.cc +++ b/lib/osmosdr_sink_c_impl.cc @@ -180,15 +180,13 @@ size_t osmosdr_sink_c_impl::get_num_channels() osmosdr::meta_range_t osmosdr_sink_c_impl::get_sample_rates() { - osmosdr::meta_range_t rates(0, 0, 0); - - if (!_devs.empty()) - rates = _devs[0]->get_sample_rates(); // assume same devices used in the group + if ( ! _devs.empty() ) + return _devs[0]->get_sample_rates(); // assume same devices used in the group #if 0 else throw std::runtime_error(NO_DEVICES_MSG); #endif - return rates; + return osmosdr::meta_range_t(); } double osmosdr_sink_c_impl::set_sample_rate(double rate) @@ -490,7 +488,7 @@ double osmosdr_sink_c_impl::get_bandwidth( size_t chan ) return 0; } -osmosdr::meta_range_t osmosdr_sink_c_impl::get_bandwidth_range( size_t chan ) +osmosdr::freq_range_t osmosdr_sink_c_impl::get_bandwidth_range( size_t chan ) { size_t channel = 0; BOOST_FOREACH( osmosdr_snk_iface *dev, _devs ) @@ -498,5 +496,5 @@ osmosdr::meta_range_t osmosdr_sink_c_impl::get_bandwidth_range( size_t chan ) if ( chan == channel++ ) return dev->get_bandwidth_range( dev_chan ); - return osmosdr::meta_range_t(); + return osmosdr::freq_range_t(); } diff --git a/lib/osmosdr_sink_c_impl.h b/lib/osmosdr_sink_c_impl.h index 9194168..766be75 100644 --- a/lib/osmosdr_sink_c_impl.h +++ b/lib/osmosdr_sink_c_impl.h @@ -63,7 +63,7 @@ public: double set_bandwidth( double bandwidth, size_t chan = 0 ); double get_bandwidth( size_t chan = 0 ); - osmosdr::meta_range_t get_bandwidth_range( size_t chan = 0 ); + osmosdr::freq_range_t get_bandwidth_range( size_t chan = 0 ); private: osmosdr_sink_c_impl (const std::string & args); // private constructor diff --git a/lib/osmosdr_snk_iface.h b/lib/osmosdr_snk_iface.h index 4a45529..bd952d8 100644 --- a/lib/osmosdr_snk_iface.h +++ b/lib/osmosdr_snk_iface.h @@ -254,8 +254,8 @@ public: * \param chan the channel index 0 to N-1 * \return a range of bandwidths in Hz */ - virtual osmosdr::meta_range_t get_bandwidth_range( size_t chan = 0 ) - { return osmosdr::meta_range_t(); } + virtual osmosdr::freq_range_t get_bandwidth_range( size_t chan = 0 ) + { return osmosdr::freq_range_t(); } }; #endif // OSMOSDR_SNK_IFACE_H diff --git a/lib/osmosdr_source_c_impl.cc b/lib/osmosdr_source_c_impl.cc index 568e7b4..f05e522 100644 --- a/lib/osmosdr_source_c_impl.cc +++ b/lib/osmosdr_source_c_impl.cc @@ -312,15 +312,13 @@ size_t osmosdr_source_c_impl::get_num_channels() osmosdr::meta_range_t osmosdr_source_c_impl::get_sample_rates() { - osmosdr::meta_range_t rates(0, 0, 0); - - if (!_devs.empty()) - rates = _devs[0]->get_sample_rates(); // assume same devices used in the group + if ( ! _devs.empty() ) + return _devs[0]->get_sample_rates(); // assume same devices used in the group #if 0 else throw std::runtime_error(NO_DEVICES_MSG); #endif - return rates; + return osmosdr::meta_range_t();; } double osmosdr_source_c_impl::set_sample_rate(double rate) @@ -688,7 +686,7 @@ double osmosdr_source_c_impl::get_bandwidth( size_t chan ) return 0; } -osmosdr::meta_range_t osmosdr_source_c_impl::get_bandwidth_range( size_t chan ) +osmosdr::freq_range_t osmosdr_source_c_impl::get_bandwidth_range( size_t chan ) { size_t channel = 0; BOOST_FOREACH( osmosdr_src_iface *dev, _devs ) @@ -696,5 +694,5 @@ osmosdr::meta_range_t osmosdr_source_c_impl::get_bandwidth_range( size_t chan ) if ( chan == channel++ ) return dev->get_bandwidth_range( dev_chan ); - return osmosdr::meta_range_t(); + return osmosdr::freq_range_t(); } diff --git a/lib/osmosdr_source_c_impl.h b/lib/osmosdr_source_c_impl.h index 6c252d4..bbefc84 100644 --- a/lib/osmosdr_source_c_impl.h +++ b/lib/osmosdr_source_c_impl.h @@ -68,7 +68,7 @@ public: double set_bandwidth( double bandwidth, size_t chan = 0 ); double get_bandwidth( size_t chan = 0 ); - osmosdr::meta_range_t get_bandwidth_range( size_t chan = 0 ); + osmosdr::freq_range_t get_bandwidth_range( size_t chan = 0 ); private: osmosdr_source_c_impl (const std::string & args); // private constructor diff --git a/lib/osmosdr_src_iface.h b/lib/osmosdr_src_iface.h index f5c7565..f7c2925 100644 --- a/lib/osmosdr_src_iface.h +++ b/lib/osmosdr_src_iface.h @@ -254,8 +254,8 @@ public: * \param chan the channel index 0 to N-1 * \return a range of bandwidths in Hz */ - virtual osmosdr::meta_range_t get_bandwidth_range( size_t chan = 0 ) - { return osmosdr::meta_range_t(); } + virtual osmosdr::freq_range_t get_bandwidth_range( size_t chan = 0 ) + { return osmosdr::freq_range_t(); } }; #endif // OSMOSDR_SRC_IFACE_H