Hi all,

I'm not sure about how to read and write PMT ports from and to local
variables. I'm going to expose what i'm doing, and if someone can help me i
would be very greatful.

I've created an input and an output of PMT type.

message_port_register_in(pmt::pmt_t in_threshold)
message_port_register_out(pmt::pmt_t out_threshold)

Now i want to read the port, and save the data in a local variable, do
operations with that variable, and later write it in the output,

I create the variables,

double d_threshold;
pmt::pmt_t target;



*I read it, I don't know how to do it. But I suppose:*
message_port_sub(pmt::pmt_t
<https://gnuradio.org/doc/doxygen/namespacepmt.html#ab4b70d9293452eb74dd07c670e6811fa>
in_threshold,pmt::pmt_t
<https://gnuradio.org/doc/doxygen/namespacepmt.html#ab4b70d9293452eb74dd07c670e6811fa>
target);
d_threshold= pmt::to_double
<https://gnuradio.org/doc/doxygen/namespacepmt.html#a0f58166fe9f449249f5de7dc7b3ab754>
(target);

And, I think i can write it as follows:

msg=pmt::from_double
<https://gnuradio.org/doc/doxygen/namespacepmt.html#ad20c287c509e8470d03d1c8e97fea12d>
(d_threshold);
message_port_pub(pmt::pmt_t
<https://gnuradio.org/doc/doxygen/namespacepmt.html#ab4b70d9293452eb74dd07c670e6811fa>
out_threshold,pmt::pmt_t
<https://gnuradio.org/doc/doxygen/namespacepmt.html#ab4b70d9293452eb74dd07c670e6811fa>
msg);

What do you think, i've seen several examples, and they do this,
message_port_pub(pmt::mp("symbols"), pmt::cons(pmt::make_dict(),
pmt::init_c32vector(48, symbols)));

But I don't understand why it is necessary to use pmt::make_dict().

Thanks in advance.

Best regards,

Cristian
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to