diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 4eebaa950..62d75f86c 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -19,4 +19,4 @@
add_subdirectory(system_parameters)
add_subdirectory(libs)
add_subdirectory(receiver)
-
+add_subdirectory(monitor)
diff --git a/src/core/monitor/CMakeLists.txt b/src/core/monitor/CMakeLists.txt
new file mode 100644
index 000000000..545e8641e
--- /dev/null
+++ b/src/core/monitor/CMakeLists.txt
@@ -0,0 +1,37 @@
+# Copyright (C) 2012-2018 (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 .
+#
+
+
+set(CORE_MONITOR_LIBS_SOURCES
+ gnss_synchro_monitor.cc
+ gnss_synchro_udp_sink.cc
+)
+
+include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_SOURCE_DIR}/src/core/system_parameters
+ ${GLOG_INCLUDE_DIRS}
+ ${GFlags_INCLUDE_DIRS}
+ ${Boost_INCLUDE_DIRS}
+)
+
+file(GLOB CORE_MONITOR_LIBS_HEADERS "*.h")
+list(SORT CORE_MONITOR_LIBS_HEADERS)
+add_library(core_monitor_lib ${CORE_MONITOR_LIBS_SOURCES} ${CORE_MONITOR_LIBS_HEADERS})
+source_group(Headers FILES ${CORE_MONITOR_LIBS_HEADERS})
+target_link_libraries(core_monitor_lib ${Boost_LIBRARIES})
diff --git a/src/core/monitor/gnss_synchro_monitor.cc b/src/core/monitor/gnss_synchro_monitor.cc
new file mode 100644
index 000000000..bde09ef69
--- /dev/null
+++ b/src/core/monitor/gnss_synchro_monitor.cc
@@ -0,0 +1,92 @@
+/*!
+ * \file gnss_synchro_monitor.cc
+ * \brief Interface of a Position Velocity and Time computation block
+ * \author Álvaro Cebrián Juan, 2018. acebrianjuan(at)gmail.com
+ *
+ * -------------------------------------------------------------------------
+ *
+ * Copyright (C) 2010-2018 (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 .
+ *
+ * -------------------------------------------------------------------------
+ */
+
+#include "gnss_synchro_monitor.h"
+#include "gnss_synchro.h"
+#include
+#include
+#include
+
+
+using google::LogMessage;
+
+
+gnss_synchro_monitor_sptr gnss_synchro_make_monitor(unsigned int n_channels,
+ int output_rate_ms,
+ int udp_port,
+ std::vector udp_addresses)
+{
+ return gnss_synchro_monitor_sptr(new gnss_synchro_monitor(n_channels,
+ output_rate_ms,
+ udp_port,
+ udp_addresses));
+}
+
+
+gnss_synchro_monitor::gnss_synchro_monitor(unsigned int n_channels,
+ int output_rate_ms,
+ int udp_port,
+ std::vector udp_addresses) : gr::sync_block("gnss_synchro_monitor",
+ gr::io_signature::make(n_channels, n_channels, sizeof(Gnss_Synchro)),
+ gr::io_signature::make(0, 0, 0))
+{
+ d_output_rate_ms = output_rate_ms;
+ d_nchannels = n_channels;
+
+ udp_sink_ptr = std::unique_ptr(new Gnss_Synchro_Udp_Sink(udp_addresses, udp_port));
+}
+
+
+gnss_synchro_monitor::~gnss_synchro_monitor()
+{
+}
+
+
+int gnss_synchro_monitor::work(int noutput_items, gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items __attribute__((unused)))
+{
+ const Gnss_Synchro** in = reinterpret_cast(&input_items[0]); // Get the input buffer pointer
+ for (int epoch = 0; epoch < noutput_items; epoch++)
+ {
+ // ############ 1. READ PSEUDORANGES ####
+ for (unsigned int i = 0; i < d_nchannels; i++)
+ {
+ //if (in[i][epoch].Flag_valid_pseudorange)
+ // {
+ // }
+ //todo: send the gnss_synchro objects
+
+ std::vector stocks;
+ stocks.push_back(in[i][epoch]);
+ udp_sink_ptr->write_gnss_synchro(stocks);
+ }
+ }
+ return noutput_items;
+}
diff --git a/src/core/monitor/gnss_synchro_monitor.h b/src/core/monitor/gnss_synchro_monitor.h
new file mode 100644
index 000000000..36b6f1e3a
--- /dev/null
+++ b/src/core/monitor/gnss_synchro_monitor.h
@@ -0,0 +1,81 @@
+/*!
+ * \file gnss_synchro_monitor.h
+ * \brief Interface of a Position Velocity and Time computation block
+ * \author Álvaro Cebrián Juan, 2018. acebrianjuan(at)gmail.com
+ *
+ * -------------------------------------------------------------------------
+ *
+ * Copyright (C) 2010-2018 (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 .
+ *
+ * -------------------------------------------------------------------------
+ */
+
+#ifndef GNSS_SDR_GNSS_SYNCHRO_MONITOR_H
+#define GNSS_SDR_GNSS_SYNCHRO_MONITOR_H
+
+
+#include "gnss_synchro_udp_sink.h"
+#include
+#include
+#include
+#include
+
+
+class gnss_synchro_monitor;
+
+typedef boost::shared_ptr gnss_synchro_monitor_sptr;
+
+gnss_synchro_monitor_sptr gnss_synchro_make_monitor(unsigned int n_channels,
+ int output_rate_ms,
+ int udp_port,
+ std::vector udp_addresses);
+
+/*!
+ * \brief This class implements a block that computes the PVT solution with Galileo E1 signals
+ */
+class gnss_synchro_monitor : public gr::sync_block
+{
+private:
+ friend gnss_synchro_monitor_sptr gnss_synchro_make_monitor(unsigned int nchannels,
+ int output_rate_ms,
+ int udp_port,
+ std::vector udp_addresses);
+
+ unsigned int d_nchannels;
+
+ int d_output_rate_ms;
+
+ std::unique_ptr udp_sink_ptr;
+
+
+public:
+ gnss_synchro_monitor(unsigned int nchannels,
+ int output_rate_ms,
+ int udp_port,
+ std::vector udp_addresses);
+
+ ~gnss_synchro_monitor(); //!< Default destructor
+
+ int work(int noutput_items, gr_vector_const_void_star& input_items,
+ gr_vector_void_star& output_items);
+};
+
+#endif
diff --git a/src/core/monitor/gnss_synchro_udp_sink.cc b/src/core/monitor/gnss_synchro_udp_sink.cc
new file mode 100644
index 000000000..52b53b260
--- /dev/null
+++ b/src/core/monitor/gnss_synchro_udp_sink.cc
@@ -0,0 +1,69 @@
+/*!
+ * \file gnss_synchro_udp_sink.cc
+ * \brief Implementation of a class that sends serialized Gnss_Synchro
+ * objects over udp to one or multiple endponits
+ * \author Álvaro Cebrián Juan, 2018. acebrianjuan(at)gmail.com
+ *
+ * -------------------------------------------------------------------------
+ *
+ * Copyright (C) 2010-2018 (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 .
+ *
+ * -------------------------------------------------------------------------
+ */
+
+#include "gnss_synchro_udp_sink.h"
+#include
+#include
+#include
+#include
+
+Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(std::vector addresses, const unsigned short& port) : socket{io_service}
+{
+ for (auto address : addresses)
+ {
+ boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string(address, error), port);
+ endpoints.push_back(endpoint);
+ }
+}
+
+bool Gnss_Synchro_Udp_Sink::write_gnss_synchro(std::vector stocks)
+{
+ std::ostringstream archive_stream;
+ boost::archive::binary_oarchive oa{archive_stream};
+ oa << stocks;
+ std::string outbound_data = archive_stream.str();
+
+ for (auto endpoint : endpoints)
+ {
+ socket.open(endpoint.protocol(), error);
+ socket.connect(endpoint, error);
+
+ try
+ {
+ socket.send(boost::asio::buffer(outbound_data));
+ }
+ catch (boost::system::system_error const& e)
+ {
+ return false;
+ }
+ }
+ return true;
+}
diff --git a/src/core/monitor/gnss_synchro_udp_sink.h b/src/core/monitor/gnss_synchro_udp_sink.h
new file mode 100644
index 000000000..cf3cfc91d
--- /dev/null
+++ b/src/core/monitor/gnss_synchro_udp_sink.h
@@ -0,0 +1,53 @@
+/*!
+ * \file gnss_synchro_udp_sink.h
+ * \brief Interface of a class that sends serialized Gnss_Synchro objects
+ * over udp to one or multiple endponits
+ * \author Álvaro Cebrián Juan, 2018. acebrianjuan(at)gmail.com
+ *
+ * -------------------------------------------------------------------------
+ *
+ * Copyright (C) 2010-2018 (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 .
+ *
+ * -------------------------------------------------------------------------
+ */
+
+#ifndef GNSS_SYNCHRO_UDP_SINK_H_
+#define GNSS_SYNCHRO_UDP_SINK_H_
+
+#include
+#include "gnss_synchro.h"
+
+class Gnss_Synchro_Udp_Sink
+{
+public:
+ Gnss_Synchro_Udp_Sink(std::vector addresses, const unsigned short &port);
+ bool write_gnss_synchro(std::vector stocks);
+
+private:
+ boost::asio::io_service io_service;
+ boost::asio::ip::udp::socket socket;
+ boost::system::error_code error;
+ std::vector endpoints;
+ std::vector stocks;
+};
+
+
+#endif /* GNSS_SYNCHRO_UDP_SINK_H_ */
diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt
index 7be920a47..46a13614e 100644
--- a/src/core/receiver/CMakeLists.txt
+++ b/src/core/receiver/CMakeLists.txt
@@ -111,6 +111,7 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/core/libs/supl
${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-rrlp
${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl
+ ${CMAKE_SOURCE_DIR}/src/core/monitor
${CMAKE_SOURCE_DIR}/src/algorithms/libs
${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/libs
${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/adapters
@@ -178,4 +179,5 @@ target_link_libraries(gnss_rx ${Boost_LIBRARIES}
pvt_adapters
pvt_lib
rx_core_lib
+ core_monitor_lib
)
diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc
index ab9589658..b5b978d9f 100644
--- a/src/core/receiver/gnss_flowgraph.cc
+++ b/src/core/receiver/gnss_flowgraph.cc
@@ -4,6 +4,7 @@
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Luis Esteve, 2012. luis(at)epsilon-formacion.com
* Carles Fernandez-Prades, 2014. cfernandez(at)cttc.es
+ * Álvaro Cebrián Juan, 2018. acebrianjuan(at)gmail.com
*
* -------------------------------------------------------------------------
*
@@ -496,6 +497,25 @@ void GNSSFlowgraph::connect()
return;
}
+ // GNSS SYNCHRO MONITOR
+ if (enable_monitor_)
+ {
+ try
+ {
+ for (unsigned int i = 0; i < channels_count_; i++)
+ {
+ top_block_->connect(observables_->get_right_block(), i, GnssSynchroMonitor_, i);
+ }
+ }
+ catch (const std::exception& e)
+ {
+ LOG(WARNING) << "Can't connect observables to Monitor block";
+ LOG(ERROR) << e.what();
+ top_block_->disconnect_all();
+ return;
+ }
+ }
+
// Activate acquisition in enabled channels
for (unsigned int i = 0; i < channels_count_; i++)
{
@@ -1091,6 +1111,25 @@ void GNSSFlowgraph::init()
set_channels_state();
applied_actions_ = 0;
DLOG(INFO) << "Blocks instantiated. " << channels_count_ << " channels.";
+
+ /*
+ * Instantiate the receiver monitor block, if required
+ */
+ enable_monitor_ = configuration_->property("Monitor.enable_monitor", false);
+
+ std::vector udp_addr_vec;
+
+ std::string address_string = configuration_->property("Monitor.client_addresses", std::string("127.0.0.1"));
+ //todo: split the string in substrings using the separator and fill the address vector.
+ udp_addr_vec.push_back(address_string);
+
+ if (enable_monitor_)
+ {
+ GnssSynchroMonitor_ = gr::basic_block_sptr(new gnss_synchro_monitor(channels_count_,
+ configuration_->property("Monitor.output_rate_ms", 1),
+ configuration_->property("Monitor.udp_port", 1234),
+ udp_addr_vec));
+ }
}
diff --git a/src/core/receiver/gnss_flowgraph.h b/src/core/receiver/gnss_flowgraph.h
index 5da90cd1f..00a6ced4e 100644
--- a/src/core/receiver/gnss_flowgraph.h
+++ b/src/core/receiver/gnss_flowgraph.h
@@ -4,6 +4,7 @@
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Luis Esteve, 2011. luis(at)epsilon-formacion.com
* Carles Fernandez-Prades, 2014. cfernandez(at)cttc.es
+ * Álvaro Cebrián Juan, 2018. acebrianjuan(at)gmail.com
*
* It contains a signal source,
* a signal conditioner, a set of channels, an observables block and a pvt.
@@ -39,6 +40,7 @@
#include "GPS_L1_CA.h"
#include "gnss_signal.h"
#include "gnss_sdr_sample_counter.h"
+#include "gnss_synchro_monitor.h"
#include
#include
#include
@@ -185,6 +187,9 @@ private:
std::vector channels_state_;
std::mutex signal_list_mutex;
+
+ bool enable_monitor_;
+ gr::basic_block_sptr GnssSynchroMonitor_;
};
#endif /*GNSS_SDR_GNSS_FLOWGRAPH_H_*/
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index f24dcd8cc..54b3ac685 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -307,6 +307,7 @@ set(LIST_INCLUDE_DIRS
${CMAKE_SOURCE_DIR}/src/core/libs/supl
${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-rrlp
${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl
+ ${CMAKE_SOURCE_DIR}/src/core/monitor
${CMAKE_SOURCE_DIR}/src/algorithms/libs
${CMAKE_SOURCE_DIR}/src/algorithms/libs/rtklib
${CMAKE_SOURCE_DIR}/src/algorithms/data_type_adapter/adapters