mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 12:10:34 +00:00
Split the message collector block in a separated object inside channel
This commit is contained in:
parent
0f80ce0159
commit
853e314bf0
@ -37,55 +37,17 @@
|
|||||||
#include "tracking_interface.h"
|
#include "tracking_interface.h"
|
||||||
#include "telemetry_decoder_interface.h"
|
#include "telemetry_decoder_interface.h"
|
||||||
#include "configuration_interface.h"
|
#include "configuration_interface.h"
|
||||||
|
#include "channel_msg_receiver_cc.h"
|
||||||
|
|
||||||
using google::LogMessage;
|
using google::LogMessage;
|
||||||
|
|
||||||
void Channel::msg_handler_events(pmt::pmt_t msg)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
long int message=pmt::to_long(msg);
|
|
||||||
switch (message)
|
|
||||||
{
|
|
||||||
case 1: //positive acquisition
|
|
||||||
DLOG(INFO) << "Channel " << channel_ << " ACQ SUCCESS satellite " <<
|
|
||||||
gnss_synchro_.System << " " << gnss_synchro_.PRN;
|
|
||||||
channel_fsm_.Event_valid_acquisition();
|
|
||||||
break;
|
|
||||||
case 2: //negative acquisition
|
|
||||||
DLOG(INFO) << "Channel " << channel_
|
|
||||||
<< " ACQ FAILED satellite " << gnss_synchro_.System << " " << gnss_synchro_.PRN;
|
|
||||||
if (repeat_ == true)
|
|
||||||
{
|
|
||||||
channel_fsm_.Event_failed_acquisition_repeat();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
channel_fsm_.Event_failed_acquisition_no_repeat();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 3: // tracking loss of lock event
|
|
||||||
channel_fsm_.Event_failed_tracking_standby();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
LOG(WARNING) << "Default case, invalid message.";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}catch(boost::bad_any_cast& e)
|
|
||||||
{
|
|
||||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Channel::Channel(ConfigurationInterface *configuration, unsigned int channel,
|
Channel::Channel(ConfigurationInterface *configuration, unsigned int channel,
|
||||||
GNSSBlockInterface *pass_through, AcquisitionInterface *acq,
|
GNSSBlockInterface *pass_through, AcquisitionInterface *acq,
|
||||||
TrackingInterface *trk, TelemetryDecoderInterface *nav,
|
TrackingInterface *trk, TelemetryDecoderInterface *nav,
|
||||||
std::string role, std::string implementation, boost::shared_ptr<gr::msg_queue> queue) :
|
std::string role, std::string implementation, boost::shared_ptr<gr::msg_queue> queue)
|
||||||
gr::block("galileo_e1_pvt_cc", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
|
||||||
{
|
{
|
||||||
|
|
||||||
this->message_port_register_in(pmt::mp("events"));
|
|
||||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&Channel::msg_handler_events, this, _1));
|
|
||||||
|
|
||||||
pass_through_=pass_through;
|
pass_through_=pass_through;
|
||||||
acq_=acq;
|
acq_=acq;
|
||||||
trk_=trk;
|
trk_=trk;
|
||||||
@ -133,11 +95,15 @@ Channel::Channel(ConfigurationInterface *configuration, unsigned int channel,
|
|||||||
|
|
||||||
connected_ = false;
|
connected_ = false;
|
||||||
gnss_signal_ = Gnss_Signal();
|
gnss_signal_ = Gnss_Signal();
|
||||||
|
|
||||||
|
chennel_msg_rx= channel_msg_receiver_make_cc(&channel_fsm_, repeat_);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
Channel::~Channel()
|
Channel::~Channel()
|
||||||
{
|
{
|
||||||
|
channel_fsm_.terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Channel::connect(gr::top_block_sptr top_block)
|
void Channel::connect(gr::top_block_sptr top_block)
|
||||||
@ -165,8 +131,8 @@ void Channel::connect(gr::top_block_sptr top_block)
|
|||||||
DLOG(INFO) << "MSG FEEDBACK CHANNEL telemetry_decoder -> tracking";
|
DLOG(INFO) << "MSG FEEDBACK CHANNEL telemetry_decoder -> tracking";
|
||||||
|
|
||||||
//std::cout<<"has port: "<<trk_->get_right_block()->has_msg_port(pmt::mp("events"))<<std::endl;
|
//std::cout<<"has port: "<<trk_->get_right_block()->has_msg_port(pmt::mp("events"))<<std::endl;
|
||||||
top_block->msg_connect(acq_->get_right_block(),pmt::mp("events"), gr::basic_block_sptr(this),pmt::mp("events"));
|
top_block->msg_connect(acq_->get_right_block(),pmt::mp("events"), chennel_msg_rx,pmt::mp("events"));
|
||||||
top_block->msg_connect(trk_->get_right_block(),pmt::mp("events"), gr::basic_block_sptr(this),pmt::mp("events"));
|
top_block->msg_connect(trk_->get_right_block(),pmt::mp("events"), chennel_msg_rx,pmt::mp("events"));
|
||||||
|
|
||||||
connected_ = true;
|
connected_ = true;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#include "channel_interface.h"
|
#include "channel_interface.h"
|
||||||
#include "channel_fsm.h"
|
#include "channel_fsm.h"
|
||||||
#include "gnss_synchro.h"
|
#include "gnss_synchro.h"
|
||||||
|
#include "channel_msg_receiver_cc.h"
|
||||||
|
|
||||||
class ConfigurationInterface;
|
class ConfigurationInterface;
|
||||||
class AcquisitionInterface;
|
class AcquisitionInterface;
|
||||||
@ -55,7 +55,7 @@ class TelemetryDecoderInterface;
|
|||||||
* their interaction through a Finite State Machine
|
* their interaction through a Finite State Machine
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class Channel: public ChannelInterface, public gr::block
|
class Channel: public ChannelInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -87,6 +87,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
channel_msg_receiver_cc_sptr chennel_msg_rx;
|
||||||
GNSSBlockInterface *pass_through_;
|
GNSSBlockInterface *pass_through_;
|
||||||
AcquisitionInterface *acq_;
|
AcquisitionInterface *acq_;
|
||||||
TrackingInterface *trk_;
|
TrackingInterface *trk_;
|
||||||
@ -97,8 +98,6 @@ private:
|
|||||||
Gnss_Synchro gnss_synchro_;
|
Gnss_Synchro gnss_synchro_;
|
||||||
Gnss_Signal gnss_signal_;
|
Gnss_Signal gnss_signal_;
|
||||||
bool connected_;
|
bool connected_;
|
||||||
//bool stop_;
|
|
||||||
//int message_;
|
|
||||||
bool repeat_;
|
bool repeat_;
|
||||||
ChannelFsm channel_fsm_;
|
ChannelFsm channel_fsm_;
|
||||||
boost::shared_ptr<gr::msg_queue> queue_;
|
boost::shared_ptr<gr::msg_queue> queue_;
|
||||||
|
@ -16,7 +16,10 @@
|
|||||||
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
set(CHANNEL_FSM_SOURCES channel_fsm.cc )
|
set(CHANNEL_FSM_SOURCES
|
||||||
|
channel_fsm.cc
|
||||||
|
channel_msg_receiver_cc.cc
|
||||||
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
$(CMAKE_CURRENT_SOURCE_DIR)
|
$(CMAKE_CURRENT_SOURCE_DIR)
|
||||||
|
94
src/algorithms/channel/libs/channel_msg_receiver_cc.cc
Normal file
94
src/algorithms/channel/libs/channel_msg_receiver_cc.cc
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
/*!
|
||||||
|
* \file channel_msg_receiver_cc.cc
|
||||||
|
* \brief GNURadio block that receives asynchronous channel messages from acquisition and tracking blocks
|
||||||
|
* \author Javier Arribas, 2016. jarribas(at)cttc.es
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2016 (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 "channel_msg_receiver_cc.h"
|
||||||
|
#include <gnuradio/gr_complex.h>
|
||||||
|
#include <gnuradio/io_signature.h>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
|
||||||
|
channel_msg_receiver_cc_sptr channel_msg_receiver_make_cc(ChannelFsm* channel_fsm, bool repeat)
|
||||||
|
{
|
||||||
|
return channel_msg_receiver_cc_sptr(new channel_msg_receiver_cc(channel_fsm, repeat));
|
||||||
|
}
|
||||||
|
|
||||||
|
void channel_msg_receiver_cc::msg_handler_events(pmt::pmt_t msg)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
long int message=pmt::to_long(msg);
|
||||||
|
switch (message)
|
||||||
|
{
|
||||||
|
case 1: //positive acquisition
|
||||||
|
//DLOG(INFO) << "Channel " << channel_ << " ACQ SUCCESS satellite " <<
|
||||||
|
// gnss_synchro_.System << " " << gnss_synchro_.PRN;
|
||||||
|
d_channel_fsm->Event_valid_acquisition();
|
||||||
|
break;
|
||||||
|
case 2: //negative acquisition
|
||||||
|
//DLOG(INFO) << "Channel " << channel_
|
||||||
|
// << " ACQ FAILED satellite " << gnss_synchro_.System << " " << gnss_synchro_.PRN;
|
||||||
|
if (d_repeat == true)
|
||||||
|
{
|
||||||
|
d_channel_fsm->Event_failed_acquisition_repeat();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_channel_fsm->Event_failed_acquisition_no_repeat();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3: // tracking loss of lock event
|
||||||
|
d_channel_fsm->Event_failed_tracking_standby();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
LOG(WARNING) << "Default case, invalid message.";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}catch(boost::bad_any_cast& e)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "msg_handler_telemetry Bad any cast!\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
channel_msg_receiver_cc::channel_msg_receiver_cc(ChannelFsm* channel_fsm, bool repeat) :
|
||||||
|
gr::block("channel_msg_receiver_cc", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||||
|
{
|
||||||
|
|
||||||
|
this->message_port_register_in(pmt::mp("events"));
|
||||||
|
this->set_msg_handler(pmt::mp("events"), boost::bind(&channel_msg_receiver_cc::msg_handler_events, this, _1));
|
||||||
|
|
||||||
|
d_channel_fsm=channel_fsm;
|
||||||
|
d_repeat=repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
channel_msg_receiver_cc::~channel_msg_receiver_cc()
|
||||||
|
{}
|
||||||
|
|
60
src/algorithms/channel/libs/channel_msg_receiver_cc.h
Normal file
60
src/algorithms/channel/libs/channel_msg_receiver_cc.h
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/*!
|
||||||
|
* \file channel_msg_receiver_cc.h
|
||||||
|
* \brief GNURadio block that receives asynchronous channel messages from acquisition and tracking blocks
|
||||||
|
* \author Javier Arribas, 2016. jarribas(at)cttc.es
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2016 (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_CHANNEL_MSG_RECEIVER_CC_H
|
||||||
|
#define GNSS_SDR_CHANNEL_MSG_RECEIVER_CC_H
|
||||||
|
|
||||||
|
#include <gnuradio/block.h>
|
||||||
|
#include "channel_fsm.h"
|
||||||
|
|
||||||
|
class channel_msg_receiver_cc;
|
||||||
|
|
||||||
|
typedef boost::shared_ptr<channel_msg_receiver_cc> channel_msg_receiver_cc_sptr;
|
||||||
|
|
||||||
|
channel_msg_receiver_cc_sptr channel_msg_receiver_make_cc(ChannelFsm* channel_fsm, bool repeat);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief This class implements a block that computes the PVT solution with Galileo E1 signals
|
||||||
|
*/
|
||||||
|
class channel_msg_receiver_cc : public gr::block
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
ChannelFsm* d_channel_fsm;
|
||||||
|
bool d_repeat; // todo: change FSM to include repeat value
|
||||||
|
friend channel_msg_receiver_cc_sptr channel_msg_receiver_make_cc(ChannelFsm* channel_fsm, bool repeat);
|
||||||
|
void msg_handler_events(pmt::pmt_t msg);
|
||||||
|
channel_msg_receiver_cc(ChannelFsm* channel_fsm, bool repeat);
|
||||||
|
|
||||||
|
public:
|
||||||
|
~channel_msg_receiver_cc (); //!< Default destructor
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user