discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Message passing: boost::bind() not executing


From: Laura Arjona
Subject: [Discuss-gnuradio] Message passing: boost::bind() not executing
Date: Mon, 19 Aug 2019 15:52:44 -0700


Hi all,
I would really appreciate some help with using message passing.
I have 2 different OOT modules, connected (called gate and decoder). And I want to pass information from gate to decoder For example, the string "OK".
However, the message is not received in the decoder block. And I am not sure whether the problem is in my gate or in my decoder block.

Find below a sketch of my flow graph (partial) and the code in C++ (partial) and python



python main file
....
self.connect((self.gate), (self.decoder))
self.msg_connect(self.gate, "out_gate", self.decoder, "in_decoder")


OOT Module: gate_impl
/* The private constructor */
    gate_impl::gate_impl(int sample_rate)  :
     gr::block("gate", gr::io_signature::make(1, 1, sizeof(gr_complex)),
              gr::io_signature::make(1, 1, sizeof(gr_complex) ))  {

       message_port_register_out(pmt::mp("out_gate"));

}

int
    gate_impl::general_work (int noutput_items,
                       gr_vector_int &ninput_items,
                       gr_vector_const_void_star &input_items,
                       gr_vector_void_star &output_items)
    {

    message_port_pub(pmt::mp("out_gate"), pmt::mp("OK"));
    }

OOT Module: decoder_impl

 /*
     * The private constructor
     */
    decoder_impl::decoder_impl(int sample_rate,std::vector<int> output_sizes)
      : gr::block("decoder",
              gr::io_signature::make(1, 1, sizeof(gr_complex)),
              gr::io_signature::makev(2, 2, output_sizes)),
              s_rate(sample_rate)
    {

       message_port_register_in(pmt::mp("in_decoder"));

set_msg_handler(pmt::mp("in_decoder"),
   boost::bind(&decoder_impl::msg_handler_method, this, _1) 
);


void
decoder_impl::msg_handler_method(pmt::pmt_t msg)

{
  std::cout << "***** MESSAGE DEBUG PRINT ********\n";
  pmt::print(msg);
  std::cout << "**********************************\n";
}



--
Laura Arjona 
Washington Research Foundation Innovation Postdoctoral Fellow in Neuroengineering

Paul G. Allen School of Computer Science & Engineering
185 E Stevens Way NE
University of Washington
Seattle, WA 98195-2350

Attachment: IMG_3128.jpg
Description: JPEG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]