2018-09-07 12:36:11 +00:00
|
|
|
/*!
|
|
|
|
* \file acquisition_msg_rx.cc
|
|
|
|
* \brief This is a helper class to catch the asynchronous messages
|
|
|
|
* emitted by an acquisition block.
|
|
|
|
* \author Carles Fernandez-Prades, 2018. cfernandez(at)cttc.cat
|
|
|
|
*
|
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2018-09-07 12:36:11 +00:00
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* Copyright (C) 2012-2020 (see AUTHORS file for a list of contributors)
|
2018-09-07 12:36:11 +00:00
|
|
|
*
|
|
|
|
* GNSS-SDR is a software defined Global Navigation
|
|
|
|
* Satellite Systems receiver
|
|
|
|
*
|
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
2020-02-08 00:20:02 +00:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2018-09-07 12:36:11 +00:00
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
2018-09-07 12:36:11 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "acquisition_msg_rx.h"
|
|
|
|
#include <gflags/gflags.h>
|
|
|
|
#include <glog/logging.h>
|
2018-12-09 21:00:09 +00:00
|
|
|
#include <cstdint>
|
|
|
|
#include <utility>
|
2020-04-26 06:41:49 +00:00
|
|
|
#if HAS_GENERIC_LAMBDA
|
|
|
|
#else
|
2020-06-06 21:41:38 +00:00
|
|
|
#include <boost/bind/bind.hpp>
|
2020-04-26 06:41:49 +00:00
|
|
|
#endif
|
2018-09-07 12:36:11 +00:00
|
|
|
|
|
|
|
Acquisition_msg_rx_sptr Acquisition_msg_rx_make()
|
|
|
|
{
|
|
|
|
return Acquisition_msg_rx_sptr(new Acquisition_msg_rx());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-03 06:13:21 +00:00
|
|
|
void Acquisition_msg_rx::msg_handler_channel_events(const pmt::pmt_t& msg)
|
2018-09-07 12:36:11 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2019-09-13 06:56:37 +00:00
|
|
|
int64_t message = pmt::to_long(msg);
|
2018-09-07 12:36:11 +00:00
|
|
|
rx_message = message;
|
|
|
|
top_block->stop(); // stop the flowgraph
|
|
|
|
}
|
2020-08-03 06:13:21 +00:00
|
|
|
catch (const boost::bad_any_cast& e)
|
2018-09-07 12:36:11 +00:00
|
|
|
{
|
|
|
|
LOG(WARNING) << "msg_handler_acquisition Bad cast!\n";
|
|
|
|
rx_message = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Acquisition_msg_rx::Acquisition_msg_rx() : gr::block("Acquisition_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
|
|
|
{
|
|
|
|
this->message_port_register_in(pmt::mp("events"));
|
2020-04-25 21:03:44 +00:00
|
|
|
this->set_msg_handler(pmt::mp("events"),
|
|
|
|
#if HAS_GENERIC_LAMBDA
|
2020-08-03 06:13:21 +00:00
|
|
|
[this](auto&& PH1) { msg_handler_channel_events(PH1); });
|
2020-04-25 21:03:44 +00:00
|
|
|
#else
|
2020-06-12 22:32:40 +00:00
|
|
|
#if USE_BOOST_BIND_PLACEHOLDERS
|
2020-08-03 06:13:21 +00:00
|
|
|
boost::bind(&Acquisition_msg_rx::msg_handler_channel_events, this, boost::placeholders::_1));
|
2020-05-18 20:50:34 +00:00
|
|
|
#else
|
2020-08-03 06:13:21 +00:00
|
|
|
boost::bind(&Acquisition_msg_rx::msg_handler_channel_events, this, _1));
|
2020-05-18 20:50:34 +00:00
|
|
|
#endif
|
2020-04-25 21:03:44 +00:00
|
|
|
#endif
|
2018-09-07 12:36:11 +00:00
|
|
|
rx_message = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-12-03 10:12:10 +00:00
|
|
|
Acquisition_msg_rx::~Acquisition_msg_rx() = default;
|