diff --git a/lib/uhd/uhd_sink_c.cc b/lib/uhd/uhd_sink_c.cc index c043e56..39abd0d 100644 --- a/lib/uhd/uhd_sink_c.cc +++ b/lib/uhd/uhd_sink_c.cc @@ -276,12 +276,20 @@ std::string uhd_sink_c::get_antenna( size_t chan ) void uhd_sink_c::set_dc_offset( const std::complex &offset, size_t chan ) { - _snk->set_dc_offset( offset, chan ); + try { + _snk->set_dc_offset( offset, chan ); + } catch ( const std::exception &ex ) { + std::cerr << __FUNCTION__ << ": " << ex.what() << std::endl; + } } void uhd_sink_c::set_iq_balance( const std::complex &balance, size_t chan ) { - _snk->set_iq_balance( balance, chan ); + try { + _snk->set_iq_balance( balance, chan ); + } catch ( const std::exception &ex ) { + std::cerr << __FUNCTION__ << ": " << ex.what() << std::endl; + } } double uhd_sink_c::set_bandwidth( double bandwidth, size_t chan ) diff --git a/lib/uhd/uhd_source_c.cc b/lib/uhd/uhd_source_c.cc index 54e0d4b..c41f0d3 100644 --- a/lib/uhd/uhd_source_c.cc +++ b/lib/uhd/uhd_source_c.cc @@ -277,35 +277,51 @@ std::string uhd_source_c::get_antenna( size_t chan ) void uhd_source_c::set_dc_offset_mode( int mode, size_t chan ) { - if ( osmosdr::source::DCOffsetOff == mode ) { - _src->set_auto_dc_offset( false, chan ); - _src->set_dc_offset( std::complex(0.0, 0.0), chan ); /* uhd default */ - } else if ( osmosdr::source::DCOffsetManual == mode ) { - _src->set_auto_dc_offset( false, chan ); - } else if ( osmosdr::source::DCOffsetAutomatic == mode ) { - _src->set_auto_dc_offset( true, chan ); + try { + if ( osmosdr::source::DCOffsetOff == mode ) { + _src->set_auto_dc_offset( false, chan ); + _src->set_dc_offset( std::complex(0.0, 0.0), chan ); /* uhd default */ + } else if ( osmosdr::source::DCOffsetManual == mode ) { + _src->set_auto_dc_offset( false, chan ); + } else if ( osmosdr::source::DCOffsetAutomatic == mode ) { + _src->set_auto_dc_offset( true, chan ); + } + } catch ( const std::exception &ex ) { + std::cerr << __FUNCTION__ << ": " << ex.what() << std::endl; } } void uhd_source_c::set_dc_offset( const std::complex &offset, size_t chan ) { - _src->set_dc_offset( offset, chan ); + try { + _src->set_dc_offset( offset, chan ); + } catch ( const std::exception &ex ) { + std::cerr << __FUNCTION__ << ": " << ex.what() << std::endl; + } } void uhd_source_c::set_iq_balance_mode( int mode, size_t chan ) { - if ( osmosdr::source::IQBalanceOff == mode ) { - _src->set_iq_balance( std::complex(0.0, 0.0), chan ); /* uhd default */ - } else if ( osmosdr::source::IQBalanceManual == mode ) { - /* nothing to do */ - } else if ( osmosdr::source::IQBalanceAutomatic == mode ) { - throw std::runtime_error("Automatic IQ imbalance correction not implemented"); + try { + if ( osmosdr::source::IQBalanceOff == mode ) { + _src->set_iq_balance( std::complex(0.0, 0.0), chan ); /* uhd default */ + } else if ( osmosdr::source::IQBalanceManual == mode ) { + /* nothing to do */ + } else if ( osmosdr::source::IQBalanceAutomatic == mode ) { + throw std::runtime_error("Automatic IQ imbalance correction not implemented"); + } + } catch ( const std::exception &ex ) { + std::cerr << __FUNCTION__ << ": " << ex.what() << std::endl; } } void uhd_source_c::set_iq_balance( const std::complex &balance, size_t chan ) { - _src->set_iq_balance( balance, chan ); + try { + _src->set_iq_balance( balance, chan ); + } catch ( const std::exception &ex ) { + std::cerr << __FUNCTION__ << ": " << ex.what() << std::endl; + } } double uhd_source_c::set_bandwidth( double bandwidth, size_t chan )