mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-02-15 02:20:09 +00:00
adding more data types
This commit is contained in:
parent
bd01c841c9
commit
3dcac855b8
@ -128,6 +128,7 @@ include_directories(
|
||||
${GFlags_INCLUDE_DIRS}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${GNURADIO_RUNTIME_INCLUDE_DIRS}
|
||||
${VOLK_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
if(ARCH_64BITS)
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include <exception>
|
||||
#include <gflags/gflags.h>
|
||||
#include <glog/logging.h>
|
||||
#include <volk/volk.h>
|
||||
#include "gnss_sdr_valve.h"
|
||||
#include "configuration_interface.h"
|
||||
|
||||
@ -82,11 +83,11 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
|
||||
}
|
||||
else if (item_type_.compare("short") == 0)
|
||||
{
|
||||
item_size_ = sizeof(short int);
|
||||
item_size_ = sizeof(int16_t);
|
||||
}
|
||||
else if (item_type_.compare("byte") == 0)
|
||||
{
|
||||
item_size_ = sizeof(char);
|
||||
item_size_ = sizeof(int8_t);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <iostream>
|
||||
#include <uhd/types/device_addr.hpp>
|
||||
#include <uhd/exception.hpp>
|
||||
#include <volk/volk.h>
|
||||
#include <glog/logging.h>
|
||||
#include "configuration_interface.h"
|
||||
#include "gnss_sdr_valve.h"
|
||||
@ -48,7 +49,7 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
|
||||
// DUMP PARAMETERS
|
||||
std::string empty = "";
|
||||
std::string default_dump_file = "./data/signal_source.dat";
|
||||
std::string default_item_type = "short";
|
||||
std::string default_item_type = "cshort";
|
||||
samples_ = configuration->property(role + ".samples", 0);
|
||||
dump_ = configuration->property(role + ".dump", false);
|
||||
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
|
||||
@ -71,13 +72,6 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
|
||||
IF_bandwidth_hz_ = configuration->property(role + ".IF_bandwidth_hz", sample_rate_/2);
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
|
||||
if (item_type_.compare("short") == 0)
|
||||
{
|
||||
item_size_ = sizeof(short);
|
||||
}
|
||||
else if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
// 1. Make the uhd driver instance
|
||||
//uhd_source_= uhd::usrp::multi_usrp::make(dev_addr);
|
||||
|
||||
@ -88,9 +82,27 @@ 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].
|
||||
//uhd_source_ = uhd_make_usrp_source(dev_addr, uhd::stream_args_t("fc32"));
|
||||
if (item_type_.compare("cbyte") == 0)
|
||||
{
|
||||
item_size_ = sizeof(lv_8sc_t);
|
||||
uhd_source_ = gr::uhd::usrp_source::make(dev_addr, uhd::stream_args_t("sc8"));
|
||||
}
|
||||
else if (item_type_.compare("cshort") == 0)
|
||||
{
|
||||
item_size_ = sizeof(lv_16sc_t);
|
||||
uhd_source_ = gr::uhd::usrp_source::make(dev_addr, uhd::stream_args_t("sc16"));
|
||||
}
|
||||
else if (item_type_.compare("gr_complex") == 0)
|
||||
{
|
||||
item_size_ = sizeof(gr_complex);
|
||||
uhd_source_ = gr::uhd::usrp_source::make(dev_addr, uhd::stream_args_t("fc32"));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(WARNING) << item_type_ << " unrecognized item type. Using cshort.";
|
||||
item_size_ = sizeof(lv_16sc_t);
|
||||
uhd_source_ = gr::uhd::usrp_source::make(dev_addr, uhd::stream_args_t("sc16"));
|
||||
}
|
||||
|
||||
// 2.1 set sampling clock reference
|
||||
// Set the clock source for the usrp device.
|
||||
@ -153,12 +165,6 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
|
||||
// For daughterboards, see http://files.ettus.com/uhd_docs/manual/html/dboards.html
|
||||
// "0" is valid for DBSRX, DBSRX2, WBX Series
|
||||
uhd_source_->set_subdev_spec(subdevice_, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(WARNING) << item_type_ << " unrecognized item type. Using short.";
|
||||
item_size_ = sizeof(short);
|
||||
}
|
||||
|
||||
if (samples_ != 0)
|
||||
{
|
||||
@ -170,7 +176,6 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
|
||||
if (dump_)
|
||||
{
|
||||
LOG(INFO) << "Dumping output into file " << dump_filename_;
|
||||
//file_sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str());
|
||||
file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str());
|
||||
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user