1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 04:30:33 +00:00

Migrate channel_fsm pointer to std::shared_ptr

This commit is contained in:
Antonio Ramos 2018-01-08 12:03:32 +01:00
parent 74a1f76282
commit 320b4e2d7b
4 changed files with 14 additions and 13 deletions

View File

@ -50,6 +50,7 @@ Channel::Channel(ConfigurationInterface *configuration, unsigned int channel,
implementation_ = implementation; implementation_ = implementation;
channel_ = channel; channel_ = channel;
queue_ = queue; queue_ = queue;
channel_fsm_ = std::make_shared<ChannelFsm>();
flag_enable_fpga = configuration->property("Channel.enable_FPGA", false); flag_enable_fpga = configuration->property("Channel.enable_FPGA", false);
acq_->set_channel(channel_); acq_->set_channel(channel_);
@ -89,16 +90,16 @@ Channel::Channel(ConfigurationInterface *configuration, unsigned int channel,
repeat_ = configuration->property("Acquisition_" + implementation_ + boost::lexical_cast<std::string>(channel_) + ".repeat_satellite", false); repeat_ = configuration->property("Acquisition_" + implementation_ + boost::lexical_cast<std::string>(channel_) + ".repeat_satellite", false);
DLOG(INFO) << "Channel " << channel_ << " satellite repeat = " << repeat_; DLOG(INFO) << "Channel " << channel_ << " satellite repeat = " << repeat_;
channel_fsm_.set_acquisition(acq_); channel_fsm_->set_acquisition(acq_);
channel_fsm_.set_tracking(trk_); channel_fsm_->set_tracking(trk_);
channel_fsm_.set_channel(channel_); channel_fsm_->set_channel(channel_);
channel_fsm_.set_queue(queue_); channel_fsm_->set_queue(queue_);
connected_ = false; connected_ = false;
gnss_signal_ = Gnss_Signal(implementation_); gnss_signal_ = Gnss_Signal(implementation_);
channel_msg_rx = channel_msg_receiver_make_cc(&channel_fsm_, repeat_); channel_msg_rx = channel_msg_receiver_make_cc(channel_fsm_, repeat_);
} }
@ -198,7 +199,7 @@ void Channel::set_signal(const Gnss_Signal& gnss_signal)
void Channel::start_acquisition() void Channel::start_acquisition()
{ {
bool result = false; bool result = false;
result = channel_fsm_.Event_start_acquisition(); result = channel_fsm_->Event_start_acquisition();
if(!result) if(!result)
{ {
LOG(WARNING) << "Invalid channel event"; LOG(WARNING) << "Invalid channel event";

View File

@ -104,7 +104,7 @@ private:
Gnss_Signal gnss_signal_; Gnss_Signal gnss_signal_;
bool connected_; bool connected_;
bool repeat_; bool repeat_;
ChannelFsm channel_fsm_; std::shared_ptr<ChannelFsm> channel_fsm_;
gr::msg_queue::sptr queue_; gr::msg_queue::sptr queue_;
}; };

View File

@ -37,7 +37,7 @@
using google::LogMessage; using google::LogMessage;
channel_msg_receiver_cc_sptr channel_msg_receiver_make_cc(ChannelFsm* channel_fsm, bool repeat) channel_msg_receiver_cc_sptr channel_msg_receiver_make_cc(std::shared_ptr<ChannelFsm> channel_fsm, bool repeat)
{ {
return channel_msg_receiver_cc_sptr(new channel_msg_receiver_cc(channel_fsm, repeat)); return channel_msg_receiver_cc_sptr(new channel_msg_receiver_cc(channel_fsm, repeat));
} }
@ -82,7 +82,7 @@ void channel_msg_receiver_cc::msg_handler_events(pmt::pmt_t msg)
} }
channel_msg_receiver_cc::channel_msg_receiver_cc(ChannelFsm* channel_fsm, bool repeat) : channel_msg_receiver_cc::channel_msg_receiver_cc(std::shared_ptr<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)) 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->message_port_register_in(pmt::mp("events"));

View File

@ -38,7 +38,7 @@ class channel_msg_receiver_cc;
typedef boost::shared_ptr<channel_msg_receiver_cc> channel_msg_receiver_cc_sptr; 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); channel_msg_receiver_cc_sptr channel_msg_receiver_make_cc(std::shared_ptr<ChannelFsm> channel_fsm, bool repeat);
/*! /*!
* \brief GNU Radio block that receives asynchronous channel messages from acquisition and tracking blocks * \brief GNU Radio block that receives asynchronous channel messages from acquisition and tracking blocks
@ -46,11 +46,11 @@ channel_msg_receiver_cc_sptr channel_msg_receiver_make_cc(ChannelFsm* channel_fs
class channel_msg_receiver_cc : public gr::block class channel_msg_receiver_cc : public gr::block
{ {
private: private:
ChannelFsm* d_channel_fsm; std::shared_ptr<ChannelFsm> d_channel_fsm;
bool d_repeat; // todo: change FSM to include repeat value 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); friend channel_msg_receiver_cc_sptr channel_msg_receiver_make_cc(std::shared_ptr<ChannelFsm> channel_fsm, bool repeat);
void msg_handler_events(pmt::pmt_t msg); void msg_handler_events(pmt::pmt_t msg);
channel_msg_receiver_cc(ChannelFsm* channel_fsm, bool repeat); channel_msg_receiver_cc(std::shared_ptr<ChannelFsm> channel_fsm, bool repeat);
public: public:
~channel_msg_receiver_cc (); //!< Default destructor ~channel_msg_receiver_cc (); //!< Default destructor