Merge pull request #9 from anthony-arnold/tcp

A new signal source block for rtl_tcp.
This commit is contained in:
Carles Fernandez 2015-05-19 17:00:13 +02:00
commit 0fa39f6e3b
16 changed files with 1199 additions and 70 deletions

View File

@ -9,7 +9,7 @@
;internal_fs_hz: Internal signal sampling frequency after the signal conditioning stage [Hz].
;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE
; i.e. using front-end-cal as reported here:http://www.cttc.es/publication/turning-a-television-into-a-gnss-receiver/
GNSS-SDR.internal_fs_hz=1999898
GNSS-SDR.internal_fs_hz=1200000
;######### CONTROL_THREAD CONFIG ############
ControlThread.wait_for_flowgraph=false
@ -28,7 +28,7 @@ GNSS-SDR.SUPL_CI=0x31b0
;######### SIGNAL_SOURCE CONFIG ############
;#implementation: Use [File_Signal_Source] or [UHD_Signal_Source] or [GN3S_Signal_Source] [Osmosdr_Signal_Source]
SignalSource.implementation=Osmosdr_Signal_Source
SignalSource.implementation=RtlTcp_Signal_Source
;#filename: path to file with the captured GNSS signal samples to be processed
SignalSource.filename=/media/DATALOGGER_/signals/RTL-SDR/geo/pmt4.dat
@ -39,7 +39,7 @@ SignalSource.item_type=gr_complex
;#sampling_frequency: Original Signal sampling frequency in [Hz]
;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE
; i.e. using front-end-cal as reported here:http://www.cttc.es/publication/turning-a-television-into-a-gnss-receiver/
SignalSource.sampling_frequency=2000000
SignalSource.sampling_frequency=1200000
;#freq: RF front-end center frequency in [Hz]
SignalSource.freq=1575420000
@ -72,9 +72,14 @@ SignalSource.dump_filename=../data/signal_source.dat
; it helps to not overload the CPU, but the processing time will be longer.
SignalSource.enable_throttle_control=false
;#Send optional arguments to the OsmoSdr Gnuradio block
;#Arguments are comma-delimited. See http://sdr.osmocom.org/trac/wiki/GrOsmoSDR for documentation.
SignalSource.osmosdr_args=rtl_tcp,offset_tune=1
;#Address of the rtl_tcp server (IPv6 allowed)
SignalSource.address=127.0.0.1
;#Port of the rtl_tcp server
SignalSource.port=1234
;# Set to true if I/Q samples come swapped
SignalSource.swap_iq=false
;######### SIGNAL_CONDITIONER CONFIG ############
;## It holds blocks to change data type, filter and resample input data.
@ -157,7 +162,7 @@ InputFilter.grid_density=16
;#InputFilter.IF is the intermediate frequency (in Hz) shifted down to zero Hz
;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE
; i.e. using front-end-cal as reported here:http://www.cttc.es/publication/turning-a-television-into-a-gnss-receiver/
InputFilter.sampling_frequency=1999898
InputFilter.sampling_frequency=1200000
;# IF deviation due to front-end LO inaccuracies [HZ]
InputFilter.IF=80558

View File

@ -16,5 +16,6 @@
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
#
add_subdirectory(libs)
add_subdirectory(adapters)
add_subdirectory(gnuradio_blocks)

View File

@ -25,7 +25,7 @@ if(ENABLE_GN3S)
# find_package(GrGN3S)
# if not found, build it with ExternalPackage_Add
include(ExternalProject)
include(ExternalProject)
ExternalProject_Add(
gr-gn3s
SOURCE_DIR ${CMAKE_SOURCE_DIR}/drivers/gr-gn3s
@ -34,21 +34,21 @@ if(ENABLE_GN3S)
PATCH_COMMAND ""
INSTALL_COMMAND ""
)
# Set up variables
set(GRGN3S_INCLUDE_DIRS ${GRGN3S_DIR}/include ${GRGN3S_DIR} ${GRGN3S_DIR}/src)
set(GRGN3S_LIBRARIES
set(GRGN3S_LIBRARIES
"${CMAKE_CURRENT_BINARY_DIR}/../../../../gr-gn3s/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gr-gn3s${CMAKE_SHARED_LIBRARY_SUFFIX}"
)
)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${GRGN3S_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${GRGN3S_INCLUDE_DIRS})
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} gn3s_signal_source.cc)
# Copy GN3S firmware binary file to install folder
message(STATUS "Copying the GN3S firmware binary file to install folder")
file(COPY ${CMAKE_SOURCE_DIR}/firmware/GN3S_v2/bin/gn3s_firmware.ihx
message(STATUS "Copying the GN3S firmware binary file to install folder")
file(COPY ${CMAKE_SOURCE_DIR}/firmware/GN3S_v2/bin/gn3s_firmware.ihx
DESTINATION ${CMAKE_SOURCE_DIR}/install/
)
)
endif(ENABLE_GN3S)
if(ENABLE_FLEXIBAND)
@ -61,15 +61,15 @@ if(ENABLE_FLEXIBAND)
find_package(teleorbit REQUIRED)
if(NOT TELEORBIT_FOUND)
message(FATAL_ERROR "Teleorbit Flexiband GNURadio driver required to build gnss-sdr with the optional FLEXIBAND adapter")
endif(NOT TELEORBIT_FOUND)
endif(NOT TELEORBIT_FOUND)
# Set up variables
set(FLEXIBAND_DRIVER_INCLUDE_DIRS
${OPT_DRIVER_INCLUDE_DIRS}
set(FLEXIBAND_DRIVER_INCLUDE_DIRS
${OPT_DRIVER_INCLUDE_DIRS}
${TELEORBIT_INCLUDE_DIR}/teleorbit
)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${TELEORBIT_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${FLEXIBAND_DRIVER_INCLUDE_DIRS})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${FLEXIBAND_DRIVER_INCLUDE_DIRS})
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} flexiband_signal_source.cc)
endif(ENABLE_FLEXIBAND)
@ -83,7 +83,7 @@ if(ENABLE_ARRAY)
endif(OS_IS_MACOSX)
# find_package(GrDbfcttc)
# if not found, build it with ExternalPackage_Add
include(ExternalProject)
include(ExternalProject)
ExternalProject_Add(
gr-dbfcttc
SOURCE_DIR ${CMAKE_SOURCE_DIR}/drivers/gr-dbfcttc
@ -93,12 +93,12 @@ if(ENABLE_ARRAY)
CMAKE_ARGS ${MACOSX_ARGS}
INSTALL_COMMAND ""
)
# Set up variables
set(GRDBFCTTC_INCLUDE_DIRS ${GRDBFCTTC_DIR}/include ${GRDBFCTTC_DIR} ${GRDBFCTTC_DIR}/src)
set(GRDBFCTTC_LIBRARIES
set(GRDBFCTTC_LIBRARIES
"${CMAKE_CURRENT_BINARY_DIR}/../../../../gr-dbfcttc/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gnuradio-dbfcttc${CMAKE_SHARED_LIBRARY_SUFFIX}"
)
)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${GRDBFCTTC_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${GRDBFCTTC_INCLUDE_DIRS})
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} raw_array_signal_source.cc)
@ -108,33 +108,34 @@ endif(ENABLE_ARRAY)
if(ENABLE_OSMOSDR)
################################################################################
# OsmoSDR - http://sdr.osmocom.org/trac/
################################################################################
################################################################################
find_package(GrOsmoSDR REQUIRED)
if(NOT GROSMOSDR_FOUND)
message(FATAL_ERROR "gr-osmosdr required to build gnss-sdr with the optional OSMOSDR driver")
endif(NOT GROSMOSDR_FOUND)
endif(NOT GROSMOSDR_FOUND)
# set OSMO include dirs
set(OSMO_DRIVER_INCLUDE_DIRS
${OPT_DRIVER_INCLUDE_DIRS}
set(OSMO_DRIVER_INCLUDE_DIRS
${OPT_DRIVER_INCLUDE_DIRS}
${GROSMOSDR_INCLUDE_DIR}/osmosdr
)
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} osmosdr_signal_source.cc)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${GROSMOSDR_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${OSMO_DRIVER_INCLUDE_DIRS})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${OSMO_DRIVER_INCLUDE_DIRS})
endif(ENABLE_OSMOSDR)
if(ENABLE_UHD)
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} uhd_signal_source.cc)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${UHD_LIBRARIES} ${GNURADIO_UHD_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${UHD_INCLUDE_DIRS})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${UHD_INCLUDE_DIRS})
endif(ENABLE_UHD)
set(SIGNAL_SOURCE_ADAPTER_SOURCES file_signal_source.cc
gen_signal_source.cc
nsr_file_signal_source.cc
set(SIGNAL_SOURCE_ADAPTER_SOURCES file_signal_source.cc
gen_signal_source.cc
nsr_file_signal_source.cc
spir_file_signal_source.cc
rtl_tcp_signal_source.cc
${OPT_DRIVER_SOURCES}
)
@ -145,9 +146,10 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/core/system_parameters
${CMAKE_SOURCE_DIR}/src/core/interfaces
${CMAKE_SOURCE_DIR}/src/algorithms/libs
${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/libs
${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/gnuradio_blocks
${GLOG_INCLUDE_DIRS}
${GFlags_INCLUDE_DIRS}
${GFlags_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${GNURADIO_RUNTIME_INCLUDE_DIRS}
${VOLK_INCLUDE_DIRS}
@ -162,10 +164,10 @@ add_definitions(-DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}")
file(GLOB SIGNAL_SOURCE_ADAPTER_HEADERS "*.h")
add_library(signal_source_adapters ${SIGNAL_SOURCE_ADAPTER_SOURCES} ${SIGNAL_SOURCE_ADAPTER_HEADERS})
source_group(Headers FILES ${SIGNAL_SOURCE_ADAPTER_HEADERS})
target_link_libraries(signal_source_adapters signal_source_gr_blocks
${Boost_LIBRARIES}
${GNURADIO_PMT_LIBRARIES}
${GNURADIO_BLOCKS_LIBRARIES}
${OPT_LIBRARIES}
target_link_libraries(signal_source_adapters signal_source_gr_blocks
${Boost_LIBRARIES}
${GNURADIO_PMT_LIBRARIES}
${GNURADIO_BLOCKS_LIBRARIES}
${OPT_LIBRARIES}
gnss_sp_libs
)

View File

@ -0,0 +1,187 @@
/*!
* \file rtl_tcp_signal_source.cc
* \brief Signal source for the Realtek RTL2832U USB dongle DVB-T receiver
* over TCP.
* (see http://sdr.osmocom.org/trac/wiki/rtl-sdr for more information)
* \author Anthony Arnold, 2015. anthony.arnold(at)uqconnect.edu.au
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include "rtl_tcp_signal_source.h"
#include <glog/logging.h>
#include <iostream>
#include <boost/format.hpp>
#include "configuration_interface.h"
#include "gnss_sdr_valve.h"
#include "GPS_L1_CA.h"
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)
{
// DUMP PARAMETERS
std::string empty = "";
std::string default_dump_file = "./data/signal_source.dat";
std::string default_item_type = "gr_complex";
samples_ = configuration->property(role + ".samples", 0);
dump_ = configuration->property(role + ".dump", false);
dump_filename_ = configuration->property(role + ".dump_filename",
default_dump_file);
// rtl_tcp PARAMTERS
std::string default_address = "127.0.0.1";
short 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", (double)40.0);
rf_gain_ = configuration->property(role + ".rf_gain", (double)40.0);
if_gain_ = configuration->property(role + ".if_gain", (double)40.0);
sample_rate_ = configuration->property(role + ".sampling_frequency", (double)2.0e6);
item_type_ = configuration->property(role + ".item_type", default_item_type);
address_ = configuration->property(role + ".address", default_address);
port_ = configuration->property(role + ".port", default_port);
flip_iq_ = configuration->property(role + ".flip_iq", false);
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 gr block
try
{
std::cout << "Connecting to " << address_ << ":" << port_ << std::endl;
LOG (INFO) << "Connecting to " << address_ << ":" << port_;
signal_source_ = rtl_tcp_make_signal_source_c (address_, port_, flip_iq_);
}
catch( boost::exception & e )
{
DLOG(FATAL) << "Boost exception: " << boost::diagnostic_information(e);
}
// 2 set sampling rate
signal_source_->set_sample_rate(sample_rate_);
// 3. set rx frequency
signal_source_->set_frequency(freq_);
// 4. set rx gain
signal_source_->set_agc_mode(true);
if (this->AGC_enabled_ == true)
{
std::cout << "AGC enabled" << std::endl;
LOG(INFO) << "AGC enabled";
signal_source_->set_agc_mode(true);
}
else
{
std::cout << "AGC disabled" << std::endl;
LOG(INFO) << "AGC disabled";
signal_source_->set_agc_mode(false);
std::cout << "Setting gain to " << gain_ << std::endl;
LOG(INFO) << "Setting gain to " << gain_;
signal_source_->set_gain(gain_);
std::cout << "Setting IF gain to " << if_gain_ << std::endl;
LOG(INFO) << "Setting IF gain to " << if_gain_;
signal_source_->set_if_gain(if_gain_);
}
}
else
{
LOG(WARNING) << item_type_ << " unrecognized item type. Using short.";
item_size_ = sizeof(short);
}
if (samples_ != 0)
{
DLOG(INFO) << "Send STOP signal after " << samples_ << " samples";
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_);
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
}
if (dump_)
{
DLOG(INFO) << "Dumping output into file " << dump_filename_;
file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str());
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
}
}
RtlTcpSignalSource::~RtlTcpSignalSource()
{}
void RtlTcpSignalSource::connect(gr::top_block_sptr top_block) {
if ( samples_ ) {
top_block->connect (signal_source_, 0, valve_, 0);
DLOG(INFO) << "connected rtl tcp source to valve";
if ( dump_ ) {
top_block->connect(valve_, 0, file_sink_, 0);
DLOG(INFO) << "connected valve to file sink";
}
}
else if ( dump_ ) {
top_block->connect(signal_source_, 0, file_sink_, 0);
DLOG(INFO) << "connected rtl tcp source to file sink";
}
}
void RtlTcpSignalSource::disconnect(gr::top_block_sptr top_block) {
if ( samples_ ) {
top_block->disconnect (signal_source_, 0, valve_, 0);
if ( dump_ ) {
top_block->disconnect(valve_, 0, file_sink_, 0);
}
}
else if ( dump_ ) {
top_block->disconnect(signal_source_, 0, file_sink_, 0);
}
}
gr::basic_block_sptr RtlTcpSignalSource::get_left_block() {
LOG(WARNING) << "Trying to get signal source left block.";
return gr::basic_block_sptr();
}
gr::basic_block_sptr RtlTcpSignalSource::get_right_block() {
if (samples_ != 0) {
return valve_;
}
else {
return signal_source_;
}
}

View File

@ -0,0 +1,113 @@
/*!
* \file rtl_tcp_signal_source.h
* \brief Signal source which reads from rtl_tcp.
* (see http://sdr.osmocom.org/trac/wiki/rtl-sdr for more information)
* \author Anthony Arnold, 2015. anthony.arnold(at)uqconnect.edu.au
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_H
#define GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_H
#include <string>
#include <boost/shared_ptr.hpp>
#include <gnuradio/msg_queue.h>
#include <gnuradio/blocks/file_sink.h>
#include <gnuradio/blocks/deinterleave.h>
#include <gnuradio/blocks/float_to_complex.h>
#include "rtl_tcp_signal_source_c.h"
#include "gnss_block_interface.h"
class ConfigurationInterface;
/*!
* \brief This class reads from rtl_tcp, which streams interleaved
* I/Q samples over TCP.
* (see http://sdr.osmocom.org/trac/wiki/rtl-sdr)
*/
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);
virtual ~RtlTcpSignalSource();
std::string role()
{
return role_;
}
/*!
* \brief Returns "RtlTcp_Signal_Source"
*/
std::string implementation()
{
return "RtlTcp_Signal_Source";
}
size_t item_size()
{
return item_size_;
}
void connect(gr::top_block_sptr top_block);
void disconnect(gr::top_block_sptr top_block);
gr::basic_block_sptr get_left_block();
gr::basic_block_sptr get_right_block();
private:
std::string role_;
// rtl_tcp settings
std::string address_;
short port_;
bool AGC_enabled_;
double sample_rate_;
bool flip_iq_;
unsigned int in_stream_;
unsigned int out_stream_;
double freq_;
double gain_;
double if_gain_;
double rf_gain_;
std::string item_type_;
size_t item_size_;
long samples_;
bool dump_;
std::string dump_filename_;
rtl_tcp_signal_source_c_sptr signal_source_;
boost::shared_ptr<gr::block> valve_;
gr::blocks::file_sink::sptr file_sink_;
boost::shared_ptr<gr::msg_queue> queue_;
};
#endif /*GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_H */

View File

@ -17,19 +17,22 @@
#
set(SIGNAL_SOURCE_GR_BLOCKS_SOURCES
set(SIGNAL_SOURCE_GR_BLOCKS_SOURCES
unpack_byte_2bit_samples.cc
unpack_intspir_1bit_samples.cc
rtl_tcp_signal_source_c.cc
)
include_directories(
$(CMAKE_CURRENT_SOURCE_DIR)
${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/libs
${GLOG_INCLUDE_DIRS}
${GFlags_INCLUDE_DIRS}
${GNURADIO_RUNTIME_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
file(GLOB SIGNAL_SOURCE_GR_BLOCKS_HEADERS "*.h")
add_library(signal_source_gr_blocks ${SIGNAL_SOURCE_GR_BLOCKS_SOURCES} ${SIGNAL_SOURCE_GR_BLOCKS_HEADERS})
source_group(Headers FILES ${SIGNAL_SOURCE_GR_BLOCKS_HEADERS})
target_link_libraries(signal_source_gr_blocks ${GNURADIO_RUNTIME_LIBRARIES})
target_link_libraries(signal_source_gr_blocks signal_source_lib ${GNURADIO_RUNTIME_LIBRARIES} ${Boost_LIBRARIES})

View File

@ -0,0 +1,321 @@
/*!
* \file rtl_tcp_signal_source_c.cc
* \brief An rtl_tcp signal source reader.
* \author Anthony Arnold, 2015. anthony.arnold(at)uqconnect.edu.au
*
* This module contains logic taken from gr-omsosdr
* <http://git.osmocom.org/gr-osmosdr>
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include "rtl_tcp_signal_source_c.h"
#include "rtl_tcp_commands.h"
#include <glog/logging.h>
#include <boost/thread/thread.hpp>
#include <map>
using google::LogMessage;
namespace ip = boost::asio::ip;
using boost::asio::ip::tcp;
// Buffer constants
// TODO: Make these configurable
enum {
RTL_TCP_BUFFER_SIZE = 1024 * 16, // 16 KB
RTL_TCP_PAYLOAD_SIZE = 1024 * 4 // 4 KB
};
rtl_tcp_signal_source_c_sptr
rtl_tcp_make_signal_source_c(const std::string &address,
short port,
bool flip_iq)
{
return gnuradio::get_initial_sptr (new rtl_tcp_signal_source_c (address,
port,
flip_iq));
}
rtl_tcp_signal_source_c::rtl_tcp_signal_source_c(const std::string &address,
short port,
bool flip_iq)
: gr::sync_block ("rtl_tcp_signal_source_c",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(1, 1, sizeof(gr_complex))),
socket_ (io_service_),
data_ (RTL_TCP_PAYLOAD_SIZE),
flip_iq_(flip_iq),
buffer_ (RTL_TCP_BUFFER_SIZE),
unread_ (0)
{
boost::system::error_code ec;
// 1. Setup lookup table
for (unsigned i = 0; i < 0xff; i++) {
lookup_[i] = ((float)(i & 0xff) - 127.4f) * (1.0f / 128.0f);
}
// 2. Set socket options
ip::address addr = ip::address::from_string (address, ec);
if (ec) {
std::cout << address << " is not an IP address" << std::endl;
LOG (ERROR) << address << " is not an IP address";
return;
}
ip::tcp::endpoint ep (addr, port);
socket_.open (ep.protocol( ), ec);
if (ec) {
std::cout << "Failed to open socket." << std::endl;
LOG (ERROR) << "Failed to open socket.";
}
socket_.set_option (boost::asio::socket_base::reuse_address (true), ec);
if (ec) {
std::cout << "Failed to set reuse address option: " << ec << std::endl;
LOG (WARNING) << "Failed to set reuse address option";
}
socket_.set_option (boost::asio::socket_base::linger (true, 0), ec);
if (ec) {
std::cout << "Failed to set linger option: " << ec << std::endl;
LOG (WARNING) << "Failed to set linger option";
}
// 3. Connect socket
socket_.connect(ep, ec);
if (ec) {
std::cout << "Failed to connect to " << addr << ":" << port
<< "(" << ec << ")" << std::endl;
LOG (ERROR) << "Failed to connect to " << addr << ":" << port
<< "(" << ec << ")";
return;
}
std::cout << "Connected to " << addr << ":" << port << std::endl;
LOG (INFO) << "Connected to " << addr << ":" << port;
// 4. Set nodelay
socket_.set_option (tcp::no_delay (true), ec);
if (ec) {
std::cout << "Failed to set no delay option." << std::endl;
LOG (WARNING) << "Failed to set no delay option";
}
// 5. Receive dongle info
ec = info_.read (socket_);
if (ec) {
std::cout << "Failed to read dongle info." << std::endl;
LOG (WARNING) << "Failed to read dongle info";
}
else if (info_.is_valid ()) {
std::cout << "Found " << info_.get_type_name() << " tuner." << std::endl;
LOG (INFO) << "Found " << info_.get_type_name() << " tuner.";
}
// 6. Start reading
boost::asio::async_read (socket_, boost::asio::buffer (data_),
boost::bind (&rtl_tcp_signal_source_c::handle_read,
this, _1, _2));
boost::thread (boost::bind (&boost::asio::io_service::run, &io_service_));
}
rtl_tcp_signal_source_c::~rtl_tcp_signal_source_c()
{
io_service_.stop ();
}
int rtl_tcp_signal_source_c::work (int noutput_items,
gr_vector_const_void_star &/*input_items*/,
gr_vector_void_star &output_items)
{
gr_complex *out = reinterpret_cast <gr_complex *>( output_items[0] );
int i = 0;
if (io_service_.stopped ()) {
return -1;
}
{
boost::mutex::scoped_lock lock (mutex_);
not_empty_.wait (lock, boost::bind (&rtl_tcp_signal_source_c::not_empty,
this));
for ( ; i < noutput_items && unread_ > 1; i++ ) {
float re = buffer_[--unread_];
float im = buffer_[--unread_];
if (flip_iq_) {
out[i] = gr_complex (im, re);
}
else {
out[i] = gr_complex (re, im);
}
}
}
not_full_.notify_one ();
return i == 0 ? -1 : i;
}
void rtl_tcp_signal_source_c::set_frequency (int frequency) {
boost::system::error_code ec =
rtl_tcp_command (RTL_TCP_SET_FREQUENCY, frequency, socket_);
if (ec) {
std::cout << "Failed to set frequency" << std::endl;
LOG (WARNING) << "Failed to set frequency";
}
}
void rtl_tcp_signal_source_c::set_sample_rate (int sample_rate) {
boost::system::error_code ec =
rtl_tcp_command (RTL_TCP_SET_SAMPLE_RATE, sample_rate, socket_);
if (ec) {
std::cout << "Failed to set sample rate" << std::endl;
LOG (WARNING) << "Failed to set sample rate";
}
}
void rtl_tcp_signal_source_c::set_agc_mode (bool agc) {
boost::system::error_code ec =
rtl_tcp_command (RTL_TCP_SET_GAIN_MODE, !agc, socket_);
if (ec) {
std::cout << "Failed to set gain mode" << std::endl;
LOG (WARNING) << "Failed to set gain mode";
}
ec =
rtl_tcp_command (RTL_TCP_SET_AGC_MODE, agc, socket_);
if (ec) {
std::cout << "Failed to set gain mode" << std::endl;
LOG (WARNING) << "Failed to set gain mode";
}
}
void rtl_tcp_signal_source_c::set_gain (int gain) {
unsigned 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) {
std::cout << "Failed to set gain" << std::endl;
LOG (WARNING) << "Failed to set gain";
}
}
void rtl_tcp_signal_source_c::set_if_gain (int gain) {
// from gr-osmosdr
struct range {
double start, stop, step;
};
if (info_.get_tuner_type () != rtl_tcp_dongle_info::TUNER_E4000) {
return;
}
std::vector<range> ranges = {
{ -3, 6, 9 },
{ 0, 9, 3 },
{ 0, 9, 3 },
{ 0, 2, 1 },
{ 3, 15, 3},
{ 3, 15, 3}
};
std::map <int, double> gains;
for (int i = 0; i < static_cast<int>(ranges.size ()); i++) {
gains[i+1] = ranges[i].start;
}
for (int i = ranges.size() - 1; i >= 0; i--) {
const range &r = ranges[i];
double error = gain;
for (double g = r.start; g < r.stop; g += r.step) {
double sum = 0;
for (int j = 0; j < static_cast<int> ( gains.size() ); j++) {
if (i == j) {
sum += g;
}
else {
sum += gains[j + 1];
}
}
double err = std::abs (gain - sum);
if (err < error) {
error = err;
gains[i+1] = g;
}
}
}
for (unsigned stage = 1; stage <= gains.size(); stage++) {
int stage_gain = static_cast<int>( gains[stage] * 10 );
unsigned param = (stage << 16) | (stage_gain & 0xffff);
boost::system::error_code ec =
rtl_tcp_command (RTL_TCP_SET_IF_GAIN, param, socket_);
if (ec) {
std::cout << "Failed to set if gain" << std::endl;
LOG (WARNING) << "Failed to set if gain";
}
}
}
void
rtl_tcp_signal_source_c::handle_read (const boost::system::error_code &ec,
size_t bytes_transferred)
{
if (ec) {
std::cout << "Error during read: " << ec << std::endl;
LOG (WARNING) << "Error during read: " << ec;
boost::mutex::scoped_lock lock (mutex_);
io_service_.stop ();
not_empty_.notify_one ();
}
else {
{
// Unpack read data
boost::mutex::scoped_lock lock (mutex_);
not_full_.wait (lock,
boost::bind (&rtl_tcp_signal_source_c::not_full,
this));
for (size_t i = 0; i < bytes_transferred; i++) {
while (!not_full( )) {
// uh-oh, buffer overflow
// wait until there's space for more
not_empty_.notify_one ();
not_full_.wait (lock,
boost::bind (&rtl_tcp_signal_source_c::not_full,
this));
}
buffer_.push_front (lookup_[data_[i]]);
unread_++;
}
}
// let woker know that more data is available
not_empty_.notify_one ();
// Read some more
boost::asio::async_read (socket_,
boost::asio::buffer (data_),
boost::bind (&rtl_tcp_signal_source_c::handle_read,
this, _1, _2));
}
}

View File

@ -0,0 +1,123 @@
/*!
* \file rtl_tcp_signal_source_c.h
* \brief Interface of an rtl_tcp signal source reader.
* \author Anthony Arnold, 2015. anthony.arnold(at)uqconnect.edu.au
*
* The implementation of this block is a combination of various helpful
* sources. The data format and command structure is taken from the
* original Osmocom rtl_tcp_source_f (http://git.osmocom.org/gr-osmosdr).
* The aynchronous reading code comes from the examples provides
* by Boost.Asio and the bounded buffer producer-consumer solution is
* taken from the Boost.CircularBuffer examples (http://boost.org/).
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_C_H
#define GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_C_H
#include "rtl_tcp_dongle_info.h"
#include <boost/asio.hpp>
#include <gnuradio/sync_block.h>
#include <string>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <boost/array.hpp>
#include <boost/circular_buffer.hpp>
class rtl_tcp_signal_source_c;
typedef boost::shared_ptr<rtl_tcp_signal_source_c>
rtl_tcp_signal_source_c_sptr;
rtl_tcp_signal_source_c_sptr
rtl_tcp_make_signal_source_c(const std::string &address,
short port,
bool flip_iq = false);
/*!
* \brief This class reads interleaved I/Q samples
* from an rtl_tcp server and outputs complex types.
*/
class rtl_tcp_signal_source_c : public gr::sync_block
{
public:
~rtl_tcp_signal_source_c();
int work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
void set_frequency (int frequency);
void set_sample_rate (int sample_rate);
void set_agc_mode (bool agc);
void set_gain (int gain);
void set_if_gain (int gain);
private:
typedef boost::circular_buffer_space_optimized<float> buffer_type;
friend rtl_tcp_signal_source_c_sptr
rtl_tcp_make_signal_source_c(const std::string &address,
short port,
bool flip_iq);
rtl_tcp_signal_source_c(const std::string &address,
short port,
bool flip_iq);
rtl_tcp_dongle_info info_;
// IO members
boost::asio::io_service io_service_;
boost::asio::ip::tcp::socket socket_;
std::vector<unsigned char> data_;
bool flip_iq_;
// producer-consumer helpers
boost::mutex mutex_;
boost::condition not_full_;
boost::condition not_empty_;
buffer_type buffer_;
size_t unread_;
// lookup for scaling data
boost::array<float, 0xff> lookup_;
// async read callback
void handle_read (const boost::system::error_code &ec,
size_t bytes_transferred);
inline bool not_full ( ) const {
return unread_ < buffer_.capacity( );
}
inline bool not_empty ( ) const {
return unread_ > 0 || io_service_.stopped ();
}
};
#endif //GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_C_H

View File

@ -0,0 +1,25 @@
# Copyright (C) 2012-2015 (see AUTHORS file for a list of contributors)
#
# This file is part of GNSS-SDR.
#
# GNSS-SDR is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GNSS-SDR is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
#
set (SIGNAL_SOURCE_LIB_SOURCES
rtl_tcp_commands.cc
rtl_tcp_dongle_info.cc)
file(GLOB SIGNAL_SOURCE_LIB_HEADERS "*.h")
add_library(signal_source_lib ${SIGNAL_SOURCE_LIB_SOURCES} ${SIGNAL_SOURCE_LIB_HEADERS})
source_group(Headers FILES ${SIGNAL_SOURCE_LIB_HEADERS})

View File

@ -0,0 +1,53 @@
/*!
* \file rtl_tcp_commands.cc
* \brief Defines methods for communicating with rtl_tcp
* \author Anthony Arnold, 2015. anthony.arnold(at)uqconnect.edu.au
*
* This file contains information taken from librtlsdr:
* http://git.osmocom.org/rtl-sdr/
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include "rtl_tcp_commands.h"
#include <string.h>
using boost::asio::ip::tcp;
boost::system::error_code
rtl_tcp_command (RTL_TCP_COMMAND id, unsigned param, tcp::socket &socket) {
// Data payload
unsigned char data[sizeof (unsigned char) + sizeof (unsigned)];
data[0] = static_cast<unsigned char> (id);
unsigned nparam =
boost::asio::detail::socket_ops::host_to_network_long (param);
::memcpy (&data[1], &nparam, sizeof (nparam));
boost::system::error_code ec;
socket.send (boost::asio::buffer (data), 0, ec);
return ec;
}

View File

@ -0,0 +1,55 @@
/*!
* \file rtl_tcp_commands.h
* \brief Defines structures and constants for communicating with rtl_tcp
* \author Anthony Arnold, 2015. anthony.arnold(at)uqconnect.edu.au
*
* This file contains information taken from librtlsdr:
* http://git.osmocom.org/rtl-sdr/
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_RTL_TCP_COMMANDS_H
#define GNSS_SDR_RTL_TCP_COMMANDS_H
#include <boost/asio/ip/tcp.hpp>
/// Command IDs for configuration rtl_tcp
enum RTL_TCP_COMMAND {
RTL_TCP_SET_FREQUENCY = 1,
RTL_TCP_SET_SAMPLE_RATE = 2,
RTL_TCP_SET_GAIN_MODE = 3,
RTL_TCP_SET_GAIN = 4,
RTL_TCP_SET_IF_GAIN = 6,
RTL_TCP_SET_AGC_MODE = 8
};
/*!
* \brief Send a command to rtl_tcp over the given socket.
*/
boost::system::error_code
rtl_tcp_command (RTL_TCP_COMMAND id, unsigned param,
boost::asio::ip::tcp::socket &socket);
#endif // GNSS_SDR_RTL_TCP_COMMANDS_H

View File

@ -0,0 +1,144 @@
/*!
* \file rtl_tcp_dongle_info.cc
* \brief Defines methods for retrieving and validating rtl_tcp donle
* info.
* \author Anthony Arnold, 2015. anthony.arnold(at)uqconnect.edu.au
*
* This file contains information taken from librtlsdr:
* http://git.osmocom.org/rtl-sdr/
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include "rtl_tcp_dongle_info.h"
#include <string.h>
#include <boost/foreach.hpp>
using boost::asio::ip::tcp;
rtl_tcp_dongle_info::rtl_tcp_dongle_info ()
: tuner_type_ (0), tuner_gain_count_ (0)
{
::memset (magic_, 0, sizeof (magic_));
}
boost::system::error_code rtl_tcp_dongle_info::read (tcp::socket &socket) {
boost::system::error_code ec;
unsigned char data[sizeof (char) * 4 + sizeof (uint32_t) * 2];
socket.receive (boost::asio::buffer (data), 0, ec);
if (!ec) {
::memcpy (magic_, data, 4);
uint32_t type;
::memcpy (&type, &data[4], 4);
tuner_type_ =
boost::asio::detail::socket_ops::network_to_host_long (type);
uint32_t count;
::memcpy (&count, &data[8], 4);
tuner_gain_count_ =
boost::asio::detail::socket_ops::network_to_host_long (count);
}
return ec;
}
const char *rtl_tcp_dongle_info::get_type_name () const {
switch (get_tuner_type()) {
default:
return "UNKNOWN";
case TUNER_E4000:
return "E4000";
case TUNER_FC0012:
return "FC0012";
case TUNER_FC0013:
return "FC0013";
case TUNER_FC2580:
return "FC2580";
case TUNER_R820T:
return "R820T";
case TUNER_R828D:
return "R828D";
}
}
double rtl_tcp_dongle_info::clip_gain (int gain) const {
// the following gain values have been copied from librtlsdr
// all gain values are expressed in tenths of a dB
std::vector<double> gains;
switch (get_tuner_type()) {
case TUNER_E4000:
gains = { -10, 15, 40, 65, 90, 115, 140, 165, 190, 215,
240, 290, 340, 420 };
break;
case TUNER_FC0012:
gains = { -99, -40, 71, 179, 192 };
break;
case TUNER_FC0013:
gains = { -99, -73, -65, -63, -60, -58, -54, 58, 61,
63, 65, 67, 68, 70, 71, 179, 181, 182,
184, 186, 188, 191, 197 };
break;
case TUNER_R820T:
gains = { 0, 9, 14, 27, 37, 77, 87, 125, 144, 157,
166, 197, 207, 229, 254, 280, 297, 328,
338, 364, 372, 386, 402, 421, 434, 439,
445, 480, 496 };
break;
default:
// no gains
break;
}
// clip
if (gains.size() == 0) {
// 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) {
if (std::abs (gain - g) < std::abs (gain - last_stop)) {
return g;
}
else {
return last_stop;
}
}
last_stop = g;
}
return last_stop;
}
}
bool rtl_tcp_dongle_info::is_valid () const {
return ::memcmp (magic_, "RTL0", 4) == 0;
}

View File

@ -0,0 +1,80 @@
/*!
* \file rtl_tcp_dongle_info.h
* \brief Interface for a structure sent by rtl_tcp defining the hardware.
* \author Anthony Arnold, 2015. anthony.arnold(at)uqconnect.edu.au
*
* This file contains information taken from librtlsdr:
* http://git.osmocom.org/rtl-sdr/
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_RTL_TCP_DONGLE_INFO_H
#define GNSS_SDR_RTL_TCP_DONGLE_INFO_H
#include <boost/asio/ip/tcp.hpp>
/*!
* \brief This class represents the dongle information
* which is sent by rtl_tcp.
*/
class rtl_tcp_dongle_info {
public:
enum {
TUNER_UNKNOWN = 0,
TUNER_E4000,
TUNER_FC0012,
TUNER_FC0013,
TUNER_FC2580,
TUNER_R820T,
TUNER_R828D
};
private:
char magic_[4];
uint32_t tuner_type_;
uint32_t tuner_gain_count_;
public:
rtl_tcp_dongle_info ();
boost::system::error_code read (
boost::asio::ip::tcp::socket &socket);
bool is_valid () const;
const char *get_type_name () const;
double clip_gain (int gain) const;
inline uint32_t get_tuner_type () const {
return tuner_type_;
}
inline uint32_t get_tuner_gain_count () const {
return tuner_gain_count_;
}
};
#endif // GNSS_SDR_RTL_TCP_DONGLE_INFO_H

View File

@ -16,10 +16,10 @@
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
#
set(GNSS_RECEIVER_SOURCES
control_thread.cc
control_message_factory.cc
file_configuration.cc
set(GNSS_RECEIVER_SOURCES
control_thread.cc
control_message_factory.cc
file_configuration.cc
gnss_block_factory.cc
gnss_flowgraph.cc
in_memory_configuration.cc
@ -34,6 +34,7 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-rrlp
${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl
${CMAKE_SOURCE_DIR}/src/algorithms/libs
${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/libs
${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/adapters
${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/gnuradio_blocks
${CMAKE_SOURCE_DIR}/src/algorithms/output_filter/adapters
@ -104,27 +105,27 @@ file(GLOB GNSS_RECEIVER_INTERFACE_HEADERS "../interfaces/*.h")
add_library(gnss_rx ${GNSS_RECEIVER_SOURCES} ${GNSS_RECEIVER_HEADERS} ${GNSS_RECEIVER_INTERFACE_HEADERS})
source_group(Headers FILES ${GNSS_RECEIVER_HEADERS} ${GNSS_RECEIVER_INTERFACE_HEADERS})
target_link_libraries(gnss_rx ${Boost_LIBRARIES}
${ARMADILLO_LIBRARIES}
${GNURADIO_RUNTIME_LIBRARIES}
${GNURADIO_BLOCKS_LIBRARIES}
${GNURADIO_FFT_LIBRARIES}
${GNURADIO_FILTER_LIBRARIES}
gnss_system_parameters
gnss_sp_libs
signal_source_adapters
datatype_adapters
input_filter_adapters
conditioner_adapters
resampler_adapters
acq_adapters
tracking_lib
tracking_adapters
channel_adapters
telemetry_decoder_adapters
obs_adapters
pvt_adapters
pvt_lib
out_adapters
target_link_libraries(gnss_rx ${Boost_LIBRARIES}
${ARMADILLO_LIBRARIES}
${GNURADIO_RUNTIME_LIBRARIES}
${GNURADIO_BLOCKS_LIBRARIES}
${GNURADIO_FFT_LIBRARIES}
${GNURADIO_FILTER_LIBRARIES}
gnss_system_parameters
gnss_sp_libs
signal_source_adapters
datatype_adapters
input_filter_adapters
conditioner_adapters
resampler_adapters
acq_adapters
tracking_lib
tracking_adapters
channel_adapters
telemetry_decoder_adapters
obs_adapters
pvt_adapters
pvt_lib
out_adapters
rx_core_lib
)

View File

@ -46,6 +46,7 @@
#include "file_signal_source.h"
#include "nsr_file_signal_source.h"
#include "spir_file_signal_source.h"
#include "rtl_tcp_signal_source.h"
#include "null_sink_output_filter.h"
#include "file_output_filter.h"
#include "channel.h"
@ -1050,6 +1051,21 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetBlock(
out_streams, queue));
block = std::move(block_);
}
catch (const std::exception &e)
{
std::cout << "GNSS-SDR program ended." << std::endl;
exit(1);
}
}
else if (implementation.compare("RtlTcp_Signal_Source") == 0)
{
try
{
std::unique_ptr<GNSSBlockInterface> block_(new RtlTcpSignalSource(configuration.get(), role, in_streams,
out_streams, queue));
block = std::move(block_);
}
catch (const std::exception &e)
{

View File

@ -17,7 +17,7 @@
#
if(ENABLE_OSMOSDR)
#if(ENABLE_OSMOSDR)
set(FRONT_END_CAL_SOURCES front_end_cal.cc)
include_directories(
@ -97,4 +97,4 @@ if(ENABLE_OSMOSDR)
install(FILES ${CMAKE_BINARY_DIR}/front-end-cal.1.gz DESTINATION share/man/man1)
endif(NOT GZIP_NOTFOUND)
endif(ENABLE_OSMOSDR)
#endif(ENABLE_OSMOSDR)