discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] PMT: Get a value associated to a specific key in a ca


From: Cristian Rodríguez
Subject: [Discuss-gnuradio] PMT: Get a value associated to a specific key in a car of PMT message C++
Date: Thu, 29 Jun 2017 19:32:55 -0500

Hi all.

I'm trying to get the car of a PMT message. And later in the car, the value associated to a specific key.

I'm receiving it:

(((dlt . 105) (freqofs . -0.00015152) (nomfreq . 5.89e+09) (snr . 144.985) (encoding . 0)) . #[1 2 3 4 5 6 7 8 9 0])

I want to get the car:

((dlt . 105) (freqofs . -0.00015152) (nomfreq . 5.89e+09) (snr . 144.985) (encoding . 0))

And later get the value of the key "snr":
144.985

I'm doing that with the next code: msg is the message that I receive.

pmt::pmt_t dict = pmt::car(msg);
          pmt::pmt_t snrf =pmt::dict_ref(dict, pmt::mp("snr"), pmt::from_double(10));
          message_port_pub(pmt::mp("SNR out"), snrf);

If I public dict, I get in console:

pmt_uniform_vector_elements: wrong_type : ((freqofs . -0.00015152) (nomfreq . 5.89e+09) (snr . 144.985) (encoding . 0))

If I public snrf, I get in console:

pmt_car: wrong_type : 144.985

In general, it is working, but I don't understand why these messages appears.

What do you think, Is another way of doing the same?

Thanks in advance.

Best regards,

Cristian

reply via email to

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