From 6bef750ac9b779fb28315b7c3f9385eddfdc3314 Mon Sep 17 00:00:00 2001 From: Dimitri Stolnikov Date: Thu, 17 May 2012 10:35:58 +0200 Subject: [PATCH] change gain mode argument to 'automatic' for clarity --- include/osmosdr/osmosdr_source_c.h | 6 +++--- lib/fcd/fcd_source.cc | 2 +- lib/fcd/fcd_source.h | 2 +- lib/file/file_source_c.cc | 2 +- lib/file/file_source_c.h | 2 +- lib/osmosdr_source_c_impl.cc | 8 ++++---- lib/osmosdr_source_c_impl.h | 2 +- lib/osmosdr_src_iface.h | 6 +++--- lib/rtl/rtl_source_c.cc | 6 +++--- lib/rtl/rtl_source_c.h | 2 +- lib/rtl_tcp/rtl_tcp_source_c.cc | 6 +++--- lib/rtl_tcp/rtl_tcp_source_c.h | 2 +- lib/uhd/uhd_source_c.cc | 2 +- lib/uhd/uhd_source_c.h | 2 +- 14 files changed, 25 insertions(+), 25 deletions(-) diff --git a/include/osmosdr/osmosdr_source_c.h b/include/osmosdr/osmosdr_source_c.h index 1da922b..425902d 100644 --- a/include/osmosdr/osmosdr_source_c.h +++ b/include/osmosdr/osmosdr_source_c.h @@ -148,16 +148,16 @@ public: /*! * Set the gain mode for the underlying radio hardware. * This might be supported only for certain hardware types. - * \param mode the gain mode (true means automatic gain mode) + * \param automatic the gain mode (true means automatic gain mode) * \param chan the channel index 0 to N-1 * \return the actual gain mode */ - virtual bool set_gain_mode( bool mode, size_t chan = 0 ) = 0; + virtual bool set_gain_mode( bool automatic, size_t chan = 0 ) = 0; /*! * Get the gain mode selected for the underlying radio hardware. * \param chan the channel index 0 to N-1 - * \return the actual gain mode + * \return the actual gain mode (true means automatic gain mode) */ virtual bool get_gain_mode( size_t chan = 0 ) = 0; diff --git a/lib/fcd/fcd_source.cc b/lib/fcd/fcd_source.cc index c77e33a..fa6caeb 100644 --- a/lib/fcd/fcd_source.cc +++ b/lib/fcd/fcd_source.cc @@ -198,7 +198,7 @@ osmosdr::gain_range_t fcd_source::get_gain_range( const std::string & name, size return get_gain_range( chan ); } -bool fcd_source::set_gain_mode( bool mode, size_t chan ) +bool fcd_source::set_gain_mode( bool automatic, size_t chan ) { return get_gain_mode(chan); } diff --git a/lib/fcd/fcd_source.h b/lib/fcd/fcd_source.h index 5d23a26..5e816b8 100644 --- a/lib/fcd/fcd_source.h +++ b/lib/fcd/fcd_source.h @@ -65,7 +65,7 @@ public: std::vector get_gain_names( size_t chan = 0 ); osmosdr::gain_range_t get_gain_range( size_t chan = 0 ); osmosdr::gain_range_t get_gain_range( const std::string & name, size_t chan = 0 ); - bool set_gain_mode( bool mode, size_t chan = 0 ); + bool set_gain_mode( bool automatic, size_t chan = 0 ); bool get_gain_mode( size_t chan = 0 ); double set_gain( double gain, size_t chan = 0 ); double set_gain( double gain, const std::string & name, size_t chan = 0 ); diff --git a/lib/file/file_source_c.cc b/lib/file/file_source_c.cc index 87de181..48e9b17 100644 --- a/lib/file/file_source_c.cc +++ b/lib/file/file_source_c.cc @@ -172,7 +172,7 @@ osmosdr::gain_range_t file_source_c::get_gain_range( const std::string & name, s return get_gain_range( chan ); } -bool file_source_c::set_gain_mode( bool mode, size_t chan ) +bool file_source_c::set_gain_mode( bool automatic, size_t chan ) { return get_gain_mode(chan); } diff --git a/lib/file/file_source_c.h b/lib/file/file_source_c.h index 78cc985..8091118 100644 --- a/lib/file/file_source_c.h +++ b/lib/file/file_source_c.h @@ -61,7 +61,7 @@ public: std::vector get_gain_names( size_t chan = 0 ); osmosdr::gain_range_t get_gain_range( size_t chan = 0 ); osmosdr::gain_range_t get_gain_range( const std::string & name, size_t chan = 0 ); - bool set_gain_mode( bool mode, size_t chan = 0 ); + bool set_gain_mode( bool automatic, size_t chan = 0 ); bool get_gain_mode( size_t chan = 0 ); double set_gain( double gain, size_t chan = 0 ); double set_gain( double gain, const std::string & name, size_t chan = 0 ); diff --git a/lib/osmosdr_source_c_impl.cc b/lib/osmosdr_source_c_impl.cc index bb53a05..ef41b59 100644 --- a/lib/osmosdr_source_c_impl.cc +++ b/lib/osmosdr_source_c_impl.cc @@ -316,15 +316,15 @@ 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 mode, size_t chan ) +bool osmosdr_source_c_impl::set_gain_mode( bool automatic, size_t chan ) { size_t channel = 0; BOOST_FOREACH( osmosdr_src_iface *dev, _devs ) for (size_t dev_chan = 0; dev_chan < dev->get_num_channels(); dev_chan++) if ( chan == channel++ ) - if ( _gain_mode[ chan ] != mode ) { - _gain_mode[ chan ] = mode; - return dev->set_gain_mode( mode, dev_chan ); + if ( _gain_mode[ chan ] != automatic ) { + _gain_mode[ chan ] = automatic; + return dev->set_gain_mode( automatic, dev_chan ); } return false; diff --git a/lib/osmosdr_source_c_impl.h b/lib/osmosdr_source_c_impl.h index 20e3ded..0202fce 100644 --- a/lib/osmosdr_source_c_impl.h +++ b/lib/osmosdr_source_c_impl.h @@ -45,7 +45,7 @@ public: std::vector get_gain_names( size_t chan = 0 ); osmosdr::gain_range_t get_gain_range( size_t chan = 0 ); osmosdr::gain_range_t get_gain_range( const std::string & name, size_t chan = 0 ); - bool set_gain_mode( bool mode, size_t chan = 0 ); + bool set_gain_mode( bool automatic, size_t chan = 0 ); bool get_gain_mode( size_t chan = 0 ); double set_gain( double gain, size_t chan = 0 ); double set_gain( double gain, const std::string & name, size_t chan = 0 ); diff --git a/lib/osmosdr_src_iface.h b/lib/osmosdr_src_iface.h index a02e8c1..dbcc4cf 100644 --- a/lib/osmosdr_src_iface.h +++ b/lib/osmosdr_src_iface.h @@ -126,16 +126,16 @@ public: /*! * Set the gain mode for the underlying radio hardware. * This might be supported only for certain hardware types. - * \param mode the gain mode (true means automatic gain mode) + * \param automatic the gain mode (true means automatic gain mode) * \param chan the channel index 0 to N-1 * \return the actual gain mode */ - virtual bool set_gain_mode( bool mode, size_t chan = 0 ) = 0; + virtual bool set_gain_mode( bool automatic, size_t chan = 0 ) = 0; /*! * Get the gain mode selected for the underlying radio hardware. * \param chan the channel index 0 to N-1 - * \return the actual gain mode + * \return the actual gain mode (true means automatic gain mode) */ virtual bool get_gain_mode( size_t chan = 0 ) = 0; diff --git a/lib/rtl/rtl_source_c.cc b/lib/rtl/rtl_source_c.cc index 12ad1c0..ecb6055 100644 --- a/lib/rtl/rtl_source_c.cc +++ b/lib/rtl/rtl_source_c.cc @@ -427,11 +427,11 @@ osmosdr::gain_range_t rtl_source_c::get_gain_range( const std::string & name, si return get_gain_range( chan ); } -bool rtl_source_c::set_gain_mode( bool mode, size_t chan ) +bool rtl_source_c::set_gain_mode( bool automatic, size_t chan ) { if (_dev) { - if (!rtlsdr_set_tuner_gain_mode(_dev, int(!mode))) { - _auto_gain = mode; + if (!rtlsdr_set_tuner_gain_mode(_dev, int(!automatic))) { + _auto_gain = automatic; } } diff --git a/lib/rtl/rtl_source_c.h b/lib/rtl/rtl_source_c.h index eccf349..0b05229 100644 --- a/lib/rtl/rtl_source_c.h +++ b/lib/rtl/rtl_source_c.h @@ -100,7 +100,7 @@ public: std::vector get_gain_names( size_t chan = 0 ); osmosdr::gain_range_t get_gain_range( size_t chan = 0 ); osmosdr::gain_range_t get_gain_range( const std::string & name, size_t chan = 0 ); - bool set_gain_mode( bool mode, size_t chan = 0 ); + bool set_gain_mode( bool automatic, size_t chan = 0 ); bool get_gain_mode( size_t chan = 0 ); double set_gain( double gain, size_t chan = 0 ); double set_gain( double gain, const std::string & name, size_t chan = 0 ); diff --git a/lib/rtl_tcp/rtl_tcp_source_c.cc b/lib/rtl_tcp/rtl_tcp_source_c.cc index 5bb13e0..1960f7b 100644 --- a/lib/rtl_tcp/rtl_tcp_source_c.cc +++ b/lib/rtl_tcp/rtl_tcp_source_c.cc @@ -217,11 +217,11 @@ osmosdr::gain_range_t rtl_tcp_source_c::get_gain_range( const std::string & name return get_gain_range( chan ); } -bool rtl_tcp_source_c::set_gain_mode( bool mode, size_t chan ) +bool rtl_tcp_source_c::set_gain_mode( bool automatic, size_t chan ) { - _src->set_gain_mode(int(!mode)); + _src->set_gain_mode(int(!automatic)); - _auto_gain = mode; + _auto_gain = automatic; return get_gain_mode(chan); } diff --git a/lib/rtl_tcp/rtl_tcp_source_c.h b/lib/rtl_tcp/rtl_tcp_source_c.h index bb67027..9657714 100644 --- a/lib/rtl_tcp/rtl_tcp_source_c.h +++ b/lib/rtl_tcp/rtl_tcp_source_c.h @@ -63,7 +63,7 @@ public: std::vector get_gain_names( size_t chan = 0 ); osmosdr::gain_range_t get_gain_range( size_t chan = 0 ); osmosdr::gain_range_t get_gain_range( const std::string & name, size_t chan = 0 ); - bool set_gain_mode( bool mode, size_t chan = 0 ); + bool set_gain_mode( bool automatic, size_t chan = 0 ); bool get_gain_mode( size_t chan = 0 ); double set_gain( double gain, size_t chan = 0 ); double set_gain( double gain, const std::string & name, size_t chan = 0 ); diff --git a/lib/uhd/uhd_source_c.cc b/lib/uhd/uhd_source_c.cc index d2fda61..e930454 100644 --- a/lib/uhd/uhd_source_c.cc +++ b/lib/uhd/uhd_source_c.cc @@ -184,7 +184,7 @@ osmosdr::gain_range_t uhd_source_c::get_gain_range( const std::string & name, si return range; } -bool uhd_source_c::set_gain_mode( bool mode, size_t chan ) +bool uhd_source_c::set_gain_mode( bool automatic, size_t chan ) { return get_gain_mode(chan); } diff --git a/lib/uhd/uhd_source_c.h b/lib/uhd/uhd_source_c.h index 18529ce..9c193ae 100644 --- a/lib/uhd/uhd_source_c.h +++ b/lib/uhd/uhd_source_c.h @@ -65,7 +65,7 @@ public: std::vector get_gain_names( size_t chan = 0 ); osmosdr::gain_range_t get_gain_range( size_t chan = 0 ); osmosdr::gain_range_t get_gain_range( const std::string & name, size_t chan = 0 ); - bool set_gain_mode( bool mode, size_t chan = 0 ); + bool set_gain_mode( bool automatic, size_t chan = 0 ); bool get_gain_mode( size_t chan = 0 ); double set_gain( double gain, size_t chan = 0 ); double set_gain( double gain, const std::string & name, size_t chan = 0 );