mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-30 14:53:03 +00:00
Do not use LOG(FATAL) since the glog library could have been stripped
off
This commit is contained in:
@@ -75,19 +75,7 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration,
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
// 1. Make the driver instance
|
||||
try
|
||||
{
|
||||
if (!osmosdr_args_.empty())
|
||||
{
|
||||
std::cout << "OsmoSdr arguments: " << osmosdr_args_ << std::endl;
|
||||
LOG(INFO) << "OsmoSdr arguments: " << osmosdr_args_;
|
||||
}
|
||||
osmosdr_source_ = osmosdr::source::make(osmosdr_args_);
|
||||
}
|
||||
catch( const boost::exception & e )
|
||||
{
|
||||
DLOG(FATAL) << "Boost exception: " << boost::diagnostic_information(e);
|
||||
}
|
||||
OsmosdrSignalSource::driver_instance();
|
||||
|
||||
// 2 set sampling rate
|
||||
osmosdr_source_->set_sample_rate(sample_rate_);
|
||||
@@ -147,6 +135,24 @@ OsmosdrSignalSource::~OsmosdrSignalSource()
|
||||
{}
|
||||
|
||||
|
||||
void OsmosdrSignalSource::driver_instance()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!osmosdr_args_.empty())
|
||||
{
|
||||
std::cout << "OsmoSdr arguments: " << osmosdr_args_ << std::endl;
|
||||
LOG(INFO) << "OsmoSdr arguments: " << osmosdr_args_;
|
||||
}
|
||||
osmosdr_source_ = osmosdr::source::make(osmosdr_args_);
|
||||
}
|
||||
catch( const boost::exception & e )
|
||||
{
|
||||
LOG(WARNING) << "Boost exception: " << boost::diagnostic_information(e);
|
||||
throw std::invalid_argument( "Wrong OsmoSdr arguments" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void OsmosdrSignalSource::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#ifndef GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H_
|
||||
#define GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H_
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
@@ -80,6 +81,7 @@ public:
|
||||
gr::basic_block_sptr get_right_block() override;
|
||||
|
||||
private:
|
||||
void driver_instance();
|
||||
std::string role_;
|
||||
|
||||
// Front-end settings
|
||||
|
||||
@@ -78,16 +78,7 @@ RtlTcpSignalSource::RtlTcpSignalSource(ConfigurationInterface* configuration,
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
// 1. Make the gr block
|
||||
try
|
||||
{
|
||||
std::cout << "Connecting to " << address_ << ":" << port_ << std::endl;
|
||||
LOG (INFO) << "Connecting to " << address_ << ":" << port_;
|
||||
signal_source_ = rtl_tcp_make_signal_source_c (address_, port_, flip_iq_);
|
||||
}
|
||||
catch( const boost::exception & e )
|
||||
{
|
||||
DLOG(FATAL) << "Boost exception: " << boost::diagnostic_information(e);
|
||||
}
|
||||
MakeBlock();
|
||||
|
||||
// 2 set sampling rate
|
||||
signal_source_->set_sample_rate(sample_rate_);
|
||||
@@ -145,6 +136,22 @@ RtlTcpSignalSource::~RtlTcpSignalSource()
|
||||
{}
|
||||
|
||||
|
||||
void RtlTcpSignalSource::MakeBlock()
|
||||
{
|
||||
try
|
||||
{
|
||||
std::cout << "Connecting to " << address_ << ":" << port_ << std::endl;
|
||||
LOG (INFO) << "Connecting to " << address_ << ":" << port_;
|
||||
signal_source_ = rtl_tcp_make_signal_source_c (address_, port_, flip_iq_);
|
||||
}
|
||||
catch( const boost::exception & e )
|
||||
{
|
||||
LOG(WARNING) << "Boost exception: " << boost::diagnostic_information(e);
|
||||
throw std::runtime_error( "Failure connecting to the device" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RtlTcpSignalSource::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if ( samples_ )
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#ifndef GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_H
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
@@ -81,6 +82,7 @@ public:
|
||||
gr::basic_block_sptr get_right_block() override;
|
||||
|
||||
private:
|
||||
void MakeBlock();
|
||||
std::string role_;
|
||||
|
||||
// rtl_tcp settings
|
||||
|
||||
Reference in New Issue
Block a user