Re: [Discuss-gnuradio] usrp_spectrum_sense.py newer version
2013/2/22 Juan Daniel Fernandez Martinez : > Hi everyone, > There is a new version of usrp_spectrum_sense.py that works with UHD instead > of USRP? > > Thanks for your attention :) GNU Radio 3.6 ships with the usrp_spectrum_sense converted to use the UHD interfaces. Tom ___ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Re: [Discuss-gnuradio] Usage of Message Queues
Thank you much for your answer. Indeed, its a shared pointer. I now figured out, the the only way to get the data is via .to_string(). Though, im stuck again. I use the following code to initialize the queue and message sink: self.sink_queue = gr.msg_queue() self.gr_file_source_0 = gr.file_source(gr.sizeof_char*1, "stream", False) self.gr_message_sink_0 = gr.message_sink(gr.sizeof_char*1, self.sink_queue, False) Then I'm putting a DPSK mod and demod between and connect the output of the demod to the message sink: self.connect((self.gr_file_source_0, 0), (self.gr_throttle_0, 0)) self.connect((self.gr_throttle_0, 0), (self.digital_dxpsk_mod_0, 0)) self.connect((self.digital_dxpsk_mod_0, 0), (self.digital_dxpsk_demod_0, 0)) self.connect((self.digital_dxpsk_demod_0, 0), (self.gr_message_sink_0, 0)) So my thought was, that all the messages then should contain one byte (with one bit information). At the end, my code looks like that: tb = top_block() tb.start() while 1: point=tb.sink_queue.delete_head() point=point.to_string() print len(point) The first curiosity is, that the length variates from 2 up to 2048. Can somebody explain why? The next question is, how to i convert the "bitvalue" of the string to an actual char? -- View this message in context: http://gnuradio.4.n7.nabble.com/Usage-of-Message-Queues-tp39295p39815.html Sent from the GnuRadio mailing list archive at Nabble.com. ___ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Re: [Discuss-gnuradio] Usage of Message Queues
Am 23.02.2013 17:09, schrieb Hanz: Thank you much for your answer. Indeed, its a shared pointer. I now figured out, the the only way to get the data is via .to_string(). So my thought was, that all the messages then should contain one byte (with one bit information). At the end, my code looks like that: tb = top_block() tb.start() while 1: point=tb.sink_queue.delete_head() point=point.to_string() print len(point) The first curiosity is, that the length variates from 2 up to 2048. Can somebody explain why? The next question is, how to i convert the "bitvalue" of the string to an actual char? Hi, your code setup with the blocks and connects looks fine to me. Although I have not checked the details of msg_sink I would expect it to process blocks of incomming bytes into messages. So a message can contain an abritrary amount of bytes in it (I think that is why your length varies). Once again speaking for the C++ interface with the method length() you will get the number of elements that this message contains. Then you can usually access the message's data through a call to the msg() function which returns a pointer to a byte array containing the bytes. This will be wrapped to some python code, so check the return type of msg() and try to process this returned data instead of to_string() if you are interested in the data itself. So I think your code should look something like this (not tested, please check agains the actual Python interface documented with Sphinx or Python docstrings): message=tb.sink_queue.delete_head() data=message.msg() length=message.length() for i in xrange(length) : byte=data[i] Hope this gives you an idea on how to use the interface. Martin ___ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio