Re: [Discuss-gnuradio] PMT blobs in Python

2013-08-05 Thread Josh Blum
On 08/04/2013 06:08 AM, Marcus Müller wrote: > I can't really test this right now, > but you could insert > %include > into your project's swig file[1]; this should generate a python method >cdata(ptr, length) > that you can feed your blob_data() to. I'm not quite sure that WILL > work as

Re: [Discuss-gnuradio] PMT blobs in Python

2013-08-04 Thread Peter Horvath
Hi Marcus, pmt.u8vector_elements() did the trick. The result being a long array is not a problem, I could compare its elements with a list using assertSequenceEqual(). Thank you, Peter ___ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://l

Re: [Discuss-gnuradio] PMT blobs in Python

2013-08-04 Thread Marcus Müller
On second thought: Does using pmt.make_vector solve your problem? in C++: p = pmt::make_u8vector(length, fill); (do stuff like pmt::u8vector_set(p, index, value), or even unsigned char* p_vec = pmt::u8vector_writable_elements(p,length). The later can summon hell if you use the same PMT object in

Re: [Discuss-gnuradio] PMT blobs in Python

2013-08-04 Thread Marcus Müller
I can't really test this right now, but you could insert %include into your project's swig file[1]; this should generate a python method cdata(ptr, length) that you can feed your blob_data() to. I'm not quite sure that WILL work as is, maybe you will need a C(++) wrapper that simply returns

[Discuss-gnuradio] PMT blobs in Python

2013-08-03 Thread Peter Horvath
Hi, can I convert a blob created by my C++ code (unsigned chars) to a Python list or NumPy array? pmt.blob_data() returns a 'SwigPyObject' with which I can't do anything. Passing it to a NumPy array constructor doesn't seem to do the job. The blobs are in a tuple: pmt::pmt_t b1 = pmt::make_blob(