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";
}