mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-11-09 03:33:05 +00:00
Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into fpga
This commit is contained in:
@@ -31,13 +31,14 @@
|
||||
*/
|
||||
|
||||
#include "ad9361_fpga_signal_source.h"
|
||||
#include "configuration_interface.h"
|
||||
#include "ad9361_manager.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "GPS_L2C.h"
|
||||
#include "ad9361_manager.h"
|
||||
#include "configuration_interface.h"
|
||||
#include <glog/logging.h>
|
||||
#include <exception>
|
||||
#include <iostream> // for cout, endl
|
||||
#include <utility>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <iio/iio.h>
|
||||
@@ -46,8 +47,8 @@
|
||||
#endif
|
||||
|
||||
Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface* configuration,
|
||||
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)
|
||||
const 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_(std::move(queue))
|
||||
{
|
||||
std::string default_item_type = "gr_complex";
|
||||
std::string default_dump_file = "./data/signal_source.dat";
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
#ifndef GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H_
|
||||
#define GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H_
|
||||
|
||||
#include "gnss_block_interface.h"
|
||||
#include "fpga_switch.h"
|
||||
#include "gnss_block_interface.h"
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <cstdint>
|
||||
@@ -45,7 +45,7 @@ class Ad9361FpgaSignalSource : public GNSSBlockInterface
|
||||
{
|
||||
public:
|
||||
Ad9361FpgaSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_stream,
|
||||
const std::string& role, unsigned int in_stream,
|
||||
unsigned int out_stream, boost::shared_ptr<gr::msg_queue> queue);
|
||||
|
||||
~Ad9361FpgaSignalSource();
|
||||
|
||||
@@ -31,19 +31,20 @@
|
||||
|
||||
|
||||
#include "custom_udp_signal_source.h"
|
||||
#include "configuration_interface.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "configuration_interface.h"
|
||||
#include <boost/format.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
|
||||
CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configuration,
|
||||
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)
|
||||
const 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_(std::move(queue))
|
||||
{
|
||||
// DUMP PARAMETERS
|
||||
std::string empty = "";
|
||||
@@ -112,9 +113,7 @@ CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configurati
|
||||
}
|
||||
|
||||
|
||||
CustomUDPSignalSource::~CustomUDPSignalSource()
|
||||
{
|
||||
}
|
||||
CustomUDPSignalSource::~CustomUDPSignalSource() = default;
|
||||
|
||||
|
||||
void CustomUDPSignalSource::connect(gr::top_block_sptr top_block)
|
||||
|
||||
@@ -36,9 +36,9 @@
|
||||
#include "gnss_block_interface.h"
|
||||
#include "gr_complex_ip_packet_source.h"
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/blocks/null_sink.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -54,7 +54,7 @@ class CustomUDPSignalSource : public GNSSBlockInterface
|
||||
{
|
||||
public:
|
||||
CustomUDPSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_stream,
|
||||
const std::string& role, unsigned int in_stream,
|
||||
unsigned int out_stream, boost::shared_ptr<gr::msg_queue> queue);
|
||||
|
||||
virtual ~CustomUDPSignalSource();
|
||||
|
||||
@@ -35,18 +35,19 @@
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include "gnss_sdr_valve.h"
|
||||
#include <glog/logging.h>
|
||||
#include <iostream> // for std::cerr
|
||||
#include <exception>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <exception>
|
||||
#include <iostream> // for std::cerr
|
||||
#include <utility>
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
|
||||
FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_streams, unsigned int out_streams,
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue)
|
||||
const std::string& role, unsigned int in_streams, unsigned int out_streams,
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(std::move(queue))
|
||||
{
|
||||
std::string default_filename = "./example_capture.dat";
|
||||
std::string default_item_type = "short";
|
||||
@@ -59,8 +60,8 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
|
||||
filename_ = configuration->property(role + ".filename", default_filename);
|
||||
|
||||
// override value with commandline flag, if present
|
||||
if (FLAGS_signal_source.compare("-") != 0) filename_ = FLAGS_signal_source;
|
||||
if (FLAGS_s.compare("-") != 0) filename_ = FLAGS_s;
|
||||
if (FLAGS_signal_source != "-") filename_ = FLAGS_signal_source;
|
||||
if (FLAGS_s != "-") filename_ = FLAGS_s;
|
||||
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
repeat_ = configuration->property(role + ".repeat", false);
|
||||
@@ -74,28 +75,28 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
|
||||
|
||||
bool is_complex = false;
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
if (item_type_ == "gr_complex")
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
}
|
||||
else if (item_type_.compare("float") == 0)
|
||||
else if (item_type_ == "float")
|
||||
{
|
||||
item_size_ = sizeof(float);
|
||||
}
|
||||
else if (item_type_.compare("short") == 0)
|
||||
else if (item_type_ == "short")
|
||||
{
|
||||
item_size_ = sizeof(int16_t);
|
||||
}
|
||||
else if (item_type_.compare("ishort") == 0)
|
||||
else if (item_type_ == "ishort")
|
||||
{
|
||||
item_size_ = sizeof(int16_t);
|
||||
is_complex = true;
|
||||
}
|
||||
else if (item_type_.compare("byte") == 0)
|
||||
else if (item_type_ == "byte")
|
||||
{
|
||||
item_size_ = sizeof(int8_t);
|
||||
}
|
||||
else if (item_type_.compare("ibyte") == 0)
|
||||
else if (item_type_ == "ibyte")
|
||||
{
|
||||
item_size_ = sizeof(int8_t);
|
||||
is_complex = true;
|
||||
@@ -135,7 +136,7 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
if (filename_.compare(default_filename) == 0)
|
||||
if (filename_ == default_filename)
|
||||
{
|
||||
std::cerr
|
||||
<< "The configuration file has not been found."
|
||||
@@ -251,9 +252,7 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
|
||||
}
|
||||
|
||||
|
||||
FileSignalSource::~FileSignalSource()
|
||||
{
|
||||
}
|
||||
FileSignalSource::~FileSignalSource() = default;
|
||||
|
||||
|
||||
void FileSignalSource::connect(gr::top_block_sptr top_block)
|
||||
@@ -371,15 +370,9 @@ gr::basic_block_sptr FileSignalSource::get_right_block()
|
||||
{
|
||||
return valve_;
|
||||
}
|
||||
else
|
||||
if (enable_throttle_control_ == true)
|
||||
{
|
||||
if (enable_throttle_control_ == true)
|
||||
{
|
||||
return throttle_;
|
||||
}
|
||||
else
|
||||
{
|
||||
return file_source_;
|
||||
}
|
||||
return throttle_;
|
||||
}
|
||||
return file_source_;
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
#define GNSS_SDR_FILE_SIGNAL_SOURCE_H_
|
||||
|
||||
#include "gnss_block_interface.h"
|
||||
#include <gnuradio/blocks/file_source.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/blocks/file_source.h>
|
||||
#include <gnuradio/blocks/throttle.h>
|
||||
#include <gnuradio/hier_block2.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
@@ -53,7 +53,7 @@ class ConfigurationInterface;
|
||||
class FileSignalSource : public GNSSBlockInterface
|
||||
{
|
||||
public:
|
||||
FileSignalSource(ConfigurationInterface* configuration, std::string role,
|
||||
FileSignalSource(ConfigurationInterface* configuration, const std::string& role,
|
||||
unsigned int in_streams, unsigned int out_streams,
|
||||
boost::shared_ptr<gr::msg_queue> queue);
|
||||
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
|
||||
#include "flexiband_signal_source.h"
|
||||
#include "configuration_interface.h"
|
||||
#include <glog/logging.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <glog/logging.h>
|
||||
#include <teleorbit/frontend.h>
|
||||
|
||||
|
||||
|
||||
@@ -34,11 +34,11 @@
|
||||
#define FLEXIBAND_SIGNAL_SOURCE_H_
|
||||
|
||||
#include "gnss_block_interface.h"
|
||||
#include <gnuradio/blocks/char_to_float.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/blocks/float_to_complex.h>
|
||||
#include <gnuradio/hier_block2.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/blocks/char_to_float.h>
|
||||
#include <gnuradio/blocks/float_to_complex.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -30,21 +30,22 @@
|
||||
*/
|
||||
|
||||
#include "fmcomms2_signal_source.h"
|
||||
#include "configuration_interface.h"
|
||||
#include "gnss_sdr_valve.h"
|
||||
#include "ad9361_manager.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "GPS_L2C.h"
|
||||
#include "ad9361_manager.h"
|
||||
#include "configuration_interface.h"
|
||||
#include "gnss_sdr_valve.h"
|
||||
#include <glog/logging.h>
|
||||
#include <exception>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration,
|
||||
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)
|
||||
const 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_(std::move(queue))
|
||||
{
|
||||
std::string default_item_type = "gr_complex";
|
||||
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 << "sample rate: " << sample_rate_ << " Hz" << std::endl;
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
if (item_type_ == "gr_complex")
|
||||
{
|
||||
if (RF_channels_ == 1)
|
||||
{
|
||||
|
||||
@@ -35,9 +35,9 @@
|
||||
|
||||
#include "gnss_block_interface.h"
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/iio/fmcomms2_source.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <string>
|
||||
|
||||
class ConfigurationInterface;
|
||||
@@ -46,7 +46,7 @@ class Fmcomms2SignalSource : public GNSSBlockInterface
|
||||
{
|
||||
public:
|
||||
Fmcomms2SignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_stream,
|
||||
const std::string& role, unsigned int in_stream,
|
||||
unsigned int out_stream, boost::shared_ptr<gr::msg_queue> queue);
|
||||
|
||||
virtual ~Fmcomms2SignalSource();
|
||||
|
||||
@@ -33,10 +33,11 @@
|
||||
#include "gen_signal_source.h"
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include <gnuradio/message.h>
|
||||
#include <glog/logging.h>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
@@ -44,8 +45,8 @@ using google::LogMessage;
|
||||
GenSignalSource::GenSignalSource(GNSSBlockInterface *signal_generator, GNSSBlockInterface *filter,
|
||||
std::string role, boost::shared_ptr<gr::msg_queue> queue) : signal_generator_(signal_generator),
|
||||
filter_(filter),
|
||||
role_(role),
|
||||
queue_(queue)
|
||||
role_(std::move(role)),
|
||||
queue_(std::move(queue))
|
||||
{
|
||||
connected_ = false;
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
|
||||
#include "gn3s_signal_source.h"
|
||||
#include "configuration_interface.h"
|
||||
#include <glog/logging.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <glog/logging.h>
|
||||
#include <gn3s/gn3s_source_cc.h>
|
||||
|
||||
|
||||
|
||||
@@ -33,9 +33,9 @@
|
||||
#define GNSS_SDR_GN3S_SIGNAL_SOURCE_H_
|
||||
|
||||
#include "gnss_block_interface.h"
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/hier_block2.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <string>
|
||||
|
||||
|
||||
|
||||
@@ -32,12 +32,14 @@
|
||||
#include "configuration_interface.h"
|
||||
#include "labsat23_source.h"
|
||||
#include <glog/logging.h>
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
LabsatSignalSource::LabsatSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_stream, unsigned int out_stream, gr::msg_queue::sptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue)
|
||||
const std::string& role, unsigned int in_stream, unsigned int out_stream, gr::msg_queue::sptr 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_dump_file = "./data/source.bin";
|
||||
@@ -51,7 +53,7 @@ LabsatSignalSource::LabsatSignalSource(ConfigurationInterface* configuration,
|
||||
samples_ = configuration->property(role + ".samples", 0);
|
||||
filename_ = configuration->property(role + ".filename", default_filename);
|
||||
|
||||
if (item_type_.compare("gr_complex") == 0)
|
||||
if (item_type_ == "gr_complex")
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
labsat23_source_ = labsat23_make_source(filename_.c_str(), channel_selector);
|
||||
@@ -61,7 +63,7 @@ LabsatSignalSource::LabsatSignalSource(ConfigurationInterface* configuration,
|
||||
else
|
||||
{
|
||||
LOG(WARNING) << item_type_ << " unrecognized item type for LabSat source";
|
||||
item_size_ = sizeof(short);
|
||||
item_size_ = sizeof(int16_t);
|
||||
}
|
||||
if (dump_)
|
||||
{
|
||||
@@ -83,9 +85,7 @@ LabsatSignalSource::LabsatSignalSource(ConfigurationInterface* configuration,
|
||||
}
|
||||
|
||||
|
||||
LabsatSignalSource::~LabsatSignalSource()
|
||||
{
|
||||
}
|
||||
LabsatSignalSource::~LabsatSignalSource() = default;
|
||||
|
||||
|
||||
void LabsatSignalSource::connect(gr::top_block_sptr top_block)
|
||||
|
||||
@@ -33,9 +33,9 @@
|
||||
#define GNSS_SDR_LABSAT_SIGNAL_SOURCE_H_
|
||||
|
||||
#include "gnss_block_interface.h"
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/hier_block2.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <string>
|
||||
|
||||
class ConfigurationInterface;
|
||||
@@ -47,7 +47,7 @@ class LabsatSignalSource : public GNSSBlockInterface
|
||||
{
|
||||
public:
|
||||
LabsatSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_stream,
|
||||
const std::string& role, unsigned int in_stream,
|
||||
unsigned int out_stream, gr::msg_queue::sptr queue);
|
||||
|
||||
virtual ~LabsatSignalSource();
|
||||
|
||||
@@ -39,14 +39,15 @@
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
|
||||
NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_streams, unsigned int out_streams,
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue)
|
||||
const std::string& role, unsigned int in_streams, unsigned int out_streams,
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(std::move(queue))
|
||||
{
|
||||
std::string default_filename = "../data/my_capture.dat";
|
||||
std::string default_item_type = "byte";
|
||||
@@ -57,8 +58,8 @@ NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration,
|
||||
filename_ = configuration->property(role + ".filename", default_filename);
|
||||
|
||||
// override value with commandline flag, if present
|
||||
if (FLAGS_signal_source.compare("-") != 0) filename_ = FLAGS_signal_source;
|
||||
if (FLAGS_s.compare("-") != 0) filename_ = FLAGS_s;
|
||||
if (FLAGS_signal_source != "-") filename_ = FLAGS_signal_source;
|
||||
if (FLAGS_s != "-") filename_ = FLAGS_s;
|
||||
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
repeat_ = configuration->property(role + ".repeat", false);
|
||||
@@ -66,7 +67,7 @@ NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration,
|
||||
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
|
||||
enable_throttle_control_ = configuration->property(role + ".enable_throttle_control", false);
|
||||
|
||||
if (item_type_.compare("byte") == 0)
|
||||
if (item_type_ == "byte")
|
||||
{
|
||||
item_size_ = sizeof(char);
|
||||
}
|
||||
@@ -177,9 +178,7 @@ NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration,
|
||||
}
|
||||
|
||||
|
||||
NsrFileSignalSource::~NsrFileSignalSource()
|
||||
{
|
||||
}
|
||||
NsrFileSignalSource::~NsrFileSignalSource() = default;
|
||||
|
||||
|
||||
void NsrFileSignalSource::connect(gr::top_block_sptr top_block)
|
||||
@@ -310,15 +309,9 @@ gr::basic_block_sptr NsrFileSignalSource::get_right_block()
|
||||
{
|
||||
return valve_;
|
||||
}
|
||||
else
|
||||
if (enable_throttle_control_ == true)
|
||||
{
|
||||
if (enable_throttle_control_ == true)
|
||||
{
|
||||
return throttle_;
|
||||
}
|
||||
else
|
||||
{
|
||||
return unpack_byte_;
|
||||
}
|
||||
return throttle_;
|
||||
}
|
||||
return unpack_byte_;
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
|
||||
#include "gnss_block_interface.h"
|
||||
#include "unpack_byte_2bit_samples.h"
|
||||
#include <gnuradio/blocks/file_source.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/blocks/file_source.h>
|
||||
#include <gnuradio/blocks/throttle.h>
|
||||
#include <gnuradio/hier_block2.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
@@ -53,7 +53,7 @@ class ConfigurationInterface;
|
||||
class NsrFileSignalSource : public GNSSBlockInterface
|
||||
{
|
||||
public:
|
||||
NsrFileSignalSource(ConfigurationInterface* configuration, std::string role,
|
||||
NsrFileSignalSource(ConfigurationInterface* configuration, const std::string& role,
|
||||
unsigned int in_streams, unsigned int out_streams,
|
||||
boost::shared_ptr<gr::msg_queue> queue);
|
||||
|
||||
|
||||
@@ -30,21 +30,22 @@
|
||||
*/
|
||||
|
||||
#include "osmosdr_signal_source.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "configuration_interface.h"
|
||||
#include "gnss_sdr_valve.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
#include <boost/format.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
|
||||
OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration,
|
||||
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)
|
||||
const 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_(std::move(queue))
|
||||
{
|
||||
// DUMP PARAMETERS
|
||||
std::string empty = "";
|
||||
@@ -66,11 +67,11 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration,
|
||||
osmosdr_args_ = configuration->property(role + ".osmosdr_args", std::string());
|
||||
antenna_ = configuration->property(role + ".antenna", empty);
|
||||
|
||||
if (item_type_.compare("short") == 0)
|
||||
if (item_type_ == "short")
|
||||
{
|
||||
item_size_ = sizeof(short);
|
||||
item_size_ = sizeof(int16_t);
|
||||
}
|
||||
else if (item_type_.compare("gr_complex") == 0)
|
||||
else if (item_type_ == "gr_complex")
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
// 1. Make the driver instance
|
||||
@@ -130,7 +131,7 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration,
|
||||
else
|
||||
{
|
||||
LOG(WARNING) << item_type_ << " unrecognized item type. Using short.";
|
||||
item_size_ = sizeof(short);
|
||||
item_size_ = sizeof(int16_t);
|
||||
}
|
||||
|
||||
if (samples_ != 0)
|
||||
@@ -157,9 +158,7 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration,
|
||||
}
|
||||
|
||||
|
||||
OsmosdrSignalSource::~OsmosdrSignalSource()
|
||||
{
|
||||
}
|
||||
OsmosdrSignalSource::~OsmosdrSignalSource() = default;
|
||||
|
||||
|
||||
void OsmosdrSignalSource::driver_instance()
|
||||
|
||||
@@ -35,8 +35,9 @@
|
||||
|
||||
#include "gnss_block_interface.h"
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <cstdint>
|
||||
#include <osmosdr/source.h>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
@@ -52,7 +53,7 @@ class OsmosdrSignalSource : public GNSSBlockInterface
|
||||
{
|
||||
public:
|
||||
OsmosdrSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_stream,
|
||||
const std::string& role, unsigned int in_stream,
|
||||
unsigned int out_stream, boost::shared_ptr<gr::msg_queue> queue);
|
||||
|
||||
virtual ~OsmosdrSignalSource();
|
||||
@@ -98,7 +99,7 @@ private:
|
||||
|
||||
std::string item_type_;
|
||||
size_t item_size_;
|
||||
long samples_;
|
||||
int64_t samples_;
|
||||
bool dump_;
|
||||
std::string dump_filename_;
|
||||
|
||||
|
||||
@@ -29,19 +29,20 @@
|
||||
*/
|
||||
|
||||
#include "plutosdr_signal_source.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "configuration_interface.h"
|
||||
#include "gnss_sdr_valve.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
#include <glog/logging.h>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
|
||||
PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration,
|
||||
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)
|
||||
const 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_(std::move(queue))
|
||||
{
|
||||
std::string default_item_type = "gr_complex";
|
||||
std::string default_dump_file = "./data/signal_source.dat";
|
||||
@@ -63,7 +64,7 @@ PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration
|
||||
dump_ = configuration->property(role + ".dump", false);
|
||||
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;
|
||||
LOG(FATAL) << "Configuration error: item_type must be gr_complex!";
|
||||
@@ -105,9 +106,7 @@ PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration
|
||||
}
|
||||
|
||||
|
||||
PlutosdrSignalSource::~PlutosdrSignalSource()
|
||||
{
|
||||
}
|
||||
PlutosdrSignalSource::~PlutosdrSignalSource() = default;
|
||||
|
||||
|
||||
void PlutosdrSignalSource::connect(gr::top_block_sptr top_block)
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
|
||||
#include "gnss_block_interface.h"
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/iio/pluto_source.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class PlutosdrSignalSource : public GNSSBlockInterface
|
||||
{
|
||||
public:
|
||||
PlutosdrSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_stream,
|
||||
const std::string& role, unsigned int in_stream,
|
||||
unsigned int out_stream, boost::shared_ptr<gr::msg_queue> queue);
|
||||
|
||||
virtual ~PlutosdrSignalSource();
|
||||
|
||||
@@ -30,10 +30,10 @@
|
||||
|
||||
#include "raw_array_signal_source.h"
|
||||
#include "configuration_interface.h"
|
||||
#include <dbfcttc/raw_array.h>
|
||||
#include <glog/logging.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <glog/logging.h>
|
||||
#include <dbfcttc/raw_array.h>
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
@@ -33,9 +33,9 @@
|
||||
#define RAW_ARRAY_SIGNAL_SOURCE_H_
|
||||
|
||||
#include "gnss_block_interface.h"
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/hier_block2.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <string>
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
@@ -31,20 +31,27 @@
|
||||
*/
|
||||
|
||||
#include "rtl_tcp_signal_source.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "configuration_interface.h"
|
||||
#include "gnss_sdr_valve.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
#include <boost/format.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
|
||||
RtlTcpSignalSource::RtlTcpSignalSource(ConfigurationInterface* configuration,
|
||||
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)
|
||||
const std::string& role,
|
||||
unsigned int in_stream,
|
||||
unsigned int out_stream,
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(std::move(role)),
|
||||
in_stream_(in_stream),
|
||||
out_stream_(out_stream),
|
||||
queue_(queue)
|
||||
{
|
||||
// DUMP PARAMETERS
|
||||
std::string empty = "";
|
||||
@@ -57,7 +64,7 @@ RtlTcpSignalSource::RtlTcpSignalSource(ConfigurationInterface* configuration,
|
||||
|
||||
// rtl_tcp PARAMETERS
|
||||
std::string default_address = "127.0.0.1";
|
||||
short default_port = 1234;
|
||||
int16_t default_port = 1234;
|
||||
AGC_enabled_ = configuration->property(role + ".AGC_enabled", true);
|
||||
freq_ = configuration->property(role + ".freq", GPS_L1_FREQ_HZ);
|
||||
gain_ = configuration->property(role + ".gain", 40.0);
|
||||
@@ -69,11 +76,11 @@ RtlTcpSignalSource::RtlTcpSignalSource(ConfigurationInterface* configuration,
|
||||
port_ = configuration->property(role + ".port", default_port);
|
||||
flip_iq_ = configuration->property(role + ".flip_iq", false);
|
||||
|
||||
if (item_type_.compare("short") == 0)
|
||||
if (item_type_ == "short")
|
||||
{
|
||||
item_size_ = sizeof(short);
|
||||
item_size_ = sizeof(int16_t);
|
||||
}
|
||||
else if (item_type_.compare("gr_complex") == 0)
|
||||
else if (item_type_ == "gr_complex")
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
// 1. Make the gr block
|
||||
@@ -112,7 +119,7 @@ RtlTcpSignalSource::RtlTcpSignalSource(ConfigurationInterface* configuration,
|
||||
else
|
||||
{
|
||||
LOG(WARNING) << item_type_ << " unrecognized item type. Using short.";
|
||||
item_size_ = sizeof(short);
|
||||
item_size_ = sizeof(int16_t);
|
||||
}
|
||||
|
||||
if (samples_ != 0)
|
||||
@@ -139,9 +146,7 @@ RtlTcpSignalSource::RtlTcpSignalSource(ConfigurationInterface* configuration,
|
||||
}
|
||||
|
||||
|
||||
RtlTcpSignalSource::~RtlTcpSignalSource()
|
||||
{
|
||||
}
|
||||
RtlTcpSignalSource::~RtlTcpSignalSource() = default;
|
||||
|
||||
|
||||
void RtlTcpSignalSource::MakeBlock()
|
||||
|
||||
@@ -32,13 +32,13 @@
|
||||
#ifndef GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_H
|
||||
|
||||
#include "rtl_tcp_signal_source_c.h"
|
||||
#include "gnss_block_interface.h"
|
||||
#include "rtl_tcp_signal_source_c.h"
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/blocks/deinterleave.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/blocks/float_to_complex.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
@@ -54,8 +54,10 @@ class RtlTcpSignalSource : public GNSSBlockInterface
|
||||
{
|
||||
public:
|
||||
RtlTcpSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_stream,
|
||||
unsigned int out_stream, boost::shared_ptr<gr::msg_queue> queue);
|
||||
const std::string& role,
|
||||
unsigned int in_stream,
|
||||
unsigned int out_stream,
|
||||
boost::shared_ptr<gr::msg_queue> queue);
|
||||
|
||||
virtual ~RtlTcpSignalSource();
|
||||
|
||||
|
||||
@@ -38,14 +38,15 @@
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
|
||||
SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_streams, unsigned int out_streams,
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue)
|
||||
const std::string& role, unsigned int in_streams, unsigned int out_streams,
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(std::move(queue))
|
||||
{
|
||||
std::string default_filename = "../data/my_capture.dat";
|
||||
std::string default_item_type = "int";
|
||||
@@ -56,8 +57,8 @@ SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration
|
||||
filename_ = configuration->property(role + ".filename", default_filename);
|
||||
|
||||
// override value with commandline flag, if present
|
||||
if (FLAGS_signal_source.compare("-") != 0) filename_ = FLAGS_signal_source;
|
||||
if (FLAGS_s.compare("-") != 0) filename_ = FLAGS_s;
|
||||
if (FLAGS_signal_source != "-") filename_ = FLAGS_signal_source;
|
||||
if (FLAGS_s != "-") filename_ = FLAGS_s;
|
||||
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
repeat_ = configuration->property(role + ".repeat", false);
|
||||
@@ -65,7 +66,7 @@ SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration
|
||||
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
|
||||
enable_throttle_control_ = configuration->property(role + ".enable_throttle_control", false);
|
||||
|
||||
if (item_type_.compare("int") == 0)
|
||||
if (item_type_ == "int")
|
||||
{
|
||||
item_size_ = sizeof(int);
|
||||
}
|
||||
@@ -176,9 +177,7 @@ SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration
|
||||
}
|
||||
|
||||
|
||||
SpirFileSignalSource::~SpirFileSignalSource()
|
||||
{
|
||||
}
|
||||
SpirFileSignalSource::~SpirFileSignalSource() = default;
|
||||
|
||||
|
||||
void SpirFileSignalSource::connect(gr::top_block_sptr top_block)
|
||||
@@ -309,15 +308,9 @@ gr::basic_block_sptr SpirFileSignalSource::get_right_block()
|
||||
{
|
||||
return valve_;
|
||||
}
|
||||
else
|
||||
if (enable_throttle_control_ == true)
|
||||
{
|
||||
if (enable_throttle_control_ == true)
|
||||
{
|
||||
return throttle_;
|
||||
}
|
||||
else
|
||||
{
|
||||
return unpack_intspir_;
|
||||
}
|
||||
return throttle_;
|
||||
}
|
||||
return unpack_intspir_;
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
|
||||
#include "gnss_block_interface.h"
|
||||
#include "unpack_intspir_1bit_samples.h"
|
||||
#include <gnuradio/blocks/file_source.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/blocks/file_source.h>
|
||||
#include <gnuradio/blocks/throttle.h>
|
||||
#include <gnuradio/hier_block2.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
@@ -50,7 +50,7 @@ class ConfigurationInterface;
|
||||
class SpirFileSignalSource : public GNSSBlockInterface
|
||||
{
|
||||
public:
|
||||
SpirFileSignalSource(ConfigurationInterface* configuration, std::string role,
|
||||
SpirFileSignalSource(ConfigurationInterface* configuration, const std::string& role,
|
||||
unsigned int in_streams, unsigned int out_streams,
|
||||
boost::shared_ptr<gr::msg_queue> queue);
|
||||
|
||||
|
||||
@@ -36,13 +36,14 @@
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
|
||||
SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, uint32_t in_streams, uint32_t out_streams, gr::msg_queue::sptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue)
|
||||
const std::string& role, uint32_t in_streams, uint32_t out_streams, gr::msg_queue::sptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(std::move(queue))
|
||||
{
|
||||
std::string default_filename = "../data/my_capture.dat";
|
||||
std::string default_dump_filename = "../data/my_capture_dump.dat";
|
||||
@@ -181,9 +182,7 @@ SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface*
|
||||
}
|
||||
|
||||
|
||||
SpirGSS6450FileSignalSource::~SpirGSS6450FileSignalSource()
|
||||
{
|
||||
}
|
||||
SpirGSS6450FileSignalSource::~SpirGSS6450FileSignalSource() = default;
|
||||
|
||||
|
||||
void SpirGSS6450FileSignalSource::connect(gr::top_block_sptr top_block)
|
||||
|
||||
@@ -35,12 +35,12 @@
|
||||
#include "gnss_block_interface.h"
|
||||
#include "gnss_sdr_valve.h"
|
||||
#include "unpack_spir_gss6450_samples.h"
|
||||
#include <gnuradio/blocks/file_source.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/blocks/throttle.h>
|
||||
#include <gnuradio/blocks/deinterleave.h>
|
||||
#include <gnuradio/blocks/null_sink.h>
|
||||
#include <gnuradio/blocks/endian_swap.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/blocks/file_source.h>
|
||||
#include <gnuradio/blocks/null_sink.h>
|
||||
#include <gnuradio/blocks/throttle.h>
|
||||
#include <gnuradio/hier_block2.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <cstdint>
|
||||
@@ -57,7 +57,7 @@ class ConfigurationInterface;
|
||||
class SpirGSS6450FileSignalSource : public GNSSBlockInterface
|
||||
{
|
||||
public:
|
||||
SpirGSS6450FileSignalSource(ConfigurationInterface* configuration, std::string role,
|
||||
SpirGSS6450FileSignalSource(ConfigurationInterface* configuration, const std::string& role,
|
||||
uint32_t in_streams, uint32_t out_streams, gr::msg_queue::sptr queue);
|
||||
|
||||
virtual ~SpirGSS6450FileSignalSource();
|
||||
|
||||
@@ -38,14 +38,20 @@
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
|
||||
TwoBitCpxFileSignalSource::TwoBitCpxFileSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_streams, unsigned int out_streams,
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue)
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams,
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams),
|
||||
queue_(std::move(queue))
|
||||
{
|
||||
std::string default_filename = "../data/my_capture.dat";
|
||||
std::string default_item_type = "byte";
|
||||
@@ -56,8 +62,8 @@ TwoBitCpxFileSignalSource::TwoBitCpxFileSignalSource(ConfigurationInterface* con
|
||||
filename_ = configuration->property(role + ".filename", default_filename);
|
||||
|
||||
// override value with commandline flag, if present
|
||||
if (FLAGS_signal_source.compare("-") != 0) filename_ = FLAGS_signal_source;
|
||||
if (FLAGS_s.compare("-") != 0) filename_ = FLAGS_s;
|
||||
if (FLAGS_signal_source != "-") filename_ = FLAGS_signal_source;
|
||||
if (FLAGS_s != "-") filename_ = FLAGS_s;
|
||||
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
repeat_ = configuration->property(role + ".repeat", false);
|
||||
@@ -65,7 +71,7 @@ TwoBitCpxFileSignalSource::TwoBitCpxFileSignalSource(ConfigurationInterface* con
|
||||
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
|
||||
enable_throttle_control_ = configuration->property(role + ".enable_throttle_control", false);
|
||||
|
||||
if (item_type_.compare("byte") == 0)
|
||||
if (item_type_ == "byte")
|
||||
{
|
||||
item_size_ = sizeof(char);
|
||||
}
|
||||
@@ -177,9 +183,7 @@ TwoBitCpxFileSignalSource::TwoBitCpxFileSignalSource(ConfigurationInterface* con
|
||||
}
|
||||
|
||||
|
||||
TwoBitCpxFileSignalSource::~TwoBitCpxFileSignalSource()
|
||||
{
|
||||
}
|
||||
TwoBitCpxFileSignalSource::~TwoBitCpxFileSignalSource() = default;
|
||||
|
||||
|
||||
void TwoBitCpxFileSignalSource::connect(gr::top_block_sptr top_block)
|
||||
@@ -314,15 +318,9 @@ gr::basic_block_sptr TwoBitCpxFileSignalSource::get_right_block()
|
||||
{
|
||||
return valve_;
|
||||
}
|
||||
else
|
||||
if (enable_throttle_control_ == true)
|
||||
{
|
||||
if (enable_throttle_control_ == true)
|
||||
{
|
||||
return throttle_;
|
||||
}
|
||||
else
|
||||
{
|
||||
return unpack_byte_;
|
||||
}
|
||||
return throttle_;
|
||||
}
|
||||
return unpack_byte_;
|
||||
}
|
||||
|
||||
@@ -36,12 +36,13 @@
|
||||
|
||||
#include "gnss_block_interface.h"
|
||||
#include "unpack_byte_2bit_cpx_samples.h"
|
||||
#include <gnuradio/blocks/file_source.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/blocks/file_source.h>
|
||||
#include <gnuradio/blocks/interleaved_short_to_complex.h>
|
||||
#include <gnuradio/blocks/throttle.h>
|
||||
#include <gnuradio/hier_block2.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <gnuradio/blocks/interleaved_short_to_complex.h>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -54,8 +55,10 @@ class ConfigurationInterface;
|
||||
class TwoBitCpxFileSignalSource : public GNSSBlockInterface
|
||||
{
|
||||
public:
|
||||
TwoBitCpxFileSignalSource(ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams,
|
||||
TwoBitCpxFileSignalSource(ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams,
|
||||
boost::shared_ptr<gr::msg_queue> queue);
|
||||
|
||||
virtual ~TwoBitCpxFileSignalSource();
|
||||
@@ -97,19 +100,19 @@ public:
|
||||
return repeat_;
|
||||
}
|
||||
|
||||
inline long sampling_frequency() const
|
||||
inline int64_t sampling_frequency() const
|
||||
{
|
||||
return sampling_frequency_;
|
||||
}
|
||||
|
||||
inline long samples() const
|
||||
inline uint64_t samples() const
|
||||
{
|
||||
return samples_;
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned long long samples_;
|
||||
long sampling_frequency_;
|
||||
uint64_t samples_;
|
||||
int64_t sampling_frequency_;
|
||||
std::string filename_;
|
||||
std::string item_type_;
|
||||
bool repeat_;
|
||||
|
||||
@@ -40,14 +40,20 @@
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
|
||||
TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_streams, unsigned int out_streams,
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue)
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams,
|
||||
boost::shared_ptr<gr::msg_queue> queue) : role_(role),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams),
|
||||
queue_(std::move(queue))
|
||||
{
|
||||
std::string default_filename = "../data/my_capture.dat";
|
||||
std::string default_item_type = "byte";
|
||||
@@ -55,13 +61,13 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(ConfigurationInterfac
|
||||
std::string default_sample_type = "real";
|
||||
double default_seconds_to_skip = 0.0;
|
||||
|
||||
samples_ = configuration->property(role + ".samples", 0L);
|
||||
samples_ = configuration->property(role + ".samples", 0);
|
||||
sampling_frequency_ = configuration->property(role + ".sampling_frequency", 0);
|
||||
filename_ = configuration->property(role + ".filename", default_filename);
|
||||
|
||||
// override value with commandline flag, if present
|
||||
if (FLAGS_signal_source.compare("-") != 0) filename_ = FLAGS_signal_source;
|
||||
if (FLAGS_s.compare("-") != 0) filename_ = FLAGS_s;
|
||||
if (FLAGS_signal_source != "-") filename_ = FLAGS_signal_source;
|
||||
if (FLAGS_s != "-") filename_ = FLAGS_s;
|
||||
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
big_endian_items_ = configuration->property(role + ".big_endian_items", true);
|
||||
@@ -72,19 +78,19 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(ConfigurationInterfac
|
||||
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
|
||||
enable_throttle_control_ = configuration->property(role + ".enable_throttle_control", false);
|
||||
double seconds_to_skip = configuration->property(role + ".seconds_to_skip", default_seconds_to_skip);
|
||||
long bytes_to_skip = 0;
|
||||
int64_t bytes_to_skip = 0;
|
||||
|
||||
if (item_type_.compare("byte") == 0)
|
||||
if (item_type_ == "byte")
|
||||
{
|
||||
item_size_ = sizeof(char);
|
||||
}
|
||||
else if (item_type_.compare("short") == 0)
|
||||
else if (item_type_ == "short")
|
||||
{
|
||||
// If we have shorts stored in little endian format, might as
|
||||
// well read them in as bytes.
|
||||
if (big_endian_items_)
|
||||
{
|
||||
item_size_ = sizeof(short);
|
||||
item_size_ = sizeof(int16_t);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -97,16 +103,16 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(ConfigurationInterfac
|
||||
item_size_ = sizeof(char);
|
||||
}
|
||||
|
||||
if (sample_type_.compare("real") == 0)
|
||||
if (sample_type_ == "real")
|
||||
{
|
||||
is_complex_ = false;
|
||||
}
|
||||
else if (sample_type_.compare("iq") == 0)
|
||||
else if (sample_type_ == "iq")
|
||||
{
|
||||
is_complex_ = true;
|
||||
reverse_interleaving_ = false;
|
||||
}
|
||||
else if (sample_type_.compare("qi") == 0)
|
||||
else if (sample_type_ == "qi")
|
||||
{
|
||||
is_complex_ = true;
|
||||
reverse_interleaving_ = true;
|
||||
@@ -122,7 +128,7 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(ConfigurationInterfac
|
||||
|
||||
if (seconds_to_skip > 0)
|
||||
{
|
||||
bytes_to_skip = static_cast<long>(
|
||||
bytes_to_skip = static_cast<int64_t>(
|
||||
seconds_to_skip * sampling_frequency_ / 4);
|
||||
if (is_complex_)
|
||||
{
|
||||
@@ -241,9 +247,7 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(ConfigurationInterfac
|
||||
}
|
||||
|
||||
|
||||
TwoBitPackedFileSignalSource::~TwoBitPackedFileSignalSource()
|
||||
{
|
||||
}
|
||||
TwoBitPackedFileSignalSource::~TwoBitPackedFileSignalSource() = default;
|
||||
|
||||
|
||||
void TwoBitPackedFileSignalSource::connect(gr::top_block_sptr top_block)
|
||||
|
||||
@@ -37,12 +37,13 @@
|
||||
|
||||
#include "gnss_block_interface.h"
|
||||
#include "unpack_2bit_samples.h"
|
||||
#include <gnuradio/blocks/file_source.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/blocks/file_source.h>
|
||||
#include <gnuradio/blocks/interleaved_char_to_complex.h>
|
||||
#include <gnuradio/blocks/throttle.h>
|
||||
#include <gnuradio/hier_block2.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <gnuradio/blocks/interleaved_char_to_complex.h>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -55,7 +56,7 @@ class ConfigurationInterface;
|
||||
class TwoBitPackedFileSignalSource : public GNSSBlockInterface
|
||||
{
|
||||
public:
|
||||
TwoBitPackedFileSignalSource(ConfigurationInterface* configuration, std::string role,
|
||||
TwoBitPackedFileSignalSource(ConfigurationInterface* configuration, const std::string& role,
|
||||
unsigned int in_streams, unsigned int out_streams,
|
||||
boost::shared_ptr<gr::msg_queue> queue);
|
||||
|
||||
@@ -98,12 +99,12 @@ public:
|
||||
return repeat_;
|
||||
}
|
||||
|
||||
inline long sampling_frequency() const
|
||||
inline int64_t sampling_frequency() const
|
||||
{
|
||||
return sampling_frequency_;
|
||||
}
|
||||
|
||||
inline long samples() const
|
||||
inline uint64_t samples() const
|
||||
{
|
||||
return samples_;
|
||||
}
|
||||
@@ -129,8 +130,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned long long samples_;
|
||||
long sampling_frequency_;
|
||||
uint64_t samples_;
|
||||
int64_t sampling_frequency_;
|
||||
std::string filename_;
|
||||
std::string item_type_;
|
||||
bool repeat_;
|
||||
|
||||
@@ -29,21 +29,22 @@
|
||||
*/
|
||||
|
||||
#include "uhd_signal_source.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "configuration_interface.h"
|
||||
#include "gnss_sdr_valve.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
#include <glog/logging.h>
|
||||
#include <uhd/types/device_addr.hpp>
|
||||
#include <uhd/exception.hpp>
|
||||
#include <uhd/types/device_addr.hpp>
|
||||
#include <volk/volk.h>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
|
||||
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)
|
||||
const 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_(std::move(queue))
|
||||
{
|
||||
// DUMP PARAMETERS
|
||||
std::string empty = "";
|
||||
@@ -57,13 +58,13 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
|
||||
// available transports on the system (ethernet, usb...).
|
||||
// To narrow down the discovery process to a particular device,
|
||||
// specify a transport key/value pair specific to your device.
|
||||
if (empty.compare(device_address_) != 0) // if not empty
|
||||
if (empty != device_address_) // if not empty
|
||||
{
|
||||
dev_addr["addr"] = device_address_;
|
||||
}
|
||||
//filter the device by serial number if required (useful for USB devices)
|
||||
std::string device_serial = configuration->property(role + ".device_serial", empty);
|
||||
if (empty.compare(device_serial) != 0) // if not empty
|
||||
if (empty != device_serial) // if not empty
|
||||
{
|
||||
dev_addr["serial"] = device_serial;
|
||||
}
|
||||
@@ -91,14 +92,14 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
|
||||
for (int i = 0; i < RF_channels_; i++)
|
||||
{
|
||||
// Single RF channel UHD operation (backward compatible config file format)
|
||||
samples_.push_back(configuration->property(role + ".samples" + boost::lexical_cast<std::string>(i), 0));
|
||||
dump_.push_back(configuration->property(role + ".dump" + boost::lexical_cast<std::string>(i), false));
|
||||
dump_filename_.push_back(configuration->property(role + ".dump_filename" + boost::lexical_cast<std::string>(i), default_dump_file));
|
||||
samples_.push_back(configuration->property(role + ".samples" + std::to_string(i), 0));
|
||||
dump_.push_back(configuration->property(role + ".dump" + std::to_string(i), false));
|
||||
dump_filename_.push_back(configuration->property(role + ".dump_filename" + std::to_string(i), default_dump_file));
|
||||
|
||||
freq_.push_back(configuration->property(role + ".freq" + boost::lexical_cast<std::string>(i), GPS_L1_FREQ_HZ));
|
||||
gain_.push_back(configuration->property(role + ".gain" + boost::lexical_cast<std::string>(i), 50.0));
|
||||
freq_.push_back(configuration->property(role + ".freq" + std::to_string(i), GPS_L1_FREQ_HZ));
|
||||
gain_.push_back(configuration->property(role + ".gain" + std::to_string(i), 50.0));
|
||||
|
||||
IF_bandwidth_hz_.push_back(configuration->property(role + ".IF_bandwidth_hz" + boost::lexical_cast<std::string>(i), sample_rate_ / 2));
|
||||
IF_bandwidth_hz_.push_back(configuration->property(role + ".IF_bandwidth_hz" + std::to_string(i), sample_rate_ / 2));
|
||||
}
|
||||
}
|
||||
// 1. Make the uhd driver instance
|
||||
@@ -111,17 +112,17 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
|
||||
// fc32: Complex floating point (32-bit floats) range [-1.0, +1.0].
|
||||
// sc16: Complex signed integer (16-bit integers) range [-32768, +32767].
|
||||
// sc8: Complex signed integer (8-bit integers) range [-128, 127].
|
||||
if (item_type_.compare("cbyte") == 0)
|
||||
if (item_type_ == "cbyte")
|
||||
{
|
||||
item_size_ = sizeof(lv_8sc_t);
|
||||
uhd_stream_args_ = uhd::stream_args_t("sc8");
|
||||
}
|
||||
else if (item_type_.compare("cshort") == 0)
|
||||
else if (item_type_ == "cshort")
|
||||
{
|
||||
item_size_ = sizeof(lv_16sc_t);
|
||||
uhd_stream_args_ = uhd::stream_args_t("sc16");
|
||||
}
|
||||
else if (item_type_.compare("gr_complex") == 0)
|
||||
else if (item_type_ == "gr_complex")
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
uhd_stream_args_ = uhd::stream_args_t("fc32");
|
||||
@@ -239,9 +240,7 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
|
||||
}
|
||||
|
||||
|
||||
UhdSignalSource::~UhdSignalSource()
|
||||
{
|
||||
}
|
||||
UhdSignalSource::~UhdSignalSource() = default;
|
||||
|
||||
|
||||
void UhdSignalSource::connect(gr::top_block_sptr top_block)
|
||||
@@ -315,8 +314,5 @@ gr::basic_block_sptr UhdSignalSource::get_right_block(int RF_channel)
|
||||
{
|
||||
return valve_.at(RF_channel);
|
||||
}
|
||||
else
|
||||
{
|
||||
return uhd_source_;
|
||||
}
|
||||
return uhd_source_;
|
||||
}
|
||||
|
||||
@@ -33,10 +33,10 @@
|
||||
|
||||
#include "gnss_block_interface.h"
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <gnuradio/hier_block2.h>
|
||||
#include <gnuradio/uhd/usrp_source.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/hier_block2.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <gnuradio/uhd/usrp_source.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -50,7 +50,7 @@ class UhdSignalSource : public GNSSBlockInterface
|
||||
{
|
||||
public:
|
||||
UhdSignalSource(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_stream,
|
||||
const std::string& role, unsigned int in_stream,
|
||||
unsigned int out_stream, boost::shared_ptr<gr::msg_queue> queue);
|
||||
|
||||
virtual ~UhdSignalSource();
|
||||
|
||||
@@ -32,7 +32,8 @@
|
||||
|
||||
#include "gr_complex_ip_packet_source.h"
|
||||
#include <gnuradio/io_signature.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
const int FIFO_SIZE = 1472000;
|
||||
|
||||
@@ -76,15 +77,15 @@ typedef struct gr_udp_header
|
||||
|
||||
gr_complex_ip_packet_source::sptr
|
||||
gr_complex_ip_packet_source::make(std::string src_device,
|
||||
std::string origin_address,
|
||||
const std::string &origin_address,
|
||||
int udp_port,
|
||||
int udp_packet_size,
|
||||
int n_baseband_channels,
|
||||
std::string wire_sample_type,
|
||||
const std::string &wire_sample_type,
|
||||
size_t item_size,
|
||||
bool IQ_swap_)
|
||||
{
|
||||
return gnuradio::get_initial_sptr(new gr_complex_ip_packet_source(src_device,
|
||||
return gnuradio::get_initial_sptr(new gr_complex_ip_packet_source(std::move(src_device),
|
||||
origin_address,
|
||||
udp_port,
|
||||
udp_packet_size,
|
||||
@@ -99,11 +100,11 @@ gr_complex_ip_packet_source::make(std::string src_device,
|
||||
* The private constructor
|
||||
*/
|
||||
gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device,
|
||||
__attribute__((unused)) std::string origin_address,
|
||||
__attribute__((unused)) const std::string &origin_address,
|
||||
int udp_port,
|
||||
int udp_packet_size,
|
||||
int n_baseband_channels,
|
||||
std::string wire_sample_type,
|
||||
const std::string &wire_sample_type,
|
||||
size_t item_size,
|
||||
bool IQ_swap_)
|
||||
: gr::sync_block("gr_complex_ip_packet_source",
|
||||
@@ -113,12 +114,12 @@ gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device,
|
||||
std::cout << "Start Ethernet packet capture\n";
|
||||
|
||||
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_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_bytes_per_sample = d_n_baseband_channels;
|
||||
@@ -129,7 +130,7 @@ gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device,
|
||||
exit(0);
|
||||
}
|
||||
std::cout << "d_wire_sample_type:" << d_wire_sample_type << std::endl;
|
||||
d_src_device = src_device;
|
||||
d_src_device = std::move(src_device);
|
||||
d_udp_port = udp_port;
|
||||
d_udp_payload_size = udp_packet_size;
|
||||
d_fifo_full = false;
|
||||
@@ -142,8 +143,8 @@ gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device,
|
||||
d_item_size = item_size;
|
||||
d_IQ_swap = IQ_swap_;
|
||||
d_sock_raw = 0;
|
||||
d_pcap_thread = NULL;
|
||||
descr = NULL;
|
||||
d_pcap_thread = nullptr;
|
||||
descr = nullptr;
|
||||
|
||||
memset(reinterpret_cast<char *>(&si_me), 0, sizeof(si_me));
|
||||
}
|
||||
@@ -171,7 +172,7 @@ bool gr_complex_ip_packet_source::start()
|
||||
bool gr_complex_ip_packet_source::stop()
|
||||
{
|
||||
std::cout << "gr_complex_ip_packet_source STOP\n";
|
||||
if (descr != NULL)
|
||||
if (descr != nullptr)
|
||||
{
|
||||
pcap_breakloop(descr);
|
||||
d_pcap_thread->join();
|
||||
@@ -187,7 +188,7 @@ bool gr_complex_ip_packet_source::open()
|
||||
boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function
|
||||
// open device for reading
|
||||
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 << "Fatal Error in pcap_open_live(): " << std::string(errbuf) << std::endl;
|
||||
@@ -220,7 +221,7 @@ bool gr_complex_ip_packet_source::open()
|
||||
|
||||
gr_complex_ip_packet_source::~gr_complex_ip_packet_source()
|
||||
{
|
||||
if (d_pcap_thread != NULL)
|
||||
if (d_pcap_thread != nullptr)
|
||||
{
|
||||
delete d_pcap_thread;
|
||||
}
|
||||
@@ -232,7 +233,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,
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -327,22 +328,22 @@ void gr_complex_ip_packet_source::demux_samples(gr_vector_void_star output_items
|
||||
switch (d_wire_sample_type)
|
||||
{
|
||||
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++];
|
||||
imag = fifo_buff[fifo_read_ptr++];
|
||||
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
|
||||
{
|
||||
static_cast<gr_complex *>(output_items[i])[n] = gr_complex(imag, real);
|
||||
static_cast<gr_complex *>(output_item)[n] = gr_complex(imag, real);
|
||||
}
|
||||
}
|
||||
break;
|
||||
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;
|
||||
if (tmp_char2 >= 8)
|
||||
@@ -365,11 +366,11 @@ void gr_complex_ip_packet_source::demux_samples(gr_vector_void_star output_items
|
||||
}
|
||||
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
|
||||
{
|
||||
static_cast<gr_complex *>(output_items[i])[n] = gr_complex(real, imag);
|
||||
static_cast<gr_complex *>(output_item)[n] = gr_complex(real, imag);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -390,7 +391,7 @@ int gr_complex_ip_packet_source::work(int noutput_items,
|
||||
boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function
|
||||
if (fifo_items == 0) return 0;
|
||||
|
||||
if (output_items.size() > static_cast<long unsigned int>(d_n_baseband_channels))
|
||||
if (output_items.size() > static_cast<uint64_t>(d_n_baseband_channels))
|
||||
{
|
||||
std::cout << "Configuration error: more baseband channels connected than the available in the UDP source\n";
|
||||
exit(0);
|
||||
@@ -439,7 +440,7 @@ int gr_complex_ip_packet_source::work(int noutput_items,
|
||||
// update fifo items
|
||||
fifo_items = fifo_items - bytes_requested;
|
||||
|
||||
for (long unsigned int n = 0; n < output_items.size(); n++)
|
||||
for (uint64_t n = 0; n < output_items.size(); n++)
|
||||
{
|
||||
produce(static_cast<int>(n), num_samples_readed);
|
||||
}
|
||||
|
||||
@@ -33,13 +33,13 @@
|
||||
#ifndef INCLUDED_GR_COMPLEX_IP_PACKET_SOURCE_H
|
||||
#define INCLUDED_GR_COMPLEX_IP_PACKET_SOURCE_H
|
||||
|
||||
#include <gnuradio/sync_block.h>
|
||||
#include <boost/thread.hpp>
|
||||
#include <pcap.h>
|
||||
#include <gnuradio/sync_block.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <net/if.h>
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#include <pcap.h>
|
||||
#include <string>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
@@ -84,19 +84,19 @@ private:
|
||||
public:
|
||||
typedef boost::shared_ptr<gr_complex_ip_packet_source> sptr;
|
||||
static sptr make(std::string src_device,
|
||||
std::string origin_address,
|
||||
const std::string &origin_address,
|
||||
int udp_port,
|
||||
int udp_packet_size,
|
||||
int n_baseband_channels,
|
||||
std::string wire_sample_type,
|
||||
const std::string &wire_sample_type,
|
||||
size_t item_size,
|
||||
bool IQ_swap_);
|
||||
gr_complex_ip_packet_source(std::string src_device,
|
||||
std::string origin_address,
|
||||
const std::string &origin_address,
|
||||
int udp_port,
|
||||
int udp_packet_size,
|
||||
int n_baseband_channels,
|
||||
std::string wire_sample_type,
|
||||
const std::string &wire_sample_type,
|
||||
size_t item_size,
|
||||
bool IQ_swap_);
|
||||
~gr_complex_ip_packet_source();
|
||||
|
||||
@@ -172,7 +172,7 @@ int labsat23_source::general_work(int noutput_items,
|
||||
__attribute__((unused)) gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
gr_complex *out = reinterpret_cast<gr_complex *>(output_items[0]);
|
||||
auto *out = reinterpret_cast<gr_complex *>(output_items[0]);
|
||||
|
||||
if (d_header_parsed == false)
|
||||
{
|
||||
@@ -300,7 +300,7 @@ int labsat23_source::general_work(int noutput_items,
|
||||
return -1;
|
||||
}
|
||||
|
||||
//check if the selected channel in config file match the file encoding
|
||||
// check if the selected channel in config file match the file encoding
|
||||
if (d_channel_selector_config == 2 and d_channel_selector != 0)
|
||||
{
|
||||
std::cout << "Labsat source channel config inconsistency: channel 2 is selected but the file has only one channel" << std::endl;
|
||||
@@ -314,7 +314,7 @@ int labsat23_source::general_work(int noutput_items,
|
||||
return -1;
|
||||
}
|
||||
byte_counter++;
|
||||
uint8_t quantization = static_cast<uint8_t>(memblock[byte_counter]);
|
||||
auto quantization = static_cast<uint8_t>(memblock[byte_counter]);
|
||||
switch (quantization)
|
||||
{
|
||||
case 1:
|
||||
@@ -327,7 +327,7 @@ int labsat23_source::general_work(int noutput_items,
|
||||
std::cout << "Unknown quantization ID " << static_cast<int>(quantization) << std::endl;
|
||||
}
|
||||
byte_counter++;
|
||||
uint8_t channel_a_constellation = static_cast<uint8_t>(memblock[byte_counter]);
|
||||
auto channel_a_constellation = static_cast<uint8_t>(memblock[byte_counter]);
|
||||
switch (channel_a_constellation)
|
||||
{
|
||||
case 0:
|
||||
@@ -343,7 +343,7 @@ int labsat23_source::general_work(int noutput_items,
|
||||
std::cout << "Unknown channel A constellation ID " << static_cast<int>(channel_a_constellation) << std::endl;
|
||||
}
|
||||
byte_counter++;
|
||||
uint8_t channel_b_constellation = static_cast<uint8_t>(memblock[byte_counter]);
|
||||
auto channel_b_constellation = static_cast<uint8_t>(memblock[byte_counter]);
|
||||
switch (channel_b_constellation)
|
||||
{
|
||||
case 0:
|
||||
@@ -359,138 +359,128 @@ int labsat23_source::general_work(int noutput_items,
|
||||
std::cout << "Unknown channel B constellation ID " << static_cast<int>(channel_b_constellation) << std::endl;
|
||||
}
|
||||
|
||||
//end of header
|
||||
// end of header
|
||||
d_header_parsed = true;
|
||||
//seek file to the first signal sample
|
||||
// seek file to the first signal sample
|
||||
binary_input_file->clear();
|
||||
binary_input_file->seekg(header_bytes, binary_input_file->beg);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Labsat file header error: section 2 is not available." << std::endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Labsat file read error: file is empty." << std::endl;
|
||||
std::cout << "Labsat file header error: section 2 is not available." << std::endl;
|
||||
return -1;
|
||||
}
|
||||
std::cout << "Labsat file read error: file is empty." << std::endl;
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
|
||||
|
||||
// ready to start reading samples
|
||||
switch (d_bits_per_sample)
|
||||
{
|
||||
//ready to start reading samples
|
||||
switch (d_bits_per_sample)
|
||||
{
|
||||
case 2:
|
||||
case 2:
|
||||
{
|
||||
switch (d_channel_selector)
|
||||
{
|
||||
switch (d_channel_selector)
|
||||
{
|
||||
case 0:
|
||||
// dual channel 2 bits per complex sample
|
||||
break;
|
||||
default:
|
||||
//single channel 2 bits per complex sample (1 bit I + 1 bit Q, 8 samples per int16)
|
||||
int n_int16_to_read = noutput_items / 8;
|
||||
if (n_int16_to_read > 0)
|
||||
{
|
||||
int16_t memblock[n_int16_to_read];
|
||||
binary_input_file->read(reinterpret_cast<char *>(memblock), n_int16_to_read * 2);
|
||||
n_int16_to_read = binary_input_file->gcount() / 2; //from bytes to int16
|
||||
if (n_int16_to_read > 0)
|
||||
{
|
||||
int output_pointer = 0;
|
||||
for (int i = 0; i < n_int16_to_read; i++)
|
||||
{
|
||||
decode_samples_one_channel(memblock[i], &out[output_pointer], d_bits_per_sample);
|
||||
output_pointer += 8;
|
||||
}
|
||||
return output_pointer;
|
||||
}
|
||||
else
|
||||
{
|
||||
//trigger the read of the next file in the sequence
|
||||
std::cout << "End of current file, reading the next Labsat file in sequence: " << generate_filename() << std::endl;
|
||||
|
||||
d_current_file_number++;
|
||||
binary_input_file->close();
|
||||
binary_input_file->open(generate_filename().c_str(), std::ios::in | std::ios::binary);
|
||||
if (binary_input_file->is_open())
|
||||
{
|
||||
std::cout << "Labsat file source is reading samples from " << generate_filename() << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Last file reached, LabSat source stop" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
case 0:
|
||||
// dual channel 2 bits per complex sample
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
switch (d_channel_selector)
|
||||
default:
|
||||
// single channel 2 bits per complex sample (1 bit I + 1 bit Q, 8 samples per int16)
|
||||
int n_int16_to_read = noutput_items / 8;
|
||||
if (n_int16_to_read > 0)
|
||||
{
|
||||
case 0:
|
||||
// dual channel
|
||||
break;
|
||||
default:
|
||||
//single channel 4 bits per complex sample (2 bit I + 2 bit Q, 4 samples per int16)
|
||||
int n_int16_to_read = noutput_items / 4;
|
||||
int16_t memblock[n_int16_to_read];
|
||||
binary_input_file->read(reinterpret_cast<char *>(memblock), n_int16_to_read * 2);
|
||||
n_int16_to_read = binary_input_file->gcount() / 2; //from bytes to int16
|
||||
if (n_int16_to_read > 0)
|
||||
{
|
||||
int16_t memblock[n_int16_to_read];
|
||||
binary_input_file->read(reinterpret_cast<char *>(memblock), n_int16_to_read * 2);
|
||||
n_int16_to_read = binary_input_file->gcount() / 2; //from bytes to int16
|
||||
if (n_int16_to_read > 0)
|
||||
int output_pointer = 0;
|
||||
for (int i = 0; i < n_int16_to_read; i++)
|
||||
{
|
||||
int output_pointer = 0;
|
||||
for (int i = 0; i < n_int16_to_read; i++)
|
||||
{
|
||||
decode_samples_one_channel(memblock[i], &out[output_pointer], d_bits_per_sample);
|
||||
output_pointer += 4;
|
||||
}
|
||||
return output_pointer;
|
||||
decode_samples_one_channel(memblock[i], &out[output_pointer], d_bits_per_sample);
|
||||
output_pointer += 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
//trigger the read of the next file in the sequence
|
||||
std::cout << "End of current file, reading the next Labsat file in sequence: " << generate_filename() << std::endl;
|
||||
return output_pointer;
|
||||
}
|
||||
|
||||
d_current_file_number++;
|
||||
binary_input_file->close();
|
||||
binary_input_file->open(generate_filename().c_str(), std::ios::in | std::ios::binary);
|
||||
if (binary_input_file->is_open())
|
||||
{
|
||||
std::cout << "Labsat file source is reading samples from " << generate_filename() << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Last file reached, LabSat source stop" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
// trigger the read of the next file in the sequence
|
||||
std::cout << "End of current file, reading the next Labsat file in sequence: " << generate_filename() << std::endl;
|
||||
|
||||
d_current_file_number++;
|
||||
binary_input_file->close();
|
||||
binary_input_file->open(generate_filename().c_str(), std::ios::in | std::ios::binary);
|
||||
if (binary_input_file->is_open())
|
||||
{
|
||||
std::cout << "Labsat file source is reading samples from " << generate_filename() << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
std::cout << "Last file reached, LabSat source stop" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
switch (d_channel_selector)
|
||||
{
|
||||
return -1;
|
||||
case 0:
|
||||
// dual channel
|
||||
break;
|
||||
default:
|
||||
// single channel 4 bits per complex sample (2 bit I + 2 bit Q, 4 samples per int16)
|
||||
int n_int16_to_read = noutput_items / 4;
|
||||
if (n_int16_to_read > 0)
|
||||
{
|
||||
int16_t memblock[n_int16_to_read];
|
||||
binary_input_file->read(reinterpret_cast<char *>(memblock), n_int16_to_read * 2);
|
||||
n_int16_to_read = binary_input_file->gcount() / 2; //from bytes to int16
|
||||
if (n_int16_to_read > 0)
|
||||
{
|
||||
int output_pointer = 0;
|
||||
for (int i = 0; i < n_int16_to_read; i++)
|
||||
{
|
||||
decode_samples_one_channel(memblock[i], &out[output_pointer], d_bits_per_sample);
|
||||
output_pointer += 4;
|
||||
}
|
||||
return output_pointer;
|
||||
}
|
||||
|
||||
// trigger the read of the next file in the sequence
|
||||
std::cout << "End of current file, reading the next Labsat file in sequence: " << generate_filename() << std::endl;
|
||||
|
||||
d_current_file_number++;
|
||||
binary_input_file->close();
|
||||
binary_input_file->open(generate_filename().c_str(), std::ios::in | std::ios::binary);
|
||||
if (binary_input_file->is_open())
|
||||
{
|
||||
std::cout << "Labsat file source is reading samples from " << generate_filename() << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Last file reached, LabSat source stop" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "Warning!!" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
|
||||
#include "rtl_tcp_signal_source_c.h"
|
||||
#include "rtl_tcp_commands.h"
|
||||
#include <glog/logging.h>
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <map>
|
||||
|
||||
using google::LogMessage;
|
||||
@@ -51,7 +51,7 @@ enum
|
||||
|
||||
rtl_tcp_signal_source_c_sptr
|
||||
rtl_tcp_make_signal_source_c(const std::string &address,
|
||||
short port,
|
||||
int16_t port,
|
||||
bool flip_iq)
|
||||
{
|
||||
return gnuradio::get_initial_sptr(new rtl_tcp_signal_source_c(address,
|
||||
@@ -61,7 +61,7 @@ rtl_tcp_make_signal_source_c(const std::string &address,
|
||||
|
||||
|
||||
rtl_tcp_signal_source_c::rtl_tcp_signal_source_c(const std::string &address,
|
||||
short port,
|
||||
int16_t port,
|
||||
bool flip_iq)
|
||||
: gr::sync_block("rtl_tcp_signal_source_c",
|
||||
gr::io_signature::make(0, 0, 0),
|
||||
@@ -152,7 +152,7 @@ rtl_tcp_signal_source_c::rtl_tcp_signal_source_c(const std::string &address,
|
||||
}
|
||||
|
||||
|
||||
rtl_tcp_signal_source_c::~rtl_tcp_signal_source_c()
|
||||
rtl_tcp_signal_source_c::~rtl_tcp_signal_source_c() // NOLINT(modernize-use-equals-default)
|
||||
{
|
||||
mutex_.unlock();
|
||||
io_service_.stop();
|
||||
@@ -205,7 +205,7 @@ void rtl_tcp_signal_source_c::set_agc_mode(bool agc)
|
||||
|
||||
void rtl_tcp_signal_source_c::set_gain(int gain)
|
||||
{
|
||||
unsigned clipped = static_cast<unsigned>(info_.clip_gain(gain) * 10.0);
|
||||
auto clipped = static_cast<unsigned>(info_.clip_gain(gain) * 10.0);
|
||||
boost::system::error_code ec = rtl_tcp_command(RTL_TCP_SET_GAIN, clipped, socket_);
|
||||
if (ec)
|
||||
{
|
||||
|
||||
@@ -39,12 +39,13 @@
|
||||
#define GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_C_H
|
||||
|
||||
#include "rtl_tcp_dongle_info.h"
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/condition.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/circular_buffer.hpp>
|
||||
#include <boost/thread/condition.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <gnuradio/sync_block.h>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
class rtl_tcp_signal_source_c;
|
||||
@@ -54,7 +55,7 @@ typedef boost::shared_ptr<rtl_tcp_signal_source_c>
|
||||
|
||||
rtl_tcp_signal_source_c_sptr
|
||||
rtl_tcp_make_signal_source_c(const std::string &address,
|
||||
short port,
|
||||
int16_t port,
|
||||
bool flip_iq = false);
|
||||
|
||||
/*!
|
||||
@@ -81,11 +82,11 @@ private:
|
||||
|
||||
friend rtl_tcp_signal_source_c_sptr
|
||||
rtl_tcp_make_signal_source_c(const std::string &address,
|
||||
short port,
|
||||
int16_t port,
|
||||
bool flip_iq);
|
||||
|
||||
rtl_tcp_signal_source_c(const std::string &address,
|
||||
short port,
|
||||
int16_t port,
|
||||
bool flip_iq);
|
||||
|
||||
rtl_tcp_dongle_info info_;
|
||||
|
||||
@@ -62,12 +62,12 @@ bool systemIsBigEndian()
|
||||
|
||||
bool systemBytesAreBigEndian()
|
||||
{
|
||||
byte_and_samples b;
|
||||
byte_and_samples b{};
|
||||
b.byte = static_cast<int8_t>(0x01);
|
||||
if (*(char *)&b.byte == 1)
|
||||
if (*reinterpret_cast<char *>(&b.byte) == 1)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -131,17 +131,15 @@ unpack_2bit_samples::unpack_2bit_samples(bool big_endian_bytes,
|
||||
}
|
||||
|
||||
|
||||
unpack_2bit_samples::~unpack_2bit_samples()
|
||||
{
|
||||
}
|
||||
unpack_2bit_samples::~unpack_2bit_samples() = default;
|
||||
|
||||
|
||||
int unpack_2bit_samples::work(int noutput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
signed char const *in = reinterpret_cast<signed char const *>(input_items[0]);
|
||||
int8_t *out = reinterpret_cast<int8_t *>(output_items[0]);
|
||||
auto const *in = reinterpret_cast<signed char const *>(input_items[0]);
|
||||
auto *out = reinterpret_cast<int8_t *>(output_items[0]);
|
||||
|
||||
size_t ninput_bytes = noutput_items / 4;
|
||||
size_t ninput_items = ninput_bytes / item_size_;
|
||||
@@ -160,7 +158,7 @@ int unpack_2bit_samples::work(int noutput_items,
|
||||
// 1) The samples in a byte are in big endian order
|
||||
// 2) The samples in a byte are in little endian order
|
||||
|
||||
byte_and_samples raw_byte;
|
||||
byte_and_samples raw_byte{};
|
||||
int n = 0;
|
||||
|
||||
if (!reverse_interleaving_)
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include "unpack_byte_2bit_cpx_samples.h"
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include <cstdint>
|
||||
|
||||
struct byte_2bit_struct
|
||||
{
|
||||
@@ -49,26 +50,24 @@ unpack_byte_2bit_cpx_samples_sptr make_unpack_byte_2bit_cpx_samples()
|
||||
|
||||
|
||||
unpack_byte_2bit_cpx_samples::unpack_byte_2bit_cpx_samples() : sync_interpolator("unpack_byte_2bit_cpx_samples",
|
||||
gr::io_signature::make(1, 1, sizeof(signed char)),
|
||||
gr::io_signature::make(1, 1, sizeof(short)),
|
||||
gr::io_signature::make(1, 1, sizeof(int8_t)),
|
||||
gr::io_signature::make(1, 1, sizeof(int16_t)),
|
||||
4)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
unpack_byte_2bit_cpx_samples::~unpack_byte_2bit_cpx_samples()
|
||||
{
|
||||
}
|
||||
unpack_byte_2bit_cpx_samples::~unpack_byte_2bit_cpx_samples() = default;
|
||||
|
||||
|
||||
int unpack_byte_2bit_cpx_samples::work(int noutput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
const signed char *in = reinterpret_cast<const signed char *>(input_items[0]);
|
||||
short *out = reinterpret_cast<short *>(output_items[0]);
|
||||
const auto *in = reinterpret_cast<const int8_t *>(input_items[0]);
|
||||
auto *out = reinterpret_cast<int16_t *>(output_items[0]);
|
||||
|
||||
byte_2bit_struct sample;
|
||||
byte_2bit_struct sample{};
|
||||
int n = 0;
|
||||
for (int i = 0; i < noutput_items / 4; i++)
|
||||
{
|
||||
@@ -78,34 +77,34 @@ int unpack_byte_2bit_cpx_samples::work(int noutput_items,
|
||||
//* Least Significant Nibble - Sample n+1
|
||||
//* Packing order in Nibble Q1 Q0 I1 I0
|
||||
//normal
|
||||
// signed char c = in[i];
|
||||
// int8_t c = in[i];
|
||||
// //Q[n]
|
||||
// sample.two_bit_sample = (c>>6) & 3;
|
||||
// out[n++] = (2*(short)sample.two_bit_sample+1);
|
||||
// out[n++] = (2*(int16_t)sample.two_bit_sample+1);
|
||||
// //I[n]
|
||||
// sample.two_bit_sample = (c>>4) & 3;
|
||||
// out[n++] = (2*(short)sample.two_bit_sample+1);
|
||||
// out[n++] = (2*(int16_t)sample.two_bit_sample+1);
|
||||
// //Q[n+1]
|
||||
// sample.two_bit_sample = (c>>2) & 3;
|
||||
// out[n++] = (2*(short)sample.two_bit_sample+1);
|
||||
// out[n++] = (2*(int16_t)sample.two_bit_sample+1);
|
||||
// //I[n+1]
|
||||
// sample.two_bit_sample = c & 3;
|
||||
// out[n++] = (2*(short)sample.two_bit_sample+1);
|
||||
// out[n++] = (2*(int16_t)sample.two_bit_sample+1);
|
||||
|
||||
//I/Q swap
|
||||
signed char c = in[i];
|
||||
int8_t c = in[i];
|
||||
//I[n]
|
||||
sample.two_bit_sample = (c >> 4) & 3;
|
||||
out[n++] = (2 * static_cast<short>(sample.two_bit_sample) + 1);
|
||||
out[n++] = (2 * static_cast<int16_t>(sample.two_bit_sample) + 1);
|
||||
//Q[n]
|
||||
sample.two_bit_sample = (c >> 6) & 3;
|
||||
out[n++] = (2 * static_cast<short>(sample.two_bit_sample) + 1);
|
||||
out[n++] = (2 * static_cast<int16_t>(sample.two_bit_sample) + 1);
|
||||
//I[n+1]
|
||||
sample.two_bit_sample = c & 3;
|
||||
out[n++] = (2 * static_cast<short>(sample.two_bit_sample) + 1);
|
||||
out[n++] = (2 * static_cast<int16_t>(sample.two_bit_sample) + 1);
|
||||
//Q[n+1]
|
||||
sample.two_bit_sample = (c >> 2) & 3;
|
||||
out[n++] = (2 * static_cast<short>(sample.two_bit_sample) + 1);
|
||||
out[n++] = (2 * static_cast<int16_t>(sample.two_bit_sample) + 1);
|
||||
}
|
||||
return noutput_items;
|
||||
}
|
||||
|
||||
@@ -52,19 +52,17 @@ unpack_byte_2bit_samples::unpack_byte_2bit_samples() : sync_interpolator("unpack
|
||||
}
|
||||
|
||||
|
||||
unpack_byte_2bit_samples::~unpack_byte_2bit_samples()
|
||||
{
|
||||
}
|
||||
unpack_byte_2bit_samples::~unpack_byte_2bit_samples() = default;
|
||||
|
||||
|
||||
int unpack_byte_2bit_samples::work(int noutput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
const signed char *in = reinterpret_cast<const signed char *>(input_items[0]);
|
||||
float *out = reinterpret_cast<float *>(output_items[0]);
|
||||
const auto *in = reinterpret_cast<const signed char *>(input_items[0]);
|
||||
auto *out = reinterpret_cast<float *>(output_items[0]);
|
||||
|
||||
byte_2bit_struct sample;
|
||||
byte_2bit_struct sample{};
|
||||
int n = 0;
|
||||
for (int i = 0; i < noutput_items / 4; i++)
|
||||
{
|
||||
|
||||
@@ -47,17 +47,15 @@ unpack_byte_4bit_samples::unpack_byte_4bit_samples() : sync_interpolator("unpack
|
||||
}
|
||||
|
||||
|
||||
unpack_byte_4bit_samples::~unpack_byte_4bit_samples()
|
||||
{
|
||||
}
|
||||
unpack_byte_4bit_samples::~unpack_byte_4bit_samples() = default;
|
||||
|
||||
|
||||
int unpack_byte_4bit_samples::work(int noutput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
const signed char *in = reinterpret_cast<const signed char *>(input_items[0]);
|
||||
signed char *out = reinterpret_cast<signed char *>(output_items[0]);
|
||||
const auto *in = reinterpret_cast<const signed char *>(input_items[0]);
|
||||
auto *out = reinterpret_cast<signed char *>(output_items[0]);
|
||||
int n = 0;
|
||||
unsigned char tmp_char2;
|
||||
for (int i = 0; i < noutput_items / 2; i++)
|
||||
|
||||
@@ -47,17 +47,15 @@ unpack_intspir_1bit_samples::unpack_intspir_1bit_samples() : sync_interpolator("
|
||||
}
|
||||
|
||||
|
||||
unpack_intspir_1bit_samples::~unpack_intspir_1bit_samples()
|
||||
{
|
||||
}
|
||||
unpack_intspir_1bit_samples::~unpack_intspir_1bit_samples() = default;
|
||||
|
||||
|
||||
int unpack_intspir_1bit_samples::work(int noutput_items,
|
||||
gr_vector_const_void_star &input_items,
|
||||
gr_vector_void_star &output_items)
|
||||
{
|
||||
const signed int *in = reinterpret_cast<const signed int *>(input_items[0]);
|
||||
float *out = reinterpret_cast<float *>(output_items[0]);
|
||||
const auto *in = reinterpret_cast<const signed int *>(input_items[0]);
|
||||
auto *out = reinterpret_cast<float *>(output_items[0]);
|
||||
|
||||
int n = 0;
|
||||
int channel = 1;
|
||||
|
||||
@@ -49,9 +49,8 @@ unpack_spir_gss6450_samples::unpack_spir_gss6450_samples(unsigned int adc_nbit)
|
||||
}
|
||||
|
||||
|
||||
unpack_spir_gss6450_samples::~unpack_spir_gss6450_samples()
|
||||
{
|
||||
}
|
||||
unpack_spir_gss6450_samples::~unpack_spir_gss6450_samples() = default;
|
||||
|
||||
|
||||
void unpack_spir_gss6450_samples::decode_4bits_word(uint32_t input_uint32, gr_complex* out, int adc_bits)
|
||||
{
|
||||
@@ -124,8 +123,8 @@ void unpack_spir_gss6450_samples::decode_4bits_word(uint32_t input_uint32, gr_co
|
||||
int unpack_spir_gss6450_samples::work(int noutput_items,
|
||||
gr_vector_const_void_star& input_items, gr_vector_void_star& output_items)
|
||||
{
|
||||
const int32_t* in = reinterpret_cast<const int32_t*>(input_items[0]);
|
||||
gr_complex* out = reinterpret_cast<gr_complex*>(output_items[0]);
|
||||
const auto* in = reinterpret_cast<const int32_t*>(input_items[0]);
|
||||
auto* out = reinterpret_cast<gr_complex*>(output_items[0]);
|
||||
int n_sample = 0;
|
||||
int in_counter = 0;
|
||||
do
|
||||
|
||||
@@ -75,10 +75,10 @@ bool get_ad9361_stream_dev(struct iio_context *ctx, enum iodev d, struct iio_dev
|
||||
{
|
||||
case TX:
|
||||
*dev = iio_context_find_device(ctx, "cf-ad9361-dds-core-lpc");
|
||||
return *dev != NULL;
|
||||
return *dev != nullptr;
|
||||
case RX:
|
||||
*dev = iio_context_find_device(ctx, "cf-ad9361-lpc");
|
||||
return *dev != NULL;
|
||||
return *dev != nullptr;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -100,7 +100,7 @@ bool get_ad9361_stream_ch(struct iio_context *ctx __attribute__((unused)), enum
|
||||
name << chid;
|
||||
*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 << chid;
|
||||
*chn = iio_device_find_channel(get_ad9361_phy(ctx), name.str().c_str(), false);
|
||||
return *chn != NULL;
|
||||
return *chn != nullptr;
|
||||
break;
|
||||
case TX:
|
||||
name.str("");
|
||||
name << "voltage";
|
||||
name << chid;
|
||||
*chn = iio_device_find_channel(get_ad9361_phy(ctx), name.str().c_str(), true);
|
||||
return *chn != NULL;
|
||||
return *chn != nullptr;
|
||||
break;
|
||||
default:
|
||||
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
|
||||
case RX:
|
||||
*chn = iio_device_find_channel(get_ad9361_phy(ctx), "altvoltage0", true);
|
||||
return *chn != NULL;
|
||||
return *chn != nullptr;
|
||||
case TX:
|
||||
*chn = iio_device_find_channel(get_ad9361_phy(ctx), "altvoltage1", true);
|
||||
return *chn != NULL;
|
||||
return *chn != nullptr;
|
||||
default:
|
||||
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 */
|
||||
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
|
||||
//LOG(INFO)<<"* Acquiring AD9361 phy channel"<<chid;
|
||||
@@ -179,9 +179,9 @@ bool cfg_ad9361_streaming_ch(struct iio_context *ctx, struct stream_cfg *cfg, en
|
||||
bool config_ad9361_rx_local(uint64_t bandwidth_,
|
||||
uint64_t sample_rate_,
|
||||
uint64_t freq_,
|
||||
std::string rf_port_select_,
|
||||
std::string gain_mode_rx1_,
|
||||
std::string gain_mode_rx2_,
|
||||
const std::string &rf_port_select_,
|
||||
const std::string &gain_mode_rx1_,
|
||||
const std::string &gain_mode_rx2_,
|
||||
double rf_gain_rx1_,
|
||||
double rf_gain_rx2_)
|
||||
|
||||
@@ -291,13 +291,13 @@ bool config_ad9361_rx_local(uint64_t bandwidth_,
|
||||
}
|
||||
|
||||
|
||||
bool config_ad9361_rx_remote(std::string remote_host,
|
||||
bool config_ad9361_rx_remote(const std::string &remote_host,
|
||||
uint64_t bandwidth_,
|
||||
uint64_t sample_rate_,
|
||||
uint64_t freq_,
|
||||
std::string rf_port_select_,
|
||||
std::string gain_mode_rx1_,
|
||||
std::string gain_mode_rx2_,
|
||||
const std::string &rf_port_select_,
|
||||
const std::string &gain_mode_rx1_,
|
||||
const std::string &gain_mode_rx2_,
|
||||
double rf_gain_rx1_,
|
||||
double rf_gain_rx2_)
|
||||
{
|
||||
@@ -543,7 +543,7 @@ bool config_ad9361_lo_local(uint64_t bandwidth_,
|
||||
}
|
||||
|
||||
|
||||
bool config_ad9361_lo_remote(std::string remote_host,
|
||||
bool config_ad9361_lo_remote(const std::string &remote_host,
|
||||
uint64_t bandwidth_,
|
||||
uint64_t sample_rate_,
|
||||
uint64_t freq_rf_tx_hz_,
|
||||
@@ -680,7 +680,7 @@ bool config_ad9361_lo_remote(std::string remote_host,
|
||||
}
|
||||
|
||||
|
||||
bool ad9361_disable_lo_remote(std::string remote_host)
|
||||
bool ad9361_disable_lo_remote(const std::string &remote_host)
|
||||
{
|
||||
std::cout << "AD9361 Acquiring IIO REMOTE context in host " << remote_host << std::endl;
|
||||
struct iio_context *ctx;
|
||||
|
||||
@@ -92,19 +92,19 @@ bool cfg_ad9361_streaming_ch(struct iio_context *ctx, struct stream_cfg *cfg, en
|
||||
bool config_ad9361_rx_local(uint64_t bandwidth_,
|
||||
uint64_t sample_rate_,
|
||||
uint64_t freq_,
|
||||
std::string rf_port_select_,
|
||||
std::string gain_mode_rx1_,
|
||||
std::string gain_mode_rx2_,
|
||||
const std::string &rf_port_select_,
|
||||
const std::string &gain_mode_rx1_,
|
||||
const std::string &gain_mode_rx2_,
|
||||
double rf_gain_rx1_,
|
||||
double rf_gain_rx2_);
|
||||
|
||||
bool config_ad9361_rx_remote(std::string remote_host,
|
||||
bool config_ad9361_rx_remote(const std::string &remote_host,
|
||||
uint64_t bandwidth_,
|
||||
uint64_t sample_rate_,
|
||||
uint64_t freq_,
|
||||
std::string rf_port_select_,
|
||||
std::string gain_mode_rx1_,
|
||||
std::string gain_mode_rx2_,
|
||||
const std::string &rf_port_select_,
|
||||
const std::string &gain_mode_rx1_,
|
||||
const std::string &gain_mode_rx2_,
|
||||
double rf_gain_rx1_,
|
||||
double rf_gain_rx2_);
|
||||
|
||||
@@ -115,7 +115,7 @@ bool config_ad9361_lo_local(uint64_t bandwidth_,
|
||||
int64_t freq_dds_tx_hz_,
|
||||
double scale_dds_dbfs_);
|
||||
|
||||
bool config_ad9361_lo_remote(std::string remote_host,
|
||||
bool config_ad9361_lo_remote(const std::string &remote_host,
|
||||
uint64_t bandwidth_,
|
||||
uint64_t sample_rate_,
|
||||
uint64_t freq_rf_tx_hz_,
|
||||
@@ -124,7 +124,7 @@ bool config_ad9361_lo_remote(std::string remote_host,
|
||||
double scale_dds_dbfs_);
|
||||
|
||||
|
||||
bool ad9361_disable_lo_remote(std::string remote_host);
|
||||
bool ad9361_disable_lo_remote(const std::string &remote_host);
|
||||
|
||||
bool ad9361_disable_lo_local();
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
const size_t PAGE_SIZE = 0x10000;
|
||||
const unsigned int TEST_REGISTER_TRACK_WRITEVAL = 0x55AA;
|
||||
|
||||
fpga_switch::fpga_switch(std::string device_name)
|
||||
fpga_switch::fpga_switch(const std::string &device_name)
|
||||
{
|
||||
if ((d_device_descriptor = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1)
|
||||
{
|
||||
@@ -108,7 +108,7 @@ unsigned fpga_switch::fpga_switch_test_register(
|
||||
|
||||
void fpga_switch::close_device()
|
||||
{
|
||||
unsigned *aux = const_cast<unsigned *>(d_map_base);
|
||||
auto *aux = const_cast<unsigned *>(d_map_base);
|
||||
if (munmap(static_cast<void *>(aux), PAGE_SIZE) == -1)
|
||||
{
|
||||
std::cout << "Failed to unmap memory uio" << std::endl;
|
||||
|
||||
@@ -44,13 +44,13 @@
|
||||
class fpga_switch
|
||||
{
|
||||
public:
|
||||
fpga_switch(std::string device_name);
|
||||
fpga_switch(const std::string& device_name);
|
||||
~fpga_switch();
|
||||
void set_switch_position(int switch_position);
|
||||
|
||||
private:
|
||||
int d_device_descriptor; // driver descriptor
|
||||
volatile unsigned *d_map_base; // driver memory map
|
||||
volatile unsigned* d_map_base; // driver memory map
|
||||
|
||||
// private functions
|
||||
unsigned fpga_switch_test_register(unsigned writeval);
|
||||
|
||||
@@ -126,28 +126,26 @@ double rtl_tcp_dongle_info::clip_gain(int gain) const
|
||||
// no defined gains to clip to
|
||||
return gain;
|
||||
}
|
||||
else
|
||||
{
|
||||
double last_stop = gains.front();
|
||||
BOOST_FOREACH (double g, gains)
|
||||
{
|
||||
g /= 10.0;
|
||||
|
||||
if (gain < g)
|
||||
double last_stop = gains.front();
|
||||
BOOST_FOREACH (double g, gains)
|
||||
{
|
||||
g /= 10.0;
|
||||
|
||||
if (gain < g)
|
||||
{
|
||||
if (std::abs(gain - g) < std::abs(gain - last_stop))
|
||||
{
|
||||
if (std::abs(gain - g) < std::abs(gain - last_stop))
|
||||
{
|
||||
return g;
|
||||
}
|
||||
else
|
||||
{
|
||||
return last_stop;
|
||||
}
|
||||
return g;
|
||||
}
|
||||
else
|
||||
{
|
||||
return last_stop;
|
||||
}
|
||||
last_stop = g;
|
||||
}
|
||||
return last_stop;
|
||||
last_stop = g;
|
||||
}
|
||||
return last_stop;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
class rtl_tcp_dongle_info
|
||||
{
|
||||
private:
|
||||
char magic_[4];
|
||||
char magic_[4]{};
|
||||
uint32_t tuner_type_;
|
||||
uint32_t tuner_gain_count_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user