mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-09-04 03:47:59 +00:00
Apply fixes by clang-tidy
This commit is contained in:
@@ -38,6 +38,7 @@
|
|||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <iostream> // for cout, endl
|
#include <iostream> // for cout, endl
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <iio/iio.h>
|
#include <iio/iio.h>
|
||||||
@@ -47,7 +48,7 @@
|
|||||||
|
|
||||||
Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface* configuration,
|
Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface* configuration,
|
||||||
std::string role, unsigned int in_stream, unsigned int out_stream,
|
std::string role, unsigned int in_stream, unsigned int out_stream,
|
||||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue)
|
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
|
||||||
{
|
{
|
||||||
std::string default_item_type = "gr_complex";
|
std::string default_item_type = "gr_complex";
|
||||||
std::string default_dump_file = "./data/signal_source.dat";
|
std::string default_dump_file = "./data/signal_source.dat";
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
using google::LogMessage;
|
using google::LogMessage;
|
||||||
@@ -43,7 +44,7 @@ using google::LogMessage;
|
|||||||
|
|
||||||
CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configuration,
|
CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configuration,
|
||||||
std::string role, unsigned int in_stream, unsigned int out_stream,
|
std::string role, unsigned int in_stream, unsigned int out_stream,
|
||||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue)
|
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
|
||||||
{
|
{
|
||||||
// DUMP PARAMETERS
|
// DUMP PARAMETERS
|
||||||
std::string empty = "";
|
std::string empty = "";
|
||||||
@@ -113,8 +114,7 @@ CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configurati
|
|||||||
|
|
||||||
|
|
||||||
CustomUDPSignalSource::~CustomUDPSignalSource()
|
CustomUDPSignalSource::~CustomUDPSignalSource()
|
||||||
{
|
= default;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CustomUDPSignalSource::connect(gr::top_block_sptr top_block)
|
void CustomUDPSignalSource::connect(gr::top_block_sptr top_block)
|
||||||
|
@@ -38,13 +38,14 @@
|
|||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
using google::LogMessage;
|
using google::LogMessage;
|
||||||
|
|
||||||
Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration,
|
Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration,
|
||||||
std::string role, unsigned int in_stream, unsigned int out_stream,
|
std::string role, unsigned int in_stream, unsigned int out_stream,
|
||||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue)
|
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
|
||||||
{
|
{
|
||||||
std::string default_item_type = "gr_complex";
|
std::string default_item_type = "gr_complex";
|
||||||
std::string default_dump_file = "./data/signal_source.dat";
|
std::string default_dump_file = "./data/signal_source.dat";
|
||||||
@@ -85,7 +86,7 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration
|
|||||||
std::cout << "LO frequency : " << freq_ << " Hz" << std::endl;
|
std::cout << "LO frequency : " << freq_ << " Hz" << std::endl;
|
||||||
std::cout << "sample rate: " << sample_rate_ << " Hz" << std::endl;
|
std::cout << "sample rate: " << sample_rate_ << " Hz" << std::endl;
|
||||||
|
|
||||||
if (item_type_.compare("gr_complex") == 0)
|
if (item_type_ == "gr_complex")
|
||||||
{
|
{
|
||||||
if (RF_channels_ == 1)
|
if (RF_channels_ == 1)
|
||||||
{
|
{
|
||||||
|
@@ -37,6 +37,7 @@
|
|||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include <gnuradio/blocks/file_sink.h>
|
#include <gnuradio/blocks/file_sink.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
using google::LogMessage;
|
using google::LogMessage;
|
||||||
@@ -44,7 +45,7 @@ using google::LogMessage;
|
|||||||
|
|
||||||
OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration,
|
OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration,
|
||||||
std::string role, unsigned int in_stream, unsigned int out_stream,
|
std::string role, unsigned int in_stream, unsigned int out_stream,
|
||||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue)
|
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
|
||||||
{
|
{
|
||||||
// DUMP PARAMETERS
|
// DUMP PARAMETERS
|
||||||
std::string empty = "";
|
std::string empty = "";
|
||||||
@@ -66,11 +67,11 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration,
|
|||||||
osmosdr_args_ = configuration->property(role + ".osmosdr_args", std::string());
|
osmosdr_args_ = configuration->property(role + ".osmosdr_args", std::string());
|
||||||
antenna_ = configuration->property(role + ".antenna", empty);
|
antenna_ = configuration->property(role + ".antenna", empty);
|
||||||
|
|
||||||
if (item_type_.compare("short") == 0)
|
if (item_type_ == "short")
|
||||||
{
|
{
|
||||||
item_size_ = sizeof(short);
|
item_size_ = sizeof(short);
|
||||||
}
|
}
|
||||||
else if (item_type_.compare("gr_complex") == 0)
|
else if (item_type_ == "gr_complex")
|
||||||
{
|
{
|
||||||
item_size_ = sizeof(gr_complex);
|
item_size_ = sizeof(gr_complex);
|
||||||
// 1. Make the driver instance
|
// 1. Make the driver instance
|
||||||
@@ -158,8 +159,7 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration,
|
|||||||
|
|
||||||
|
|
||||||
OsmosdrSignalSource::~OsmosdrSignalSource()
|
OsmosdrSignalSource::~OsmosdrSignalSource()
|
||||||
{
|
= default;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void OsmosdrSignalSource::driver_instance()
|
void OsmosdrSignalSource::driver_instance()
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#include "gnss_sdr_valve.h"
|
#include "gnss_sdr_valve.h"
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
using google::LogMessage;
|
using google::LogMessage;
|
||||||
@@ -41,7 +42,7 @@ using google::LogMessage;
|
|||||||
|
|
||||||
PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration,
|
PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration,
|
||||||
std::string role, unsigned int in_stream, unsigned int out_stream,
|
std::string role, unsigned int in_stream, unsigned int out_stream,
|
||||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue)
|
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
|
||||||
{
|
{
|
||||||
std::string default_item_type = "gr_complex";
|
std::string default_item_type = "gr_complex";
|
||||||
std::string default_dump_file = "./data/signal_source.dat";
|
std::string default_dump_file = "./data/signal_source.dat";
|
||||||
@@ -63,7 +64,7 @@ PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration
|
|||||||
dump_ = configuration->property(role + ".dump", false);
|
dump_ = configuration->property(role + ".dump", false);
|
||||||
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
|
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
|
||||||
|
|
||||||
if (item_type_.compare("gr_complex") != 0)
|
if (item_type_ != "gr_complex")
|
||||||
{
|
{
|
||||||
std::cout << "Configuration error: item_type must be gr_complex" << std::endl;
|
std::cout << "Configuration error: item_type must be gr_complex" << std::endl;
|
||||||
LOG(FATAL) << "Configuration error: item_type must be gr_complex!";
|
LOG(FATAL) << "Configuration error: item_type must be gr_complex!";
|
||||||
@@ -106,8 +107,7 @@ PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration
|
|||||||
|
|
||||||
|
|
||||||
PlutosdrSignalSource::~PlutosdrSignalSource()
|
PlutosdrSignalSource::~PlutosdrSignalSource()
|
||||||
{
|
= default;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PlutosdrSignalSource::connect(gr::top_block_sptr top_block)
|
void PlutosdrSignalSource::connect(gr::top_block_sptr top_block)
|
||||||
|
@@ -113,12 +113,12 @@ gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device,
|
|||||||
std::cout << "Start Ethernet packet capture\n";
|
std::cout << "Start Ethernet packet capture\n";
|
||||||
|
|
||||||
d_n_baseband_channels = n_baseband_channels;
|
d_n_baseband_channels = n_baseband_channels;
|
||||||
if (wire_sample_type.compare("cbyte") == 0)
|
if (wire_sample_type == "cbyte")
|
||||||
{
|
{
|
||||||
d_wire_sample_type = 1;
|
d_wire_sample_type = 1;
|
||||||
d_bytes_per_sample = d_n_baseband_channels * 2;
|
d_bytes_per_sample = d_n_baseband_channels * 2;
|
||||||
}
|
}
|
||||||
else if (wire_sample_type.compare("c4bits") == 0)
|
else if (wire_sample_type == "c4bits")
|
||||||
{
|
{
|
||||||
d_wire_sample_type = 2;
|
d_wire_sample_type = 2;
|
||||||
d_bytes_per_sample = d_n_baseband_channels;
|
d_bytes_per_sample = d_n_baseband_channels;
|
||||||
@@ -142,8 +142,8 @@ gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device,
|
|||||||
d_item_size = item_size;
|
d_item_size = item_size;
|
||||||
d_IQ_swap = IQ_swap_;
|
d_IQ_swap = IQ_swap_;
|
||||||
d_sock_raw = 0;
|
d_sock_raw = 0;
|
||||||
d_pcap_thread = NULL;
|
d_pcap_thread = nullptr;
|
||||||
descr = NULL;
|
descr = nullptr;
|
||||||
|
|
||||||
memset(reinterpret_cast<char *>(&si_me), 0, sizeof(si_me));
|
memset(reinterpret_cast<char *>(&si_me), 0, sizeof(si_me));
|
||||||
}
|
}
|
||||||
@@ -171,7 +171,7 @@ bool gr_complex_ip_packet_source::start()
|
|||||||
bool gr_complex_ip_packet_source::stop()
|
bool gr_complex_ip_packet_source::stop()
|
||||||
{
|
{
|
||||||
std::cout << "gr_complex_ip_packet_source STOP\n";
|
std::cout << "gr_complex_ip_packet_source STOP\n";
|
||||||
if (descr != NULL)
|
if (descr != nullptr)
|
||||||
{
|
{
|
||||||
pcap_breakloop(descr);
|
pcap_breakloop(descr);
|
||||||
d_pcap_thread->join();
|
d_pcap_thread->join();
|
||||||
@@ -187,7 +187,7 @@ bool gr_complex_ip_packet_source::open()
|
|||||||
boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function
|
boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function
|
||||||
// open device for reading
|
// open device for reading
|
||||||
descr = pcap_open_live(d_src_device.c_str(), 1500, 1, 1000, errbuf);
|
descr = pcap_open_live(d_src_device.c_str(), 1500, 1, 1000, errbuf);
|
||||||
if (descr == NULL)
|
if (descr == nullptr)
|
||||||
{
|
{
|
||||||
std::cout << "Error opening Ethernet device " << d_src_device << std::endl;
|
std::cout << "Error opening Ethernet device " << d_src_device << std::endl;
|
||||||
std::cout << "Fatal Error in pcap_open_live(): " << std::string(errbuf) << std::endl;
|
std::cout << "Fatal Error in pcap_open_live(): " << std::string(errbuf) << std::endl;
|
||||||
@@ -220,7 +220,7 @@ bool gr_complex_ip_packet_source::open()
|
|||||||
|
|
||||||
gr_complex_ip_packet_source::~gr_complex_ip_packet_source()
|
gr_complex_ip_packet_source::~gr_complex_ip_packet_source()
|
||||||
{
|
{
|
||||||
if (d_pcap_thread != NULL)
|
if (d_pcap_thread != nullptr)
|
||||||
{
|
{
|
||||||
delete d_pcap_thread;
|
delete d_pcap_thread;
|
||||||
}
|
}
|
||||||
@@ -232,7 +232,7 @@ gr_complex_ip_packet_source::~gr_complex_ip_packet_source()
|
|||||||
void gr_complex_ip_packet_source::static_pcap_callback(u_char *args, const struct pcap_pkthdr *pkthdr,
|
void gr_complex_ip_packet_source::static_pcap_callback(u_char *args, const struct pcap_pkthdr *pkthdr,
|
||||||
const u_char *packet)
|
const u_char *packet)
|
||||||
{
|
{
|
||||||
gr_complex_ip_packet_source *bridge = reinterpret_cast<gr_complex_ip_packet_source *>(args);
|
auto *bridge = reinterpret_cast<gr_complex_ip_packet_source *>(args);
|
||||||
bridge->pcap_callback(args, pkthdr, packet);
|
bridge->pcap_callback(args, pkthdr, packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,22 +327,22 @@ void gr_complex_ip_packet_source::demux_samples(gr_vector_void_star output_items
|
|||||||
switch (d_wire_sample_type)
|
switch (d_wire_sample_type)
|
||||||
{
|
{
|
||||||
case 1: // interleaved byte samples
|
case 1: // interleaved byte samples
|
||||||
for (long unsigned int i = 0; i < output_items.size(); i++)
|
for (auto & output_item : output_items)
|
||||||
{
|
{
|
||||||
real = fifo_buff[fifo_read_ptr++];
|
real = fifo_buff[fifo_read_ptr++];
|
||||||
imag = fifo_buff[fifo_read_ptr++];
|
imag = fifo_buff[fifo_read_ptr++];
|
||||||
if (d_IQ_swap)
|
if (d_IQ_swap)
|
||||||
{
|
{
|
||||||
static_cast<gr_complex *>(output_items[i])[n] = gr_complex(real, imag);
|
static_cast<gr_complex *>(output_item)[n] = gr_complex(real, imag);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static_cast<gr_complex *>(output_items[i])[n] = gr_complex(imag, real);
|
static_cast<gr_complex *>(output_item)[n] = gr_complex(imag, real);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: // 4-bit samples
|
case 2: // 4-bit samples
|
||||||
for (long unsigned int i = 0; i < output_items.size(); i++)
|
for (auto & output_item : output_items)
|
||||||
{
|
{
|
||||||
tmp_char2 = fifo_buff[fifo_read_ptr] & 0x0F;
|
tmp_char2 = fifo_buff[fifo_read_ptr] & 0x0F;
|
||||||
if (tmp_char2 >= 8)
|
if (tmp_char2 >= 8)
|
||||||
@@ -365,11 +365,11 @@ void gr_complex_ip_packet_source::demux_samples(gr_vector_void_star output_items
|
|||||||
}
|
}
|
||||||
if (d_IQ_swap)
|
if (d_IQ_swap)
|
||||||
{
|
{
|
||||||
static_cast<gr_complex *>(output_items[i])[n] = gr_complex(imag, real);
|
static_cast<gr_complex *>(output_item)[n] = gr_complex(imag, real);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
static_cast<gr_complex *>(output_items[i])[n] = gr_complex(real, imag);
|
static_cast<gr_complex *>(output_item)[n] = gr_complex(real, imag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@@ -75,10 +75,10 @@ bool get_ad9361_stream_dev(struct iio_context *ctx, enum iodev d, struct iio_dev
|
|||||||
{
|
{
|
||||||
case TX:
|
case TX:
|
||||||
*dev = iio_context_find_device(ctx, "cf-ad9361-dds-core-lpc");
|
*dev = iio_context_find_device(ctx, "cf-ad9361-dds-core-lpc");
|
||||||
return *dev != NULL;
|
return *dev != nullptr;
|
||||||
case RX:
|
case RX:
|
||||||
*dev = iio_context_find_device(ctx, "cf-ad9361-lpc");
|
*dev = iio_context_find_device(ctx, "cf-ad9361-lpc");
|
||||||
return *dev != NULL;
|
return *dev != nullptr;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@ bool get_ad9361_stream_ch(struct iio_context *ctx __attribute__((unused)), enum
|
|||||||
name << chid;
|
name << chid;
|
||||||
*chn = iio_device_find_channel(dev, name.str().c_str(), d == TX);
|
*chn = iio_device_find_channel(dev, name.str().c_str(), d == TX);
|
||||||
}
|
}
|
||||||
return *chn != NULL;
|
return *chn != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -115,14 +115,14 @@ bool get_phy_chan(struct iio_context *ctx, enum iodev d, int chid, struct iio_ch
|
|||||||
name << "voltage";
|
name << "voltage";
|
||||||
name << chid;
|
name << chid;
|
||||||
*chn = iio_device_find_channel(get_ad9361_phy(ctx), name.str().c_str(), false);
|
*chn = iio_device_find_channel(get_ad9361_phy(ctx), name.str().c_str(), false);
|
||||||
return *chn != NULL;
|
return *chn != nullptr;
|
||||||
break;
|
break;
|
||||||
case TX:
|
case TX:
|
||||||
name.str("");
|
name.str("");
|
||||||
name << "voltage";
|
name << "voltage";
|
||||||
name << chid;
|
name << chid;
|
||||||
*chn = iio_device_find_channel(get_ad9361_phy(ctx), name.str().c_str(), true);
|
*chn = iio_device_find_channel(get_ad9361_phy(ctx), name.str().c_str(), true);
|
||||||
return *chn != NULL;
|
return *chn != nullptr;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@@ -138,10 +138,10 @@ bool get_lo_chan(struct iio_context *ctx, enum iodev d, struct iio_channel **chn
|
|||||||
// LO chan is always output, i.e. true
|
// LO chan is always output, i.e. true
|
||||||
case RX:
|
case RX:
|
||||||
*chn = iio_device_find_channel(get_ad9361_phy(ctx), "altvoltage0", true);
|
*chn = iio_device_find_channel(get_ad9361_phy(ctx), "altvoltage0", true);
|
||||||
return *chn != NULL;
|
return *chn != nullptr;
|
||||||
case TX:
|
case TX:
|
||||||
*chn = iio_device_find_channel(get_ad9361_phy(ctx), "altvoltage1", true);
|
*chn = iio_device_find_channel(get_ad9361_phy(ctx), "altvoltage1", true);
|
||||||
return *chn != NULL;
|
return *chn != nullptr;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -151,7 +151,7 @@ bool get_lo_chan(struct iio_context *ctx, enum iodev d, struct iio_channel **chn
|
|||||||
/* applies streaming configuration through IIO */
|
/* applies streaming configuration through IIO */
|
||||||
bool cfg_ad9361_streaming_ch(struct iio_context *ctx, struct stream_cfg *cfg, enum iodev type, int chid)
|
bool cfg_ad9361_streaming_ch(struct iio_context *ctx, struct stream_cfg *cfg, enum iodev type, int chid)
|
||||||
{
|
{
|
||||||
struct iio_channel *chn = NULL;
|
struct iio_channel *chn = nullptr;
|
||||||
|
|
||||||
// Configure phy and lo channels
|
// Configure phy and lo channels
|
||||||
//LOG(INFO)<<"* Acquiring AD9361 phy channel"<<chid;
|
//LOG(INFO)<<"* Acquiring AD9361 phy channel"<<chid;
|
||||||
|
Reference in New Issue
Block a user